From 1be9ae72d4e8cc04ae310b83812518fb7323d850 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 10 Oct 2024 18:53:59 +0400 Subject: [PATCH 01/35] remove bindings --- contracts/ibc_transfer/Cargo.toml | 1 + contracts/ibc_transfer/src/contract.rs | 72 +-- .../src/contract.rs | 30 +- .../neutron_interchain_txs/src/contract.rs | 2 - packages/neutron-sdk/Cargo.toml | 1 + .../neutron-sdk/src/bin/neutron-sdk-schema.rs | 13 +- packages/neutron-sdk/src/bindings/dex/mod.rs | 3 - packages/neutron-sdk/src/bindings/dex/msg.rs | 102 ---- .../neutron-sdk/src/bindings/dex/query.rs | 231 -------- .../neutron-sdk/src/bindings/dex/types.rs | 199 ------- .../neutron-sdk/src/bindings/marketmap/mod.rs | 2 - .../src/bindings/marketmap/query.rs | 48 -- .../src/bindings/marketmap/types.rs | 84 --- packages/neutron-sdk/src/bindings/mod.rs | 4 - packages/neutron-sdk/src/bindings/msg.rs | 505 +----------------- .../neutron-sdk/src/bindings/oracle/mod.rs | 2 - .../neutron-sdk/src/bindings/oracle/query.rs | 40 -- .../neutron-sdk/src/bindings/oracle/types.rs | 23 - packages/neutron-sdk/src/bindings/query.rs | 171 ------ packages/neutron-sdk/src/lib.rs | 1 - packages/neutron-sdk/src/query/min_ibc_fee.rs | 18 - packages/neutron-sdk/src/query/mod.rs | 3 - .../neutron-sdk/src/query/token_factory.rs | 54 -- .../src/query/total_burned_neutrons.rs | 18 - 24 files changed, 59 insertions(+), 1568 deletions(-) delete mode 100644 packages/neutron-sdk/src/bindings/dex/mod.rs delete mode 100644 packages/neutron-sdk/src/bindings/dex/msg.rs delete mode 100644 packages/neutron-sdk/src/bindings/dex/query.rs delete mode 100644 packages/neutron-sdk/src/bindings/dex/types.rs delete mode 100644 packages/neutron-sdk/src/bindings/marketmap/mod.rs delete mode 100644 packages/neutron-sdk/src/bindings/marketmap/query.rs delete mode 100644 packages/neutron-sdk/src/bindings/marketmap/types.rs delete mode 100644 packages/neutron-sdk/src/bindings/oracle/mod.rs delete mode 100644 packages/neutron-sdk/src/bindings/oracle/query.rs delete mode 100644 packages/neutron-sdk/src/bindings/oracle/types.rs delete mode 100644 packages/neutron-sdk/src/bindings/query.rs delete mode 100644 packages/neutron-sdk/src/query/min_ibc_fee.rs delete mode 100644 packages/neutron-sdk/src/query/mod.rs delete mode 100644 packages/neutron-sdk/src/query/token_factory.rs delete mode 100644 packages/neutron-sdk/src/query/total_burned_neutrons.rs diff --git a/contracts/ibc_transfer/Cargo.toml b/contracts/ibc_transfer/Cargo.toml index e53f6dae..c253a0d7 100644 --- a/contracts/ibc_transfer/Cargo.toml +++ b/contracts/ibc_transfer/Cargo.toml @@ -26,6 +26,7 @@ serde-json-wasm = { workspace = true } cw-storage-plus = { workspace = true, features = ["iterator"]} cosmwasm-schema = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } +neutron-std = "4.2.2-rc" [dev-dependencies] cosmwasm-schema = { workspace = true } diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 46ddeb0c..187c06c6 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -3,20 +3,17 @@ use cosmwasm_std::{ StdError, StdResult, SubMsg, }; use cw2::set_contract_version; +use neutron_std::types::neutron::transfer::MsgTransfer; use neutron_sdk::interchain_txs::helpers::decode_message_response; -use neutron_sdk::proto_types::neutron::transfer::MsgTransferResponse; +use neutron_sdk::proto_types::neutron::transfer::{MsgTransferResponse}; use neutron_sdk::{ - bindings::{ - msg::{IbcFee, NeutronMsg}, - query::NeutronQuery, - }, - query::min_ibc_fee::query_min_ibc_fee, sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg}, NeutronResult, }; +use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; // TODO: rename use schemars::JsonSchema; use serde::{Deserialize, Serialize}; - +use neutron_sdk::proto_types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, state::{ @@ -45,11 +42,11 @@ pub fn instantiate( #[entry_point] pub fn execute( - deps: DepsMut, + deps: DepsMut, env: Env, _: MessageInfo, msg: ExecuteMsg, -) -> NeutronResult> { +) -> StdResult { match msg { // NOTE: this is an example contract that shows how to make IBC transfers! // Please add necessary authorization or other protection mechanisms @@ -100,7 +97,7 @@ pub enum SudoPayload { // saves payload to process later to the storage and returns a SubmitTX Cosmos SubMsg with necessary reply id fn msg_with_sudo_callback>, T>( - deps: DepsMut, + deps: DepsMut, msg: C, payload: SudoPayload, ) -> StdResult> { @@ -143,46 +140,44 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { } fn execute_send( - mut deps: DepsMut, + mut deps: DepsMut, env: Env, channel: String, to: String, denom: String, amount: u128, timeout_height: Option, -) -> NeutronResult> { +) -> StdResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_ibc_fee(deps.as_ref())?.min_fee); - let coin1 = coin(amount, denom.clone()); - let msg1 = NeutronMsg::IbcTransfer { + let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); + let msg1 = MsgTransfer { source_port: "transfer".to_string(), source_channel: channel.clone(), sender: env.contract.address.to_string(), receiver: to.clone(), - token: coin1, - timeout_height: RequestPacketTimeoutHeight { - revision_number: Some(2), - revision_height: timeout_height.or(Some(DEFAULT_TIMEOUT_HEIGHT)), - }, + token: Some(SuperCoin{ denom: denom.clone(), amount: amount.to_string() }), + timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { + revision_number: 2, + revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), + }), timeout_timestamp: 0, memo: "".to_string(), - fee: fee.clone(), + fee: Some(fee.clone()), }; - let coin2 = coin(2 * amount, denom); - let msg2 = NeutronMsg::IbcTransfer { + let msg2 = MsgTransfer { source_port: "transfer".to_string(), source_channel: channel, sender: env.contract.address.to_string(), receiver: to, - token: coin2, - timeout_height: RequestPacketTimeoutHeight { - revision_number: Some(2), - revision_height: timeout_height.or(Some(DEFAULT_TIMEOUT_HEIGHT)), - }, + token: Some(SuperCoin{ denom, amount: (2 * amount).to_string() }), + timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { + revision_number: 2, + revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), + }), timeout_timestamp: 0, memo: "".to_string(), - fee, + fee: Some(fee.clone()), }; // prepare first transfer message with payload of Type1 let submsg1 = msg_with_sudo_callback( @@ -279,17 +274,26 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult IbcFee { - IbcFee { - recv_fee: fee.recv_fee, +fn query_min_fee(deps: Deps) -> StdResult { + let querier = FeerefunderQuerier::new(&deps.querier); + let params = querier.params()?; + let params_inner = params.params.ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; + let min_fee = params_inner.min_fee.ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; + + Ok(min_fee) +} + +fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { + neutron_std::types::neutron::feerefunder::Fee { + recv_fee: fee.recv_fee.iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ).collect(), ack_fee: fee .ack_fee - .into_iter() + .iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ) .filter(|a| a.denom == FEE_DENOM) .collect(), timeout_fee: fee .timeout_fee - .into_iter() + .iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ) .filter(|a| a.denom == FEE_DENOM) .collect(), } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 53e94f0d..ac5e723a 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -63,11 +63,11 @@ pub fn instantiate( #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( - _deps: DepsMut, + _deps: DepsMut, _env: Env, _: MessageInfo, msg: ExecuteMsg, -) -> NeutronResult> { +) -> NeutronResult { match msg { ExecuteMsg::RegisterBalancesQuery { connection_id, @@ -148,7 +148,7 @@ pub fn register_balances_query( addr: String, denoms: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_balances_query_msg(connection_id, addr, denoms, update_period)?; Ok(Response::new().add_message(msg)) @@ -158,7 +158,7 @@ pub fn register_bank_total_supply_query( connection_id: String, denoms: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_bank_total_supply_query_msg(connection_id, denoms, update_period)?; Ok(Response::new().add_message(msg)) @@ -167,7 +167,7 @@ pub fn register_bank_total_supply_query( pub fn register_distribution_fee_pool_query( connection_id: String, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_distribution_fee_pool_query_msg(connection_id, update_period)?; Ok(Response::new().add_message(msg)) @@ -177,7 +177,7 @@ pub fn register_gov_proposal_query( connection_id: String, proposals_ids: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_gov_proposals_query_msg(connection_id, proposals_ids, update_period)?; Ok(Response::new().add_message(msg)) @@ -187,7 +187,7 @@ pub fn register_staking_validators_query( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_staking_validators_query_msg(connection_id, validators, update_period)?; Ok(Response::new().add_message(msg)) @@ -197,7 +197,7 @@ pub fn register_validators_signing_infos_query( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_validators_signing_infos_query_msg(connection_id, validators, update_period)?; @@ -209,7 +209,7 @@ pub fn register_delegations_query( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_delegator_delegations_query_msg( connection_id, delegator, @@ -225,7 +225,7 @@ pub fn register_unbonding_delegations_query( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_delegator_unbonding_delegations_query_msg( connection_id, delegator, @@ -241,7 +241,7 @@ pub fn register_transfers_query( recipient: String, update_period: u64, min_height: Option, -) -> NeutronResult> { +) -> NeutronResult { let msg = new_register_transfers_query_msg(connection_id, recipient, update_period, min_height)?; @@ -253,7 +253,7 @@ pub fn register_cw20_balance_query( update_period: u64, cw20_contract_address: String, account_address: String, -) -> NeutronResult> { +) -> NeutronResult { // cw_storage_plus uses this prefix for maps let mut storage_key = vec![0u8, 7u8]; @@ -275,7 +275,7 @@ pub fn update_interchain_query( new_keys: Option>, new_update_period: Option, new_recipient: Option, -) -> NeutronResult> { +) -> NeutronResult { let new_filter = new_recipient.map(|recipient| { vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), @@ -289,13 +289,13 @@ pub fn update_interchain_query( Ok(Response::new().add_message(update_msg)) } -pub fn remove_interchain_query(query_id: u64) -> NeutronResult> { +pub fn remove_interchain_query(query_id: u64) -> NeutronResult { let remove_msg = NeutronMsg::remove_interchain_query(query_id); Ok(Response::new().add_message(remove_msg)) } #[cfg_attr(not(feature = "library"), entry_point)] -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { match msg { //TODO: check if query.result.height is too old (for all interchain queries) QueryMsg::Balance { query_id } => Ok(to_json_binary(&query_balance(deps, env, query_id)?)?), diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index a23cb4b5..cddab948 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -22,12 +22,10 @@ use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse; use neutron_sdk::{ bindings::{ msg::NeutronMsg, - query::{NeutronQuery, QueryInterchainAccountAddressResponse}, types::ProtobufAny, }, interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, - query::min_ibc_fee::query_min_ibc_fee, sudo::msg::{RequestPacket, SudoMsg}, NeutronError, NeutronResult, }; diff --git a/packages/neutron-sdk/Cargo.toml b/packages/neutron-sdk/Cargo.toml index ad1fcfc0..5d710d23 100644 --- a/packages/neutron-sdk/Cargo.toml +++ b/packages/neutron-sdk/Cargo.toml @@ -25,6 +25,7 @@ prost-types = { workspace = true } tendermint-proto = { workspace = true } speedate = { workspace = true } chrono = { version = "0.4.22", default-features = false } +neutron-std = { version = "4.2.2-rc" } neutron-std-derive = { version = "0.20.1", path = "../neutron-std-derive" } [dev-dependencies] diff --git a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs b/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs index 6132c48b..31ce2532 100644 --- a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs +++ b/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs @@ -1,14 +1,3 @@ -use std::env::current_dir; -use std::fs::create_dir_all; - -use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; -use neutron_sdk::bindings::{msg::NeutronMsg, query::NeutronQuery}; - fn main() { - let mut out_dir = current_dir().unwrap(); - out_dir.push("schema"); - create_dir_all(&out_dir).unwrap(); - remove_schemas(&out_dir).unwrap(); - export_schema(&schema_for!(NeutronMsg), &out_dir); - export_schema(&schema_for!(NeutronQuery), &out_dir); + // TODO: remove this file } diff --git a/packages/neutron-sdk/src/bindings/dex/mod.rs b/packages/neutron-sdk/src/bindings/dex/mod.rs deleted file mode 100644 index 299b4f33..00000000 --- a/packages/neutron-sdk/src/bindings/dex/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod msg; -pub mod query; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/dex/msg.rs b/packages/neutron-sdk/src/bindings/dex/msg.rs deleted file mode 100644 index d1e06baa..00000000 --- a/packages/neutron-sdk/src/bindings/dex/msg.rs +++ /dev/null @@ -1,102 +0,0 @@ -use crate::bindings::dex::types::LimitOrderType; -use cosmwasm_std::Uint128; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use super::types::{DepositOptions, MultiHopRoute, PrecDec}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum DexMsg { - /// Deposit provides liquidity to a specific trading pair by depositing tokens - /// at a specific price into one or both sides of the pair in “a liquidity pool” - Deposit { - /// The account to which PoolShares will be issued - receiver: String, - /// Denom for one side of the deposit - token_a: String, - /// Denom for the opposing side of the deposit - token_b: String, - /// Amounts of tokenA to deposit - amounts_a: Vec, - /// Amounts of tokenB to deposit - amounts_b: Vec, - /// Tick indexes to deposit at defined in terms of TokenA to TokenB (ie. TokenA is on the left) - tick_indexes_a_to_b: Vec, - /// Fees to use for each deposit - fees: Vec, - /// Additional deposit options - options: Vec, - }, - /// Withdraw is used to redeem PoolShares for the user’s pro-rata - /// portion of tokens within a liquidity pool. Users can withdraw from a pool at any time - Withdrawal { - /// The account to which the tokens are credited - receiver: String, - /// Denom for one side of the deposit - token_a: String, - /// Denom for the opposing side of the deposit - token_b: String, - /// Amount of shares to remove from each pool - shares_to_remove: Vec, - /// Tick indexes of the target LiquidityPools defined in terms of TokenA to TokenB - /// (ie. TokenA is on the left) - tick_indexes_a_to_b: Vec, - /// Fee for the target LiquidityPools - fees: Vec, - }, - /// PlaceLimitOrder provides the primary mechanism for trading on the Duality Dex. Limit - /// orders can provide liquidity to the Dex (“Maker Limit Orders”) and/or can be used to - /// trade against preexisting liquidity (“Taker Limit Orders”) - PlaceLimitOrder { - /// Account to which TokenOut is credited or that will be allowed to - /// withdraw or cancel a maker order - receiver: String, - /// Token being “sold” - token_in: String, - /// Token being “bought” - token_out: String, - /// Limit tick for a limit order, specified in terms of TokenIn to TokenOut - tick_index_in_to_out: i64, - /// Amount of TokenIn to be traded - amount_in: Uint128, - /// Type of limit order to be used. Must be one of: - /// GOOD_TIL_CANCELLED, FILL_OR_KILL, IMMEDIATE_OR_CANCEL, JUST_IN_TIME, or GOOD_TIL_TIME - order_type: LimitOrderType, - // expirationTime is only valid if orderType == GOOD_TIL_TIME. - /// Expiration time for order. Only valid for GOOD_TIL_TIME limit orders - expiration_time: Option, - /// Maximum amount of TokenB can be bought. For everything except JUST_IN_TIME OrderType - max_amount_out: Option, - /// Accepts standard decimals and decimals with scientific notation (ie. 1234.23E-7) - limit_sell_price: String, - }, - /// WithdrawFilledLimitOrder. Once a limit order has been filled – either partially or in - /// its entirety, it can be withdrawn at any time. Withdrawing from a limit order credits - /// all available proceeds to the user. Withdraw can be called on a limit order multiple - /// times as new proceeds become available - WithdrawFilledLimitOrder { - /// TrancheKey for the target limit order - tranche_key: String, - }, - /// CancelLimitOrder. Standard Taker limit orders (Good-til-cancelled & Good-til-Time) - /// can be canceled at any time if they have not been completely filled - CancelLimitOrder { - /// TrancheKey for the target limit order - tranche_key: String, - }, - /// MultiHopSwap provides a swapping mechanism to achieve better prices by routing - /// through a series of pools - MultiHopSwap { - /// Account to which TokenOut is credited - receiver: String, - /// Array of possible routes - routes: Vec, - /// Amount of TokenIn to swap - amount_in: Uint128, - /// Minimum price that that must be satisfied for a route to succeed - exit_limit_price: PrecDec, - /// If true all routes are run and the route with the best price is used - pick_best_route: bool, - }, -} diff --git a/packages/neutron-sdk/src/bindings/dex/query.rs b/packages/neutron-sdk/src/bindings/dex/query.rs deleted file mode 100644 index 0f39f74b..00000000 --- a/packages/neutron-sdk/src/bindings/dex/query.rs +++ /dev/null @@ -1,231 +0,0 @@ -use crate::bindings::dex::types::{ - DepositRecord, LimitOrderTranche, LimitOrderTrancheUser, LimitOrderType, MultiHopRoute, Params, - Pool, PoolMetadata, PoolReserves, PrecDec, TickLiquidity, -}; -use crate::bindings::query::{PageRequest, PageResponse}; -use cosmwasm_std::{Coin, Int128}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum DexQuery { - /// Parameters queries the parameters of the module. - Params {}, - /// Queries a LimitOrderTrancheUser by index. - LimitOrderTrancheUser { - address: String, - tranche_key: String, - }, - /// Queries a list of LimitOrderTrancheMap items. - LimitOrderTrancheUserAll { pagination: Option }, - /// Queries a list of LimitOrderTrancheUser items for a given address. - LimitOrderTrancheUserAllByAddress { - address: String, - pagination: Option, - }, - /// Queries a LimitOrderTranche by index. - LimitOrderTranche { - pair_id: String, - tick_index: i64, - token_in: String, - tranche_key: String, - }, - /// Queries a list of LimitOrderTranche items for a given pairID / TokenIn combination. - LimitOrderTrancheAll { - pair_id: String, - token_in: String, - pagination: Option, - }, - /// Queries a list of UserDeposits items. - UserDepositAll { - address: String, - include_pool_data: bool, - pagination: Option, - }, - /// Queries a list of TickLiquidity items. - TickLiquidityAll { - pair_id: String, - token_in: String, - pagination: Option, - }, - /// Queries a InactiveLimitOrderTranche by index. - InactiveLimitOrderTranche { - pair_id: String, - tick_index: i64, - token_in: String, - tranche_key: String, - }, - /// Queries a list of InactiveLimitOrderTranche items. - InactiveLimitOrderTrancheAll { pagination: Option }, - /// Queries a list of PoolReserves items. - PoolReservesAll { - pair_id: String, - token_in: String, - pagination: Option, - }, - /// Queries a PoolReserve by index - PoolReserves { - pair_id: String, - token_in: String, - tick_index: i64, - fee: u64, - }, - /// Queries the simulated result of a multihop swap - EstimateMultiHopSwap { - creator: String, - receiver: String, - routes: Vec, - amount_in: Int128, - exit_limit_price: PrecDec, - pick_best_route: bool, - }, - /// Queries the simulated result of a PlaceLimit order - EstimatePlaceLimitOrder { - creator: String, - receiver: String, - token_in: String, - token_out: String, - tick_index_in_to_out: i64, - amount_in: Int128, - order_type: LimitOrderType, - // expirationTime is only valid iff orderType == GOOD_TIL_TIME. - expiration_time: Option, - max_amount_out: Option, - }, - /// Queries a pool by pair, tick and fee - Pool { - pair_id: String, - tick_index: i64, - fee: u64, - }, - /// Queries a pool by ID - #[serde(rename = "pool_by_id")] - PoolByID { pool_id: u64 }, - /// Queries a PoolMetadata by ID - PoolMetadata { id: u64 }, - /// Queries a list of PoolMetadata items. - PoolMetadataAll { pagination: Option }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ParamsResponse { - pub params: Params, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTrancheUserResponse { - pub limit_order_tranche_user: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllLimitOrderTrancheUserResponse { - #[serde(default)] - pub limit_order_tranche_user: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct AllUserLimitOrdersResponse { - #[serde(default)] - pub limit_orders: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTrancheResponse { - pub limit_order_tranche: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct AllLimitOrderTrancheResponse { - #[serde(default)] - pub limit_order_tranche: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct AllUserDepositsResponse { - #[serde(default)] - pub deposits: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllTickLiquidityResponse { - pub tick_liquidity: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct InactiveLimitOrderTrancheResponse { - pub inactive_limit_order_tranche: LimitOrderTranche, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllInactiveLimitOrderTrancheResponse { - pub inactive_limit_order_tranche: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllPoolReservesResponse { - pub pool_reserves: Vec, - pub pagination: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolReservesResponse { - pub pool_reserves: PoolReserves, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct EstimateMultiHopSwapResponse { - pub coin_out: Coin, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct EstimatePlaceLimitOrderResponse { - /// Total amount of coin used for the limit order - /// You can derive makerLimitInCoin using the equation: totalInCoin = swapInCoin + makerLimitInCoin - pub total_in_coin: Coin, - /// Total amount of the token in that was immediately swapped for swapOutCoin - pub swap_in_coin: Coin, - /// Total amount of coin received from the taker portion of the limit order - /// This is the amount of coin immediately available in the users account after executing the - /// limit order. It does not include any future proceeds from the maker portion which will have withdrawn in the future - pub swap_out_coin: Coin, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolResponse { - pub pool: Pool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolMetadataResponse { - pub pool_metadata: PoolMetadata, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct AllPoolMetadataResponse { - pub pool_metadata: Vec, - pub pagination: Option, -} diff --git a/packages/neutron-sdk/src/bindings/dex/types.rs b/packages/neutron-sdk/src/bindings/dex/types.rs deleted file mode 100644 index 58c4742b..00000000 --- a/packages/neutron-sdk/src/bindings/dex/types.rs +++ /dev/null @@ -1,199 +0,0 @@ -use cosmwasm_std::Int128; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -pub enum LimitOrderType { - #[default] - /// Good-til-Cancelled limit orders are hybrid maker and taker limit orders. - /// They will attempt to trade the supplied AmountIn at the TickIndex or better. - /// However, if they total AmountIn cannot be traded at the limit price they are remaining - /// amount will be placed as a maker limit order. The proceeds from the taker portion - /// are deposited into the user’s account immediately, however, the proceeds from the - /// maker portion must be explicitly withdrawn via WithdrawLimitOrder. - GoodTilCancelled, - /// Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% - /// of the supplied AmountIn or return an error. If there is insufficient liquidity to - /// complete the trade at or above the supplied TickIndex a Fill-or-Kill order will - /// return an error `codespace: dex, code: 1134` - /// ( ErrGoodTilOrderWithoutExpiration). - FillOrKill, - /// Immediate-or-Cancel limit orders are taker orders that will swap as much as of the - /// AmountIn as possible given available liquidity above the supplied TickIndex. - /// Unlike Fill-or-Kill orders they will still successfully complete even if they - /// are only able to partially trade through the AmountIn at the TickIndex or better. - ImmediateOrCancel, - /// Just-in-Time limit orders are an advanced maker limit order that provides tradeable - /// liquidity for exactly one block. At the end of the same block in which the Just-in-Time - /// order was submitted the order is canceled and any untraded portion will no longer be - /// usable as active liquidity. - JustInTime, - /// Good-til-Time limit order function exactly the same as Good-til-Cancelled limit orders - /// first trying to trade as a taker limit order and then placing any remaining amount - /// as a maker limit order. However, the maker portion of the limit order has a specified ExpirationTime. - /// After the ExpirationTime the order will be cancelled and can no longer be traded against. - /// When withdrawing a Good-til-Time limit order the user will receive both the successfully - /// traded portion of the limit order (TokenOut) as well as any remaining untraded amount (TokenIn). - GoodTilTime, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case", default)] -pub struct LimitOrderTrancheUser { - pub trade_pair_id: TradePairID, - pub tick_index_taker_to_maker: i64, - pub tranche_key: String, - pub address: String, - pub shares_owned: Int128, - pub shares_withdrawn: Int128, - pub shares_cancelled: Int128, - pub order_type: LimitOrderType, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTrancheKey { - pub trade_pair_id: TradePairID, - pub tick_index_taker_to_maker: i64, - pub tranche_key: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LimitOrderTranche { - pub key: LimitOrderTrancheKey, - pub reserves_maker_denom: Int128, - pub reserves_taker_denom: Int128, - pub total_maker_denom: Int128, - pub total_taker_denom: Int128, - pub expiration_time: Option, - pub price_taker_to_maker: PrecDec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct TradePairID { - pub maker_denom: String, - pub taker_denom: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct FailedDeposit { - pub deposit_idx: Option, - pub error: Option, -} - -// TODO implement math for PrecDec -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -#[serde(from = "String")] -#[serde(into = "String")] -pub struct PrecDec { - pub i: String, -} - -#[allow(clippy::from_over_into)] -impl Into for PrecDec { - fn into(self) -> String { - self.i - } -} - -impl From for PrecDec { - fn from(value: String) -> Self { - PrecDec { i: value } - } -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct DepositOptions { - pub disable_autoswap: Option, - pub fail_tx_on_bel: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MultiHopRoute { - pub hops: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Params { - pub fee_tiers: Vec, - pub paused: bool, - pub max_jits_per_block: u64, - pub good_til_purge_allowance: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -#[serde(default)] -pub struct PoolMetadata { - pub id: u64, - pub tick: i64, - pub fee: u64, - pub pair_id: PairID, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Pool { - #[serde(default)] - pub id: u64, - pub lower_tick0: Option, - pub upper_tick1: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct DepositRecord { - pub pair_id: PairID, - pub shares_owned: Int128, - pub center_tick_index: i64, - pub lower_tick_index: i64, - pub upper_tick_index: i64, - pub fee: Option, - pub total_shares: Option, - pub pool: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, Default)] -#[serde(rename_all = "snake_case")] -pub struct PairID { - pub token0: String, - pub token1: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct TickLiquidity { - pub liquidity: Liquidity, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum Liquidity { - PoolReserves(PoolReserves), - LimitOrderTranche(LimitOrderTranche), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolReserves { - pub key: PoolReservesKey, - pub reserves_maker_denom: Int128, - pub price_taker_to_maker: PrecDec, - pub price_opposite_taker_to_maker: PrecDec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PoolReservesKey { - pub trade_pair_id: TradePairID, - pub tick_index_taker_to_maker: i64, - pub fee: Option, -} diff --git a/packages/neutron-sdk/src/bindings/marketmap/mod.rs b/packages/neutron-sdk/src/bindings/marketmap/mod.rs deleted file mode 100644 index e44ca515..00000000 --- a/packages/neutron-sdk/src/bindings/marketmap/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod query; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/marketmap/query.rs b/packages/neutron-sdk/src/bindings/marketmap/query.rs deleted file mode 100644 index b62b8f90..00000000 --- a/packages/neutron-sdk/src/bindings/marketmap/query.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::bindings::marketmap::types::{Market, MarketMap, Params}; -use crate::bindings::oracle::types::CurrencyPair; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum MarketMapQuery { - /// Parameters queries the parameters of the module. - Params {}, - LastUpdated {}, - MarketMap {}, - Market { - currency_pair: CurrencyPair, - }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ParamsResponse { - pub params: Params, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct LastUpdatedResponse { - pub last_updated: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MarketMapResponse { - /// **market_map** defines the global set of market configurations for all providers - /// and markets. - pub market_map: MarketMap, - /// **last_updated** is the last block height that the market map was updated. - /// This field can be used as an optimization for clients checking if there - /// is a new update to the map. - pub last_updated: Option, - /// **chain_id** is the chain identifier for the market map. - pub chain_id: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MarketResponse { - pub market: Market, -} diff --git a/packages/neutron-sdk/src/bindings/marketmap/types.rs b/packages/neutron-sdk/src/bindings/marketmap/types.rs deleted file mode 100644 index d3ffe95f..00000000 --- a/packages/neutron-sdk/src/bindings/marketmap/types.rs +++ /dev/null @@ -1,84 +0,0 @@ -use schemars::{JsonSchema, Map}; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Params { - pub admin: String, - pub market_authorities: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MarketMap { - pub markets: Map, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Market { - /// **ticker** is the full list of tickers and their associated configurations - /// to be stored on-chain. - pub ticker: Ticker, - pub provider_configs: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct ProviderConfig { - /// **name** corresponds to the name of the provider for which the configuration is - /// being set. - pub name: String, - /// **off_chain_ticker** is the off-chain representation of the ticker i.e. BTC/USD. - /// The off-chain ticker is unique to a given provider and is used to fetch the - /// price of the ticker from the provider. - pub off_chain_ticker: String, - /// **normalize_by_pair** is the currency pair for this ticker to be normalized by. - /// For example, if the desired Ticker is BTC/USD, this market could be reached - /// using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is - /// optional and nullable. - pub normalize_by_pair: Option, - /// **invert** is a boolean indicating if the BASE and QUOTE of the market should - /// be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE - #[serde(default)] - pub invert: bool, - /// **metadata_json** is a string of JSON that encodes any extra configuration - /// for the given provider config. - #[serde( - default, - rename(serialize = "metadata_JSON", deserialize = "metadata_JSON") - )] - pub metadata_json: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct CurrencyPair { - #[serde(rename(serialize = "Base", deserialize = "Base"))] - pub base: String, - #[serde(rename(serialize = "Quote", deserialize = "Quote"))] - pub quote: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Ticker { - /// **currency_pair** is the currency pair for this ticker. - pub currency_pair: CurrencyPair, - /// **decimals** is the number of decimal places for the ticker. The number of - /// decimal places is used to convert the price to a human-readable format. - pub decimals: u64, - /// **min_provider_count** is the minimum number of providers required to consider - /// the ticker valid. - pub min_provider_count: u64, - /// **enabled** is the flag that denotes if the Ticker is enabled for price - /// fetching by an oracle. - #[serde(default)] - pub enabled: bool, - /// **metadata_json** is a string of JSON that encodes any extra configuration - /// for the given ticker. , - #[serde( - default, - rename(serialize = "metadata_JSON", deserialize = "metadata_JSON") - )] - pub metadata_json: String, -} diff --git a/packages/neutron-sdk/src/bindings/mod.rs b/packages/neutron-sdk/src/bindings/mod.rs index e09ce752..08938b58 100644 --- a/packages/neutron-sdk/src/bindings/mod.rs +++ b/packages/neutron-sdk/src/bindings/mod.rs @@ -1,7 +1,3 @@ -pub mod dex; -pub mod marketmap; #[allow(deprecated)] pub mod msg; -pub mod oracle; -pub mod query; pub mod types; diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index cc2c3fed..a8292044 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -5,8 +5,6 @@ use crate::{ sudo::msg::RequestPacketTimeoutHeight, NeutronResult, }; - -use crate::bindings::dex::msg::DexMsg; use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg, DenomUnit, StdError, Uint128}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -35,511 +33,14 @@ pub enum ChannelOrdering { OrderUnordered, } +#[deprecated(note = "Please use neutron-std autogenerated messages instead of wasmbindings", since = "0.12.0")] #[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. pub enum NeutronMsg { - /// RegisterInterchainAccount registers an interchain account on remote chain. - RegisterInterchainAccount { - /// **connection_id** is an IBC connection identifier between Neutron and remote chain. - connection_id: String, - - /// **interchain_account_id** is an identifier of your new interchain account. Can be any string. - /// This identifier allows contracts to have multiple interchain accounts on remote chains. - interchain_account_id: String, - - /// **register_fee** is a fees required to be payed to register interchain account - register_fee: Option>, - - /// **ordering** is an order of channel. Can be ordered or unordered. - /// Set to ordered if not specified. - ordering: Option, - }, - - /// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain. - SubmitTx { - /// **connection_id** is an IBC connection identifier between Neutron and remote chain. - connection_id: String, - - /// **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs. - interchain_account_id: String, - - /// **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain. - msgs: Vec, - - /// **memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction. - memo: String, - - /// **timeout** is a timeout in seconds after which the packet times out. - timeout: u64, - - /// ***fee** is an ibc fee for the transaction. - fee: IbcFee, - }, - - /// RegisterInterchainQuery registers an interchain query. - RegisterInterchainQuery { - /// **query_type** is a query type identifier ('tx' or 'kv' for now). - query_type: String, - - /// **keys** is the KV-storage keys for which we want to get values from remote chain. - keys: Vec, - - /// **transactions_filter** is the filter for transaction search ICQ. - transactions_filter: String, - - /// **connection_id** is an IBC connection identifier between Neutron and remote chain. - connection_id: String, - - /// **update_period** is used to say how often the query must be updated. - update_period: u64, - }, - - /// RegisterInterchainQuery updates an interchain query. - UpdateInterchainQuery { - /// **query_id** is the ID of the query we want to update. - query_id: u64, - - /// **new_keys** is the new query keys to retrieve. - new_keys: Option>, - - /// **new_update_period** is a new update period of the query. - new_update_period: Option, - - /// **new_transactions_filter** is a new transactions filter of the query. - new_transactions_filter: Option, - }, - - /// RemoveInterchainQuery removes as interchain query. - RemoveInterchainQuery { - /// **query_id** is ID of the query we want to remove. - query_id: u64, - }, - /// IbcTransfer sends a fungible token packet over IBC. - IbcTransfer { - // the port on which the packet will be sent - source_port: String, - // the channel by which the packet will be sent - source_channel: String, - // the tokens to be transferred - token: Coin, - // the sender address - sender: String, - // the recipient address on the destination chain - receiver: String, - // Timeout height relative to the current block height. - // The timeout is disabled when set to 0. - timeout_height: RequestPacketTimeoutHeight, - // Timeout timestamp in absolute nanoseconds since unix epoch. - // The timeout is disabled when set to 0. - timeout_timestamp: u64, - // Memo to be sent along with transaction. - memo: String, - // Fees to refund relayer for different kinds of `SudoMsg` transmission - // Unused fee types will be returned to msg sender. - fee: IbcFee, - }, /// SubmitAdminProposal sends a proposal to neutron's Admin module. /// This type of messages can be only executed by Neutron DAO. SubmitAdminProposal { admin_proposal: AdminProposal }, - - /// TokenFactory message. - /// Contracts can create denoms, namespaced under the contract's address. - /// A contract may create any number of independent sub-denoms. - CreateDenom { subdenom: String }, - - /// TokenFactory message. - /// Contracts can change the admin of a denom that they are the admin of. - ChangeAdmin { - denom: String, - new_admin_address: String, - }, - - /// TokenFactory message. - /// Contracts can mint native tokens for an existing factory denom - /// that they are the admin of. - MintTokens { - denom: String, - amount: Uint128, - mint_to_address: String, - }, - - /// TokenFactory message. - /// Contracts can burn native tokens for an existing factory denom - /// that they are the admin of. - /// Currently, the burn from address must be the admin contract. - BurnTokens { - denom: String, - amount: Uint128, - /// Must be set to `""` for now - burn_from_address: String, - }, - - /// TokenFactory message. - /// Contracts can set before send hooks for denoms, namespaced under the contract's address. - SetBeforeSendHook { - denom: String, - contract_addr: String, - }, - - /// TokenFactoryMessage - /// Contracts can force specified `amount` of an existing factory denom - /// that they are admin of to a `transfer_to_address` from a `transfer_from_address`. - ForceTransfer { - denom: String, - amount: Uint128, - transfer_from_address: String, - transfer_to_address: String, - }, - - /// TokenFactoryMessage - /// Contracts can set a metadata for of an existing factory denom - /// that they are admin of. - SetDenomMetadata { - /// **description** description of a token - description: String, - /// **denom_units** represents the list of DenomUnit's for a given coin - denom_units: Vec, - /// **base** represents the base denom (should be the DenomUnit with exponent = 0). - base: String, - /// **display** indicates the suggested denom that should be - /// displayed in clients. - display: String, - /// **name** defines the name of the token (eg: Cosmos Atom) - name: String, - /// **symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can - /// be the same as the display. - symbol: String, - /// **uri** to a document (on or off-chain) that contains additional information. Optional. - uri: String, - /// **uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that - /// the document didn't change. Optional. - uri_hash: String, - }, - - /// AddSchedule adds new schedule with a given `name`. - /// Until schedule is removed it will execute all `msgs` every `period` blocks. - /// First execution is at least on `current_block + period` block. - /// [Permissioned - DAO Only] - AddSchedule { - /// Name of a new schedule. - /// Needed to be able to `RemoveSchedule` and to log information about it - name: String, - /// period in blocks with which `msgs` will be executed - period: u64, - /// list of cosmwasm messages to be executed - msgs: Vec, - /// execution stage where schedule will be executed - execution_stage: String, - }, - - /// RemoveSchedule removes the schedule with a given `name`. - /// [Permissioned - DAO or Security DAO only] - RemoveSchedule { name: String }, - - /// Contractmanager message - /// Resubmits failed acknowledgement. - /// Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. - /// [Permissioned - only from contract that is initial caller of IBC transaction] - ResubmitFailure { failure_id: u64 }, - - /// Dex messages - Dex(DexMsg), -} - -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>, - ordering: Option, - ) -> Self { - NeutronMsg::RegisterInterchainAccount { - connection_id, - interchain_account_id, - register_fee, - ordering, - } - } - - /// Basic helper to define a submit tx message: - /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; - /// * **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs; - /// * **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain; - /// * **memo** is a memo you want to attach to your interchain transaction. It behaves like a memo in usual Cosmos transaction; - /// * **timeout** is a timeout in seconds after which the packet times out. - /// * **fee** is a fee that is used for different kinds of callbacks. Unused fee types will be returned to msg sender. - pub fn submit_tx( - connection_id: String, - interchain_account_id: String, - msgs: Vec, - memo: String, - timeout: u64, - fee: IbcFee, - ) -> Self { - NeutronMsg::SubmitTx { - connection_id, - interchain_account_id, - msgs, - memo, - timeout, - fee, - } - } - - /// Basic helper to define a register interchain query message: - /// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload: - /// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get - /// values from remote chain; - /// - when the query enum is 'tx' then payload is the filters for transaction search ICQ, - /// maximum allowed number of filters is 32. - /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; - /// * **update_period** is used to say how often (in neutron blocks) the query must be updated. - pub fn register_interchain_query( - query: QueryPayload, - connection_id: String, - update_period: u64, - ) -> NeutronResult { - Ok(match query { - QueryPayload::KV(keys) => NeutronMsg::RegisterInterchainQuery { - query_type: QueryType::KV.into(), - keys, - transactions_filter: String::new(), - connection_id, - update_period, - }, - QueryPayload::TX(transactions_filters) => NeutronMsg::RegisterInterchainQuery { - query_type: QueryType::TX.into(), - keys: vec![], - transactions_filter: to_string(&transactions_filters) - .map_err(|e| StdError::generic_err(e.to_string()))?, - connection_id, - update_period, - }, - }) - } - - /// Basic helper to define a update interchain query message: - /// * **query_id** is ID of the query we want to update; - /// * **new_keys** is encoded keys to query; - /// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated. - pub fn update_interchain_query( - query_id: u64, - new_keys: Option>, - new_update_period: Option, - new_transactions_filter: Option>, - ) -> NeutronResult { - Ok(NeutronMsg::UpdateInterchainQuery { - query_id, - new_keys, - new_update_period, - new_transactions_filter: match new_transactions_filter { - Some(filters) => { - Some(to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))?) - } - None => None, - }, - }) - } - - /// Basic helper to define a remove interchain query message: - /// * **query_id** is ID of the query we want to remove. - pub fn remove_interchain_query(query_id: u64) -> Self { - NeutronMsg::RemoveInterchainQuery { query_id } - } - - /// Basic helper to define a parameter change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that should change network parameter. - pub fn submit_param_change_proposal(proposal: ParamChangeProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ParamChangeProposal(proposal), - } - } - - #[deprecated( - since = "0.11.0", - note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use submit_proposal_execute_message instead" - )] - /// Basic helper to define an ibc upgrade proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal that upgrades network. - pub fn submit_upgrade_proposal(proposal: UpgradeProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::UpgradeProposal(proposal), - } - } - - #[deprecated( - since = "0.11.0", - note = "Used only for querying old proposals. Will fail if executed in a new proposal. Use submit_proposal_execute_message instead" - )] - /// Basic helper to define an ibc update client change proposal passed to AdminModule: - /// * **proposal** is struct which contains proposal updates cliient. - pub fn submit_client_update_proposal(proposal: ClientUpdateProposal) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ClientUpdateProposal(proposal), - } - } - - /// Basic helper to define sdk47 compatible proposal passed to AdminModule: - /// * **proposal** is struct which contains JSON encoded sdk message. - pub fn submit_proposal_execute_message(proposal: ProposalExecuteMessage) -> Self { - NeutronMsg::SubmitAdminProposal { - admin_proposal: AdminProposal::ProposalExecuteMessage(proposal), - } - } - - /// Basic helper to build create denom message passed to TokenFactory module: - /// * **subdenom** is a subdenom name for denom to be created. - pub fn submit_create_denom(subdenom: impl Into) -> Self { - NeutronMsg::CreateDenom { - subdenom: subdenom.into(), - } - } - - /// Basic helper to define change of admin for a token passed to TokenFactory module: - /// * **denom** is a name of the denom to change an admin for; - /// * **new_admin_address** is a new admin address for a denom. - pub fn submit_change_admin( - denom: impl Into, - new_admin_address: impl Into, - ) -> Self { - NeutronMsg::ChangeAdmin { - denom: denom.into(), - new_admin_address: new_admin_address.into(), - } - } - - /// Basic helper to define mint tokens passed to TokenFactory module: - /// * **denom** is a name of the denom; - /// * **amount** is an amount of tokens to mint; - /// * **mint_to_address** is an address that will receive minted tokens. - pub fn submit_mint_tokens( - denom: impl Into, - amount: Uint128, - mint_to_address: impl Into, - ) -> Self { - NeutronMsg::MintTokens { - denom: denom.into(), - amount, - mint_to_address: mint_to_address.into(), - } - } - - /// Basic helper to define burn tokens passed to TokenFactory module: - /// * **denom** is a name of the denom; - /// * **amount** is an amount of tokens to burn. - /// * **burn_from_address** is an address tokens will be burned from - pub fn submit_burn_tokens( - denom: impl Into, - amount: Uint128, - burn_from_address: Option, - ) -> Self { - NeutronMsg::BurnTokens { - denom: denom.into(), - amount, - burn_from_address: burn_from_address.unwrap_or_default(), - } - } - - /// Basic helper to create set before send hook message passed to TokenFactory module: - /// * **denom** is a name for denom for hook to be created. - pub fn submit_set_before_send_hook( - denom: impl Into, - contract_addr: impl Into, - ) -> Self { - NeutronMsg::SetBeforeSendHook { - denom: denom.into(), - contract_addr: contract_addr.into(), - } - } - - /// Basic helper to create force transfer message passed to TokenFactory module: - /// * **denom** is a name for a denom to transfer; - /// * **amount** is an amount of **denom** tokens to transfer; - /// * **from_address** is from which address to transfer tokens; - /// * **to_address** is where to transfer tokens. - pub fn submit_force_transfer( - denom: impl Into, - amount: Uint128, - from_address: impl Into, - to_address: impl Into, - ) -> Self { - NeutronMsg::ForceTransfer { - denom: denom.into(), - amount, - transfer_from_address: from_address.into(), - transfer_to_address: to_address.into(), - } - } - /// Basic helper to create a set denom metadata message passed to TokenFactory module: - /// * **description** description of a token; - /// * **denom_units** represents the list of DenomUnit's for a given coin; - /// * **base** represents the base denom (should be the DenomUnit with exponent = 0); - /// * **display** indicates the suggested denom that should be - /// displayed in clients; - /// * **name** defines the name of the token (eg: Cosmos Atom); - /// * **symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can - /// be the same as the display; - /// * **uri** to a document (on or off-chain) that contains additional information. Optional; - /// * **uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that - /// the document didn't change. Optional. - #[allow(clippy::too_many_arguments)] - pub fn submit_set_denom_metadata( - description: String, - denom_units: Vec, - base: String, - display: String, - name: String, - symbol: String, - uri: String, - uri_hash: String, - ) -> Self { - NeutronMsg::SetDenomMetadata { - description, - denom_units, - base, - display, - name, - symbol, - uri, - uri_hash, - } - } - - /// Basic helper to define add schedule passed to Cron module: - /// * **name** is a name of the schedule; - /// * **period** is a period of schedule execution in blocks; - /// * **msgs** is the messages that will be executed. - /// * **execution_stage** is the stage where schedule will be executed. - pub fn submit_add_schedule( - name: String, - period: u64, - msgs: Vec, - 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: - /// * **name** is a name of the schedule to be removed. - pub fn submit_remove_schedule(name: String) -> Self { - NeutronMsg::RemoveSchedule { name } - } - - /// Basic helper to define resubmit failure passed to Contractmanager module: - /// * **failure_id** is an id of the failure to be resubmitted. - pub fn submit_resubmit_failure(failure_id: u64) -> Self { - NeutronMsg::ResubmitFailure { failure_id } - } } impl From for CosmosMsg { @@ -574,7 +75,7 @@ pub struct MsgRegisterInterchainAccountResponse { pub struct MsgSubmitTxResponse { /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel. pub sequence_id: u64, - /// **channel** is a src channel on neutron side trasaction was submitted from. + /// **channel** is a src channel on neutron side transaction was submitted from. pub channel: String, } @@ -584,7 +85,7 @@ pub struct MsgSubmitTxResponse { pub struct MsgIbcTransferResponse { /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel. pub sequence_id: u64, - /// **channel** is a src channel on neutron side trasaction was submitted from. + /// **channel** is a src channel on neutron side transaction was submitted from. pub channel: String, } diff --git a/packages/neutron-sdk/src/bindings/oracle/mod.rs b/packages/neutron-sdk/src/bindings/oracle/mod.rs deleted file mode 100644 index e44ca515..00000000 --- a/packages/neutron-sdk/src/bindings/oracle/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod query; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/oracle/query.rs b/packages/neutron-sdk/src/bindings/oracle/query.rs deleted file mode 100644 index 73d01683..00000000 --- a/packages/neutron-sdk/src/bindings/oracle/query.rs +++ /dev/null @@ -1,40 +0,0 @@ -use crate::bindings::oracle::types::{CurrencyPair, QuotePrice}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum OracleQuery { - GetAllCurrencyPairs {}, - GetPrice { currency_pair: CurrencyPair }, - GetPrices { currency_pair_ids: Vec }, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct GetPriceResponse { - /// **price** represents the quote-price for the CurrencyPair given in - /// GetPriceRequest (possibly nil if no update has been made) - pub price: QuotePrice, - /// **nonce** represents the nonce for the CurrencyPair if it exists in state - pub nonce: u64, - /// **decimals* represents the number of decimals that the quote-price is - /// represented in. For Pairs where ETHEREUM is the quote this will be 18, - /// otherwise it will be 8. - pub decimals: u64, - /// *id** represents the identifier for the CurrencyPair. - #[serde(default)] - pub id: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct GetPricesResponse { - pub prices: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct GetAllCurrencyPairsResponse { - pub currency_pairs: Vec, -} diff --git a/packages/neutron-sdk/src/bindings/oracle/types.rs b/packages/neutron-sdk/src/bindings/oracle/types.rs deleted file mode 100644 index 6afde01f..00000000 --- a/packages/neutron-sdk/src/bindings/oracle/types.rs +++ /dev/null @@ -1,23 +0,0 @@ -use cosmwasm_std::Int128; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub struct CurrencyPair { - #[serde(rename(serialize = "Base", deserialize = "Base"))] - pub base: String, - #[serde(rename(serialize = "Quote", deserialize = "Quote"))] - pub quote: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QuotePrice { - pub price: Int128, - /// **block_timestamp** tracks the block height associated with this price update. - /// We include block timestamp alongside the price to ensure that smart - /// contracts and applications are not utilizing stale oracle prices - pub block_timestamp: String, - /// **block_height** is height of block mentioned above - pub block_height: Option, -} diff --git a/packages/neutron-sdk/src/bindings/query.rs b/packages/neutron-sdk/src/bindings/query.rs deleted file mode 100644 index 94c36199..00000000 --- a/packages/neutron-sdk/src/bindings/query.rs +++ /dev/null @@ -1,171 +0,0 @@ -use crate::bindings::marketmap::query::MarketMapQuery; -use crate::bindings::oracle::query::OracleQuery; -use crate::bindings::types::{Failure, InterchainQueryResult, RegisteredQuery}; -use cosmwasm_std::{Binary, CustomQuery, QueryRequest}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use super::dex::query::DexQuery; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// The queries to interact with neutron specific blockchain modules. -pub enum NeutronQuery { - /// Query a result of registered interchain query on remote chain - InterchainQueryResult { - /// **query_id** is an ID registered interchain query - query_id: u64, - }, - - /// Query a registered interchain account address for a specific connection_id - /// Every contract may have as many interchain accounts as necessary. - InterchainAccountAddress { - /// **owner_address** is an address of contract which registered interchain account - owner_address: String, - - /// **interchain_account_id** is an identifier of your interchain account. Can be any string - /// This identifier allows contracts to have multiple interchain accounts on remote chains - interchain_account_id: String, - - /// **connection_id** is an IBC connection identifier between Neutron and remote chain - connection_id: String, - }, - - /// Query all registered interchain queries on all remote chains - RegisteredInterchainQueries { - owners: Vec, - connection_id: String, - pagination: PageRequest, - }, - - /// Query registered interchain query with a specific query_id - RegisteredInterchainQuery { - /// **query_id** is an ID registered interchain query - query_id: u64, - }, - - /// Query total amount of burned neutron fees - TotalBurnedNeutronsAmount {}, - - /// Query minimum IBC fee - MinIbcFee {}, - - /// TokenFactory query. Given a subdenom minted by a contract via - /// [`NeutronMsg::MintTokens`](crate::bindings::msg::NeutronMsg::MintTokens), - /// returns the full denom as used by [`BankMsg::Send`](cosmwasm_std::BankMsg::Send). - FullDenom { - creator_addr: String, - subdenom: String, - }, - - /// TokenFactory query. Returns the admin of a denom, if the denom is a TokenFactory denom. - DenomAdmin { - subdenom: String, - }, - - /// TokenFactory query. Returns the before send hook address of a denom, if the denom is a TokenFactory denom. - BeforeSendHook { - denom: String, - }, - - /// Contractmanager query. Returns the failures for a particular contract address. - Failures { - address: String, - pagination: PageRequest, - }, - - Dex(DexQuery), - - MarketMap(MarketMapQuery), - - Oracle(OracleQuery), -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PageRequest { - /// **key** is a value returned in PageResponse.next_key to begin - /// querying the next page most efficiently. Only one of offset or key - /// should be set. - pub key: Binary, - /// **offset** is a numeric offset that can be used when key is unavailable. - /// It is less efficient than using key. Only one of offset or key should - /// be set. - pub offset: u64, - /// **limit** is the total number of results to be returned in the result page. - /// If left empty it will default to a value to be set by each app. - pub limit: u64, - /// **count_total** is set to true to indicate that the result set should include - /// a count of the total number of items available for pagination in UIs. - /// count_total is only respected when offset is used. It is ignored when key - /// is set. - pub count_total: bool, - /// reverse is set to true if results are to be returned in the descending order. - pub reverse: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct PageResponse { - /// **next_key** is the key to be passed to PageRequest.key to - /// query the next page most efficiently. It will be empty if - /// there are no more results. - pub next_key: Option, - /// **total** is total number of results available if PageRequest.count_total - /// was set, its value is undefined otherwise - pub total: Option, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryRegisteredQueriesResponse { - /// **registered_queries** is a list of registered queries - pub registered_queries: Vec, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryRegisteredQueryResponse { - /// **registered_query** is a registered query - pub registered_query: RegisteredQuery, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryRegisteredQueryResultResponse { - pub result: InterchainQueryResult, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryInterchainAccountAddressResponse { - /// **interchain_account_address** is a interchain account address on the remote chain - pub interchain_account_address: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct QueryFailuresResponse { - /// **failures** is a list of failures of sudo handler calls - pub failures: Vec, -} - -impl CustomQuery for NeutronQuery {} - -impl From for QueryRequest { - fn from(msg: DexQuery) -> Self { - QueryRequest::Custom(NeutronQuery::Dex(msg)) - } -} - -impl From for QueryRequest { - fn from(msg: MarketMapQuery) -> Self { - QueryRequest::Custom(NeutronQuery::MarketMap(msg)) - } -} - -impl From for QueryRequest { - fn from(msg: OracleQuery) -> Self { - QueryRequest::Custom(NeutronQuery::Oracle(msg)) - } -} diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index ac788cfc..b419643d 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -12,7 +12,6 @@ pub mod interchain_queries; pub mod interchain_txs; #[allow(deprecated, clippy::module_inception)] pub mod proto_types; -pub mod query; mod serde; pub mod shim; pub mod sudo; diff --git a/packages/neutron-sdk/src/query/min_ibc_fee.rs b/packages/neutron-sdk/src/query/min_ibc_fee.rs deleted file mode 100644 index 42e27c72..00000000 --- a/packages/neutron-sdk/src/query/min_ibc_fee.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::{ - bindings::{msg::IbcFee, query::NeutronQuery}, - NeutronResult, -}; -use cosmwasm_std::Deps; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct MinIbcFeeResponse { - pub min_fee: IbcFee, -} - -pub fn query_min_ibc_fee(deps: Deps) -> NeutronResult { - let query = NeutronQuery::MinIbcFee {}; - Ok(deps.querier.query(&query.into())?) -} diff --git a/packages/neutron-sdk/src/query/mod.rs b/packages/neutron-sdk/src/query/mod.rs deleted file mode 100644 index aea5e3f8..00000000 --- a/packages/neutron-sdk/src/query/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod min_ibc_fee; -pub mod token_factory; -pub mod total_burned_neutrons; diff --git a/packages/neutron-sdk/src/query/token_factory.rs b/packages/neutron-sdk/src/query/token_factory.rs deleted file mode 100644 index 82060562..00000000 --- a/packages/neutron-sdk/src/query/token_factory.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::{bindings::query::NeutronQuery, NeutronResult}; -use cosmwasm_std::Deps; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct FullDenomResponse { - pub denom: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct DenomAdminResponse { - pub admin: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct BeforeSendHookResponse { - pub contract_addr: String, -} - -pub fn query_full_denom( - deps: Deps, - creator_addr: impl Into, - subdenom: impl Into, -) -> NeutronResult { - let query = NeutronQuery::FullDenom { - creator_addr: creator_addr.into(), - subdenom: subdenom.into(), - }; - Ok(deps.querier.query(&query.into())?) -} - -pub fn query_denom_admin( - deps: Deps, - subdenom: impl Into, -) -> NeutronResult { - let query = NeutronQuery::DenomAdmin { - subdenom: subdenom.into(), - }; - Ok(deps.querier.query(&query.into())?) -} - -pub fn query_before_send_hook( - deps: Deps, - denom: impl Into, -) -> NeutronResult { - let query = NeutronQuery::BeforeSendHook { - denom: denom.into(), - }; - Ok(deps.querier.query(&query.into())?) -} diff --git a/packages/neutron-sdk/src/query/total_burned_neutrons.rs b/packages/neutron-sdk/src/query/total_burned_neutrons.rs deleted file mode 100644 index 61d8fe21..00000000 --- a/packages/neutron-sdk/src/query/total_burned_neutrons.rs +++ /dev/null @@ -1,18 +0,0 @@ -use crate::{bindings::query::NeutronQuery, NeutronResult}; -use cosmwasm_std::{Coin, Deps}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct TotalBurnedNeutronsAmountResponse { - pub coin: Coin, -} - -/// Returns total amount of burned neutron fees -pub fn query_total_burned_neutrons( - deps: Deps, -) -> NeutronResult { - let query = NeutronQuery::TotalBurnedNeutronsAmount {}; - Ok(deps.querier.query(&query.into())?) -} From 9cc816ce0875f2cff636c3619899152ce6226b62 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 10 Oct 2024 19:14:27 +0400 Subject: [PATCH 02/35] remake interchain queries --- .../src/interchain_queries/queries.rs | 39 ++++++++----------- .../src/interchain_queries/v045/queries.rs | 2 +- .../src/interchain_queries/v047/queries.rs | 17 +++----- 3 files changed, 24 insertions(+), 34 deletions(-) diff --git a/packages/neutron-sdk/src/interchain_queries/queries.rs b/packages/neutron-sdk/src/interchain_queries/queries.rs index 399cea7a..d77fea89 100644 --- a/packages/neutron-sdk/src/interchain_queries/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/queries.rs @@ -1,14 +1,12 @@ -use crate::bindings::query::{ - NeutronQuery, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse, -}; use crate::errors::error::NeutronResult; use crate::interchain_queries::types::{KVReconstruct, QueryType}; use crate::NeutronError; -use cosmwasm_std::Deps; +use cosmwasm_std::{Deps, StdError}; +use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, QueryRegisteredQueryResultResponse, QueryRegisteredQueryResponse, RegisteredQuery, QueryResult}; /// Checks **actual** query type is **expected** query type -pub fn check_query_type(actual: QueryType, expected: QueryType) -> NeutronResult<()> { - if actual != expected { +pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<()> { + if actual != expected.to_string() { return Err(NeutronError::InvalidQueryType { query_type: actual.into(), }); @@ -18,25 +16,22 @@ pub fn check_query_type(actual: QueryType, expected: QueryType) -> NeutronResult /// Queries registered query info pub fn get_registered_query( - deps: Deps, + deps: Deps, interchain_query_id: u64, -) -> NeutronResult { - let query = NeutronQuery::RegisteredInterchainQuery { - query_id: interchain_query_id, - }; - - let res: QueryRegisteredQueryResponse = deps.querier.query(&query.into())?; +) -> NeutronResult { + let querier = InterchainqueriesQuerier::new(&deps.querier); + let query_res = querier.registered_query(interchain_query_id)?; + let res= query_res.registered_query.ok_or_else(|| StdError::generic_err("no registered query"))?; Ok(res) } /// Reads submitted raw KV values for Interchain Query with **query_id** from the storage and reconstructs the result pub fn query_kv_result( - deps: Deps, + deps: Deps, query_id: u64, ) -> NeutronResult { let registered_query_result = get_raw_interchain_query_result(deps, query_id)?; - - KVReconstruct::reconstruct(®istered_query_result.result.kv_results) + KVReconstruct::reconstruct(registered_query_result.clone().kv_results.into()) } /// Queries raw interchain query result (raw KV storage values or transactions) from Interchain Queries Module. @@ -44,12 +39,12 @@ pub fn query_kv_result( /// but in cases when Rust forbids to implement foreign trait [KVReconstruct] for some foreign type, /// it is possible to use [get_raw_interchain_query_result] and reconstruct query result manually. pub fn get_raw_interchain_query_result( - deps: Deps, + deps: Deps, interchain_query_id: u64, -) -> NeutronResult { - let interchain_query = NeutronQuery::InterchainQueryResult { - query_id: interchain_query_id, - }; - let res = deps.querier.query(&interchain_query.into())?; +) -> NeutronResult<&QueryResult> { + let querier = InterchainqueriesQuerier::new(&deps.querier); + let query_res = querier.query_result(interchain_query_id.into())?; + let res = &query_res.result.ok_or_else(|| StdError::generic_err("no result in registered query"))?; + Ok(res) } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/queries.rs index ce17573c..004bde4d 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/queries.rs @@ -80,7 +80,7 @@ pub struct DelegatorUnbondingDelegationsResponse { /// Returns balance of account on remote chain for particular denom /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_balance( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { diff --git a/packages/neutron-sdk/src/interchain_queries/v047/queries.rs b/packages/neutron-sdk/src/interchain_queries/v047/queries.rs index 8bc2000b..7f4a18b2 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/queries.rs @@ -7,7 +7,6 @@ pub use crate::interchain_queries::v045::queries::*; use crate::interchain_queries::v047::types::Delegations; use crate::{ - bindings::query::NeutronQuery, interchain_queries::{ queries::{check_query_type, get_registered_query, query_kv_result}, types::QueryType, @@ -29,20 +28,18 @@ pub struct BalanceResponse { /// Returns balance of account on remote chain for particular denom /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_balance( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let balances: Balances = query_kv_result(deps, registered_query_id)?; Ok(BalanceResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, balances, }) } @@ -57,20 +54,18 @@ pub struct DelegatorDelegationsResponse { /// Returns delegations of particular delegator on remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_delegations( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let delegations: Delegations = query_kv_result(deps, registered_query_id)?; Ok(DelegatorDelegationsResponse { delegations: delegations.delegations, - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, }) } From f6a46d819e045160d828687b35b47f355a438c2f Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 10 Oct 2024 19:25:34 +0400 Subject: [PATCH 03/35] fix register_queries in v047 --- .../src/contract.rs | 12 +++---- .../v047/register_queries.rs | 31 ++++++++++++------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index ac5e723a..bcf79580 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -1,10 +1,7 @@ use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend; use cosmos_sdk_proto::cosmos::tx::v1beta1::{TxBody, TxRaw}; use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{ - entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, - StdResult, Uint128, -}; +use cosmwasm_std::{entry_point, to_json_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, Uint128}; use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; @@ -13,7 +10,6 @@ use crate::msg::{ }; use crate::state::{Transfer, RECIPIENT_TXS, TRANSFERS}; use neutron_sdk::bindings::msg::NeutronMsg; -use neutron_sdk::bindings::query::{NeutronQuery, QueryRegisteredQueryResponse}; use neutron_sdk::bindings::types::{Height, KVKey}; use neutron_sdk::interchain_queries::v047::queries::{ query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, @@ -64,7 +60,7 @@ pub fn instantiate( #[cfg_attr(not(feature = "library"), entry_point)] pub fn execute( _deps: DepsMut, - _env: Env, + env: Env, _: MessageInfo, msg: ExecuteMsg, ) -> NeutronResult { @@ -104,7 +100,7 @@ pub fn execute( delegator, validators, update_period, - } => register_delegations_query(connection_id, delegator, validators, update_period), + } => register_delegations_query(env.contract.address, connection_id, delegator, validators, update_period), ExecuteMsg::RegisterDelegatorUnbondingDelegationsQuery { connection_id, delegator, @@ -205,12 +201,14 @@ pub fn register_validators_signing_infos_query( } pub fn register_delegations_query( + contract: Addr, connection_id: String, delegator: String, validators: Vec, update_period: u64, ) -> NeutronResult { let msg = new_register_delegator_delegations_query_msg( + contract, connection_id, delegator, validators, diff --git a/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs index 547ba091..24f58bc2 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs @@ -5,12 +5,13 @@ pub use crate::interchain_queries::v045::register_queries::*; use crate::bindings::msg::NeutronMsg; use crate::bindings::types::KVKey; use crate::interchain_queries::helpers::decode_and_convert; -use crate::interchain_queries::types::QueryPayload; +use crate::interchain_queries::types::{QueryPayload, QueryType}; use crate::interchain_queries::v045::helpers::{create_delegation_key, create_validator_key}; use crate::interchain_queries::v045::types::STAKING_STORE_KEY; use crate::interchain_queries::v047::types::STAKING_PARAMS_KEY; use crate::NeutronResult; -use cosmwasm_std::Binary; +use cosmwasm_std::{Addr, Binary, CosmosMsg}; +use neutron_std::types::neutron::interchainqueries::{MsgRegisterInterchainQuery, KvKey}; /// Creates a message to register an Interchain Query to get delegations of particular delegator on remote chain. /// @@ -19,40 +20,48 @@ use cosmwasm_std::Binary; /// * **validators** is a list of validators addresses for which you want to get delegations from particular **delegator**; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_delegator_delegations_query_msg( + contract: Addr, connection_id: String, delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory for such KV keys as: // * staking module params to get staking denomination // * validators structures to calculate amount of delegated tokens // * delegations structures to get info about delegations itself - let mut keys: Vec = Vec::with_capacity(validators.len() * 2 + 1); + let mut keys: Vec = Vec::with_capacity(validators.len() * 2 + 1); // create KV key to get Staking Params from staking module - keys.push(KVKey { + keys.push(KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(vec![STAKING_PARAMS_KEY]), + key: vec![STAKING_PARAMS_KEY], }); for v in validators { let val_addr = decode_and_convert(&v)?; // create delegation key to get delegation structure - keys.push(KVKey { + keys.push(KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_delegation_key(&delegator_addr, &val_addr)?), + key: create_delegation_key(&delegator_addr, &val_addr)?, }); // create validator key to get validator structure - keys.push(KVKey { + keys.push(KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr)?), + key: create_validator_key(&val_addr)?, }) } - NeutronMsg::register_interchain_query(QueryPayload::KV(keys), connection_id, update_period) + Ok(MsgRegisterInterchainQuery{ + query_type: QueryType::KV.to_string(), + keys, + transactions_filter: "".to_string(), + connection_id, + update_period, + sender: contract.to_string(), + }) } From 302b8b60e73ed74bc5fb09bbf68d3d3dc6fd406b Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 10 Oct 2024 19:57:02 +0400 Subject: [PATCH 04/35] fix interchain_queries contracts --- .../neutron_interchain_queries/Cargo.toml | 2 + .../src/contract.rs | 85 +++++--- .../neutron_interchain_queries/src/msg.rs | 5 +- packages/neutron-sdk/src/bindings/types.rs | 204 +++++++++--------- .../src/interchain_queries/queries.rs | 2 +- .../src/interchain_queries/types.rs | 5 +- .../src/interchain_queries/v045/helpers.rs | 29 ++- .../v045/register_queries.rs | 197 ++++++++++++----- 8 files changed, 315 insertions(+), 214 deletions(-) diff --git a/contracts/neutron_interchain_queries/Cargo.toml b/contracts/neutron_interchain_queries/Cargo.toml index 5682a1a8..5fed4a16 100644 --- a/contracts/neutron_interchain_queries/Cargo.toml +++ b/contracts/neutron_interchain_queries/Cargo.toml @@ -27,6 +27,8 @@ cw-storage-plus = { workspace = true } serde-json-wasm = { workspace = true } prost-types = { workspace = true } cosmwasm-schema = { workspace = true } +# TODO: use workspace everywhere? +neutron-std = "4.2.2-rc" [dev-dependencies] base64 = { workspace = true } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index bcf79580..6ed83501 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -1,16 +1,18 @@ use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend; use cosmos_sdk_proto::cosmos::tx::v1beta1::{TxBody, TxRaw}; use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{entry_point, to_json_binary, Addr, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, Uint128}; +use cosmwasm_std::{entry_point, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, Uint128}; use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; +use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, RegisteredQuery, QueryResult, KvKey}; +// TODO: fix name +use neutron_sdk::interchain_queries::v045::register_queries::{update_interchain_query as helpers_update_interchain_query, remove_interchain_query as helpers_remove_interchain_query}; use crate::msg::{ Cw20BalanceResponse, ExecuteMsg, GetRecipientTxsResponse, InstantiateMsg, MigrateMsg, QueryMsg, }; use crate::state::{Transfer, RECIPIENT_TXS, TRANSFERS}; -use neutron_sdk::bindings::msg::NeutronMsg; -use neutron_sdk::bindings::types::{Height, KVKey}; +use neutron_sdk::bindings::types::Height; use neutron_sdk::interchain_queries::v047::queries::{ query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, query_government_proposals, query_staking_validators, query_unbonding_delegations, @@ -70,31 +72,31 @@ pub fn execute( addr, denoms, update_period, - } => register_balances_query(connection_id, addr, denoms, update_period), + } => register_balances_query(env.contract.address, connection_id, addr, denoms, update_period), ExecuteMsg::RegisterBankTotalSupplyQuery { connection_id, denoms, update_period, - } => register_bank_total_supply_query(connection_id, denoms, update_period), + } => register_bank_total_supply_query(env.contract.address, connection_id, denoms, update_period), ExecuteMsg::RegisterDistributionFeePoolQuery { connection_id, update_period, - } => register_distribution_fee_pool_query(connection_id, update_period), + } => register_distribution_fee_pool_query(env.contract.address, connection_id, update_period), ExecuteMsg::RegisterGovernmentProposalsQuery { connection_id, proposals_ids, update_period, - } => register_gov_proposal_query(connection_id, proposals_ids, update_period), + } => register_gov_proposal_query(env.contract.address, connection_id, proposals_ids, update_period), ExecuteMsg::RegisterStakingValidatorsQuery { connection_id, validators, update_period, - } => register_staking_validators_query(connection_id, validators, update_period), + } => register_staking_validators_query(env.contract.address, connection_id, validators, update_period), ExecuteMsg::RegisterValidatorsSigningInfosQuery { connection_id, validators, update_period, - } => register_validators_signing_infos_query(connection_id, validators, update_period), + } => register_validators_signing_infos_query(env.contract.address, connection_id, validators, update_period), ExecuteMsg::RegisterDelegatorDelegationsQuery { connection_id, delegator, @@ -107,6 +109,7 @@ pub fn execute( validators, update_period, } => register_unbonding_delegations_query( + env.contract.address, connection_id, delegator, validators, @@ -117,13 +120,14 @@ pub fn execute( recipient, update_period, min_height, - } => register_transfers_query(connection_id, recipient, update_period, min_height), + } => register_transfers_query(env.contract.address, connection_id, recipient, update_period, min_height), ExecuteMsg::RegisterCw20BalanceQuery { connection_id, update_period, cw20_contract_address, account_address, } => register_cw20_balance_query( + env.contract.address, connection_id, update_period, cw20_contract_address, @@ -134,68 +138,74 @@ pub fn execute( new_keys, new_update_period, new_recipient, - } => update_interchain_query(query_id, new_keys, new_update_period, new_recipient), - ExecuteMsg::RemoveInterchainQuery { query_id } => remove_interchain_query(query_id), + } => update_interchain_query(env.contract.address, query_id, new_keys, new_update_period, new_recipient), + ExecuteMsg::RemoveInterchainQuery { query_id } => remove_interchain_query(env.contract.address, query_id), } } pub fn register_balances_query( + contract: Addr, connection_id: String, addr: String, denoms: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_balances_query_msg(connection_id, addr, denoms, update_period)?; + let msg = new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?; Ok(Response::new().add_message(msg)) } pub fn register_bank_total_supply_query( + contract: Addr, connection_id: String, denoms: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_bank_total_supply_query_msg(connection_id, denoms, update_period)?; + let msg = new_register_bank_total_supply_query_msg(contract, connection_id, denoms, update_period)?; Ok(Response::new().add_message(msg)) } pub fn register_distribution_fee_pool_query( + contract: Addr, connection_id: String, update_period: u64, ) -> NeutronResult { - let msg = new_register_distribution_fee_pool_query_msg(connection_id, update_period)?; + let msg = new_register_distribution_fee_pool_query_msg(contract, connection_id, update_period)?; Ok(Response::new().add_message(msg)) } pub fn register_gov_proposal_query( + contract: Addr, connection_id: String, proposals_ids: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_gov_proposals_query_msg(connection_id, proposals_ids, update_period)?; + let msg = new_register_gov_proposals_query_msg(contract, connection_id, proposals_ids, update_period)?; Ok(Response::new().add_message(msg)) } pub fn register_staking_validators_query( + contract: Addr, connection_id: String, validators: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_staking_validators_query_msg(connection_id, validators, update_period)?; + let msg = new_register_staking_validators_query_msg(contract, connection_id, validators, update_period)?; Ok(Response::new().add_message(msg)) } pub fn register_validators_signing_infos_query( + contract: Addr, connection_id: String, validators: Vec, update_period: u64, ) -> NeutronResult { let msg = - new_register_validators_signing_infos_query_msg(connection_id, validators, update_period)?; + new_register_validators_signing_infos_query_msg(contract, connection_id, validators, update_period)?; Ok(Response::new().add_message(msg)) } @@ -219,12 +229,14 @@ pub fn register_delegations_query( } pub fn register_unbonding_delegations_query( + contract: Addr, connection_id: String, delegator: String, validators: Vec, update_period: u64, ) -> NeutronResult { let msg = new_register_delegator_unbonding_delegations_query_msg( + contract, connection_id, delegator, validators, @@ -235,18 +247,20 @@ pub fn register_unbonding_delegations_query( } pub fn register_transfers_query( + contract: Addr, connection_id: String, recipient: String, update_period: u64, min_height: Option, ) -> NeutronResult { let msg = - new_register_transfers_query_msg(connection_id, recipient, update_period, min_height)?; + new_register_transfers_query_msg(contract, connection_id, recipient, update_period, min_height)?; Ok(Response::new().add_message(msg)) } pub fn register_cw20_balance_query( + contract: Addr, connection_id: String, update_period: u64, cw20_contract_address: String, @@ -259,6 +273,7 @@ pub fn register_cw20_balance_query( storage_key.extend_from_slice(account_address.as_bytes()); let msg = new_register_wasm_contract_store_query_msg( + contract, connection_id, cw20_contract_address, &storage_key, @@ -269,11 +284,12 @@ pub fn register_cw20_balance_query( } pub fn update_interchain_query( + contract: Addr, query_id: u64, - new_keys: Option>, - new_update_period: Option, + new_keys: Vec, + new_update_period: u64, new_recipient: Option, -) -> NeutronResult { +) -> NeutronResult> { let new_filter = new_recipient.map(|recipient| { vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), @@ -283,12 +299,12 @@ pub fn update_interchain_query( }); let update_msg = - NeutronMsg::update_interchain_query(query_id, new_keys, new_update_period, new_filter)?; + helpers_update_interchain_query(contract, query_id, new_keys, new_update_period, new_filter)?; Ok(Response::new().add_message(update_msg)) } -pub fn remove_interchain_query(query_id: u64) -> NeutronResult { - let remove_msg = NeutronMsg::remove_interchain_query(query_id); +pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult> { + let remove_msg = helpers_remove_interchain_query(contract, query_id); Ok(Response::new().add_message(remove_msg)) } @@ -328,7 +344,7 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { } } -fn query_recipient_txs(deps: Deps, recipient: String) -> NeutronResult { +fn query_recipient_txs(deps: Deps, recipient: String) -> NeutronResult { let txs = RECIPIENT_TXS .load(deps.storage, &recipient) .unwrap_or_default(); @@ -336,13 +352,13 @@ fn query_recipient_txs(deps: Deps, recipient: String) -> NeutronRe } pub fn query_cw20_balance( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let balance: Uint128 = query_kv_result(deps, registered_query_id)?; Ok(Cw20BalanceResponse { balance }) @@ -355,7 +371,7 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult, env: Env, msg: SudoMsg) -> NeutronResult { +pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> NeutronResult { match msg { // For handling tx query result SudoMsg::TxQueryResult { @@ -373,7 +389,7 @@ pub fn sudo(deps: DepsMut, env: Env, msg: SudoMsg) -> NeutronResul /// sudo_check_tx_query_result is an example callback for transaction query results that stores the /// deposits received as a result on the registered query in the contract's state. pub fn sudo_tx_query_result( - deps: DepsMut, + deps: DepsMut, _env: Env, query_id: u64, _height: Height, @@ -384,9 +400,9 @@ pub fn sudo_tx_query_result( let body: TxBody = TxBody::decode(tx.body_bytes.as_slice())?; // Get the registered query by ID and retrieve the raw query string - let registered_query: QueryRegisteredQueryResponse = + let registered_query: RegisteredQuery = get_registered_query(deps.as_ref(), query_id)?; - let transactions_filter = registered_query.registered_query.transactions_filter; + let transactions_filter = registered_query.transactions_filter; #[allow(clippy::match_single_binding)] // Depending of the query type, check the transaction data to see whether is satisfies @@ -394,7 +410,8 @@ pub fn sudo_tx_query_result( // all submitted results will be treated as valid. // // TODO: come up with solution to determine transactions filter type - match registered_query.registered_query.query_type { + // TODO: fix this? + match registered_query.query_type { _ => { // For transfer queries, query data looks like `[{"field:"transfer.recipient", "op":"eq", "value":"some_address"}]` let query_data: Vec = @@ -491,7 +508,7 @@ fn check_deposits_size(deposits: &Vec) -> StdResult<()> { /// sudo_kv_query_result is the contract's callback for KV query results. Note that only the query /// id is provided, so you need to read the query result from the state. pub fn sudo_kv_query_result( - deps: DepsMut, + deps: DepsMut, _env: Env, query_id: u64, ) -> NeutronResult { diff --git a/contracts/neutron_interchain_queries/src/msg.rs b/contracts/neutron_interchain_queries/src/msg.rs index 6f6b5cb6..86eb7041 100644 --- a/contracts/neutron_interchain_queries/src/msg.rs +++ b/contracts/neutron_interchain_queries/src/msg.rs @@ -1,5 +1,6 @@ use crate::state::Transfer; use cosmwasm_std::Uint128; +use neutron_std::types::neutron::interchainqueries::KvKey; use neutron_sdk::bindings::types::KVKey; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -66,8 +67,8 @@ pub enum ExecuteMsg { }, UpdateInterchainQuery { query_id: u64, - new_keys: Option>, - new_update_period: Option, + new_keys: Vec, + new_update_period: u64, new_recipient: Option, }, RemoveInterchainQuery { diff --git a/packages/neutron-sdk/src/bindings/types.rs b/packages/neutron-sdk/src/bindings/types.rs index 2dec2b2b..791731d7 100644 --- a/packages/neutron-sdk/src/bindings/types.rs +++ b/packages/neutron-sdk/src/bindings/types.rs @@ -22,39 +22,39 @@ pub fn decode_hex(s: &str) -> Option> { .collect() } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct RegisteredQuery { - /// The unique id of the registered query. - pub id: u64, - /// The address that registered the query. - pub owner: String, - /// The KV-storage keys for which we want to get values from remote chain - pub keys: Vec, - /// The query type identifier (i.e. 'kv' or 'tx' for now) - pub query_type: QueryType, - /// The filter for transaction search ICQ - pub transactions_filter: String, - /// The IBC connection ID for getting ConsensusState to verify proofs. - pub connection_id: String, - /// Parameter that defines how often the query must be updated. - pub update_period: u64, - /// The local chain last block height when the query result was updated. - #[serde(default)] - pub last_submitted_result_local_height: u64, - /// The remote chain last block height when the query result was updated. - #[serde(default)] - pub last_submitted_result_remote_height: Height, - /// Amount of coins deposited for the query. - #[serde(default)] - pub deposit: Vec, - /// Timeout before query becomes available for everybody to remove. - #[serde(default)] - pub submit_timeout: u64, - /// The local chain height when the query was registered. - #[serde(default)] - pub registered_at_height: u64, -} +// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +// #[serde(rename_all = "snake_case")] +// pub struct RegisteredQuery { +// /// The unique id of the registered query. +// pub id: u64, +// /// The address that registered the query. +// pub owner: String, +// /// The KV-storage keys for which we want to get values from remote chain +// pub keys: Vec, +// /// The query type identifier (i.e. 'kv' or 'tx' for now) +// pub query_type: QueryType, +// /// The filter for transaction search ICQ +// pub transactions_filter: String, +// /// The IBC connection ID for getting ConsensusState to verify proofs. +// pub connection_id: String, +// /// Parameter that defines how often the query must be updated. +// pub update_period: u64, +// /// The local chain last block height when the query result was updated. +// #[serde(default)] +// pub last_submitted_result_local_height: u64, +// /// The remote chain last block height when the query result was updated. +// #[serde(default)] +// pub last_submitted_result_remote_height: Height, +// /// Amount of coins deposited for the query. +// #[serde(default)] +// pub deposit: Vec, +// /// Timeout before query becomes available for everybody to remove. +// #[serde(default)] +// pub submit_timeout: u64, +// /// The local chain height when the query was registered. +// #[serde(default)] +// pub registered_at_height: u64, +// } #[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] @@ -182,72 +182,72 @@ impl ProtobufAny { const KV_PATH_KEY_DELIMITER: &str = "/"; const KV_KEYS_DELIMITER: &str = ","; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// Describes a KV key for which you want to get value from the storage on remote chain -pub struct KVKey { - /// **path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.) - pub path: String, - - /// **key** is a key you want to read from the storage - pub key: Binary, -} - -impl KVKey { - /// Creates KVKey from string - /// Returns None on failure - pub fn from_string>(s: S) -> Option { - let split: Vec<&str> = s.as_ref().split(KV_PATH_KEY_DELIMITER).collect(); - if split.len() < 2 { - return None; - } - - Some(KVKey { - path: split[0].to_string(), - key: Binary::new(decode_hex(split[1])?), - }) - } -} - -#[allow(clippy::from_over_into)] -impl Into for &KVKey { - fn into(self) -> String { - let mut s = String::with_capacity( - self.path.len() + KV_PATH_KEY_DELIMITER.len() + self.key.len() * 2, - ); - - s.push_str(&self.path); - s.push_str(KV_PATH_KEY_DELIMITER); - s.push_str(&encode_hex(&self.key)); - - s - } -} - -/// KVKeys describes vec of KVKey structures -pub struct KVKeys(pub Vec); - -impl KVKeys { - /// Creates KVKeys from string - /// Returns None on failure - pub fn from_string>(s: S) -> Option { - let split = s.as_ref().split(KV_KEYS_DELIMITER); - - Some(KVKeys( - split - .map(KVKey::from_string) - .collect::>>()?, - )) - } -} - -#[allow(clippy::from_over_into)] -impl Into for KVKeys { - fn into(self) -> String { - self.0 - .iter() - .map(|kv| kv.into()) - .collect::>() - .join(KV_KEYS_DELIMITER) - } -} +// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +// #[serde(rename_all = "snake_case")] +// /// Describes a KV key for which you want to get value from the storage on remote chain +// pub struct KVKey { +// /// **path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.) +// pub path: String, +// +// /// **key** is a key you want to read from the storage +// pub key: Binary, +// } +// +// impl KVKey { +// /// Creates KVKey from string +// /// Returns None on failure +// pub fn from_string>(s: S) -> Option { +// let split: Vec<&str> = s.as_ref().split(KV_PATH_KEY_DELIMITER).collect(); +// if split.len() < 2 { +// return None; +// } +// +// Some(KVKey { +// path: split[0].to_string(), +// key: Binary::new(decode_hex(split[1])?), +// }) +// } +// } +// +// #[allow(clippy::from_over_into)] +// impl Into for &KVKey { +// fn into(self) -> String { +// let mut s = String::with_capacity( +// self.path.len() + KV_PATH_KEY_DELIMITER.len() + self.key.len() * 2, +// ); +// +// s.push_str(&self.path); +// s.push_str(KV_PATH_KEY_DELIMITER); +// s.push_str(&encode_hex(&self.key)); +// +// s +// } +// } +// +// /// KVKeys describes vec of KVKey structures +// pub struct KVKeys(pub Vec); +// +// impl KVKeys { +// /// Creates KVKeys from string +// /// Returns None on failure +// pub fn from_string>(s: S) -> Option { +// let split = s.as_ref().split(KV_KEYS_DELIMITER); +// +// Some(KVKeys( +// split +// .map(KVKey::from_string) +// .collect::>>()?, +// )) +// } +// } +// +// #[allow(clippy::from_over_into)] +// impl Into for KVKeys { +// fn into(self) -> String { +// self.0 +// .iter() +// .map(|kv| kv.into()) +// .collect::>() +// .join(KV_KEYS_DELIMITER) +// } +// } diff --git a/packages/neutron-sdk/src/interchain_queries/queries.rs b/packages/neutron-sdk/src/interchain_queries/queries.rs index d77fea89..12843210 100644 --- a/packages/neutron-sdk/src/interchain_queries/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/queries.rs @@ -2,7 +2,7 @@ use crate::errors::error::NeutronResult; use crate::interchain_queries::types::{KVReconstruct, QueryType}; use crate::NeutronError; use cosmwasm_std::{Deps, StdError}; -use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, QueryRegisteredQueryResultResponse, QueryRegisteredQueryResponse, RegisteredQuery, QueryResult}; +use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, RegisteredQuery, QueryResult}; /// Checks **actual** query type is **expected** query type pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<()> { diff --git a/packages/neutron-sdk/src/interchain_queries/types.rs b/packages/neutron-sdk/src/interchain_queries/types.rs index d4a0c3f2..5e854d82 100644 --- a/packages/neutron-sdk/src/interchain_queries/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/types.rs @@ -1,8 +1,9 @@ use crate::{ - bindings::types::{KVKey, StorageValue}, + bindings::types::{StorageValue}, errors::error::NeutronResult, }; use cosmwasm_std::{from_json, StdError, Uint128}; +use neutron_std::types::neutron::interchainqueries::KvKey; use schemars::{JsonSchema, _serde_json::Value}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -92,7 +93,7 @@ impl Into for QueryType { pub enum QueryPayload { /// **kv** is an interchain query type to query KV values from remote chain /// payload is kvkeys - KV(Vec), + KV(Vec), /// **tx** is an interchain query type to query transactions from remote chain /// payload is transactions filter diff --git a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs index 9306c743..e4c8cc92 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs @@ -1,4 +1,3 @@ -use crate::bindings::types::KVKey; use crate::errors::error::NeutronResult; use crate::interchain_queries::helpers::{decode_and_convert, length_prefix}; use crate::interchain_queries::types::AddressBytes; @@ -11,7 +10,7 @@ use crate::NeutronError; use cosmos_sdk_proto::cosmos::staking::v1beta1::Commission as ValidatorCommission; use cosmwasm_std::{Binary, Decimal, Uint128}; use std::str::{from_utf8, FromStr}; - +use neutron_std::types::neutron::interchainqueries::KvKey; use super::types::{GOV_STORE_KEY, VOTES_KEY_PREFIX}; /// Creates KV key to get **module** param by **key** @@ -50,16 +49,16 @@ pub fn create_account_denom_balance_key, S: AsRef>( /// /// * **addr** address of an account on remote chain for which you want to get balances; /// * **denoms** denominations of the coins for which you want to get balance; -pub fn create_balances_query_keys(addr: String, denoms: Vec) -> NeutronResult> { +pub fn create_balances_query_keys(addr: String, denoms: Vec) -> NeutronResult> { let converted_addr_bytes = decode_and_convert(addr.as_str())?; - let mut kv_keys: Vec = Vec::with_capacity(denoms.len()); + let mut kv_keys: Vec = Vec::with_capacity(denoms.len()); for denom in denoms { let balance_key = create_account_denom_balance_key(&converted_addr_bytes, denom)?; - let kv_key = KVKey { + let kv_key = KvKey { path: BANK_STORE_KEY.to_string(), - key: Binary::new(balance_key), + key: balance_key, }; kv_keys.push(kv_key) @@ -236,13 +235,13 @@ pub fn create_gov_proposal_key(proposal_id: u64) -> NeutronResult> { } /// Creates Cosmos-SDK storage keys for list of proposals -pub fn create_gov_proposal_keys(proposals_ids: Vec) -> NeutronResult> { - let mut kv_keys: Vec = Vec::with_capacity(proposals_ids.len()); +pub fn create_gov_proposal_keys(proposals_ids: Vec) -> NeutronResult> { + let mut kv_keys: Vec = Vec::with_capacity(proposals_ids.len()); for id in proposals_ids { - let kv_key = KVKey { + let kv_key = KvKey { path: GOV_STORE_KEY.to_string(), - key: Binary::new(create_gov_proposal_key(id)?), + key: create_gov_proposal_key(id)?, }; kv_keys.push(kv_key) @@ -276,19 +275,19 @@ pub fn create_gov_proposal_voter_votes_key>( pub fn create_gov_proposals_voters_votes_keys( proposals_ids: Vec, voters: Vec, -) -> NeutronResult> { - let mut kv_keys: Vec = Vec::with_capacity(voters.len() * proposals_ids.len()); +) -> NeutronResult> { + let mut kv_keys: Vec = Vec::with_capacity(voters.len() * proposals_ids.len()); for voter in voters { let voter_addr = decode_and_convert(&voter)?; for proposal_id in proposals_ids.clone() { - let kv_key = KVKey { + let kv_key = KvKey { path: GOV_STORE_KEY.to_string(), - key: Binary::new(create_gov_proposal_voter_votes_key( + key: create_gov_proposal_voter_votes_key( proposal_id, &voter_addr, - )?), + )?, }; kv_keys.push(kv_key) diff --git a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs index d379e5a8..2a184e6a 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs @@ -1,12 +1,9 @@ -use crate::interchain_queries::types::{ - QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, -}; +use crate::interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue}; use crate::interchain_queries::v045::types::{ BANK_STORE_KEY, DISTRIBUTION_STORE_KEY, HEIGHT_FIELD, KEY_BOND_DENOM, PARAMS_STORE_KEY, RECIPIENT_FIELD, SLASHING_STORE_KEY, STAKING_STORE_KEY, WASM_STORE_KEY, }; use crate::{ - bindings::{msg::NeutronMsg, types::KVKey}, errors::error::NeutronResult, interchain_queries::helpers::decode_and_convert, interchain_queries::v045::helpers::{ @@ -16,7 +13,9 @@ use crate::{ create_validator_signing_info_key, create_wasm_contract_store_key, }, }; -use cosmwasm_std::Binary; +use cosmwasm_std::{Addr, Binary, CosmosMsg, StdError}; +use neutron_std::types::neutron::interchainqueries::{KvKey, MsgRegisterInterchainQuery, MsgRemoveInterchainQueryRequest, MsgUpdateInterchainQueryRequest}; +use serde_json_wasm::to_string; /// Creates a message to register an Interchain Query to get balance of account on remote chain for list of denoms /// @@ -25,13 +24,14 @@ use cosmwasm_std::Binary; /// * **denoms** denominations of the coins for which you want to get balance; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_balances_query_msg( + contract: Addr, connection_id: String, addr: String, denoms: Vec, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let kv_keys = create_balances_query_keys(addr, denoms)?; - NeutronMsg::register_interchain_query(QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } /// Creates a message to register an Interchain Query to get balance of account on remote chain for a particular denom @@ -42,12 +42,13 @@ pub fn new_register_balances_query_msg( /// * **update_period** is used to say how often the query must be updated. #[deprecated(note = "Please use new_register_balances_query_msg instead")] pub fn new_register_balance_query_msg( + contract: Addr, connection_id: String, addr: String, denom: String, update_period: u64, -) -> NeutronResult { - new_register_balances_query_msg(connection_id, addr, vec![denom], update_period) +) -> NeutronResult> { + new_register_balances_query_msg(contract, connection_id, addr, vec![denom], update_period) } /// Creates a message to register an Interchain Query to get total supply on remote chain for particular denom @@ -56,24 +57,25 @@ pub fn new_register_balance_query_msg( /// * **denom** denomination of the coin for which you want to get total supply; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_bank_total_supply_query_msg( + contract: Addr, connection_id: String, denoms: Vec, update_period: u64, -) -> NeutronResult { - let mut kv_keys: Vec = Vec::with_capacity(denoms.len()); +) -> NeutronResult> { + let mut kv_keys: Vec = Vec::with_capacity(denoms.len()); for denom in denoms { let supply_key = create_total_denom_key(denom)?; - let kv_key = KVKey { + let kv_key = KvKey { path: BANK_STORE_KEY.to_string(), - key: Binary::new(supply_key), + key: supply_key, }; kv_keys.push(kv_key) } - NeutronMsg::register_interchain_query(QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } /// Creates a message to register an Interchain Query to get fee pool on remote chain from distribution module @@ -81,15 +83,17 @@ pub fn new_register_bank_total_supply_query_msg( /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_distribution_fee_pool_query_msg( + contract: Addr, connection_id: String, update_period: u64, -) -> NeutronResult { - let kv_key = KVKey { +) -> NeutronResult> { + let kv_key = KvKey { path: DISTRIBUTION_STORE_KEY.to_string(), - key: Binary::new(create_fee_pool_key()?), + key: create_fee_pool_key()?, }; - NeutronMsg::register_interchain_query( + register_interchain_query( + contract, QueryPayload::KV(vec![kv_key]), connection_id, update_period, @@ -102,13 +106,14 @@ pub fn new_register_distribution_fee_pool_query_msg( /// * **proposals_ids** is a list of proposals ids from remote chain. /// * **update_period** is used to say how often the query must be updated. pub fn new_register_gov_proposals_query_msg( + contract: Addr, connection_id: String, proposals_ids: Vec, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let kv_keys = create_gov_proposal_keys(proposals_ids)?; - NeutronMsg::register_interchain_query(QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } /// Creates a message to update an Interchain Query to get governance proposals on remote chain @@ -117,13 +122,14 @@ pub fn new_register_gov_proposals_query_msg( /// * **proposals_ids** is a list of proposals ids from remote chain. /// * **new_update_period** is used to update period of how often the query must be updated. pub fn update_gov_proposals_query_msg( + contract: Addr, query_id: u64, proposals_ids: Vec, - new_update_period: Option, -) -> NeutronResult { + new_update_period: u64, +) -> NeutronResult> { let kv_keys = create_gov_proposal_keys(proposals_ids)?; - NeutronMsg::update_interchain_query(query_id, Some(kv_keys), new_update_period, None) + update_interchain_query(contract, query_id, kv_keys, new_update_period, None) } /// Creates a message to register an Interchain Query to get governance proposals votes on the remote chain @@ -133,14 +139,15 @@ pub fn update_gov_proposals_query_msg( /// * **voters** is a list of voter to get voting info from remote chain. /// * **update_period** is used to say how often the query must be updated. pub fn new_register_gov_proposals_voters_votes_query_msg( + contract: Addr, connection_id: String, proposals_ids: Vec, voters: Vec, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let kv_keys = create_gov_proposals_voters_votes_keys(proposals_ids, voters)?; - NeutronMsg::register_interchain_query(QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } /// Creates a message to update an Interchain Query to get governance proposals votes on the remote chain @@ -150,14 +157,15 @@ pub fn new_register_gov_proposals_voters_votes_query_msg( /// * **voters** is a list of voter to get voting info from remote chain. /// * **new_update_period** is used to update period of how often the query must be updated. pub fn update_gov_proposals_votes_query_msg( + contract: Addr, query_id: u64, proposals_ids: Vec, voters: Vec, - new_update_period: Option, -) -> NeutronResult { + new_update_period: u64, +) -> NeutronResult> { let kv_keys = create_gov_proposals_voters_votes_keys(proposals_ids, voters)?; - NeutronMsg::update_interchain_query(query_id, Some(kv_keys), new_update_period, None) + update_interchain_query(contract, query_id, kv_keys, new_update_period, None) } /// Creates a message to register an Interchain Query to get validator info on remote chain @@ -166,24 +174,25 @@ pub fn update_gov_proposals_votes_query_msg( /// * **validator** is an validator operator address of an account on remote chain for which you want to get rewards ; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_staking_validators_query_msg( + contract: Addr, connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult { - let mut kv_keys: Vec = Vec::with_capacity(validators.len()); +) -> NeutronResult> { + let mut kv_keys: Vec = Vec::with_capacity(validators.len()); for validator in validators { let val_addr = decode_and_convert(&validator)?; - let kv_key = KVKey { + let kv_key = KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr)?), + key: create_validator_key(&val_addr)?, }; kv_keys.push(kv_key) } - NeutronMsg::register_interchain_query(QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } /// Creates a message to register an Interchain Query to get validators signing infos on remote chain @@ -192,24 +201,25 @@ pub fn new_register_staking_validators_query_msg( /// * **validators** is an list of validators valcons addresses of an account on remote chain for which you want to get rewards ; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_validators_signing_infos_query_msg( + contract: Addr, connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult { - let mut kv_keys: Vec = Vec::with_capacity(validators.len()); +) -> NeutronResult> { + let mut kv_keys: Vec = Vec::with_capacity(validators.len()); for validator in validators { let valcons_addr = decode_and_convert(&validator)?; - let kv_key = KVKey { + let kv_key = KvKey { path: SLASHING_STORE_KEY.to_string(), - key: Binary::new(create_validator_signing_info_key(&valcons_addr)?), + key: create_validator_signing_info_key(&valcons_addr)?, }; kv_keys.push(kv_key) } - NeutronMsg::register_interchain_query(QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } /// Creates a message to register an Interchain Query to get delegations of particular delegator on remote chain. @@ -219,42 +229,43 @@ pub fn new_register_validators_signing_infos_query_msg( /// * **validators** is a list of validators addresses for which you want to get delegations from particular **delegator**; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_delegator_delegations_query_msg( + contract: Addr, connection_id: String, delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory for such KV keys as: // * staking module params to get staking denomination // * validators structures to calculate amount of delegated tokens // * delegations structures to get info about delegations itself - let mut keys: Vec = Vec::with_capacity(validators.len() * 2 + 1); + let mut keys: Vec = Vec::with_capacity(validators.len() * 2 + 1); // create KV key to get BondDenom from staking module params - keys.push(KVKey { + keys.push(KvKey { path: PARAMS_STORE_KEY.to_string(), - key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), + key: create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM), }); for v in validators { let val_addr = decode_and_convert(&v)?; // create delegation key to get delegation structure - keys.push(KVKey { + keys.push(KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_delegation_key(&delegator_addr, &val_addr)?), + key: create_delegation_key(&delegator_addr, &val_addr)?, }); // create validator key to get validator structure - keys.push(KVKey { + keys.push(KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr)?), + key: create_validator_key(&val_addr)?, }) } - NeutronMsg::register_interchain_query(QueryPayload::KV(keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(keys), connection_id, update_period) } /// Creates a message to register an Interchain Query to get unbonding delegations of particular delegator on remote chain. @@ -264,27 +275,28 @@ pub fn new_register_delegator_delegations_query_msg( /// * **validators** is a list of validators addresses for which you want to get unbonding delegations from particular **delegator**; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_delegator_unbonding_delegations_query_msg( + contract: Addr, connection_id: String, delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory, one KV key per validator - let mut keys: Vec = Vec::with_capacity(validators.len()); + let mut keys: Vec = Vec::with_capacity(validators.len()); for v in validators { let val_addr = decode_and_convert(&v)?; // create unbonding delegation key to get unbonding delegation structure - keys.push(KVKey { + keys.push(KvKey { path: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_unbonding_delegation_key(&delegator_addr, &val_addr)?), + key: create_unbonding_delegation_key(&delegator_addr, &val_addr)?, }) } - NeutronMsg::register_interchain_query(QueryPayload::KV(keys), connection_id, update_period) + register_interchain_query(contract, QueryPayload::KV(keys), connection_id, update_period) } /// Creates a message to register an Interchain Query to get wasm contract store on remote chain @@ -301,20 +313,22 @@ pub fn new_register_delegator_unbonding_delegations_query_msg( /// just by looking it. One could pipe this string into `| xxd -r -p | hexdump -C` and examine /// its contents. pub fn new_register_wasm_contract_store_query_msg( + contract: Addr, connection_id: String, contract_address: String, key: impl AsRef<[u8]>, update_period: u64, -) -> NeutronResult { +) -> NeutronResult> { let converted_addr_bytes = decode_and_convert(contract_address.as_str())?; let wasm_key = create_wasm_contract_store_key(converted_addr_bytes, key.as_ref())?; - let kv_key = KVKey { + let kv_key = KvKey { path: WASM_STORE_KEY.to_string(), - key: Binary::new(wasm_key), + key: wasm_key, }; - NeutronMsg::register_interchain_query( + register_interchain_query( + contract, QueryPayload::KV(vec![kv_key]), connection_id, update_period, @@ -328,11 +342,12 @@ pub fn new_register_wasm_contract_store_query_msg( /// * **update_period** is used to say how often the query must be updated. /// * **min_height** is used to set min height for query (by default = 0). pub fn new_register_transfers_query_msg( + contract: Addr, connection_id: String, recipient: String, update_period: u64, min_height: Option, -) -> NeutronResult { +) -> NeutronResult> { let mut query_data = vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), op: TransactionFilterOp::Eq, @@ -346,9 +361,75 @@ pub fn new_register_transfers_query_msg( }) } - NeutronMsg::register_interchain_query( + register_interchain_query( + contract, QueryPayload::TX(query_data), connection_id, update_period, ) } + +/// Basic helper to define a register interchain query message: +/// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload: +/// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get +/// values from remote chain; +/// - when the query enum is 'tx' then payload is the filters for transaction search ICQ, +/// maximum allowed number of filters is 32. +/// * **connection_id** is an IBC connection identifier between Neutron and remote chain; +/// * **update_period** is used to say how often (in neutron blocks) the query must be updated. +fn register_interchain_query(contract: Addr, query: QueryPayload, connection_id: String, update_period: u64) -> NeutronResult> { + Ok(match query { + QueryPayload::KV(keys) => MsgRegisterInterchainQuery{ + sender: contract.to_string(), + query_type: QueryType::KV.to_string(), + keys, + transactions_filter: String::new(), + connection_id, + update_period, + }, + QueryPayload::TX(transactions_filters) => MsgRegisterInterchainQuery { + sender: contract.to_string(), + query_type: QueryType::TX.into(), + keys: vec![], + transactions_filter: to_string(&transactions_filters) + .map_err(|e| StdError::generic_err(e.to_string()))?, + connection_id, + update_period, + }, + }) +} + +/// Basic helper to define a update interchain query message: +/// * **query_id** is ID of the query we want to update; +/// * **new_keys** is encoded keys to query; +/// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated. +pub fn update_interchain_query( + contract: Addr, + query_id: u64, + new_keys: Vec, + new_update_period: u64, + new_transactions_filter: Option>, +) -> NeutronResult> { + Ok(MsgUpdateInterchainQueryRequest { + sender: contract.to_string(), + query_id, + new_keys, + new_update_period, + new_transactions_filter: match new_transactions_filter { + Some(filters) => { + to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))? + } + // TODO: check if passing empty string is correct + None => "".to_string(), + }, + }) +} + +/// Basic helper to define a remove interchain query message: +/// * **query_id** is ID of the query we want to remove. +pub fn remove_interchain_query(contract: Addr, query_id: u64)-> NeutronResult> { + Ok(MsgRemoveInterchainQueryRequest { + sender: contract.to_string(), + query_id, + }) +} From 09deffebf32be6a63ca70874c2e307593a91262c Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:02:40 +0400 Subject: [PATCH 05/35] remove proto_types --- Cargo.toml | 2 +- Makefile | 3 - .../src/interchain_queries/v045/queries.rs | 71 +- .../src/proto_types/capability/mod.rs | 1 - .../src/proto_types/capability/v1.rs | 112 - .../src/proto_types/cosmos/app/mod.rs | 2 - .../src/proto_types/cosmos/app/runtime/mod.rs | 1 - .../cosmos/app/runtime/v1alpha1.rs | 80 - .../src/proto_types/cosmos/app/v1alpha1.rs | 248 -- .../src/proto_types/cosmos/auth/mod.rs | 2 - .../src/proto_types/cosmos/auth/module/mod.rs | 1 - .../src/proto_types/cosmos/auth/module/v1.rs | 47 - .../src/proto_types/cosmos/auth/v1beta1.rs | 685 ---- .../src/proto_types/cosmos/authz/mod.rs | 2 - .../proto_types/cosmos/authz/module/mod.rs | 1 - .../src/proto_types/cosmos/authz/module/v1.rs | 15 - .../src/proto_types/cosmos/authz/v1beta1.rs | 448 --- .../src/proto_types/cosmos/bank/mod.rs | 2 - .../src/proto_types/cosmos/bank/module/mod.rs | 1 - .../src/proto_types/cosmos/bank/module/v1.rs | 30 - .../src/proto_types/cosmos/bank/v1beta1.rs | 1153 ------- .../src/proto_types/cosmos/base/abci/mod.rs | 1 - .../proto_types/cosmos/base/abci/v1beta1.rs | 390 --- .../src/proto_types/cosmos/base/mod.rs | 6 - .../src/proto_types/cosmos/base/node/mod.rs | 1 - .../proto_types/cosmos/base/node/v1beta1.rs | 102 - .../src/proto_types/cosmos/base/query/mod.rs | 1 - .../proto_types/cosmos/base/query/v1beta1.rs | 97 - .../proto_types/cosmos/base/reflection/mod.rs | 2 - .../cosmos/base/reflection/v1beta1.rs | 70 - .../cosmos/base/reflection/v2alpha1.rs | 514 --- .../proto_types/cosmos/base/tendermint/mod.rs | 1 - .../cosmos/base/tendermint/v1beta1.rs | 599 ---- .../src/proto_types/cosmos/base/v1beta1.rs | 81 - .../src/proto_types/cosmos/circuit/mod.rs | 2 - .../proto_types/cosmos/circuit/module/mod.rs | 1 - .../proto_types/cosmos/circuit/module/v1.rs | 19 - .../src/proto_types/cosmos/circuit/v1.rs | 378 --- .../src/proto_types/cosmos/consensus/mod.rs | 2 - .../cosmos/consensus/module/mod.rs | 1 - .../proto_types/cosmos/consensus/module/v1.rs | 19 - .../src/proto_types/cosmos/consensus/v1.rs | 97 - .../src/proto_types/cosmos/crisis/mod.rs | 2 - .../proto_types/cosmos/crisis/module/mod.rs | 1 - .../proto_types/cosmos/crisis/module/v1.rs | 22 - .../src/proto_types/cosmos/crisis/v1beta1.rs | 98 - .../src/proto_types/cosmos/crypto/ed25519.rs | 48 - .../src/proto_types/cosmos/crypto/hd/mod.rs | 1 - .../src/proto_types/cosmos/crypto/hd/v1.rs | 48 - .../proto_types/cosmos/crypto/keyring/mod.rs | 1 - .../proto_types/cosmos/crypto/keyring/v1.rs | 117 - .../src/proto_types/cosmos/crypto/mod.rs | 6 - .../proto_types/cosmos/crypto/multisig/mod.rs | 27 - .../cosmos/crypto/multisig/v1beta1.rs | 50 - .../proto_types/cosmos/crypto/secp256k1.rs | 47 - .../proto_types/cosmos/crypto/secp256r1.rs | 46 - .../proto_types/cosmos/distribution/mod.rs | 2 - .../cosmos/distribution/module/mod.rs | 1 - .../cosmos/distribution/module/v1.rs | 21 - .../cosmos/distribution/v1beta1.rs | 1303 ------- .../src/proto_types/cosmos/evidence/mod.rs | 2 - .../proto_types/cosmos/evidence/module/mod.rs | 1 - .../proto_types/cosmos/evidence/module/v1.rs | 15 - .../proto_types/cosmos/evidence/v1beta1.rs | 220 -- .../src/proto_types/cosmos/feegrant/mod.rs | 2 - .../proto_types/cosmos/feegrant/module/mod.rs | 1 - .../proto_types/cosmos/feegrant/module/v1.rs | 15 - .../proto_types/cosmos/feegrant/v1beta1.rs | 406 --- .../src/proto_types/cosmos/genutil/mod.rs | 2 - .../proto_types/cosmos/genutil/module/mod.rs | 1 - .../proto_types/cosmos/genutil/module/v1.rs | 15 - .../src/proto_types/cosmos/genutil/v1beta1.rs | 19 - .../src/proto_types/cosmos/gov/mod.rs | 3 - .../src/proto_types/cosmos/gov/module/mod.rs | 1 - .../src/proto_types/cosmos/gov/module/v1.rs | 27 - .../src/proto_types/cosmos/gov/v1.rs | 1363 -------- .../src/proto_types/cosmos/gov/v1beta1.rs | 1071 ------ .../src/proto_types/cosmos/group/mod.rs | 2 - .../proto_types/cosmos/group/module/mod.rs | 1 - .../src/proto_types/cosmos/group/module/v1.rs | 28 - .../src/proto_types/cosmos/group/v1.rs | 2319 ------------- .../src/proto_types/cosmos/ics23/mod.rs | 1 - .../src/proto_types/cosmos/ics23/v1.rs | 618 ---- .../src/proto_types/cosmos/mint/mod.rs | 2 - .../src/proto_types/cosmos/mint/module/mod.rs | 1 - .../src/proto_types/cosmos/mint/module/v1.rs | 21 - .../src/proto_types/cosmos/mint/v1beta1.rs | 260 -- .../neutron-sdk/src/proto_types/cosmos/mod.rs | 26 - .../src/proto_types/cosmos/nft/mod.rs | 2 - .../src/proto_types/cosmos/nft/module/mod.rs | 1 - .../src/proto_types/cosmos/nft/module/v1.rs | 15 - .../src/proto_types/cosmos/nft/v1beta1.rs | 610 ---- .../src/proto_types/cosmos/orm/mod.rs | 4 - .../src/proto_types/cosmos/orm/module/mod.rs | 1 - .../proto_types/cosmos/orm/module/v1alpha1.rs | 17 - .../src/proto_types/cosmos/orm/query/mod.rs | 1 - .../proto_types/cosmos/orm/query/v1alpha1.rs | 273 -- .../src/proto_types/cosmos/orm/v1.rs | 151 - .../src/proto_types/cosmos/orm/v1alpha1.rs | 109 - .../src/proto_types/cosmos/params/mod.rs | 2 - .../proto_types/cosmos/params/module/mod.rs | 1 - .../proto_types/cosmos/params/module/v1.rs | 15 - .../src/proto_types/cosmos/params/v1beta1.rs | 168 - .../src/proto_types/cosmos/slashing/mod.rs | 2 - .../proto_types/cosmos/slashing/module/mod.rs | 1 - .../proto_types/cosmos/slashing/module/v1.rs | 19 - .../proto_types/cosmos/slashing/v1beta1.rs | 402 --- .../src/proto_types/cosmos/staking/mod.rs | 2 - .../proto_types/cosmos/staking/module/mod.rs | 1 - .../proto_types/cosmos/staking/module/v1.rs | 30 - .../src/proto_types/cosmos/staking/v1beta1.rs | 1918 ----------- .../cosmos/store/internal/kv/mod.rs | 1 - .../cosmos/store/internal/kv/v1beta1.rs | 45 - .../proto_types/cosmos/store/internal/mod.rs | 1 - .../src/proto_types/cosmos/store/mod.rs | 4 - .../proto_types/cosmos/store/snapshots/mod.rs | 1 - .../proto_types/cosmos/store/snapshots/v1.rs | 214 -- .../cosmos/store/streaming/abci.rs | 76 - .../proto_types/cosmos/store/streaming/mod.rs | 1 - .../src/proto_types/cosmos/store/v1beta1.rs | 139 - .../src/proto_types/cosmos/tx/config/mod.rs | 1 - .../src/proto_types/cosmos/tx/config/v1.rs | 24 - .../src/proto_types/cosmos/tx/mod.rs | 3 - .../src/proto_types/cosmos/tx/signing/mod.rs | 1 - .../proto_types/cosmos/tx/signing/v1beta1.rs | 221 -- .../src/proto_types/cosmos/tx/v1beta1.rs | 1022 ------ .../src/proto_types/cosmos/upgrade/mod.rs | 2 - .../proto_types/cosmos/upgrade/module/mod.rs | 1 - .../proto_types/cosmos/upgrade/module/v1.rs | 19 - .../src/proto_types/cosmos/upgrade/v1beta1.rs | 460 --- .../src/proto_types/cosmos/vesting/mod.rs | 2 - .../proto_types/cosmos/vesting/module/mod.rs | 1 - .../proto_types/cosmos/vesting/module/v1.rs | 15 - .../src/proto_types/cosmos/vesting/v1beta1.rs | 280 -- .../src/proto_types/cosmwasm/mod.rs | 1 - .../src/proto_types/cosmwasm/wasm/mod.rs | 1 - .../src/proto_types/cosmwasm/wasm/v1.rs | 2988 ----------------- .../proto_types/feemarket/feemarket/mod.rs | 2 - .../feemarket/feemarket/module/mod.rs | 1 - .../feemarket/feemarket/module/v1.rs | 20 - .../src/proto_types/feemarket/feemarket/v1.rs | 347 -- .../src/proto_types/feemarket/mod.rs | 1 - .../src/proto_types/gaia/globalfee/mod.rs | 1 - .../src/proto_types/gaia/globalfee/v1beta1.rs | 145 - .../neutron-sdk/src/proto_types/gaia/mod.rs | 1 - .../proto_types/ibc/applications/fee/mod.rs | 1 - .../proto_types/ibc/applications/fee/v1.rs | 1025 ------ .../interchain_accounts/controller/mod.rs | 1 - .../interchain_accounts/controller/v1.rs | 273 -- .../interchain_accounts/genesis/mod.rs | 1 - .../interchain_accounts/genesis/v1.rs | 120 - .../interchain_accounts/host/mod.rs | 1 - .../interchain_accounts/host/v1.rs | 107 - .../applications/interchain_accounts/mod.rs | 4 - .../applications/interchain_accounts/v1.rs | 135 - .../src/proto_types/ibc/applications/mod.rs | 3 - .../ibc/applications/transfer/mod.rs | 2 - .../ibc/applications/transfer/v1.rs | 535 --- .../ibc/applications/transfer/v2.rs | 33 - .../src/proto_types/ibc/core/channel/mod.rs | 1 - .../src/proto_types/ibc/core/channel/v1.rs | 2849 ---------------- .../src/proto_types/ibc/core/client/mod.rs | 1 - .../src/proto_types/ibc/core/client/v1.rs | 1106 ------ .../proto_types/ibc/core/commitment/mod.rs | 1 - .../src/proto_types/ibc/core/commitment/v1.rs | 87 - .../proto_types/ibc/core/connection/mod.rs | 1 - .../src/proto_types/ibc/core/connection/v1.rs | 930 ----- .../src/proto_types/ibc/core/mod.rs | 5 - .../src/proto_types/ibc/core/types/mod.rs | 1 - .../src/proto_types/ibc/core/types/v1.rs | 25 - .../ibc/lightclients/localhost/mod.rs | 1 - .../ibc/lightclients/localhost/v2.rs | 19 - .../src/proto_types/ibc/lightclients/mod.rs | 4 - .../ibc/lightclients/solomachine/mod.rs | 2 - .../ibc/lightclients/solomachine/v2.rs | 528 --- .../ibc/lightclients/solomachine/v3.rs | 252 -- .../ibc/lightclients/tendermint/mod.rs | 1 - .../ibc/lightclients/tendermint/v1.rs | 177 - .../proto_types/ibc/lightclients/wasm/mod.rs | 1 - .../proto_types/ibc/lightclients/wasm/v1.rs | 385 --- .../neutron-sdk/src/proto_types/ibc/mod.rs | 3 - packages/neutron-sdk/src/proto_types/mod.rs | 10 - .../neutron/contractmanager/mod.rs | 297 -- .../proto_types/neutron/contractmanager/v1.rs | 42 - .../src/proto_types/neutron/cron/mod.rs | 425 --- .../src/proto_types/neutron/cron/v1.rs | 79 - .../src/proto_types/neutron/dex/mod.rs | 2120 ------------ .../src/proto_types/neutron/dex/v2.rs | 24 - .../proto_types/neutron/dynamicfees/mod.rs | 1 - .../src/proto_types/neutron/dynamicfees/v1.rs | 124 - .../src/proto_types/neutron/feeburner.rs | 194 -- .../src/proto_types/neutron/feerefunder.rs | 257 -- .../proto_types/neutron/interchainqueries.rs | 798 ----- .../proto_types/neutron/interchaintxs/mod.rs | 1 - .../proto_types/neutron/interchaintxs/v1.rs | 317 -- .../src/proto_types/neutron/mod.rs | 9 - .../src/proto_types/neutron/transfer.rs | 120 - .../src/proto_types/osmosis/mod.rs | 1 - .../proto_types/osmosis/tokenfactory/mod.rs | 65 - .../osmosis/tokenfactory/v1beta1.rs | 590 ---- .../src/proto_types/slinky/abci/mod.rs | 1 - .../src/proto_types/slinky/abci/v1.rs | 21 - .../src/proto_types/slinky/alerts/mod.rs | 2 - .../proto_types/slinky/alerts/module/mod.rs | 1 - .../proto_types/slinky/alerts/module/v1.rs | 21 - .../src/proto_types/slinky/alerts/v1.rs | 576 ---- .../src/proto_types/slinky/incentives/mod.rs | 2 - .../slinky/incentives/module/mod.rs | 1 - .../slinky/incentives/module/v1.rs | 15 - .../src/proto_types/slinky/incentives/v1.rs | 192 -- .../src/proto_types/slinky/marketmap/mod.rs | 2 - .../slinky/marketmap/module/mod.rs | 1 - .../proto_types/slinky/marketmap/module/v1.rs | 25 - .../src/proto_types/slinky/marketmap/v1.rs | 522 --- .../neutron-sdk/src/proto_types/slinky/mod.rs | 8 - .../src/proto_types/slinky/oracle/mod.rs | 2 - .../proto_types/slinky/oracle/module/mod.rs | 1 - .../proto_types/slinky/oracle/module/v1.rs | 20 - .../src/proto_types/slinky/oracle/v1.rs | 425 --- .../src/proto_types/slinky/service/mod.rs | 1 - .../src/proto_types/slinky/service/v1.rs | 68 - .../src/proto_types/slinky/sla/mod.rs | 2 - .../src/proto_types/slinky/sla/module/mod.rs | 1 - .../src/proto_types/slinky/sla/module/v1.rs | 20 - .../src/proto_types/slinky/sla/v1.rs | 396 --- .../src/proto_types/slinky/types/mod.rs | 1 - .../src/proto_types/slinky/types/v1.rs | 21 - .../src/proto_types/tendermint/abci.rs | 1677 --------- .../src/proto_types/tendermint/blocksync.rs | 144 - .../src/proto_types/tendermint/consensus.rs | 471 --- .../src/proto_types/tendermint/crypto.rs | 163 - .../src/proto_types/tendermint/libs/bits.rs | 27 - .../src/proto_types/tendermint/libs/mod.rs | 1 - .../src/proto_types/tendermint/mempool.rs | 50 - .../src/proto_types/tendermint/mod.rs | 14 - .../src/proto_types/tendermint/p2p.rs | 289 -- .../src/proto_types/tendermint/privval.rs | 252 -- .../src/proto_types/tendermint/rpc/grpc.rs | 65 - .../src/proto_types/tendermint/rpc/mod.rs | 1 - .../src/proto_types/tendermint/state.rs | 231 -- .../src/proto_types/tendermint/statesync.rs | 169 - .../src/proto_types/tendermint/store.rs | 27 - .../src/proto_types/tendermint/types.rs | 1268 ------- .../src/proto_types/tendermint/version.rs | 55 - packages/neutron-sdk/src/shim.rs | 375 --- proto-build/Cargo.toml | 24 - proto-build/buf.gen.yaml | 9 - proto-build/buf.lock | 19 - proto-build/buf.yaml | 23 - proto-build/src/code_generator.rs | 256 -- proto-build/src/git.rs | 32 - proto-build/src/lib.rs | 5 - proto-build/src/main.rs | 168 - proto-build/src/mod_gen.rs | 115 - proto-build/src/transform.rs | 204 -- proto-build/src/transformers.rs | 873 ----- 256 files changed, 27 insertions(+), 46785 deletions(-) delete mode 100644 packages/neutron-sdk/src/proto_types/capability/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/capability/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/app/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/app/runtime/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/app/runtime/v1alpha1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/app/v1alpha1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/auth/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/auth/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/auth/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/auth/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/authz/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/authz/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/authz/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/authz/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/bank/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/bank/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/bank/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/bank/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/abci/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/abci/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/node/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/node/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/query/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/query/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/reflection/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v2alpha1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/base/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/circuit/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/circuit/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/circuit/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/circuit/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/consensus/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/consensus/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/consensus/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/consensus/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crisis/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crisis/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crisis/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crisis/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/ed25519.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256k1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256r1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/distribution/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/distribution/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/distribution/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/distribution/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/evidence/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/evidence/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/evidence/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/evidence/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/feegrant/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/feegrant/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/genutil/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/genutil/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/genutil/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/genutil/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/gov/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/gov/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/gov/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/gov/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/gov/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/group/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/group/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/group/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/group/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/ics23/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/ics23/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/mint/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/mint/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/mint/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/mint/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/nft/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/nft/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/nft/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/nft/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/module/v1alpha1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/query/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/query/v1alpha1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/orm/v1alpha1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/params/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/params/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/params/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/params/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/slashing/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/slashing/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/slashing/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/slashing/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/staking/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/staking/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/staking/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/staking/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/internal/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/streaming/abci.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/streaming/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/store/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/tx/config/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/tx/config/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/tx/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/tx/signing/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/tx/signing/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/tx/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/upgrade/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/upgrade/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/vesting/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/vesting/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/vesting/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmos/vesting/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmwasm/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmwasm/wasm/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/cosmwasm/wasm/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/feemarket/feemarket/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/feemarket/feemarket/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/feemarket/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/gaia/globalfee/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/gaia/globalfee/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/gaia/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/fee/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/fee/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/transfer/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v2.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/channel/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/client/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/client/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/commitment/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/commitment/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/connection/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/connection/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/types/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/core/types/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/v2.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v2.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v3.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/ibc/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/contractmanager/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/dex/v2.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/dynamicfees/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/dynamicfees/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/feeburner.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/feerefunder.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/interchaintxs/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/neutron/transfer.rs delete mode 100644 packages/neutron-sdk/src/proto_types/osmosis/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/v1beta1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/abci/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/abci/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/alerts/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/alerts/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/alerts/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/alerts/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/incentives/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/incentives/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/incentives/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/incentives/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/marketmap/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/marketmap/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/marketmap/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/marketmap/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/oracle/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/oracle/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/oracle/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/oracle/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/service/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/service/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/sla/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/sla/module/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/sla/module/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/sla/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/types/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/slinky/types/v1.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/abci.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/blocksync.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/consensus.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/crypto.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/libs/bits.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/libs/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/mempool.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/p2p.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/privval.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/rpc/grpc.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/rpc/mod.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/state.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/statesync.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/store.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/types.rs delete mode 100644 packages/neutron-sdk/src/proto_types/tendermint/version.rs delete mode 100644 packages/neutron-sdk/src/shim.rs delete mode 100644 proto-build/Cargo.toml delete mode 100644 proto-build/buf.gen.yaml delete mode 100644 proto-build/buf.lock delete mode 100644 proto-build/buf.yaml delete mode 100644 proto-build/src/code_generator.rs delete mode 100644 proto-build/src/git.rs delete mode 100644 proto-build/src/lib.rs delete mode 100644 proto-build/src/main.rs delete mode 100644 proto-build/src/mod_gen.rs delete mode 100644 proto-build/src/transform.rs delete mode 100644 proto-build/src/transformers.rs diff --git a/Cargo.toml b/Cargo.toml index 9503197d..e49faa4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["contracts/*", "packages/*", "proto-build"] +members = ["contracts/*", "packages/*"] [profile.release] opt-level = 3 diff --git a/Makefile b/Makefile index eb402adf..533cadb0 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,3 @@ check_contracts: @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron artifacts/*.wasm build: schema clippy test fmt doc compile check_contracts - -build-proto: - @cargo run --bin proto-build diff --git a/packages/neutron-sdk/src/interchain_queries/v045/queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/queries.rs index 004bde4d..31555804 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/queries.rs @@ -1,5 +1,4 @@ use crate::{ - bindings::query::NeutronQuery, interchain_queries::{ queries::{check_query_type, get_registered_query, query_kv_result}, types::QueryType, @@ -86,14 +85,12 @@ pub fn query_balance( ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let balances: Balances = query_kv_result(deps, registered_query_id)?; Ok(BalanceResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, balances, }) } @@ -101,20 +98,18 @@ pub fn query_balance( /// Returns bank total supply on remote chain for particular denom /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_bank_total( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let total_supply: TotalSupply = query_kv_result(deps, registered_query_id)?; Ok(TotalSupplyResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, supply: total_supply, }) } @@ -122,20 +117,18 @@ pub fn query_bank_total( /// Returns distribution fee pool on remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_distribution_fee_pool( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let fee_pool: FeePool = query_kv_result(deps, registered_query_id)?; Ok(FeePoolResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, pool: fee_pool, }) } @@ -143,20 +136,18 @@ pub fn query_distribution_fee_pool( /// Returns staking validator from remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_staking_validators( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let validator: StakingValidator = query_kv_result(deps, registered_query_id)?; Ok(ValidatorResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, validator, }) } @@ -164,20 +155,18 @@ pub fn query_staking_validators( /// Returns validators signing infos from remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_validators_signing_infos( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let signing_infos: SigningInfo = query_kv_result(deps, registered_query_id)?; Ok(ValidatorSigningInfoResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, signing_infos, }) } @@ -185,20 +174,18 @@ pub fn query_validators_signing_infos( /// Returns list of government proposals on the remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_government_proposals( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let proposals: GovernmentProposal = query_kv_result(deps, registered_query_id)?; Ok(ProposalResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, proposals, }) } @@ -206,20 +193,18 @@ pub fn query_government_proposals( /// Returns list of government proposal votes on the remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_government_proposal_votes( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let votes: GovernmentProposalVotes = query_kv_result(deps, registered_query_id)?; Ok(ProposalVotesResponse { - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, votes, }) } @@ -227,41 +212,37 @@ pub fn query_government_proposal_votes( /// Returns delegations of particular delegator on remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_delegations( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let delegations: Delegations = query_kv_result(deps, registered_query_id)?; Ok(DelegatorDelegationsResponse { delegations: delegations.delegations, - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, }) } /// Returns list of unbonding delegations of particular delegator on remote chain /// * ***registered_query_id*** is an identifier of the corresponding registered interchain query pub fn query_unbonding_delegations( - deps: Deps, + deps: Deps, _env: Env, registered_query_id: u64, ) -> NeutronResult { let registered_query = get_registered_query(deps, registered_query_id)?; - check_query_type(registered_query.registered_query.query_type, QueryType::KV)?; + check_query_type(registered_query.query_type, QueryType::KV)?; let unbonding_delegations: UnbondingDelegations = query_kv_result(deps, registered_query_id)?; Ok(DelegatorUnbondingDelegationsResponse { unbonding_delegations, - last_submitted_local_height: registered_query - .registered_query - .last_submitted_result_local_height, + last_submitted_local_height: registered_query.last_submitted_result_local_height, }) } diff --git a/packages/neutron-sdk/src/proto_types/capability/mod.rs b/packages/neutron-sdk/src/proto_types/capability/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/capability/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/capability/v1.rs b/packages/neutron-sdk/src/proto_types/capability/v1.rs deleted file mode 100644 index d98674e4..00000000 --- a/packages/neutron-sdk/src/proto_types/capability/v1.rs +++ /dev/null @@ -1,112 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Capability defines an implementation of an object capability. The index -/// provided to a Capability must be globally unique. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/capability.v1.Capability")] -pub struct Capability { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u64, -} -/// Owner defines a single capability owner. An owner is defined by the name of -/// capability and the module name. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/capability.v1.Owner")] -pub struct Owner { - #[prost(string, tag = "1")] - pub module: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -/// CapabilityOwners defines a set of owners of a single Capability. The set of -/// owners must be unique. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/capability.v1.CapabilityOwners")] -pub struct CapabilityOwners { - #[prost(message, repeated, tag = "1")] - pub owners: ::prost::alloc::vec::Vec, -} -/// GenesisOwners defines the capability owners with their corresponding index. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/capability.v1.GenesisOwners")] -pub struct GenesisOwners { - /// index is the index of the capability owner. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u64, - /// index_owners are the owners at the given index. - #[prost(message, optional, tag = "2")] - pub index_owners: ::core::option::Option, -} -/// GenesisState defines the capability module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/capability.v1.GenesisState")] -pub struct GenesisState { - /// index is the capability global index. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u64, - /// owners represents a map from index to owners of the capability index - /// index key is string to allow amino marshalling. - #[prost(message, repeated, tag = "2")] - pub owners: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/app/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/app/mod.rs deleted file mode 100644 index 6e347e34..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/app/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod runtime; -pub mod v1alpha1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/app/runtime/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/app/runtime/mod.rs deleted file mode 100644 index 32a5a9d4..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/app/runtime/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1alpha1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/app/runtime/v1alpha1.rs b/packages/neutron-sdk/src/proto_types/cosmos/app/runtime/v1alpha1.rs deleted file mode 100644 index a6278f7e..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/app/runtime/v1alpha1.rs +++ /dev/null @@ -1,80 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object for the runtime module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.runtime.v1alpha1.Module")] -pub struct Module { - /// app_name is the name of the app. - #[prost(string, tag = "1")] - pub app_name: ::prost::alloc::string::String, - /// begin_blockers specifies the module names of begin blockers - /// to call in the order in which they should be called. If this is left empty - /// no begin blocker will be registered. - #[prost(string, repeated, tag = "2")] - pub begin_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// end_blockers specifies the module names of the end blockers - /// to call in the order in which they should be called. If this is left empty - /// no end blocker will be registered. - #[prost(string, repeated, tag = "3")] - pub end_blockers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// init_genesis specifies the module names of init genesis functions - /// to call in the order in which they should be called. If this is left empty - /// no init genesis function will be registered. - #[prost(string, repeated, tag = "4")] - pub init_genesis: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// export_genesis specifies the order in which to export module genesis data. - /// If this is left empty, the init_genesis order will be used for export genesis - /// if it is specified. - #[prost(string, repeated, tag = "5")] - pub export_genesis: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// override_store_keys is an optional list of overrides for the module store keys - /// to be used in keeper construction. - #[prost(message, repeated, tag = "6")] - pub override_store_keys: ::prost::alloc::vec::Vec, - /// order_migrations defines the order in which module migrations are performed. - /// If this is left empty, it uses the default migration order. - /// - #[prost(string, repeated, tag = "7")] - pub order_migrations: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// precommiters specifies the module names of the precommiters - /// to call in the order in which they should be called. If this is left empty - /// no precommit function will be registered. - #[prost(string, repeated, tag = "8")] - pub precommiters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// prepare_check_staters specifies the module names of the prepare_check_staters - /// to call in the order in which they should be called. If this is left empty - /// no preparecheckstate function will be registered. - #[prost(string, repeated, tag = "9")] - pub prepare_check_staters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// StoreKeyConfig may be supplied to override the default module store key, which -/// is the module name. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.runtime.v1alpha1.StoreKeyConfig")] -pub struct StoreKeyConfig { - /// name of the module to override the store key of - #[prost(string, tag = "1")] - pub module_name: ::prost::alloc::string::String, - /// the kv store key to use instead of the module name. - #[prost(string, tag = "2")] - pub kv_store_key: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/app/v1alpha1.rs b/packages/neutron-sdk/src/proto_types/cosmos/app/v1alpha1.rs deleted file mode 100644 index 247a5512..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/app/v1alpha1.rs +++ /dev/null @@ -1,248 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ModuleDescriptor describes an app module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.v1alpha1.ModuleDescriptor")] -pub struct ModuleDescriptor { - /// go_import names the package that should be imported by an app to load the - /// module in the runtime module registry. It is required to make debugging - /// of configuration errors easier for users. - #[prost(string, tag = "1")] - pub go_import: ::prost::alloc::string::String, - /// use_package refers to a protobuf package that this module - /// uses and exposes to the world. In an app, only one module should "use" - /// or own a single protobuf package. It is assumed that the module uses - /// all of the .proto files in a single package. - #[prost(message, repeated, tag = "2")] - pub use_package: ::prost::alloc::vec::Vec, - /// can_migrate_from defines which module versions this module can migrate - /// state from. The framework will check that one module version is able to - /// migrate from a previous module version before attempting to update its - /// config. It is assumed that modules can transitively migrate from earlier - /// versions. For instance if v3 declares it can migrate from v2, and v2 - /// declares it can migrate from v1, the framework knows how to migrate - /// from v1 to v3, assuming all 3 module versions are registered at runtime. - #[prost(message, repeated, tag = "3")] - pub can_migrate_from: ::prost::alloc::vec::Vec, -} -/// PackageReference is a reference to a protobuf package used by a module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.v1alpha1.PackageReference")] -pub struct PackageReference { - /// name is the fully-qualified name of the package. - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// revision is the optional revision of the package that is being used. - /// Protobuf packages used in Cosmos should generally have a major version - /// as the last part of the package name, ex. foo.bar.baz.v1. - /// The revision of a package can be thought of as the minor version of a - /// package which has additional backwards compatible definitions that weren't - /// present in a previous version. - /// - /// A package should indicate its revision with a source code comment - /// above the package declaration in one of its files containing the - /// text "Revision N" where N is an integer revision. All packages start - /// at revision 0 the first time they are released in a module. - /// - /// When a new version of a module is released and items are added to existing - /// .proto files, these definitions should contain comments of the form - /// "Since: Revision N" where N is an integer revision. - /// - /// When the module runtime starts up, it will check the pinned proto - /// image and panic if there are runtime protobuf definitions that are not - /// in the pinned descriptor which do not have - /// a "Since Revision N" comment or have a "Since Revision N" comment where - /// N is <= to the revision specified here. This indicates that the protobuf - /// files have been updated, but the pinned file descriptor hasn't. - /// - /// If there are items in the pinned file descriptor with a revision - /// greater than the value indicated here, this will also cause a panic - /// as it may mean that the pinned descriptor for a legacy module has been - /// improperly updated or that there is some other versioning discrepancy. - /// Runtime protobuf definitions will also be checked for compatibility - /// with pinned file descriptors to make sure there are no incompatible changes. - /// - /// This behavior ensures that: - /// * pinned proto images are up-to-date - /// * protobuf files are carefully annotated with revision comments which - /// are important good client UX - /// * protobuf files are changed in backwards and forwards compatible ways - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision: u32, -} -/// MigrateFromInfo is information on a module version that a newer module -/// can migrate from. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.v1alpha1.MigrateFromInfo")] -pub struct MigrateFromInfo { - /// module is the fully-qualified protobuf name of the module config object - /// for the previous module version, ex: "cosmos.group.module.v1.Module". - #[prost(string, tag = "1")] - pub module: ::prost::alloc::string::String, -} -/// Config represents the configuration for a Cosmos SDK ABCI app. -/// It is intended that all state machine logic including the version of -/// baseapp and tx handlers (and possibly even Tendermint) that an app needs -/// can be described in a config object. For compatibility, the framework should -/// allow a mixture of declarative and imperative app wiring, however, apps -/// that strive for the maximum ease of maintainability should be able to describe -/// their state machine with a config object alone. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.v1alpha1.Config")] -pub struct Config { - /// modules are the module configurations for the app. - #[prost(message, repeated, tag = "1")] - pub modules: ::prost::alloc::vec::Vec, - /// golang_bindings specifies explicit interface to implementation type bindings which - /// depinject uses to resolve interface inputs to provider functions. The scope of this - /// field's configuration is global (not module specific). - #[prost(message, repeated, tag = "2")] - pub golang_bindings: ::prost::alloc::vec::Vec, -} -/// ModuleConfig is a module configuration for an app. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.v1alpha1.ModuleConfig")] -pub struct ModuleConfig { - /// name is the unique name of the module within the app. It should be a name - /// that persists between different versions of a module so that modules - /// can be smoothly upgraded to new versions. - /// - /// For example, for the module cosmos.bank.module.v1.Module, we may chose - /// to simply name the module "bank" in the app. When we upgrade to - /// cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same - /// and the framework knows that the v2 module should receive all the same state - /// that the v1 module had. Note: modules should provide info on which versions - /// they can migrate from in the ModuleDescriptor.can_migration_from field. - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// config is the config object for the module. Module config messages should - /// define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension. - #[prost(message, optional, tag = "2")] - pub config: ::core::option::Option, - /// golang_bindings specifies explicit interface to implementation type bindings which - /// depinject uses to resolve interface inputs to provider functions. The scope of this - /// field's configuration is module specific. - #[prost(message, repeated, tag = "3")] - pub golang_bindings: ::prost::alloc::vec::Vec, -} -/// GolangBinding is an explicit interface type to implementing type binding for dependency injection. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.app.v1alpha1.GolangBinding")] -pub struct GolangBinding { - /// interface_type is the interface type which will be bound to a specific implementation type - #[prost(string, tag = "1")] - pub interface_type: ::prost::alloc::string::String, - /// implementation is the implementing type which will be supplied when an input of type interface is requested - #[prost(string, tag = "2")] - pub implementation: ::prost::alloc::string::String, -} -/// QueryConfigRequest is the Query/Config 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 = "/cosmos.app.v1alpha1.QueryConfigRequest")] -#[proto_query( - path = "/cosmos.app.v1alpha1.Query/Config", - response_type = QueryConfigResponse -)] -pub struct QueryConfigRequest {} -/// QueryConfigRequest is the Query/Config response 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 = "/cosmos.app.v1alpha1.QueryConfigResponse")] -pub struct QueryConfigResponse { - /// config is the current app config. - #[prost(message, optional, tag = "1")] - pub config: ::core::option::Option, -} -pub struct V1alpha1Querier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> V1alpha1Querier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn config(&self) -> Result { - QueryConfigRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/auth/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/auth/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/auth/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/auth/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/auth/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/auth/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/auth/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/auth/module/v1.rs deleted file mode 100644 index 6371bf7b..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/auth/module/v1.rs +++ /dev/null @@ -1,47 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object for the auth module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.module.v1.Module")] -pub struct Module { - /// bech32_prefix is the bech32 account prefix for the app. - #[prost(string, tag = "1")] - pub bech32_prefix: ::prost::alloc::string::String, - /// module_account_permissions are module account permissions. - #[prost(message, repeated, tag = "2")] - pub module_account_permissions: ::prost::alloc::vec::Vec, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "3")] - pub authority: ::prost::alloc::string::String, -} -/// ModuleAccountPermission represents permissions for a module account. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.module.v1.ModuleAccountPermission")] -pub struct ModuleAccountPermission { - /// account is the name of the module. - #[prost(string, tag = "1")] - pub account: ::prost::alloc::string::String, - /// permissions are the permissions this module has. Currently recognized - /// values are minter, burner and staking. - #[prost(string, repeated, tag = "2")] - pub permissions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/auth/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/auth/v1beta1.rs deleted file mode 100644 index 534009ca..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/auth/v1beta1.rs +++ /dev/null @@ -1,685 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// BaseAccount defines a base account type. It contains all the necessary fields -/// for basic account functionality. Any custom account type should extend this -/// type for additional functionality (e.g. vesting). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.BaseAccount")] -pub struct BaseAccount { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub account_number: u64, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// ModuleAccount defines an account for modules that holds coins on a pool. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.ModuleAccount")] -pub struct ModuleAccount { - #[prost(message, optional, tag = "1")] - pub base_account: ::core::option::Option, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "3")] - pub permissions: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.ModuleCredential")] -pub struct ModuleCredential { - /// module_name is the name of the module used for address derivation (passed into address.Module). - #[prost(string, tag = "1")] - pub module_name: ::prost::alloc::string::String, - /// derivation_keys is for deriving a module account address (passed into address.Module) - /// adding more keys creates sub-account addresses (passed into address.Derive) - #[prost(bytes = "vec", repeated, tag = "2")] - pub derivation_keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// Params defines the parameters for the auth module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.Params")] -pub struct Params { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_memo_characters: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tx_sig_limit: u64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tx_size_cost_per_byte: u64, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sig_verify_cost_ed25519: u64, - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sig_verify_cost_secp256k1: u64, -} -/// GenesisState defines the auth module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.GenesisState")] -pub struct GenesisState { - /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// accounts are the accounts present at genesis. - #[prost(message, repeated, tag = "2")] - pub accounts: ::prost::alloc::vec::Vec, -} -/// QueryAccountsRequest is the request type for the Query/Accounts RPC method. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryAccountsRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/Accounts", - response_type = QueryAccountsResponse -)] -pub struct QueryAccountsRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// QueryAccountsResponse is the response type for the Query/Accounts RPC method. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryAccountsResponse")] -pub struct QueryAccountsResponse { - /// accounts are the existing accounts - #[prost(message, repeated, tag = "1")] - pub accounts: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryAccountRequest is the request type for the Query/Account 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 = "/cosmos.auth.v1beta1.QueryAccountRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/Account", - response_type = QueryAccountResponse -)] -pub struct QueryAccountRequest { - /// address defines the address to query for. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// QueryAccountResponse is the response type for the Query/Account 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 = "/cosmos.auth.v1beta1.QueryAccountResponse")] -pub struct QueryAccountResponse { - /// account defines the account of the corresponding address. - #[prost(message, optional, tag = "1")] - pub account: ::core::option::Option, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmos.auth.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmos.auth.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryModuleAccountsRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/ModuleAccounts", - response_type = QueryModuleAccountsResponse -)] -pub struct QueryModuleAccountsRequest {} -/// QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryModuleAccountsResponse")] -pub struct QueryModuleAccountsResponse { - #[prost(message, repeated, tag = "1")] - pub accounts: ::prost::alloc::vec::Vec, -} -/// QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName 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 = "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/ModuleAccountByName", - response_type = QueryModuleAccountByNameResponse -)] -pub struct QueryModuleAccountByNameRequest { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, -} -/// QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName 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 = "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse")] -pub struct QueryModuleAccountByNameResponse { - #[prost(message, optional, tag = "1")] - pub account: ::core::option::Option, -} -/// Bech32PrefixRequest is the request type for Bech32Prefix rpc method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.Bech32PrefixRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/Bech32Prefix", - response_type = Bech32PrefixResponse -)] -pub struct Bech32PrefixRequest {} -/// Bech32PrefixResponse is the response type for Bech32Prefix rpc method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.Bech32PrefixResponse")] -pub struct Bech32PrefixResponse { - #[prost(string, tag = "1")] - pub bech32_prefix: ::prost::alloc::string::String, -} -/// AddressBytesToStringRequest is the request type for AddressString rpc method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.AddressBytesToStringRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/AddressBytesToString", - response_type = AddressBytesToStringResponse -)] -pub struct AddressBytesToStringRequest { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub address_bytes: ::prost::alloc::vec::Vec, -} -/// AddressBytesToStringResponse is the response type for AddressString rpc method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.AddressBytesToStringResponse")] -pub struct AddressBytesToStringResponse { - #[prost(string, tag = "1")] - pub address_string: ::prost::alloc::string::String, -} -/// AddressStringToBytesRequest is the request type for AccountBytes rpc method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.AddressStringToBytesRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/AddressStringToBytes", - response_type = AddressStringToBytesResponse -)] -pub struct AddressStringToBytesRequest { - #[prost(string, tag = "1")] - pub address_string: ::prost::alloc::string::String, -} -/// AddressStringToBytesResponse is the response type for AddressBytes rpc method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.AddressStringToBytesResponse")] -pub struct AddressStringToBytesResponse { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub address_bytes: ::prost::alloc::vec::Vec, -} -/// QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method -/// -/// Since: cosmos-sdk 0.46.2 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/AccountAddressByID", - response_type = QueryAccountAddressByIdResponse -)] -pub struct QueryAccountAddressByIdRequest { - /// Deprecated, use account_id instead - /// - /// id is the account number of the address to be queried. This field - /// should have been an uint64 (like all account numbers), and will be - /// updated to uint64 in a future version of the auth query. - #[deprecated] - #[prost(int64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: i64, - /// account_id is the account number of the address to be queried. - /// - /// Since: cosmos-sdk 0.47 - #[prost(uint64, tag = "2")] - #[serde(alias = "accountID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub account_id: u64, -} -/// QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method -/// -/// Since: cosmos-sdk 0.46.2 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse")] -pub struct QueryAccountAddressByIdResponse { - #[prost(string, tag = "1")] - pub account_address: ::prost::alloc::string::String, -} -/// QueryAccountInfoRequest is the Query/AccountInfo request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryAccountInfoRequest")] -#[proto_query( - path = "/cosmos.auth.v1beta1.Query/AccountInfo", - response_type = QueryAccountInfoResponse -)] -pub struct QueryAccountInfoRequest { - /// address is the account address string. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// QueryAccountInfoResponse is the Query/AccountInfo response type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.QueryAccountInfoResponse")] -pub struct QueryAccountInfoResponse { - /// info is the account info which is represented by BaseAccount. - #[prost(message, optional, tag = "1")] - pub info: ::core::option::Option, -} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/auth parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.auth.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct AuthQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> AuthQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn accounts( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryAccountsRequest { pagination }.query(self.querier) - } - pub fn account( - &self, - address: ::prost::alloc::string::String, - ) -> Result { - QueryAccountRequest { address }.query(self.querier) - } - pub fn account_address_by_id( - &self, - id: i64, - account_id: u64, - ) -> Result { - QueryAccountAddressByIdRequest { id, account_id }.query(self.querier) - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn module_accounts(&self) -> Result { - QueryModuleAccountsRequest {}.query(self.querier) - } - pub fn module_account_by_name( - &self, - name: ::prost::alloc::string::String, - ) -> Result { - QueryModuleAccountByNameRequest { name }.query(self.querier) - } - pub fn bech32_prefix(&self) -> Result { - Bech32PrefixRequest {}.query(self.querier) - } - pub fn address_bytes_to_string( - &self, - address_bytes: ::prost::alloc::vec::Vec, - ) -> Result { - AddressBytesToStringRequest { address_bytes }.query(self.querier) - } - pub fn address_string_to_bytes( - &self, - address_string: ::prost::alloc::string::String, - ) -> Result { - AddressStringToBytesRequest { address_string }.query(self.querier) - } - pub fn account_info( - &self, - address: ::prost::alloc::string::String, - ) -> Result { - QueryAccountInfoRequest { address }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/authz/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/authz/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/authz/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/authz/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/authz/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/authz/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/authz/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/authz/module/v1.rs deleted file mode 100644 index 8d20d5f8..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/authz/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the authz module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/authz/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/authz/v1beta1.rs deleted file mode 100644 index 9e2ff238..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/authz/v1beta1.rs +++ /dev/null @@ -1,448 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenericAuthorization gives the grantee unrestricted permissions to execute -/// the provided method on behalf of the granter's account. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.GenericAuthorization")] -pub struct GenericAuthorization { - /// Msg, identified by it's type URL, to grant unrestricted permissions to execute - #[prost(string, tag = "1")] - pub msg: ::prost::alloc::string::String, -} -/// Grant gives permissions to execute -/// the provide method with expiration time. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.Grant")] -pub struct Grant { - #[prost(message, optional, tag = "1")] - pub authorization: ::core::option::Option, - /// time when the grant will expire and will be pruned. If null, then the grant - /// doesn't have a time expiration (other conditions in `authorization` - /// may apply to invalidate the grant) - #[prost(message, optional, tag = "2")] - pub expiration: ::core::option::Option, -} -/// GrantAuthorization extends a grant with both the addresses of the grantee and granter. -/// It is used in genesis.proto and query.proto -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.GrantAuthorization")] -pub struct GrantAuthorization { - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub authorization: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub expiration: ::core::option::Option, -} -/// GrantQueueItem contains the list of TypeURL of a sdk.Msg. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.GrantQueueItem")] -pub struct GrantQueueItem { - /// msg_type_urls contains the list of TypeURL of a sdk.Msg. - #[prost(string, repeated, tag = "1")] - pub msg_type_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// EventGrant is emitted on Msg/Grant -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.EventGrant")] -pub struct EventGrant { - /// Msg type URL for which an autorization is granted - #[prost(string, tag = "2")] - pub msg_type_url: ::prost::alloc::string::String, - /// Granter account address - #[prost(string, tag = "3")] - pub granter: ::prost::alloc::string::String, - /// Grantee account address - #[prost(string, tag = "4")] - pub grantee: ::prost::alloc::string::String, -} -/// EventRevoke is emitted on Msg/Revoke -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.EventRevoke")] -pub struct EventRevoke { - /// Msg type URL for which an autorization is revoked - #[prost(string, tag = "2")] - pub msg_type_url: ::prost::alloc::string::String, - /// Granter account address - #[prost(string, tag = "3")] - pub granter: ::prost::alloc::string::String, - /// Grantee account address - #[prost(string, tag = "4")] - pub grantee: ::prost::alloc::string::String, -} -/// GenesisState defines the authz module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.GenesisState")] -pub struct GenesisState { - #[prost(message, repeated, tag = "1")] - pub authorization: ::prost::alloc::vec::Vec, -} -/// QueryGrantsRequest is the request type for the Query/Grants 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 = "/cosmos.authz.v1beta1.QueryGrantsRequest")] -#[proto_query( - path = "/cosmos.authz.v1beta1.Query/Grants", - response_type = QueryGrantsResponse -)] -pub struct QueryGrantsRequest { - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - /// Optional, msg_type_url, when set, will query only grants matching given msg type. - #[prost(string, tag = "3")] - pub msg_type_url: ::prost::alloc::string::String, - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "4")] - pub pagination: ::core::option::Option, -} -/// QueryGrantsResponse is the response type for the Query/Authorizations 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 = "/cosmos.authz.v1beta1.QueryGrantsResponse")] -pub struct QueryGrantsResponse { - /// authorizations is a list of grants granted for grantee by granter. - #[prost(message, repeated, tag = "1")] - pub grants: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGranterGrantsRequest is the request type for the Query/GranterGrants 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 = "/cosmos.authz.v1beta1.QueryGranterGrantsRequest")] -#[proto_query( - path = "/cosmos.authz.v1beta1.Query/GranterGrants", - response_type = QueryGranterGrantsResponse -)] -pub struct QueryGranterGrantsRequest { - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGranterGrantsResponse is the response type for the Query/GranterGrants 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 = "/cosmos.authz.v1beta1.QueryGranterGrantsResponse")] -pub struct QueryGranterGrantsResponse { - /// grants is a list of grants granted by the granter. - #[prost(message, repeated, tag = "1")] - pub grants: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGranteeGrantsRequest is the request type for the Query/GranteeGrants 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 = "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest")] -#[proto_query( - path = "/cosmos.authz.v1beta1.Query/GranteeGrants", - response_type = QueryGranteeGrantsResponse -)] -pub struct QueryGranteeGrantsRequest { - #[prost(string, tag = "1")] - pub grantee: ::prost::alloc::string::String, - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants 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 = "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse")] -pub struct QueryGranteeGrantsResponse { - /// grants is a list of grants granted to the grantee. - #[prost(message, repeated, tag = "1")] - pub grants: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// MsgGrant is a request type for Grant method. It declares authorization to the grantee -/// on behalf of the granter with the provided expiration time. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.MsgGrant")] -pub struct MsgGrant { - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub grant: ::core::option::Option, -} -/// MsgGrantResponse defines the Msg/MsgGrant response 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 = "/cosmos.authz.v1beta1.MsgGrantResponse")] -pub struct MsgGrantResponse {} -/// MsgExec attempts to execute the provided messages using -/// authorizations granted to the grantee. Each message should have only -/// one signer corresponding to the granter of the authorization. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.MsgExec")] -pub struct MsgExec { - #[prost(string, tag = "1")] - pub grantee: ::prost::alloc::string::String, - /// Execute Msg. - /// The x/authz will try to find a grant matching (msg.signers\[0\], grantee, MsgTypeURL(msg)) - /// triple and validate it. - #[prost(message, repeated, tag = "2")] - pub msgs: ::prost::alloc::vec::Vec, -} -/// MsgExecResponse defines the Msg/MsgExecResponse response 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 = "/cosmos.authz.v1beta1.MsgExecResponse")] -pub struct MsgExecResponse { - #[prost(bytes = "vec", repeated, tag = "1")] - pub results: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// MsgRevoke revokes any authorization with the provided sdk.Msg type on the -/// granter's account with that has been granted to the grantee. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.authz.v1beta1.MsgRevoke")] -pub struct MsgRevoke { - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub msg_type_url: ::prost::alloc::string::String, -} -/// MsgRevokeResponse defines the Msg/MsgRevokeResponse response 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 = "/cosmos.authz.v1beta1.MsgRevokeResponse")] -pub struct MsgRevokeResponse {} -pub struct AuthzQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> AuthzQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn grants( - &self, - granter: ::prost::alloc::string::String, - grantee: ::prost::alloc::string::String, - msg_type_url: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryGrantsRequest { - granter, - grantee, - msg_type_url, - pagination, - } - .query(self.querier) - } - pub fn granter_grants( - &self, - granter: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryGranterGrantsRequest { - granter, - pagination, - } - .query(self.querier) - } - pub fn grantee_grants( - &self, - grantee: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryGranteeGrantsRequest { - grantee, - pagination, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/bank/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/bank/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/bank/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/bank/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/bank/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/bank/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/bank/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/bank/module/v1.rs deleted file mode 100644 index 785adefe..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/bank/module/v1.rs +++ /dev/null @@ -1,30 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the bank module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.module.v1.Module")] -pub struct Module { - /// blocked_module_accounts_override configures exceptional module accounts which should be blocked from receiving - /// funds. If left empty it defaults to the list of account names supplied in the auth module configuration as - /// module_account_permissions - #[prost(string, repeated, tag = "1")] - pub blocked_module_accounts_override: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, - /// restrictions_order specifies the order of send restrictions and should be - /// a list of module names which provide a send restriction instance. If no - /// order is provided, then restrictions will be applied in alphabetical order - /// of module names. - #[prost(string, repeated, tag = "3")] - pub restrictions_order: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/bank/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/bank/v1beta1.rs deleted file mode 100644 index 22239309..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/bank/v1beta1.rs +++ /dev/null @@ -1,1153 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// SendAuthorization allows the grantee to spend up to spend_limit coins from -/// the granter's account. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.SendAuthorization")] -pub struct SendAuthorization { - #[prost(message, repeated, tag = "1")] - pub spend_limit: ::prost::alloc::vec::Vec, - /// allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the - /// granter. If omitted, any recipient is allowed. - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, repeated, tag = "2")] - pub allow_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Params defines the parameters for the bank module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.Params")] -pub struct Params { - /// Deprecated: Use of SendEnabled in params is deprecated. - /// For genesis, use the newly added send_enabled field in the genesis object. - /// Storage, lookup, and manipulation of this information is now in the keeper. - /// - /// As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. - #[deprecated] - #[prost(message, repeated, tag = "1")] - pub send_enabled: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "2")] - pub default_send_enabled: bool, -} -/// SendEnabled maps coin denom to a send_enabled status (whether a denom is -/// sendable). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.SendEnabled")] -pub struct SendEnabled { - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - #[prost(bool, tag = "2")] - pub enabled: bool, -} -/// Input models transaction input. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.Input")] -pub struct Input { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub coins: ::prost::alloc::vec::Vec, -} -/// Output models transaction outputs. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.Output")] -pub struct Output { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub coins: ::prost::alloc::vec::Vec, -} -/// Supply represents a struct that passively keeps track of the total supply -/// amounts in the network. -/// This message is deprecated now that supply is indexed by denom. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.Supply")] -#[deprecated] -pub struct Supply { - #[prost(message, repeated, tag = "1")] - pub total: ::prost::alloc::vec::Vec, -} -/// DenomUnit represents a struct that describes a given -/// denomination unit of the basic token. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.DenomUnit")] -pub struct DenomUnit { - /// denom represents the string name of the given denom unit (e.g uatom). - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - /// exponent represents power of 10 exponent that one must - /// raise the base_denom to in order to equal the given DenomUnit's denom - /// 1 denom = 10^exponent base_denom - /// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - /// exponent = 6, thus: 1 atom = 10^6 uatom). - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub exponent: u32, - /// aliases is a list of string aliases for the given denom - #[prost(string, repeated, tag = "3")] - pub aliases: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Metadata represents a struct that describes -/// a basic token. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.Metadata")] -pub struct Metadata { - #[prost(string, tag = "1")] - pub description: ::prost::alloc::string::String, - /// denom_units represents the list of DenomUnit's for a given coin - #[prost(message, repeated, tag = "2")] - pub denom_units: ::prost::alloc::vec::Vec, - /// base represents the base denom (should be the DenomUnit with exponent = 0). - #[prost(string, tag = "3")] - pub base: ::prost::alloc::string::String, - /// display indicates the suggested denom that should be - /// displayed in clients. - #[prost(string, tag = "4")] - pub display: ::prost::alloc::string::String, - /// name defines the name of the token (eg: Cosmos Atom) - /// - /// Since: cosmos-sdk 0.43 - #[prost(string, tag = "5")] - pub name: ::prost::alloc::string::String, - /// symbol is the token symbol usually shown on exchanges (eg: ATOM). This can - /// be the same as the display. - /// - /// Since: cosmos-sdk 0.43 - #[prost(string, tag = "6")] - pub symbol: ::prost::alloc::string::String, - /// URI to a document (on or off-chain) that contains additional information. Optional. - /// - /// Since: cosmos-sdk 0.46 - #[prost(string, tag = "7")] - pub uri: ::prost::alloc::string::String, - /// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that - /// the document didn't change. Optional. - /// - /// Since: cosmos-sdk 0.46 - #[prost(string, tag = "8")] - pub uri_hash: ::prost::alloc::string::String, -} -/// GenesisState defines the bank module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.GenesisState")] -pub struct GenesisState { - /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// balances is an array containing the balances of all the accounts. - #[prost(message, repeated, tag = "2")] - pub balances: ::prost::alloc::vec::Vec, - /// supply represents the total supply. If it is left empty, then supply will be calculated based on the provided - /// balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. - #[prost(message, repeated, tag = "3")] - pub supply: ::prost::alloc::vec::Vec, - /// denom_metadata defines the metadata of the different coins. - #[prost(message, repeated, tag = "4")] - pub denom_metadata: ::prost::alloc::vec::Vec, - /// send_enabled defines the denoms where send is enabled or disabled. - /// - /// Since: cosmos-sdk 0.47 - #[prost(message, repeated, tag = "5")] - pub send_enabled: ::prost::alloc::vec::Vec, -} -/// Balance defines an account address and balance pair used in the bank module's -/// genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.Balance")] -pub struct Balance { - /// address is the address of the balance holder. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// coins defines the different coins this balance holds. - #[prost(message, repeated, tag = "2")] - pub coins: ::prost::alloc::vec::Vec, -} -/// QueryBalanceRequest is the request type for the Query/Balance 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 = "/cosmos.bank.v1beta1.QueryBalanceRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/Balance", - response_type = QueryBalanceResponse -)] -pub struct QueryBalanceRequest { - /// address is the address to query balances for. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// denom is the coin denom to query balances for. - #[prost(string, tag = "2")] - pub denom: ::prost::alloc::string::String, -} -/// QueryBalanceResponse is the response type for the Query/Balance 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 = "/cosmos.bank.v1beta1.QueryBalanceResponse")] -pub struct QueryBalanceResponse { - /// balance is the balance of the coin. - #[prost(message, optional, tag = "1")] - pub balance: ::core::option::Option, -} -/// QueryBalanceRequest is the request type for the Query/AllBalances 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 = "/cosmos.bank.v1beta1.QueryAllBalancesRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/AllBalances", - response_type = QueryAllBalancesResponse -)] -pub struct QueryAllBalancesRequest { - /// address is the address to query balances for. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, - /// resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. - /// - /// Since: cosmos-sdk 0.50 - #[prost(bool, tag = "3")] - pub resolve_denom: bool, -} -/// QueryAllBalancesResponse is the response type for the Query/AllBalances 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 = "/cosmos.bank.v1beta1.QueryAllBalancesResponse")] -pub struct QueryAllBalancesResponse { - /// balances is the balances of all the coins. - #[prost(message, repeated, tag = "1")] - pub balances: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QuerySpendableBalancesRequest defines the gRPC request structure for querying -/// an account's spendable balances. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/SpendableBalances", - response_type = QuerySpendableBalancesResponse -)] -pub struct QuerySpendableBalancesRequest { - /// address is the address to query spendable balances for. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QuerySpendableBalancesResponse defines the gRPC response structure for querying -/// an account's spendable balances. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse")] -pub struct QuerySpendableBalancesResponse { - /// balances is the spendable balances of all the coins. - #[prost(message, repeated, tag = "1")] - pub balances: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QuerySpendableBalanceByDenomRequest defines the gRPC request structure for -/// querying an account's spendable balance for a specific denom. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/SpendableBalanceByDenom", - response_type = QuerySpendableBalanceByDenomResponse -)] -pub struct QuerySpendableBalanceByDenomRequest { - /// address is the address to query balances for. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// denom is the coin denom to query balances for. - #[prost(string, tag = "2")] - pub denom: ::prost::alloc::string::String, -} -/// QuerySpendableBalanceByDenomResponse defines the gRPC response structure for -/// querying an account's spendable balance for a specific denom. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse")] -pub struct QuerySpendableBalanceByDenomResponse { - /// balance is the balance of the coin. - #[prost(message, optional, tag = "1")] - pub balance: ::core::option::Option, -} -/// QueryTotalSupplyRequest is the request type for the Query/TotalSupply 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 = "/cosmos.bank.v1beta1.QueryTotalSupplyRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/TotalSupply", - response_type = QueryTotalSupplyResponse -)] -pub struct QueryTotalSupplyRequest { - /// pagination defines an optional pagination for the request. - /// - /// Since: cosmos-sdk 0.43 - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// QueryTotalSupplyResponse is the response type for the Query/TotalSupply 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 = "/cosmos.bank.v1beta1.QueryTotalSupplyResponse")] -pub struct QueryTotalSupplyResponse { - /// supply is the supply of the coins - #[prost(message, repeated, tag = "1")] - pub supply: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - /// - /// Since: cosmos-sdk 0.43 - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QuerySupplyOfRequest is the request type for the Query/SupplyOf 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 = "/cosmos.bank.v1beta1.QuerySupplyOfRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/SupplyOf", - response_type = QuerySupplyOfResponse -)] -pub struct QuerySupplyOfRequest { - /// denom is the coin denom to query balances for. - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, -} -/// QuerySupplyOfResponse is the response type for the Query/SupplyOf 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 = "/cosmos.bank.v1beta1.QuerySupplyOfResponse")] -pub struct QuerySupplyOfResponse { - /// amount is the supply of the coin. - #[prost(message, optional, tag = "1")] - pub amount: ::core::option::Option, -} -/// QueryParamsRequest defines the request type for querying x/bank parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse defines the response type for querying x/bank parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params provides the parameters of the bank module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata 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 = "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/DenomsMetadata", - response_type = QueryDenomsMetadataResponse -)] -pub struct QueryDenomsMetadataRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata 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 = "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse")] -pub struct QueryDenomsMetadataResponse { - /// metadata provides the client information for all the registered tokens. - #[prost(message, repeated, tag = "1")] - pub metadatas: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDenomMetadataRequest is the request type for the Query/DenomMetadata 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 = "/cosmos.bank.v1beta1.QueryDenomMetadataRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/DenomMetadata", - response_type = QueryDenomMetadataResponse -)] -pub struct QueryDenomMetadataRequest { - /// denom is the coin denom to query the metadata for. - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, -} -/// QueryDenomMetadataResponse is the response type for the Query/DenomMetadata 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 = "/cosmos.bank.v1beta1.QueryDenomMetadataResponse")] -pub struct QueryDenomMetadataResponse { - /// metadata describes and provides all the client information for the requested token. - #[prost(message, optional, tag = "1")] - pub metadata: ::core::option::Option, -} -/// QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. -/// Identical with QueryDenomMetadataRequest but receives denom as query 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 = "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/DenomMetadataByQueryString", - response_type = QueryDenomMetadataByQueryStringResponse -)] -pub struct QueryDenomMetadataByQueryStringRequest { - /// denom is the coin denom to query the metadata for. - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, -} -/// QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC -/// method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse")] -pub struct QueryDenomMetadataByQueryStringResponse { - /// metadata describes and provides all the client information for the requested token. - #[prost(message, optional, tag = "1")] - pub metadata: ::core::option::Option, -} -/// QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, -/// which queries for a paginated set of all account holders of a particular -/// denomination. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryDenomOwnersRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/DenomOwners", - response_type = QueryDenomOwnersResponse -)] -pub struct QueryDenomOwnersRequest { - /// denom defines the coin denomination to query all account holders for. - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// DenomOwner defines structure representing an account that owns or holds a -/// particular denominated token. It contains the account address and account -/// balance of the denominated token. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.DenomOwner")] -pub struct DenomOwner { - /// address defines the address that owns a particular denomination. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// balance is the balance of the denominated coin for an account. - #[prost(message, optional, tag = "2")] - pub balance: ::core::option::Option, -} -/// QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryDenomOwnersResponse")] -pub struct QueryDenomOwnersResponse { - #[prost(message, repeated, tag = "1")] - pub denom_owners: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, -/// which queries for a paginated set of all account holders of a particular -/// denomination. -/// -/// Since: cosmos-sdk 0.50.3 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/DenomOwnersByQuery", - response_type = QueryDenomOwnersByQueryResponse -)] -pub struct QueryDenomOwnersByQueryRequest { - /// denom defines the coin denomination to query all account holders for. - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. -/// -/// Since: cosmos-sdk 0.50.3 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse")] -pub struct QueryDenomOwnersByQueryResponse { - #[prost(message, repeated, tag = "1")] - pub denom_owners: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QuerySendEnabledRequest")] -#[proto_query( - path = "/cosmos.bank.v1beta1.Query/SendEnabled", - response_type = QuerySendEnabledResponse -)] -pub struct QuerySendEnabledRequest { - /// denoms is the specific denoms you want look up. Leave empty to get all entries. - #[prost(string, repeated, tag = "1")] - pub denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// pagination defines an optional pagination for the request. This field is - /// only read if the denoms field is empty. - #[prost(message, optional, tag = "99")] - pub pagination: ::core::option::Option, -} -/// QuerySendEnabledResponse defines the RPC response of a SendEnable query. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.QuerySendEnabledResponse")] -pub struct QuerySendEnabledResponse { - #[prost(message, repeated, tag = "1")] - pub send_enabled: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. This field is only - /// populated if the denoms field in the request is empty. - #[prost(message, optional, tag = "99")] - pub pagination: ::core::option::Option, -} -/// MsgSend represents a message to send coins from one account to another. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.MsgSend")] -pub struct MsgSend { - #[prost(string, tag = "1")] - pub from_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub to_address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgSendResponse defines the Msg/Send response 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 = "/cosmos.bank.v1beta1.MsgSendResponse")] -pub struct MsgSendResponse {} -/// MsgMultiSend represents an arbitrary multi-in, multi-out send 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 = "/cosmos.bank.v1beta1.MsgMultiSend")] -pub struct MsgMultiSend { - /// Inputs, despite being `repeated`, only allows one sender input. This is - /// checked in MsgMultiSend's ValidateBasic. - #[prost(message, repeated, tag = "1")] - pub inputs: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub outputs: ::prost::alloc::vec::Vec, -} -/// MsgMultiSendResponse defines the Msg/MultiSend response 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 = "/cosmos.bank.v1beta1.MsgMultiSendResponse")] -pub struct MsgMultiSendResponse {} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/bank parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -/// MsgSetSendEnabled is the Msg/SetSendEnabled request type. -/// -/// Only entries to add/update/delete need to be included. -/// Existing SendEnabled entries that are not included in this -/// message are left unchanged. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.MsgSetSendEnabled")] -pub struct MsgSetSendEnabled { - /// authority is the address that controls the module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// send_enabled is the list of entries to add or update. - #[prost(message, repeated, tag = "2")] - pub send_enabled: ::prost::alloc::vec::Vec, - /// use_default_for is a list of denoms that should use the params.default_send_enabled value. - /// Denoms listed here will have their SendEnabled entries deleted. - /// If a denom is included that doesn't have a SendEnabled entry, - /// it will be ignored. - #[prost(string, repeated, tag = "3")] - pub use_default_for: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse")] -pub struct MsgSetSendEnabledResponse {} -pub struct BankQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> BankQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn balance( - &self, - address: ::prost::alloc::string::String, - denom: ::prost::alloc::string::String, - ) -> Result { - QueryBalanceRequest { address, denom }.query(self.querier) - } - pub fn all_balances( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - resolve_denom: bool, - ) -> Result { - QueryAllBalancesRequest { - address, - pagination, - resolve_denom, - } - .query(self.querier) - } - pub fn spendable_balances( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QuerySpendableBalancesRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn spendable_balance_by_denom( - &self, - address: ::prost::alloc::string::String, - denom: ::prost::alloc::string::String, - ) -> Result { - QuerySpendableBalanceByDenomRequest { address, denom }.query(self.querier) - } - pub fn total_supply( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryTotalSupplyRequest { pagination }.query(self.querier) - } - pub fn supply_of( - &self, - denom: ::prost::alloc::string::String, - ) -> Result { - QuerySupplyOfRequest { denom }.query(self.querier) - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn denom_metadata( - &self, - denom: ::prost::alloc::string::String, - ) -> Result { - QueryDenomMetadataRequest { denom }.query(self.querier) - } - pub fn denom_metadata_by_query_string( - &self, - denom: ::prost::alloc::string::String, - ) -> Result { - QueryDenomMetadataByQueryStringRequest { denom }.query(self.querier) - } - pub fn denoms_metadata( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryDenomsMetadataRequest { pagination }.query(self.querier) - } - pub fn denom_owners( - &self, - denom: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryDenomOwnersRequest { denom, pagination }.query(self.querier) - } - pub fn denom_owners_by_query( - &self, - denom: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryDenomOwnersByQueryRequest { denom, pagination }.query(self.querier) - } - pub fn send_enabled( - &self, - denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - pagination: ::core::option::Option, - ) -> Result { - QuerySendEnabledRequest { denoms, pagination }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/abci/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/abci/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/abci/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/abci/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/abci/v1beta1.rs deleted file mode 100644 index 50c1bf1b..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/abci/v1beta1.rs +++ /dev/null @@ -1,390 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// TxResponse defines a structure containing relevant tx data and metadata. The -/// tags are stringified and the log is JSON decoded. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.TxResponse")] -pub struct TxResponse { - /// The block height - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// The transaction hash. - #[prost(string, tag = "2")] - pub txhash: ::prost::alloc::string::String, - /// Namespace for the Code - #[prost(string, tag = "3")] - pub codespace: ::prost::alloc::string::String, - /// Response code. - #[prost(uint32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code: u32, - /// Result bytes, if any. - #[prost(string, tag = "5")] - pub data: ::prost::alloc::string::String, - /// The output of the application's logger (raw string). May be - /// non-deterministic. - #[prost(string, tag = "6")] - pub raw_log: ::prost::alloc::string::String, - /// The output of the application's logger (typed). May be non-deterministic. - #[prost(message, repeated, tag = "7")] - pub logs: ::prost::alloc::vec::Vec, - /// Additional information. May be non-deterministic. - #[prost(string, tag = "8")] - pub info: ::prost::alloc::string::String, - /// Amount of gas requested for transaction. - #[prost(int64, tag = "9")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_wanted: i64, - /// Amount of gas consumed by transaction. - #[prost(int64, tag = "10")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_used: i64, - /// The request transaction bytes. - #[prost(message, optional, tag = "11")] - pub tx: ::core::option::Option, - /// Time of the previous block. For heights > 1, it's the weighted median of - /// the timestamps of the valid votes in the block.LastCommit. For height == 1, - /// it's genesis time. - #[prost(string, tag = "12")] - pub timestamp: ::prost::alloc::string::String, - /// Events defines all the events emitted by processing a transaction. Note, - /// these events include those emitted by processing all the messages and those - /// emitted from the ante. Whereas Logs contains the events, with - /// additional metadata, emitted only by processing the messages. - /// - /// Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 - #[prost(message, repeated, tag = "13")] - pub events: ::prost::alloc::vec::Vec, -} -/// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.ABCIMessageLog")] -pub struct AbciMessageLog { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub msg_index: u32, - #[prost(string, tag = "2")] - pub log: ::prost::alloc::string::String, - /// Events contains a slice of Event objects that were emitted during some - /// execution. - #[prost(message, repeated, tag = "3")] - pub events: ::prost::alloc::vec::Vec, -} -/// StringEvent defines en Event object wrapper where all the attributes -/// contain key/value pairs that are strings instead of raw bytes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.StringEvent")] -pub struct StringEvent { - #[prost(string, tag = "1")] - pub r#type: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub attributes: ::prost::alloc::vec::Vec, -} -/// Attribute defines an attribute wrapper where the key and value are -/// strings instead of raw bytes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.Attribute")] -pub struct Attribute { - #[prost(string, tag = "1")] - pub key: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub value: ::prost::alloc::string::String, -} -/// GasInfo defines tx execution gas context. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.GasInfo")] -pub struct GasInfo { - /// GasWanted is the maximum units of work we allow this tx to perform. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_wanted: u64, - /// GasUsed is the amount of gas actually consumed. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_used: u64, -} -/// Result is the union of ResponseFormat and ResponseCheckTx. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.Result")] -pub struct Result { - /// Data is any data returned from message or handler execution. It MUST be - /// length prefixed in order to separate data from multiple message executions. - /// Deprecated. This field is still populated, but prefer msg_response instead - /// because it also contains the Msg response typeURL. - #[deprecated] - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - /// Log contains the log information from message or handler execution. - #[prost(string, tag = "2")] - pub log: ::prost::alloc::string::String, - /// Events contains a slice of Event objects that were emitted during message - /// or handler execution. - #[prost(message, repeated, tag = "3")] - pub events: ::prost::alloc::vec::Vec, - /// msg_responses contains the Msg handler responses type packed in Anys. - /// - /// Since: cosmos-sdk 0.46 - #[prost(message, repeated, tag = "4")] - pub msg_responses: ::prost::alloc::vec::Vec, -} -/// SimulationResponse defines the response generated when a transaction is -/// successfully simulated. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.SimulationResponse")] -pub struct SimulationResponse { - #[prost(message, optional, tag = "1")] - pub gas_info: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub result: ::core::option::Option, -} -/// MsgData defines the data returned in a Result object during message -/// execution. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.MsgData")] -#[deprecated] -pub struct MsgData { - #[prost(string, tag = "1")] - pub msg_type: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// TxMsgData defines a list of MsgData. A transaction will have a MsgData object -/// for each 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 = "/cosmos.base.abci.v1beta1.TxMsgData")] -pub struct TxMsgData { - /// data field is deprecated and not populated. - #[deprecated] - #[prost(message, repeated, tag = "1")] - pub data: ::prost::alloc::vec::Vec, - /// msg_responses contains the Msg handler responses packed into Anys. - /// - /// Since: cosmos-sdk 0.46 - #[prost(message, repeated, tag = "2")] - pub msg_responses: ::prost::alloc::vec::Vec, -} -/// SearchTxsResult defines a structure for querying txs pageable -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.SearchTxsResult")] -pub struct SearchTxsResult { - /// Count of all txs - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_count: u64, - /// Count of txs in current page - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub count: u64, - /// Index of current page, start from 1 - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub page_number: u64, - /// Count of total pages - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub page_total: u64, - /// Max count txs per page - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub limit: u64, - /// List of txs in current page - #[prost(message, repeated, tag = "6")] - pub txs: ::prost::alloc::vec::Vec, -} -/// SearchBlocksResult defines a structure for querying blocks pageable -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.abci.v1beta1.SearchBlocksResult")] -pub struct SearchBlocksResult { - /// Count of all blocks - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_count: i64, - /// Count of blocks in current page - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub count: i64, - /// Index of current page, start from 1 - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub page_number: i64, - /// Count of total pages - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub page_total: i64, - /// Max count blocks per page - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub limit: i64, - /// List of blocks in current page - #[prost(message, repeated, tag = "6")] - pub blocks: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/mod.rs deleted file mode 100644 index f0b72c9c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod abci; -pub mod node; -pub mod query; -pub mod reflection; -pub mod tendermint; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/node/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/node/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/node/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/node/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/node/v1beta1.rs deleted file mode 100644 index 78a768bd..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/node/v1beta1.rs +++ /dev/null @@ -1,102 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ConfigRequest defines the request structure for the Config gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.node.v1beta1.ConfigRequest")] -pub struct ConfigRequest {} -/// ConfigResponse defines the response structure for the Config gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.node.v1beta1.ConfigResponse")] -pub struct ConfigResponse { - #[prost(string, tag = "1")] - pub minimum_gas_price: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub pruning_keep_recent: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub pruning_interval: ::prost::alloc::string::String, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub halt_height: u64, -} -/// StateRequest defines the request structure for the status of a node. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.node.v1beta1.StatusRequest")] -pub struct StatusRequest {} -/// StateResponse defines the response structure for the status of a node. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.node.v1beta1.StatusResponse")] -pub struct StatusResponse { - /// earliest block height available in the store - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub earliest_store_height: u64, - /// current block height - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - /// block height timestamp - #[prost(message, optional, tag = "3")] - pub timestamp: ::core::option::Option, - /// app hash of the current block - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, - /// validator hash provided by the consensus header - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validator_hash: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/query/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/query/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/query/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/query/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/query/v1beta1.rs deleted file mode 100644 index b74b138e..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/query/v1beta1.rs +++ /dev/null @@ -1,97 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// PageRequest is to be embedded in gRPC request messages for efficient -/// pagination. Ex: -/// -/// message SomeRequest { -/// Foo some_parameter = 1; -/// PageRequest pagination = 2; -/// } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.query.v1beta1.PageRequest")] -pub struct PageRequest { - /// key is a value returned in PageResponse.next_key to begin - /// querying the next page most efficiently. Only one of offset or key - /// should be set. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - /// offset is a numeric offset that can be used when key is unavailable. - /// It is less efficient than using key. Only one of offset or key should - /// be set. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub offset: u64, - /// limit is the total number of results to be returned in the result page. - /// If left empty it will default to a value to be set by each app. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub limit: u64, - /// count_total is set to true to indicate that the result set should include - /// a count of the total number of items available for pagination in UIs. - /// count_total is only respected when offset is used. It is ignored when key - /// is set. - #[prost(bool, tag = "4")] - pub count_total: bool, - /// reverse is set to true if results are to be returned in the descending order. - /// - /// Since: cosmos-sdk 0.43 - #[prost(bool, tag = "5")] - pub reverse: bool, -} -/// PageResponse is to be embedded in gRPC response messages where the -/// corresponding request message has used PageRequest. -/// -/// message SomeResponse { -/// repeated Bar results = 1; -/// PageResponse page = 2; -/// } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.query.v1beta1.PageResponse")] -pub struct PageResponse { - /// next_key is the key to be passed to PageRequest.key to - /// query the next page most efficiently. It will be empty if - /// there are no more results. - #[prost(bytes = "vec", optional, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_option_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_option_base64_encoded_string::deserialize" - )] - pub next_key: ::core::option::Option<::prost::alloc::vec::Vec>, - /// total is total number of results available if PageRequest.count_total - /// was set, its value is undefined otherwise - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total: u64, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/mod.rs deleted file mode 100644 index 4ef95ad1..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod v1beta1; -pub mod v2alpha1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v1beta1.rs deleted file mode 100644 index 57638977..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v1beta1.rs +++ /dev/null @@ -1,70 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v1beta1.ListAllInterfacesRequest")] -pub struct ListAllInterfacesRequest {} -/// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v1beta1.ListAllInterfacesResponse")] -pub struct ListAllInterfacesResponse { - /// interface_names is an array of all the registered interfaces. - #[prost(string, repeated, tag = "1")] - pub interface_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// ListImplementationsRequest is the request type of the ListImplementations -/// RPC. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v1beta1.ListImplementationsRequest")] -pub struct ListImplementationsRequest { - /// interface_name defines the interface to query the implementations for. - #[prost(string, tag = "1")] - pub interface_name: ::prost::alloc::string::String, -} -/// ListImplementationsResponse is the response type of the ListImplementations -/// RPC. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v1beta1.ListImplementationsResponse")] -pub struct ListImplementationsResponse { - #[prost(string, repeated, tag = "1")] - pub implementation_message_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v2alpha1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v2alpha1.rs deleted file mode 100644 index 23b6094c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/reflection/v2alpha1.rs +++ /dev/null @@ -1,514 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// AppDescriptor describes a cosmos-sdk based application -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.AppDescriptor")] -pub struct AppDescriptor { - /// AuthnDescriptor provides information on how to authenticate transactions on the application - /// NOTE: experimental and subject to change in future releases. - #[prost(message, optional, tag = "1")] - pub authn: ::core::option::Option, - /// chain provides the chain descriptor - #[prost(message, optional, tag = "2")] - pub chain: ::core::option::Option, - /// codec provides metadata information regarding codec related types - #[prost(message, optional, tag = "3")] - pub codec: ::core::option::Option, - /// configuration provides metadata information regarding the sdk.Config type - #[prost(message, optional, tag = "4")] - pub configuration: ::core::option::Option, - /// query_services provides metadata information regarding the available queriable endpoints - #[prost(message, optional, tag = "5")] - pub query_services: ::core::option::Option, - /// tx provides metadata information regarding how to send transactions to the given application - #[prost(message, optional, tag = "6")] - pub tx: ::core::option::Option, -} -/// TxDescriptor describes the accepted transaction 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 = "/cosmos.base.reflection.v2alpha1.TxDescriptor")] -pub struct TxDescriptor { - /// fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) - /// it is not meant to support polymorphism of transaction types, it is supposed to be used by - /// reflection clients to understand if they can handle a specific transaction type in an application. - #[prost(string, tag = "1")] - pub fullname: ::prost::alloc::string::String, - /// msgs lists the accepted application messages (sdk.Msg) - #[prost(message, repeated, tag = "2")] - pub msgs: ::prost::alloc::vec::Vec, -} -/// AuthnDescriptor provides information on how to sign transactions without relying -/// on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.AuthnDescriptor")] -pub struct AuthnDescriptor { - /// sign_modes defines the supported signature algorithm - #[prost(message, repeated, tag = "1")] - pub sign_modes: ::prost::alloc::vec::Vec, -} -/// SigningModeDescriptor provides information on a signing flow of the application -/// NOTE(fdymylja): here we could go as far as providing an entire flow on how -/// to sign a message given a SigningModeDescriptor, but it's better to think about -/// this another time -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.SigningModeDescriptor")] -pub struct SigningModeDescriptor { - /// name defines the unique name of the signing mode - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// number is the unique int32 identifier for the sign_mode enum - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub number: i32, - /// authn_info_provider_method_fullname defines the fullname of the method to call to get - /// the metadata required to authenticate using the provided sign_modes - #[prost(string, tag = "3")] - pub authn_info_provider_method_fullname: ::prost::alloc::string::String, -} -/// ChainDescriptor describes chain information of the application -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.ChainDescriptor")] -pub struct ChainDescriptor { - /// id is the chain id - #[prost(string, tag = "1")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, -} -/// CodecDescriptor describes the registered interfaces and provides metadata information on the types -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.CodecDescriptor")] -pub struct CodecDescriptor { - /// interfaces is a list of the registerted interfaces descriptors - #[prost(message, repeated, tag = "1")] - pub interfaces: ::prost::alloc::vec::Vec, -} -/// InterfaceDescriptor describes the implementation of an interface -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.InterfaceDescriptor")] -pub struct InterfaceDescriptor { - /// fullname is the name of the interface - #[prost(string, tag = "1")] - pub fullname: ::prost::alloc::string::String, - /// interface_accepting_messages contains information regarding the proto messages which contain the interface as - /// google.protobuf.Any field - #[prost(message, repeated, tag = "2")] - pub interface_accepting_messages: ::prost::alloc::vec::Vec, - /// interface_implementers is a list of the descriptors of the interface implementers - #[prost(message, repeated, tag = "3")] - pub interface_implementers: ::prost::alloc::vec::Vec, -} -/// InterfaceImplementerDescriptor describes an interface implementer -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor")] -pub struct InterfaceImplementerDescriptor { - /// fullname is the protobuf queryable name of the interface implementer - #[prost(string, tag = "1")] - pub fullname: ::prost::alloc::string::String, - /// type_url defines the type URL used when marshalling the type as any - /// this is required so we can provide type safe google.protobuf.Any marshalling and - /// unmarshalling, making sure that we don't accept just 'any' type - /// in our interface fields - #[prost(string, tag = "2")] - pub type_url: ::prost::alloc::string::String, -} -/// InterfaceAcceptingMessageDescriptor describes a protobuf message which contains -/// an interface represented as a google.protobuf.Any -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor")] -pub struct InterfaceAcceptingMessageDescriptor { - /// fullname is the protobuf fullname of the type containing the interface - #[prost(string, tag = "1")] - pub fullname: ::prost::alloc::string::String, - /// field_descriptor_names is a list of the protobuf name (not fullname) of the field - /// which contains the interface as google.protobuf.Any (the interface is the same, but - /// it can be in multiple fields of the same proto message) - #[prost(string, repeated, tag = "2")] - pub field_descriptor_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// ConfigurationDescriptor contains metadata information on the sdk.Config -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.ConfigurationDescriptor")] -pub struct ConfigurationDescriptor { - /// bech32_account_address_prefix is the account address prefix - #[prost(string, tag = "1")] - pub bech32_account_address_prefix: ::prost::alloc::string::String, -} -/// MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.MsgDescriptor")] -pub struct MsgDescriptor { - /// msg_type_url contains the TypeURL of a sdk.Msg. - #[prost(string, tag = "1")] - pub msg_type_url: ::prost::alloc::string::String, -} -/// GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest")] -pub struct GetAuthnDescriptorRequest {} -/// GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse")] -pub struct GetAuthnDescriptorResponse { - /// authn describes how to authenticate to the application when sending transactions - #[prost(message, optional, tag = "1")] - pub authn: ::core::option::Option, -} -/// GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest")] -pub struct GetChainDescriptorRequest {} -/// GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse")] -pub struct GetChainDescriptorResponse { - /// chain describes application chain information - #[prost(message, optional, tag = "1")] - pub chain: ::core::option::Option, -} -/// GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest")] -pub struct GetCodecDescriptorRequest {} -/// GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse")] -pub struct GetCodecDescriptorResponse { - /// codec describes the application codec such as registered interfaces and implementations - #[prost(message, optional, tag = "1")] - pub codec: ::core::option::Option, -} -/// GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest")] -pub struct GetConfigurationDescriptorRequest {} -/// GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse")] -pub struct GetConfigurationDescriptorResponse { - /// config describes the application's sdk.Config - #[prost(message, optional, tag = "1")] - pub config: ::core::option::Option, -} -/// GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest")] -pub struct GetQueryServicesDescriptorRequest {} -/// GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse")] -pub struct GetQueryServicesDescriptorResponse { - /// queries provides information on the available queryable services - #[prost(message, optional, tag = "1")] - pub queries: ::core::option::Option, -} -/// GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest")] -pub struct GetTxDescriptorRequest {} -/// GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse")] -pub struct GetTxDescriptorResponse { - /// tx provides information on msgs that can be forwarded to the application - /// alongside the accepted transaction protobuf type - #[prost(message, optional, tag = "1")] - pub tx: ::core::option::Option, -} -/// QueryServicesDescriptor contains the list of cosmos-sdk queriable services -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.QueryServicesDescriptor")] -pub struct QueryServicesDescriptor { - /// query_services is a list of cosmos-sdk QueryServiceDescriptor - #[prost(message, repeated, tag = "1")] - pub query_services: ::prost::alloc::vec::Vec, -} -/// QueryServiceDescriptor describes a cosmos-sdk queryable service -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.QueryServiceDescriptor")] -pub struct QueryServiceDescriptor { - /// fullname is the protobuf fullname of the service descriptor - #[prost(string, tag = "1")] - pub fullname: ::prost::alloc::string::String, - /// is_module describes if this service is actually exposed by an application's module - #[prost(bool, tag = "2")] - pub is_module: bool, - /// methods provides a list of query service methods - #[prost(message, repeated, tag = "3")] - pub methods: ::prost::alloc::vec::Vec, -} -/// QueryMethodDescriptor describes a queryable method of a query service -/// no other info is provided beside method name and tendermint queryable path -/// because it would be redundant with the grpc reflection service -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.reflection.v2alpha1.QueryMethodDescriptor")] -pub struct QueryMethodDescriptor { - /// name is the protobuf name (not fullname) of the method - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// full_query_path is the path that can be used to query - /// this method via tendermint abci.Query - #[prost(string, tag = "2")] - pub full_query_path: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/v1beta1.rs deleted file mode 100644 index 3ae29e92..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/tendermint/v1beta1.rs +++ /dev/null @@ -1,599 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Block is tendermint type Block, with the Header proposer address -/// field converted to bech32 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 = "/cosmos.base.tendermint.v1beta1.Block")] -pub struct Block { - #[prost(message, optional, tag = "1")] - pub header: ::core::option::Option
, - #[prost(message, optional, tag = "2")] - pub data: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub evidence: - ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub last_commit: ::core::option::Option, -} -/// Header defines the structure of a Tendermint block header. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.Header")] -pub struct Header { - /// basic block info - #[prost(message, optional, tag = "1")] - pub version: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(message, optional, tag = "4")] - pub time: ::core::option::Option, - /// prev block info - #[prost(message, optional, tag = "5")] - #[serde(alias = "last_blockID")] - pub last_block_id: - ::core::option::Option, - /// hashes of block data - /// - /// commit from validators from the last block - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_commit_hash: ::prost::alloc::vec::Vec, - /// transactions - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data_hash: ::prost::alloc::vec::Vec, - /// hashes from the app output from the prev block - /// - /// validators for the current block - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validators_hash: ::prost::alloc::vec::Vec, - /// validators for the next block - #[prost(bytes = "vec", tag = "9")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, - /// consensus params for current block - #[prost(bytes = "vec", tag = "10")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub consensus_hash: ::prost::alloc::vec::Vec, - /// state after txs from the previous block - #[prost(bytes = "vec", tag = "11")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, - /// root hash of all results from the txs from the previous block - #[prost(bytes = "vec", tag = "12")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_results_hash: ::prost::alloc::vec::Vec, - /// consensus info - /// - /// evidence included in the block - #[prost(bytes = "vec", tag = "13")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub evidence_hash: ::prost::alloc::vec::Vec, - /// proposer_address is the original block proposer address, formatted as a Bech32 string. - /// In Tendermint, this type is `bytes`, but in the SDK, we convert it to a Bech32 string - /// for better UX. - /// - /// original proposer of the block - #[prost(string, tag = "14")] - pub proposer_address: ::prost::alloc::string::String, -} -/// GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight 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 = "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest")] -pub struct GetValidatorSetByHeightRequest { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// GetValidatorSetByHeightResponse is the response type for the Query/GetValidatorSetByHeight 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 = "/cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse")] -pub struct GetValidatorSetByHeightResponse { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_height: i64, - #[prost(message, repeated, tag = "2")] - pub validators: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -/// GetLatestValidatorSetRequest is the request type for the Query/GetValidatorSetByHeight 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 = "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest")] -pub struct GetLatestValidatorSetRequest { - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// GetLatestValidatorSetResponse is the response type for the Query/GetValidatorSetByHeight 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 = "/cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse")] -pub struct GetLatestValidatorSetResponse { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_height: i64, - #[prost(message, repeated, tag = "2")] - pub validators: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -/// Validator is the type for the validator-set. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.Validator")] -pub struct Validator { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub voting_power: i64, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposer_priority: i64, -} -/// GetBlockByHeightRequest is the request type for the Query/GetBlockByHeight 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 = "/cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest")] -pub struct GetBlockByHeightRequest { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} -/// GetBlockByHeightResponse is the response type for the Query/GetBlockByHeight 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 = "/cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse")] -pub struct GetBlockByHeightResponse { - #[prost(message, optional, tag = "1")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - /// Deprecated: please use `sdk_block` instead - #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option, - /// Since: cosmos-sdk 0.47 - #[prost(message, optional, tag = "3")] - pub sdk_block: ::core::option::Option, -} -/// GetLatestBlockRequest is the request type for the Query/GetLatestBlock 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 = "/cosmos.base.tendermint.v1beta1.GetLatestBlockRequest")] -pub struct GetLatestBlockRequest {} -/// GetLatestBlockResponse is the response type for the Query/GetLatestBlock 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 = "/cosmos.base.tendermint.v1beta1.GetLatestBlockResponse")] -pub struct GetLatestBlockResponse { - #[prost(message, optional, tag = "1")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - /// Deprecated: please use `sdk_block` instead - #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option, - /// Since: cosmos-sdk 0.47 - #[prost(message, optional, tag = "3")] - pub sdk_block: ::core::option::Option, -} -/// GetSyncingRequest is the request type for the Query/GetSyncing 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 = "/cosmos.base.tendermint.v1beta1.GetSyncingRequest")] -pub struct GetSyncingRequest {} -/// GetSyncingResponse is the response type for the Query/GetSyncing 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 = "/cosmos.base.tendermint.v1beta1.GetSyncingResponse")] -pub struct GetSyncingResponse { - #[prost(bool, tag = "1")] - pub syncing: bool, -} -/// GetNodeInfoRequest is the request type for the Query/GetNodeInfo 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 = "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest")] -pub struct GetNodeInfoRequest {} -/// GetNodeInfoResponse is the response type for the Query/GetNodeInfo 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 = "/cosmos.base.tendermint.v1beta1.GetNodeInfoResponse")] -pub struct GetNodeInfoResponse { - #[prost(message, optional, tag = "1")] - pub default_node_info: - ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub application_version: ::core::option::Option, -} -/// VersionInfo is the type for the GetNodeInfoResponse 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 = "/cosmos.base.tendermint.v1beta1.VersionInfo")] -pub struct VersionInfo { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub app_name: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub version: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub git_commit: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub build_tags: ::prost::alloc::string::String, - #[prost(string, tag = "6")] - pub go_version: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "7")] - pub build_deps: ::prost::alloc::vec::Vec, - /// Since: cosmos-sdk 0.43 - #[prost(string, tag = "8")] - pub cosmos_sdk_version: ::prost::alloc::string::String, -} -/// Module is the type for VersionInfo -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.Module")] -pub struct Module { - /// module path - #[prost(string, tag = "1")] - pub path: ::prost::alloc::string::String, - /// module version - #[prost(string, tag = "2")] - pub version: ::prost::alloc::string::String, - /// checksum - #[prost(string, tag = "3")] - pub sum: ::prost::alloc::string::String, -} -/// ABCIQueryRequest defines the request structure for the ABCIQuery gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.ABCIQueryRequest")] -pub struct AbciQueryRequest { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub path: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(bool, tag = "4")] - pub prove: bool, -} -/// ABCIQueryResponse defines the response structure for the ABCIQuery gRPC query. -/// -/// Note: This type is a duplicate of the ResponseQuery proto type defined in -/// Tendermint. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.ABCIQueryResponse")] -pub struct AbciQueryResponse { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code: u32, - /// nondeterministic - #[prost(string, tag = "3")] - pub log: ::prost::alloc::string::String, - /// nondeterministic - #[prost(string, tag = "4")] - pub info: ::prost::alloc::string::String, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: i64, - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "8")] - pub proof_ops: ::core::option::Option, - #[prost(int64, tag = "9")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(string, tag = "10")] - pub codespace: ::prost::alloc::string::String, -} -/// ProofOp defines an operation used for calculating Merkle root. The data could -/// be arbitrary format, providing necessary data for example neighbouring node -/// hash. -/// -/// Note: This type is a duplicate of the ProofOp proto type defined in Tendermint. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.ProofOp")] -pub struct ProofOp { - #[prost(string, tag = "1")] - pub r#type: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// ProofOps is Merkle proof defined by the list of ProofOps. -/// -/// Note: This type is a duplicate of the ProofOps proto type defined in Tendermint. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.tendermint.v1beta1.ProofOps")] -pub struct ProofOps { - #[prost(message, repeated, tag = "1")] - pub ops: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/base/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/base/v1beta1.rs deleted file mode 100644 index c434c32a..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/base/v1beta1.rs +++ /dev/null @@ -1,81 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Coin defines a token with a denomination and an amount. -/// -/// NOTE: The amount field is an Int which implements the custom method -/// signatures required by gogoproto. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.v1beta1.Coin")] -pub struct Coin { - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub amount: ::prost::alloc::string::String, -} -/// DecCoin defines a token with a denomination and a decimal amount. -/// -/// NOTE: The amount field is an Dec which implements the custom method -/// signatures required by gogoproto. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoin")] -pub struct DecCoin { - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub amount: ::prost::alloc::string::String, -} -/// IntProto defines a Protobuf wrapper around an Int object. -/// Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.v1beta1.IntProto")] -pub struct IntProto { - #[prost(string, tag = "1")] - pub int: ::prost::alloc::string::String, -} -/// DecProto defines a Protobuf wrapper around a Dec object. -/// Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.base.v1beta1.DecProto")] -pub struct DecProto { - #[prost(string, tag = "1")] - pub dec: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/circuit/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/circuit/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/circuit/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/circuit/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/circuit/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/circuit/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/circuit/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/circuit/module/v1.rs deleted file mode 100644 index b5952ab6..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/circuit/module/v1.rs +++ /dev/null @@ -1,19 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the circuit module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.circuit.module.v1.Module")] -pub struct Module { - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/circuit/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/circuit/v1.rs deleted file mode 100644 index 4390a4a5..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/circuit/v1.rs +++ /dev/null @@ -1,378 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Permissions are the permissions that an account has to trip -/// or reset the circuit breaker. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.circuit.v1.Permissions")] -pub struct Permissions { - /// level is the level of permissions granted to this account. - #[prost(enumeration = "permissions::Level", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub level: i32, - /// limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type - /// URLs that the account can trip. It is an error to use limit_type_urls with - /// a level other than LEVEL_SOME_MSGS. - #[prost(string, repeated, tag = "2")] - pub limit_type_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Nested message and enum types in `Permissions`. -pub mod permissions { - /// Level is the permission level. - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] - pub enum Level { - /// LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit - /// breaker permissions. - NoneUnspecified = 0, - /// LEVEL_SOME_MSGS indicates that the account will have permission to - /// trip or reset the circuit breaker for some Msg type URLs. If this level - /// is chosen, a non-empty list of Msg type URLs must be provided in - /// limit_type_urls. - SomeMsgs = 1, - /// LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit - /// breaker for Msg's of all type URLs. - AllMsgs = 2, - /// LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker - /// actions and can grant permissions to other accounts. - SuperAdmin = 3, - } - impl Level { - /// 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 { - Level::NoneUnspecified => "LEVEL_NONE_UNSPECIFIED", - Level::SomeMsgs => "LEVEL_SOME_MSGS", - Level::AllMsgs => "LEVEL_ALL_MSGS", - Level::SuperAdmin => "LEVEL_SUPER_ADMIN", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "LEVEL_NONE_UNSPECIFIED" => Some(Self::NoneUnspecified), - "LEVEL_SOME_MSGS" => Some(Self::SomeMsgs), - "LEVEL_ALL_MSGS" => Some(Self::AllMsgs), - "LEVEL_SUPER_ADMIN" => Some(Self::SuperAdmin), - _ => None, - } - } - } -} -/// GenesisAccountPermissions is the account permissions for the circuit breaker in genesis -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.circuit.v1.GenesisAccountPermissions")] -pub struct GenesisAccountPermissions { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub permissions: ::core::option::Option, -} -/// GenesisState is the state that must be provided at genesis. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.circuit.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, repeated, tag = "1")] - pub account_permissions: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag = "2")] - pub disabled_type_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// QueryAccountRequest is the request type for the Query/Account 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 = "/cosmos.circuit.v1.QueryAccountRequest")] -#[proto_query( - path = "/cosmos.circuit.v1.Query/Account", - response_type = AccountResponse -)] -pub struct QueryAccountRequest { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// AccountResponse is the response type for the Query/Account 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 = "/cosmos.circuit.v1.AccountResponse")] -pub struct AccountResponse { - #[prost(message, optional, tag = "1")] - pub permission: ::core::option::Option, -} -/// QueryAccountsRequest is the request type for the Query/Accounts 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 = "/cosmos.circuit.v1.QueryAccountsRequest")] -#[proto_query( - path = "/cosmos.circuit.v1.Query/Accounts", - response_type = AccountsResponse -)] -pub struct QueryAccountsRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// AccountsResponse is the response type for the Query/Accounts 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 = "/cosmos.circuit.v1.AccountsResponse")] -pub struct AccountsResponse { - #[prost(message, repeated, tag = "1")] - pub accounts: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDisableListRequest is the request type for the Query/DisabledList 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 = "/cosmos.circuit.v1.QueryDisabledListRequest")] -#[proto_query( - path = "/cosmos.circuit.v1.Query/DisabledList", - response_type = DisabledListResponse -)] -pub struct QueryDisabledListRequest {} -/// DisabledListResponse is the response type for the Query/DisabledList 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 = "/cosmos.circuit.v1.DisabledListResponse")] -pub struct DisabledListResponse { - #[prost(string, repeated, tag = "1")] - pub disabled_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker 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 = "/cosmos.circuit.v1.MsgAuthorizeCircuitBreaker")] -pub struct MsgAuthorizeCircuitBreaker { - /// granter is the granter of the circuit breaker permissions and must have - /// LEVEL_SUPER_ADMIN. - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// grantee is the account authorized with the provided permissions. - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - /// permissions are the circuit breaker permissions that the grantee receives. - /// These will overwrite any existing permissions. LEVEL_NONE_UNSPECIFIED can - /// be specified to revoke all permissions. - #[prost(message, optional, tag = "3")] - pub permissions: ::core::option::Option, -} -/// MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response 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 = "/cosmos.circuit.v1.MsgAuthorizeCircuitBreakerResponse")] -pub struct MsgAuthorizeCircuitBreakerResponse { - #[prost(bool, tag = "1")] - pub success: bool, -} -/// MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker 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 = "/cosmos.circuit.v1.MsgTripCircuitBreaker")] -pub struct MsgTripCircuitBreaker { - /// authority is the account authorized to trip the circuit breaker. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// msg_type_urls specifies a list of type URLs to immediately stop processing. - /// IF IT IS LEFT EMPTY, ALL MSG PROCESSING WILL STOP IMMEDIATELY. - /// This value is validated against the authority's permissions and if the - /// authority does not have permissions to trip the specified msg type URLs - /// (or all URLs), the operation will fail. - #[prost(string, repeated, tag = "2")] - pub msg_type_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response 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 = "/cosmos.circuit.v1.MsgTripCircuitBreakerResponse")] -pub struct MsgTripCircuitBreakerResponse { - #[prost(bool, tag = "1")] - pub success: bool, -} -/// MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker 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 = "/cosmos.circuit.v1.MsgResetCircuitBreaker")] -pub struct MsgResetCircuitBreaker { - /// authority is the account authorized to trip or reset the circuit breaker. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// msg_type_urls specifies a list of Msg type URLs to resume processing. If - /// it is left empty all Msg processing for type URLs that the account is - /// authorized to trip will resume. - #[prost(string, repeated, tag = "3")] - pub msg_type_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response 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 = "/cosmos.circuit.v1.MsgResetCircuitBreakerResponse")] -pub struct MsgResetCircuitBreakerResponse { - #[prost(bool, tag = "1")] - pub success: bool, -} -pub struct CircuitQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> CircuitQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn account( - &self, - address: ::prost::alloc::string::String, - ) -> Result { - QueryAccountRequest { address }.query(self.querier) - } - pub fn accounts( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryAccountsRequest { pagination }.query(self.querier) - } - pub fn disabled_list(&self) -> Result { - QueryDisabledListRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/consensus/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/consensus/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/consensus/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/consensus/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/consensus/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/consensus/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/consensus/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/consensus/module/v1.rs deleted file mode 100644 index 77b30480..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/consensus/module/v1.rs +++ /dev/null @@ -1,19 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the consensus module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.consensus.module.v1.Module")] -pub struct Module { - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/consensus/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/consensus/v1.rs deleted file mode 100644 index 3e23d1ae..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/consensus/v1.rs +++ /dev/null @@ -1,97 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// QueryParamsRequest defines the request type for querying x/consensus parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.consensus.v1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.consensus.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse defines the response type for querying x/consensus parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.consensus.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params are the tendermint consensus params stored in the consensus module. - /// Please note that `params.version` is not populated in this response, it is - /// tracked separately in the x/upgrade module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgUpdateParams is the Msg/UpdateParams 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 = "/cosmos.consensus.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/consensus parameters to update. - /// VersionsParams is not included in this Msg because it is tracked - /// separarately in x/upgrade. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub evidence: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub validator: ::core::option::Option, - /// Since: cosmos-sdk 0.50 - #[prost(message, optional, tag = "5")] - pub abci: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams 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 = "/cosmos.consensus.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct ConsensusQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ConsensusQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crisis/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/crisis/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crisis/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crisis/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/crisis/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crisis/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crisis/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crisis/module/v1.rs deleted file mode 100644 index 51938d70..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crisis/module/v1.rs +++ /dev/null @@ -1,22 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the crisis module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crisis.module.v1.Module")] -pub struct Module { - /// fee_collector_name is the name of the FeeCollector ModuleAccount. - #[prost(string, tag = "1")] - pub fee_collector_name: ::prost::alloc::string::String, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crisis/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crisis/v1beta1.rs deleted file mode 100644 index 11b65bec..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crisis/v1beta1.rs +++ /dev/null @@ -1,98 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenesisState defines the crisis module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crisis.v1beta1.GenesisState")] -pub struct GenesisState { - /// constant_fee is the fee used to verify the invariant in the crisis - /// module. - #[prost(message, optional, tag = "3")] - pub constant_fee: ::core::option::Option, -} -/// MsgVerifyInvariant represents a message to verify a particular invariance. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crisis.v1beta1.MsgVerifyInvariant")] -pub struct MsgVerifyInvariant { - /// sender is the account address of private key to send coins to fee collector account. - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// name of the invariant module. - #[prost(string, tag = "2")] - pub invariant_module_name: ::prost::alloc::string::String, - /// invariant_route is the msg's invariant route. - #[prost(string, tag = "3")] - pub invariant_route: ::prost::alloc::string::String, -} -/// MsgVerifyInvariantResponse defines the Msg/VerifyInvariant response 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 = "/cosmos.crisis.v1beta1.MsgVerifyInvariantResponse")] -pub struct MsgVerifyInvariantResponse {} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crisis.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// constant_fee defines the x/crisis parameter. - #[prost(message, optional, tag = "2")] - pub constant_fee: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crisis.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/ed25519.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/ed25519.rs deleted file mode 100644 index 907faca5..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/ed25519.rs +++ /dev/null @@ -1,48 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// PubKey is an ed25519 public key for handling Tendermint keys in SDK. -/// It's needed for Any serialization and SDK compatibility. -/// It must not be used in a non Tendermint key context because it doesn't implement -/// ADR-28. Nevertheless, you will like to use ed25519 in app user level -/// then you must create a new proto message and follow ADR-28 for Address construction. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.ed25519.PubKey")] -pub struct PubKey { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, -} -/// PrivKey defines a ed25519 private key. -/// NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.ed25519.PrivKey")] -pub struct PrivKey { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/v1.rs deleted file mode 100644 index 08099f93..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/hd/v1.rs +++ /dev/null @@ -1,48 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// BIP44Params is used as path field in ledger item in Record. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.hd.v1.BIP44Params")] -pub struct Bip44Params { - /// purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub purpose: u32, - /// coin_type is a constant that improves privacy - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub coin_type: u32, - /// account splits the key space into independent user identities - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub account: u32, - /// change is a constant used for public derivation. Constant 0 is used for external chain and constant 1 for internal - /// chain. - #[prost(bool, tag = "4")] - pub change: bool, - /// address_index is used as child index in BIP32 derivation - #[prost(uint32, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub address_index: u32, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/v1.rs deleted file mode 100644 index e0c395aa..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/keyring/v1.rs +++ /dev/null @@ -1,117 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Record is used for representing a key in the keyring. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.keyring.v1.Record")] -pub struct Record { - /// name represents a name of Record - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// pub_key represents a public key in any format - #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option, - /// Record contains one of the following items - #[prost(oneof = "record::Item", tags = "3, 4, 5, 6")] - pub item: ::core::option::Option, -} -/// Nested message and enum types in `Record`. -pub mod record { - use neutron_std_derive::CosmwasmExt; - /// Item is a keyring item stored in a keyring backend. - /// Local item - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.crypto.keyring.v1.Record.Local")] - pub struct Local { - #[prost(message, optional, tag = "1")] - pub priv_key: ::core::option::Option, - } - /// Ledger item - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.crypto.keyring.v1.Record.Ledger")] - pub struct Ledger { - #[prost(message, optional, tag = "1")] - pub path: ::core::option::Option, - } - /// Multi item - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.crypto.keyring.v1.Record.Multi")] - pub struct Multi {} - /// Offline item - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.crypto.keyring.v1.Record.Offline")] - pub struct Offline {} - /// Record contains one of the following items - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Item { - /// local stores the private key locally. - #[prost(message, tag = "3")] - Local(Local), - /// ledger stores the information about a Ledger key. - #[prost(message, tag = "4")] - Ledger(Ledger), - /// Multi does not store any other information. - #[prost(message, tag = "5")] - Multi(Multi), - /// Offline does not store any other information. - #[prost(message, tag = "6")] - Offline(Offline), - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/mod.rs deleted file mode 100644 index a243ceb7..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod ed25519; -pub mod hd; -pub mod keyring; -pub mod multisig; -pub mod secp256k1; -pub mod secp256r1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/mod.rs deleted file mode 100644 index d87ab585..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -pub mod v1beta1; -use neutron_std_derive::CosmwasmExt; -/// LegacyAminoPubKey specifies a public key type -/// which nests multiple public keys and a threshold, -/// it uses legacy amino address rules. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.multisig.LegacyAminoPubKey")] -pub struct LegacyAminoPubKey { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub threshold: u32, - #[prost(message, repeated, tag = "2")] - pub public_keys: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/v1beta1.rs deleted file mode 100644 index aa5b8afb..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/multisig/v1beta1.rs +++ /dev/null @@ -1,50 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. -/// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers -/// signed and with which modes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.multisig.v1beta1.MultiSignature")] -pub struct MultiSignature { - #[prost(bytes = "vec", repeated, tag = "1")] - pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// CompactBitArray is an implementation of a space efficient bit array. -/// This is used to ensure that the encoded data takes up a minimal amount of -/// space after proto encoding. -/// This is not thread safe, and is not intended for concurrent usage. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.multisig.v1beta1.CompactBitArray")] -pub struct CompactBitArray { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub extra_bits_stored: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub elems: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256k1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256k1.rs deleted file mode 100644 index a57237a3..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256k1.rs +++ /dev/null @@ -1,47 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// PubKey defines a secp256k1 public key -/// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -/// if the y-coordinate is the lexicographically largest of the two associated with -/// the x-coordinate. Otherwise the first byte is a 0x03. -/// This prefix is followed with the x-coordinate. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.secp256k1.PubKey")] -pub struct PubKey { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, -} -/// PrivKey defines a secp256k1 private key. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.secp256k1.PrivKey")] -pub struct PrivKey { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256r1.rs b/packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256r1.rs deleted file mode 100644 index 511a5543..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/crypto/secp256r1.rs +++ /dev/null @@ -1,46 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// PubKey defines a secp256r1 ECDSA public key. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.secp256r1.PubKey")] -pub struct PubKey { - /// Point on secp256r1 curve in a compressed representation as specified in section - /// 4.3.6 of ANSI X9.62: - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, -} -/// PrivKey defines a secp256r1 ECDSA private key. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.crypto.secp256r1.PrivKey")] -pub struct PrivKey { - /// secret number serialized using big-endian encoding - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub secret: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/distribution/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/distribution/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/distribution/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/distribution/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/distribution/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/distribution/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/distribution/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/distribution/module/v1.rs deleted file mode 100644 index 4da86720..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/distribution/module/v1.rs +++ /dev/null @@ -1,21 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the distribution module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.module.v1.Module")] -pub struct Module { - #[prost(string, tag = "1")] - pub fee_collector_name: ::prost::alloc::string::String, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/distribution/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/distribution/v1beta1.rs deleted file mode 100644 index 96fa4bcd..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/distribution/v1beta1.rs +++ /dev/null @@ -1,1303 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the set of params for the distribution module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.Params")] -pub struct Params { - #[prost(string, tag = "1")] - pub community_tax: ::prost::alloc::string::String, - /// Deprecated: The base_proposer_reward field is deprecated and is no longer used - /// in the x/distribution module's reward mechanism. - #[deprecated] - #[prost(string, tag = "2")] - pub base_proposer_reward: ::prost::alloc::string::String, - /// Deprecated: The bonus_proposer_reward field is deprecated and is no longer used - /// in the x/distribution module's reward mechanism. - #[deprecated] - #[prost(string, tag = "3")] - pub bonus_proposer_reward: ::prost::alloc::string::String, - #[prost(bool, tag = "4")] - pub withdraw_addr_enabled: bool, -} -/// ValidatorHistoricalRewards represents historical rewards for a validator. -/// Height is implicit within the store key. -/// Cumulative reward ratio is the sum from the zeroeth period -/// until this period of rewards / tokens, per the spec. -/// The reference count indicates the number of objects -/// which might need to reference this historical entry at any point. -/// ReferenceCount = -/// number of outstanding delegations which ended the associated period (and -/// might need to read that record) -/// + number of slashes which ended the associated period (and might need to -/// read that record) -/// + one per validator for the zeroeth period, set on initialization -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards")] -pub struct ValidatorHistoricalRewards { - #[prost(message, repeated, tag = "1")] - pub cumulative_reward_ratio: ::prost::alloc::vec::Vec, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub reference_count: u32, -} -/// ValidatorCurrentRewards represents current rewards and current -/// period for a validator kept as a running counter and incremented -/// each block as long as the validator's tokens remain constant. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorCurrentRewards")] -pub struct ValidatorCurrentRewards { - #[prost(message, repeated, tag = "1")] - pub rewards: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub period: u64, -} -/// ValidatorAccumulatedCommission represents accumulated commission -/// for a validator kept as a running counter, can be withdrawn at any time. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission")] -pub struct ValidatorAccumulatedCommission { - #[prost(message, repeated, tag = "1")] - pub commission: ::prost::alloc::vec::Vec, -} -/// ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards -/// for a validator inexpensive to track, allows simple sanity checks. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards")] -pub struct ValidatorOutstandingRewards { - #[prost(message, repeated, tag = "1")] - pub rewards: ::prost::alloc::vec::Vec, -} -/// ValidatorSlashEvent represents a validator slash event. -/// Height is implicit within the store key. -/// This is needed to calculate appropriate amount of staking tokens -/// for delegations which are withdrawn after a slash has occurred. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorSlashEvent")] -pub struct ValidatorSlashEvent { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub validator_period: u64, - #[prost(string, tag = "2")] - pub fraction: ::prost::alloc::string::String, -} -/// ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorSlashEvents")] -pub struct ValidatorSlashEvents { - #[prost(message, repeated, tag = "1")] - pub validator_slash_events: ::prost::alloc::vec::Vec, -} -/// FeePool is the global fee pool for distribution. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.FeePool")] -pub struct FeePool { - #[prost(message, repeated, tag = "1")] - pub community_pool: ::prost::alloc::vec::Vec, -} -/// CommunityPoolSpendProposal details a proposal for use of community funds, -/// together with how many coins are proposed to be spent, and to which -/// recipient account. -/// -/// Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no -/// longer a need for an explicit CommunityPoolSpendProposal. To spend community -/// pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov -/// module via a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal")] -#[deprecated] -pub struct CommunityPoolSpendProposal { - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub recipient: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "4")] - pub amount: ::prost::alloc::vec::Vec, -} -/// DelegatorStartingInfo represents the starting info for a delegator reward -/// period. It tracks the previous validator period, the delegation's amount of -/// staking token, and the creation height (to check later on if any slashes have -/// occurred). NOTE: Even though validators are slashed to whole staking tokens, -/// the delegators within the validator may be left with less than a full token, -/// thus sdk.Dec is used. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.DelegatorStartingInfo")] -pub struct DelegatorStartingInfo { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub previous_period: u64, - #[prost(string, tag = "2")] - pub stake: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, -} -/// DelegationDelegatorReward represents the properties -/// of a delegator's delegation reward. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.DelegationDelegatorReward")] -pub struct DelegationDelegatorReward { - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub reward: ::prost::alloc::vec::Vec, -} -/// CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal -/// with a deposit -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit")] -pub struct CommunityPoolSpendProposalWithDeposit { - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub recipient: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub amount: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub deposit: ::prost::alloc::string::String, -} -/// DelegatorWithdrawInfo is the address for where distributions rewards are -/// withdrawn to by default this struct is only used at genesis to feed in -/// default withdraw addresses. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.DelegatorWithdrawInfo")] -pub struct DelegatorWithdrawInfo { - /// delegator_address is the address of the delegator. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - /// withdraw_address is the address to withdraw the delegation rewards to. - #[prost(string, tag = "2")] - pub withdraw_address: ::prost::alloc::string::String, -} -/// ValidatorOutstandingRewardsRecord is used for import/export via genesis json. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord")] -pub struct ValidatorOutstandingRewardsRecord { - /// validator_address is the address of the validator. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - /// outstanding_rewards represents the outstanding rewards of a validator. - #[prost(message, repeated, tag = "2")] - pub outstanding_rewards: ::prost::alloc::vec::Vec, -} -/// ValidatorAccumulatedCommissionRecord is used for import / export via genesis -/// json. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord")] -pub struct ValidatorAccumulatedCommissionRecord { - /// validator_address is the address of the validator. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - /// accumulated is the accumulated commission of a validator. - #[prost(message, optional, tag = "2")] - pub accumulated: ::core::option::Option, -} -/// ValidatorHistoricalRewardsRecord is used for import / export via genesis -/// json. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord")] -pub struct ValidatorHistoricalRewardsRecord { - /// validator_address is the address of the validator. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - /// period defines the period the historical rewards apply to. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub period: u64, - /// rewards defines the historical rewards of a validator. - #[prost(message, optional, tag = "3")] - pub rewards: ::core::option::Option, -} -/// ValidatorCurrentRewardsRecord is used for import / export via genesis json. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord")] -pub struct ValidatorCurrentRewardsRecord { - /// validator_address is the address of the validator. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - /// rewards defines the current rewards of a validator. - #[prost(message, optional, tag = "2")] - pub rewards: ::core::option::Option, -} -/// DelegatorStartingInfoRecord used for import / export via genesis json. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.DelegatorStartingInfoRecord")] -pub struct DelegatorStartingInfoRecord { - /// delegator_address is the address of the delegator. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - /// validator_address is the address of the validator. - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - /// starting_info defines the starting info of a delegator. - #[prost(message, optional, tag = "3")] - pub starting_info: ::core::option::Option, -} -/// ValidatorSlashEventRecord is used for import / export via genesis json. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.ValidatorSlashEventRecord")] -pub struct ValidatorSlashEventRecord { - /// validator_address is the address of the validator. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - /// height defines the block height at which the slash event occurred. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - /// period is the period of the slash event. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub period: u64, - /// validator_slash_event describes the slash event. - #[prost(message, optional, tag = "4")] - pub validator_slash_event: ::core::option::Option, -} -/// GenesisState defines the distribution module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.GenesisState")] -pub struct GenesisState { - /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// fee_pool defines the fee pool at genesis. - #[prost(message, optional, tag = "2")] - pub fee_pool: ::core::option::Option, - /// fee_pool defines the delegator withdraw infos at genesis. - #[prost(message, repeated, tag = "3")] - pub delegator_withdraw_infos: ::prost::alloc::vec::Vec, - /// fee_pool defines the previous proposer at genesis. - #[prost(string, tag = "4")] - pub previous_proposer: ::prost::alloc::string::String, - /// fee_pool defines the outstanding rewards of all validators at genesis. - #[prost(message, repeated, tag = "5")] - pub outstanding_rewards: ::prost::alloc::vec::Vec, - /// fee_pool defines the accumulated commissions of all validators at genesis. - #[prost(message, repeated, tag = "6")] - pub validator_accumulated_commissions: - ::prost::alloc::vec::Vec, - /// fee_pool defines the historical rewards of all validators at genesis. - #[prost(message, repeated, tag = "7")] - pub validator_historical_rewards: ::prost::alloc::vec::Vec, - /// fee_pool defines the current rewards of all validators at genesis. - #[prost(message, repeated, tag = "8")] - pub validator_current_rewards: ::prost::alloc::vec::Vec, - /// fee_pool defines the delegator starting infos at genesis. - #[prost(message, repeated, tag = "9")] - pub delegator_starting_infos: ::prost::alloc::vec::Vec, - /// fee_pool defines the validator slash events at genesis. - #[prost(message, repeated, tag = "10")] - pub validator_slash_events: ::prost::alloc::vec::Vec, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmos.distribution.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmos.distribution.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryValidatorDistributionInfoRequest is the request type for the Query/ValidatorDistributionInfo 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 = "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/ValidatorDistributionInfo", - response_type = QueryValidatorDistributionInfoResponse -)] -pub struct QueryValidatorDistributionInfoRequest { - /// validator_address defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, -} -/// QueryValidatorDistributionInfoResponse is the response type for the Query/ValidatorDistributionInfo 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 = "/cosmos.distribution.v1beta1.QueryValidatorDistributionInfoResponse")] -pub struct QueryValidatorDistributionInfoResponse { - /// operator_address defines the validator operator address. - #[prost(string, tag = "1")] - pub operator_address: ::prost::alloc::string::String, - /// self_bond_rewards defines the self delegations rewards. - #[prost(message, repeated, tag = "2")] - pub self_bond_rewards: ::prost::alloc::vec::Vec, - /// commission defines the commission the validator received. - #[prost(message, repeated, tag = "3")] - pub commission: ::prost::alloc::vec::Vec, -} -/// QueryValidatorOutstandingRewardsRequest is the request type for the -/// Query/ValidatorOutstandingRewards 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 = "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/ValidatorOutstandingRewards", - response_type = QueryValidatorOutstandingRewardsResponse -)] -pub struct QueryValidatorOutstandingRewardsRequest { - /// validator_address defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, -} -/// QueryValidatorOutstandingRewardsResponse is the response type for the -/// Query/ValidatorOutstandingRewards 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 = "/cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse")] -pub struct QueryValidatorOutstandingRewardsResponse { - #[prost(message, optional, tag = "1")] - pub rewards: ::core::option::Option, -} -/// QueryValidatorCommissionRequest is the request type for the -/// Query/ValidatorCommission 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 = "/cosmos.distribution.v1beta1.QueryValidatorCommissionRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/ValidatorCommission", - response_type = QueryValidatorCommissionResponse -)] -pub struct QueryValidatorCommissionRequest { - /// validator_address defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, -} -/// QueryValidatorCommissionResponse is the response type for the -/// Query/ValidatorCommission 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 = "/cosmos.distribution.v1beta1.QueryValidatorCommissionResponse")] -pub struct QueryValidatorCommissionResponse { - /// commission defines the commission the validator received. - #[prost(message, optional, tag = "1")] - pub commission: ::core::option::Option, -} -/// QueryValidatorSlashesRequest is the request type for the -/// Query/ValidatorSlashes 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 = "/cosmos.distribution.v1beta1.QueryValidatorSlashesRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/ValidatorSlashes", - response_type = QueryValidatorSlashesResponse -)] -pub struct QueryValidatorSlashesRequest { - /// validator_address defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, - /// starting_height defines the optional starting height to query the slashes. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub starting_height: u64, - /// starting_height defines the optional ending height to query the slashes. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub ending_height: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "4")] - pub pagination: ::core::option::Option, -} -/// QueryValidatorSlashesResponse is the response type for the -/// Query/ValidatorSlashes 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 = "/cosmos.distribution.v1beta1.QueryValidatorSlashesResponse")] -pub struct QueryValidatorSlashesResponse { - /// slashes defines the slashes the validator received. - #[prost(message, repeated, tag = "1")] - pub slashes: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegationRewardsRequest is the request type for the -/// Query/DelegationRewards 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 = "/cosmos.distribution.v1beta1.QueryDelegationRewardsRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/DelegationRewards", - response_type = QueryDelegationRewardsResponse -)] -pub struct QueryDelegationRewardsRequest { - /// delegator_address defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - /// validator_address defines the validator address to query for. - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, -} -/// QueryDelegationRewardsResponse is the response type for the -/// Query/DelegationRewards 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 = "/cosmos.distribution.v1beta1.QueryDelegationRewardsResponse")] -pub struct QueryDelegationRewardsResponse { - /// rewards defines the rewards accrued by a delegation. - #[prost(message, repeated, tag = "1")] - pub rewards: ::prost::alloc::vec::Vec, -} -/// QueryDelegationTotalRewardsRequest is the request type for the -/// Query/DelegationTotalRewards 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 = "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/DelegationTotalRewards", - response_type = QueryDelegationTotalRewardsResponse -)] -pub struct QueryDelegationTotalRewardsRequest { - /// delegator_address defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, -} -/// QueryDelegationTotalRewardsResponse is the response type for the -/// Query/DelegationTotalRewards 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 = "/cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse")] -pub struct QueryDelegationTotalRewardsResponse { - /// rewards defines all the rewards accrued by a delegator. - #[prost(message, repeated, tag = "1")] - pub rewards: ::prost::alloc::vec::Vec, - /// total defines the sum of all the rewards. - #[prost(message, repeated, tag = "2")] - pub total: ::prost::alloc::vec::Vec, -} -/// QueryDelegatorValidatorsRequest is the request type for the -/// Query/DelegatorValidators 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 = "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/DelegatorValidators", - response_type = QueryDelegatorValidatorsResponse -)] -pub struct QueryDelegatorValidatorsRequest { - /// delegator_address defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, -} -/// QueryDelegatorValidatorsResponse is the response type for the -/// Query/DelegatorValidators 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 = "/cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse")] -pub struct QueryDelegatorValidatorsResponse { - /// validators defines the validators a delegator is delegating for. - #[prost(string, repeated, tag = "1")] - pub validators: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// QueryDelegatorWithdrawAddressRequest is the request type for the -/// Query/DelegatorWithdrawAddress 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 = "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/DelegatorWithdrawAddress", - response_type = QueryDelegatorWithdrawAddressResponse -)] -pub struct QueryDelegatorWithdrawAddressRequest { - /// delegator_address defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, -} -/// QueryDelegatorWithdrawAddressResponse is the response type for the -/// Query/DelegatorWithdrawAddress 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 = "/cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse")] -pub struct QueryDelegatorWithdrawAddressResponse { - /// withdraw_address defines the delegator address to query for. - #[prost(string, tag = "1")] - pub withdraw_address: ::prost::alloc::string::String, -} -/// QueryCommunityPoolRequest is the request type for the Query/CommunityPool 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 = "/cosmos.distribution.v1beta1.QueryCommunityPoolRequest")] -#[proto_query( - path = "/cosmos.distribution.v1beta1.Query/CommunityPool", - response_type = QueryCommunityPoolResponse -)] -pub struct QueryCommunityPoolRequest {} -/// QueryCommunityPoolResponse is the response type for the Query/CommunityPool -/// 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 = "/cosmos.distribution.v1beta1.QueryCommunityPoolResponse")] -pub struct QueryCommunityPoolResponse { - /// pool defines community pool's coins. - #[prost(message, repeated, tag = "1")] - pub pool: ::prost::alloc::vec::Vec, -} -/// MsgSetWithdrawAddress sets the withdraw address for -/// a delegator (or validator self-delegation). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress")] -pub struct MsgSetWithdrawAddress { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub withdraw_address: ::prost::alloc::string::String, -} -/// MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response -/// 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 = "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse")] -pub struct MsgSetWithdrawAddressResponse {} -/// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator -/// from a single validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward")] -pub struct MsgWithdrawDelegatorReward { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, -} -/// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward -/// response 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 = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse")] -pub struct MsgWithdrawDelegatorRewardResponse { - /// Since: cosmos-sdk 0.46 - #[prost(message, repeated, tag = "1")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgWithdrawValidatorCommission withdraws the full commission to the validator -/// address. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission")] -pub struct MsgWithdrawValidatorCommission { - #[prost(string, tag = "1")] - pub validator_address: ::prost::alloc::string::String, -} -/// MsgWithdrawValidatorCommissionResponse defines the -/// Msg/WithdrawValidatorCommission response 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 = "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse")] -pub struct MsgWithdrawValidatorCommissionResponse { - /// Since: cosmos-sdk 0.46 - #[prost(message, repeated, tag = "1")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgFundCommunityPool allows an account to directly -/// fund the community pool. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgFundCommunityPool")] -pub struct MsgFundCommunityPool { - #[prost(message, repeated, tag = "1")] - pub amount: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, -} -/// MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response 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 = "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse")] -pub struct MsgFundCommunityPoolResponse {} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/distribution parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -/// MsgCommunityPoolSpend defines a message for sending tokens from the community -/// pool to another account. This message is typically executed via a governance -/// proposal with the governance module being the executing authority. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend")] -pub struct MsgCommunityPoolSpend { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub recipient: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgCommunityPoolSpendResponse defines the response to executing a -/// MsgCommunityPoolSpend message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse")] -pub struct MsgCommunityPoolSpendResponse {} -/// DepositValidatorRewardsPool defines the request structure to provide -/// additional rewards to delegators from a specific validator. -/// -/// Since: cosmos-sdk 0.50 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool")] -pub struct MsgDepositValidatorRewardsPool { - #[prost(string, tag = "1")] - pub depositor: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgDepositValidatorRewardsPoolResponse defines the response to executing a -/// MsgDepositValidatorRewardsPool message. -/// -/// Since: cosmos-sdk 0.50 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse")] -pub struct MsgDepositValidatorRewardsPoolResponse {} -pub struct DistributionQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> DistributionQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn validator_distribution_info( - &self, - validator_address: ::prost::alloc::string::String, - ) -> Result { - QueryValidatorDistributionInfoRequest { validator_address }.query(self.querier) - } - pub fn validator_outstanding_rewards( - &self, - validator_address: ::prost::alloc::string::String, - ) -> Result { - QueryValidatorOutstandingRewardsRequest { validator_address }.query(self.querier) - } - pub fn validator_commission( - &self, - validator_address: ::prost::alloc::string::String, - ) -> Result { - QueryValidatorCommissionRequest { validator_address }.query(self.querier) - } - pub fn validator_slashes( - &self, - validator_address: ::prost::alloc::string::String, - starting_height: u64, - ending_height: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryValidatorSlashesRequest { - validator_address, - starting_height, - ending_height, - pagination, - } - .query(self.querier) - } - pub fn delegation_rewards( - &self, - delegator_address: ::prost::alloc::string::String, - validator_address: ::prost::alloc::string::String, - ) -> Result { - QueryDelegationRewardsRequest { - delegator_address, - validator_address, - } - .query(self.querier) - } - pub fn delegation_total_rewards( - &self, - delegator_address: ::prost::alloc::string::String, - ) -> Result { - QueryDelegationTotalRewardsRequest { delegator_address }.query(self.querier) - } - pub fn delegator_validators( - &self, - delegator_address: ::prost::alloc::string::String, - ) -> Result { - QueryDelegatorValidatorsRequest { delegator_address }.query(self.querier) - } - pub fn delegator_withdraw_address( - &self, - delegator_address: ::prost::alloc::string::String, - ) -> Result { - QueryDelegatorWithdrawAddressRequest { delegator_address }.query(self.querier) - } - pub fn community_pool(&self) -> Result { - QueryCommunityPoolRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/evidence/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/evidence/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/evidence/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/evidence/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/evidence/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/evidence/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/evidence/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/evidence/module/v1.rs deleted file mode 100644 index 07e2afe1..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/evidence/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the evidence module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.evidence.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/evidence/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/evidence/v1beta1.rs deleted file mode 100644 index 27184a18..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/evidence/v1beta1.rs +++ /dev/null @@ -1,220 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Equivocation implements the Evidence interface and defines evidence of double -/// signing misbehavior. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.evidence.v1beta1.Equivocation")] -pub struct Equivocation { - /// height is the equivocation height. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// time is the equivocation time. - #[prost(message, optional, tag = "2")] - pub time: ::core::option::Option, - /// power is the equivocation validator power. - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub power: i64, - /// consensus_address is the equivocation validator consensus address. - #[prost(string, tag = "4")] - pub consensus_address: ::prost::alloc::string::String, -} -/// GenesisState defines the evidence module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.evidence.v1beta1.GenesisState")] -pub struct GenesisState { - /// evidence defines all the evidence at genesis. - #[prost(message, repeated, tag = "1")] - pub evidence: ::prost::alloc::vec::Vec, -} -/// QueryEvidenceRequest is the request type for the Query/Evidence 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 = "/cosmos.evidence.v1beta1.QueryEvidenceRequest")] -#[proto_query( - path = "/cosmos.evidence.v1beta1.Query/Evidence", - response_type = QueryEvidenceResponse -)] -pub struct QueryEvidenceRequest { - /// evidence_hash defines the hash of the requested evidence. - /// Deprecated: Use hash, a HEX encoded string, instead. - #[deprecated] - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub evidence_hash: ::prost::alloc::vec::Vec, - /// hash defines the evidence hash of the requested evidence. - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "2")] - pub hash: ::prost::alloc::string::String, -} -/// QueryEvidenceResponse is the response type for the Query/Evidence 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 = "/cosmos.evidence.v1beta1.QueryEvidenceResponse")] -pub struct QueryEvidenceResponse { - /// evidence returns the requested evidence. - #[prost(message, optional, tag = "1")] - pub evidence: ::core::option::Option, -} -/// QueryEvidenceRequest is the request type for the Query/AllEvidence 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 = "/cosmos.evidence.v1beta1.QueryAllEvidenceRequest")] -#[proto_query( - path = "/cosmos.evidence.v1beta1.Query/AllEvidence", - response_type = QueryAllEvidenceResponse -)] -pub struct QueryAllEvidenceRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// QueryAllEvidenceResponse is the response type for the Query/AllEvidence 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 = "/cosmos.evidence.v1beta1.QueryAllEvidenceResponse")] -pub struct QueryAllEvidenceResponse { - /// evidence returns all evidences. - #[prost(message, repeated, tag = "1")] - pub evidence: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// MsgSubmitEvidence represents a message that supports submitting arbitrary -/// Evidence of misbehavior such as equivocation or counterfactual signing. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.evidence.v1beta1.MsgSubmitEvidence")] -pub struct MsgSubmitEvidence { - /// submitter is the signer account address of evidence. - #[prost(string, tag = "1")] - pub submitter: ::prost::alloc::string::String, - /// evidence defines the evidence of misbehavior. - #[prost(message, optional, tag = "2")] - pub evidence: ::core::option::Option, -} -/// MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response 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 = "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse")] -pub struct MsgSubmitEvidenceResponse { - /// hash defines the hash of the evidence. - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, -} -pub struct EvidenceQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> EvidenceQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn evidence( - &self, - evidence_hash: ::prost::alloc::vec::Vec, - hash: ::prost::alloc::string::String, - ) -> Result { - QueryEvidenceRequest { - evidence_hash, - hash, - } - .query(self.querier) - } - pub fn all_evidence( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryAllEvidenceRequest { pagination }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/feegrant/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/v1.rs deleted file mode 100644 index f3afe85e..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the feegrant module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/feegrant/v1beta1.rs deleted file mode 100644 index 1c93f57e..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/feegrant/v1beta1.rs +++ /dev/null @@ -1,406 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// BasicAllowance implements Allowance with a one-time grant of coins -/// that optionally expires. The grantee can use up to SpendLimit to cover fees. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.BasicAllowance")] -pub struct BasicAllowance { - /// spend_limit specifies the maximum amount of coins that can be spent - /// by this allowance and will be updated as coins are spent. If it is - /// empty, there is no spend limit and any amount of coins can be spent. - #[prost(message, repeated, tag = "1")] - pub spend_limit: ::prost::alloc::vec::Vec, - /// expiration specifies an optional time when this allowance expires - #[prost(message, optional, tag = "2")] - pub expiration: ::core::option::Option, -} -/// PeriodicAllowance extends Allowance to allow for both a maximum cap, -/// as well as a limit per time period. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.PeriodicAllowance")] -pub struct PeriodicAllowance { - /// basic specifies a struct of `BasicAllowance` - #[prost(message, optional, tag = "1")] - pub basic: ::core::option::Option, - /// period specifies the time duration in which period_spend_limit coins can - /// be spent before that allowance is reset - #[prost(message, optional, tag = "2")] - pub period: ::core::option::Option, - /// period_spend_limit specifies the maximum number of coins that can be spent - /// in the period - #[prost(message, repeated, tag = "3")] - pub period_spend_limit: ::prost::alloc::vec::Vec, - /// period_can_spend is the number of coins left to be spent before the period_reset time - #[prost(message, repeated, tag = "4")] - pub period_can_spend: ::prost::alloc::vec::Vec, - /// period_reset is the time at which this period resets and a new one begins, - /// it is calculated from the start time of the first transaction after the - /// last period ended - #[prost(message, optional, tag = "5")] - pub period_reset: ::core::option::Option, -} -/// AllowedMsgAllowance creates allowance only for specified message types. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.AllowedMsgAllowance")] -pub struct AllowedMsgAllowance { - /// allowance can be any of basic and periodic fee allowance. - #[prost(message, optional, tag = "1")] - pub allowance: ::core::option::Option, - /// allowed_messages are the messages for which the grantee has the access. - #[prost(string, repeated, tag = "2")] - pub allowed_messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Grant is stored in the KVStore to record a grant with full context -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.Grant")] -pub struct Grant { - /// granter is the address of the user granting an allowance of their funds. - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// grantee is the address of the user being granted an allowance of another user's funds. - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - /// allowance can be any of basic, periodic, allowed fee allowance. - #[prost(message, optional, tag = "3")] - pub allowance: ::core::option::Option, -} -/// GenesisState contains a set of fee allowances, persisted from the store -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.GenesisState")] -pub struct GenesisState { - #[prost(message, repeated, tag = "1")] - pub allowances: ::prost::alloc::vec::Vec, -} -/// QueryAllowanceRequest is the request type for the Query/Allowance 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 = "/cosmos.feegrant.v1beta1.QueryAllowanceRequest")] -#[proto_query( - path = "/cosmos.feegrant.v1beta1.Query/Allowance", - response_type = QueryAllowanceResponse -)] -pub struct QueryAllowanceRequest { - /// granter is the address of the user granting an allowance of their funds. - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// grantee is the address of the user being granted an allowance of another user's funds. - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, -} -/// QueryAllowanceResponse is the response type for the Query/Allowance 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 = "/cosmos.feegrant.v1beta1.QueryAllowanceResponse")] -pub struct QueryAllowanceResponse { - /// allowance is a allowance granted for grantee by granter. - #[prost(message, optional, tag = "1")] - pub allowance: ::core::option::Option, -} -/// QueryAllowancesRequest is the request type for the Query/Allowances 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 = "/cosmos.feegrant.v1beta1.QueryAllowancesRequest")] -#[proto_query( - path = "/cosmos.feegrant.v1beta1.Query/Allowances", - response_type = QueryAllowancesResponse -)] -pub struct QueryAllowancesRequest { - #[prost(string, tag = "1")] - pub grantee: ::prost::alloc::string::String, - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryAllowancesResponse is the response type for the Query/Allowances 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 = "/cosmos.feegrant.v1beta1.QueryAllowancesResponse")] -pub struct QueryAllowancesResponse { - /// allowances are allowance's granted for grantee by granter. - #[prost(message, repeated, tag = "1")] - pub allowances: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest")] -#[proto_query( - path = "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter", - response_type = QueryAllowancesByGranterResponse -)] -pub struct QueryAllowancesByGranterRequest { - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// pagination defines an pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse")] -pub struct QueryAllowancesByGranterResponse { - /// allowances that have been issued by the granter. - #[prost(message, repeated, tag = "1")] - pub allowances: ::prost::alloc::vec::Vec, - /// pagination defines an pagination for the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// MsgGrantAllowance adds permission for Grantee to spend up to Allowance -/// of fees from the account of Granter. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.MsgGrantAllowance")] -pub struct MsgGrantAllowance { - /// granter is the address of the user granting an allowance of their funds. - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// grantee is the address of the user being granted an allowance of another user's funds. - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, - /// allowance can be any of basic, periodic, allowed fee allowance. - #[prost(message, optional, tag = "3")] - pub allowance: ::core::option::Option, -} -/// MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response 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 = "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse")] -pub struct MsgGrantAllowanceResponse {} -/// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.MsgRevokeAllowance")] -pub struct MsgRevokeAllowance { - /// granter is the address of the user granting an allowance of their funds. - #[prost(string, tag = "1")] - pub granter: ::prost::alloc::string::String, - /// grantee is the address of the user being granted an allowance of another user's funds. - #[prost(string, tag = "2")] - pub grantee: ::prost::alloc::string::String, -} -/// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response 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 = "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse")] -pub struct MsgRevokeAllowanceResponse {} -/// MsgPruneAllowances prunes expired fee allowances. -/// -/// Since cosmos-sdk 0.50 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.MsgPruneAllowances")] -pub struct MsgPruneAllowances { - /// pruner is the address of the user pruning expired allowances. - #[prost(string, tag = "1")] - pub pruner: ::prost::alloc::string::String, -} -/// MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. -/// -/// Since cosmos-sdk 0.50 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse")] -pub struct MsgPruneAllowancesResponse {} -pub struct FeegrantQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> FeegrantQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn allowance( - &self, - granter: ::prost::alloc::string::String, - grantee: ::prost::alloc::string::String, - ) -> Result { - QueryAllowanceRequest { granter, grantee }.query(self.querier) - } - pub fn allowances( - &self, - grantee: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryAllowancesRequest { - grantee, - pagination, - } - .query(self.querier) - } - pub fn allowances_by_granter( - &self, - granter: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryAllowancesByGranterRequest { - granter, - pagination, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/genutil/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/genutil/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/genutil/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/genutil/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/genutil/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/genutil/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/genutil/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/genutil/module/v1.rs deleted file mode 100644 index f5306efb..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/genutil/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object for the genutil module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.genutil.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/genutil/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/genutil/v1beta1.rs deleted file mode 100644 index ad6c93eb..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/genutil/v1beta1.rs +++ /dev/null @@ -1,19 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenesisState defines the raw genesis transaction in JSON. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.genutil.v1beta1.GenesisState")] -pub struct GenesisState { - /// gen_txs defines the genesis transactions. - #[prost(bytes = "vec", repeated, tag = "1")] - pub gen_txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/gov/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/gov/mod.rs deleted file mode 100644 index 316ad46f..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/gov/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod module; -pub mod v1; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/gov/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/gov/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/gov/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/gov/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/gov/module/v1.rs deleted file mode 100644 index 7773f35d..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/gov/module/v1.rs +++ /dev/null @@ -1,27 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the gov module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.module.v1.Module")] -pub struct Module { - /// max_metadata_len defines the maximum proposal metadata length. - /// Defaults to 255 if not explicitly set. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_metadata_len: u64, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/gov/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/gov/v1.rs deleted file mode 100644 index cb1c0d4b..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/gov/v1.rs +++ /dev/null @@ -1,1363 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// WeightedVoteOption defines a unit of vote for vote split. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.WeightedVoteOption")] -pub struct WeightedVoteOption { - /// option defines the valid vote options, it must not contain duplicate vote options. - #[prost(enumeration = "VoteOption", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, - /// weight is the vote weight associated with the vote option. - #[prost(string, tag = "2")] - pub weight: ::prost::alloc::string::String, -} -/// Deposit defines an amount deposited by an account address to an active -/// proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.Deposit")] -pub struct Deposit { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, - /// amount to be deposited by depositor. - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// Proposal defines the core field members of a governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.Proposal")] -pub struct Proposal { - /// id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - /// messages are the arbitrary messages to be executed if the proposal passes. - #[prost(message, repeated, tag = "2")] - pub messages: ::prost::alloc::vec::Vec, - /// status defines the proposal status. - #[prost(enumeration = "ProposalStatus", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, - /// final_tally_result is the final tally result of the proposal. When - /// querying a proposal via gRPC, this field is not populated until the - /// proposal's voting period has ended. - #[prost(message, optional, tag = "4")] - pub final_tally_result: ::core::option::Option, - /// submit_time is the time of proposal submission. - #[prost(message, optional, tag = "5")] - pub submit_time: ::core::option::Option, - /// deposit_end_time is the end time for deposition. - #[prost(message, optional, tag = "6")] - pub deposit_end_time: ::core::option::Option, - /// total_deposit is the total deposit on the proposal. - #[prost(message, repeated, tag = "7")] - pub total_deposit: ::prost::alloc::vec::Vec, - /// voting_start_time is the starting time to vote on a proposal. - #[prost(message, optional, tag = "8")] - pub voting_start_time: ::core::option::Option, - /// voting_end_time is the end time of voting on a proposal. - #[prost(message, optional, tag = "9")] - pub voting_end_time: ::core::option::Option, - /// metadata is any arbitrary metadata attached to the proposal. - /// the recommended format of the metadata is to be found here: - /// - #[prost(string, tag = "10")] - pub metadata: ::prost::alloc::string::String, - /// title is the title of the proposal - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "11")] - pub title: ::prost::alloc::string::String, - /// summary is a short summary of the proposal - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "12")] - pub summary: ::prost::alloc::string::String, - /// proposer is the address of the proposal sumbitter - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "13")] - pub proposer: ::prost::alloc::string::String, - /// expedited defines if the proposal is expedited - /// - /// Since: cosmos-sdk 0.50 - #[prost(bool, tag = "14")] - pub expedited: bool, - /// failed_reason defines the reason why the proposal failed - /// - /// Since: cosmos-sdk 0.50 - #[prost(string, tag = "15")] - pub failed_reason: ::prost::alloc::string::String, -} -/// TallyResult defines a standard tally for a governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.TallyResult")] -pub struct TallyResult { - /// yes_count is the number of yes votes on a proposal. - #[prost(string, tag = "1")] - pub yes_count: ::prost::alloc::string::String, - /// abstain_count is the number of abstain votes on a proposal. - #[prost(string, tag = "2")] - pub abstain_count: ::prost::alloc::string::String, - /// no_count is the number of no votes on a proposal. - #[prost(string, tag = "3")] - pub no_count: ::prost::alloc::string::String, - /// no_with_veto_count is the number of no with veto votes on a proposal. - #[prost(string, tag = "4")] - pub no_with_veto_count: ::prost::alloc::string::String, -} -/// Vote defines a vote on a governance proposal. -/// A Vote consists of a proposal ID, the voter, and the vote option. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.Vote")] -pub struct Vote { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter address of the proposal. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// options is the weighted vote options. - #[prost(message, repeated, tag = "4")] - pub options: ::prost::alloc::vec::Vec, - /// metadata is any arbitrary metadata attached to the vote. - /// the recommended format of the metadata is to be found here: - #[prost(string, tag = "5")] - pub metadata: ::prost::alloc::string::String, -} -/// DepositParams defines the params for deposits on governance proposals. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.DepositParams")] -#[deprecated] -pub struct DepositParams { - /// Minimum deposit for a proposal to enter voting period. - #[prost(message, repeated, tag = "1")] - pub min_deposit: ::prost::alloc::vec::Vec, - /// Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - /// months. - #[prost(message, optional, tag = "2")] - pub max_deposit_period: ::core::option::Option, -} -/// VotingParams defines the params for voting on governance proposals. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.VotingParams")] -#[deprecated] -pub struct VotingParams { - /// Duration of the voting period. - #[prost(message, optional, tag = "1")] - pub voting_period: ::core::option::Option, -} -/// TallyParams defines the params for tallying votes on governance proposals. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.TallyParams")] -#[deprecated] -pub struct TallyParams { - /// Minimum percentage of total stake needed to vote for a result to be - /// considered valid. - #[prost(string, tag = "1")] - pub quorum: ::prost::alloc::string::String, - /// Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - #[prost(string, tag = "2")] - pub threshold: ::prost::alloc::string::String, - /// Minimum value of Veto votes to Total votes ratio for proposal to be - /// vetoed. Default value: 1/3. - #[prost(string, tag = "3")] - pub veto_threshold: ::prost::alloc::string::String, -} -/// Params defines the parameters for the x/gov module. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.Params")] -pub struct Params { - /// Minimum deposit for a proposal to enter voting period. - #[prost(message, repeated, tag = "1")] - pub min_deposit: ::prost::alloc::vec::Vec, - /// Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - /// months. - #[prost(message, optional, tag = "2")] - pub max_deposit_period: ::core::option::Option, - /// Duration of the voting period. - #[prost(message, optional, tag = "3")] - pub voting_period: ::core::option::Option, - /// Minimum percentage of total stake needed to vote for a result to be - /// considered valid. - #[prost(string, tag = "4")] - pub quorum: ::prost::alloc::string::String, - /// Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - #[prost(string, tag = "5")] - pub threshold: ::prost::alloc::string::String, - /// Minimum value of Veto votes to Total votes ratio for proposal to be - /// vetoed. Default value: 1/3. - #[prost(string, tag = "6")] - pub veto_threshold: ::prost::alloc::string::String, - /// The ratio representing the proportion of the deposit value that must be paid at proposal submission. - #[prost(string, tag = "7")] - pub min_initial_deposit_ratio: ::prost::alloc::string::String, - /// The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. - /// - /// Since: cosmos-sdk 0.50 - #[prost(string, tag = "8")] - pub proposal_cancel_ratio: ::prost::alloc::string::String, - /// The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. - /// If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. - /// - /// Since: cosmos-sdk 0.50 - #[prost(string, tag = "9")] - pub proposal_cancel_dest: ::prost::alloc::string::String, - /// Duration of the voting period of an expedited proposal. - /// - /// Since: cosmos-sdk 0.50 - #[prost(message, optional, tag = "10")] - pub expedited_voting_period: ::core::option::Option, - /// Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. - /// - /// Since: cosmos-sdk 0.50 - #[prost(string, tag = "11")] - pub expedited_threshold: ::prost::alloc::string::String, - /// Minimum expedited deposit for a proposal to enter voting period. - #[prost(message, repeated, tag = "12")] - pub expedited_min_deposit: ::prost::alloc::vec::Vec, - /// burn deposits if a proposal does not meet quorum - #[prost(bool, tag = "13")] - pub burn_vote_quorum: bool, - /// burn deposits if the proposal does not enter voting period - #[prost(bool, tag = "14")] - pub burn_proposal_deposit_prevote: bool, - /// burn deposits if quorum with vote type no_veto is met - #[prost(bool, tag = "15")] - pub burn_vote_veto: bool, - /// The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. - /// Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be - /// required. - /// - /// Since: cosmos-sdk 0.50 - #[prost(string, tag = "16")] - pub min_deposit_ratio: ::prost::alloc::string::String, -} -/// VoteOption enumerates the valid vote options for a given governance proposal. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum VoteOption { - /// VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - Unspecified = 0, - /// VOTE_OPTION_YES defines a yes vote option. - Yes = 1, - /// VOTE_OPTION_ABSTAIN defines an abstain vote option. - Abstain = 2, - /// VOTE_OPTION_NO defines a no vote option. - No = 3, - /// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - NoWithVeto = 4, -} -impl VoteOption { - /// 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 { - VoteOption::Unspecified => "VOTE_OPTION_UNSPECIFIED", - VoteOption::Yes => "VOTE_OPTION_YES", - VoteOption::Abstain => "VOTE_OPTION_ABSTAIN", - VoteOption::No => "VOTE_OPTION_NO", - VoteOption::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VOTE_OPTION_UNSPECIFIED" => Some(Self::Unspecified), - "VOTE_OPTION_YES" => Some(Self::Yes), - "VOTE_OPTION_ABSTAIN" => Some(Self::Abstain), - "VOTE_OPTION_NO" => Some(Self::No), - "VOTE_OPTION_NO_WITH_VETO" => Some(Self::NoWithVeto), - _ => None, - } - } -} -/// ProposalStatus enumerates the valid statuses of a proposal. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum ProposalStatus { - /// PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - Unspecified = 0, - /// PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - /// period. - DepositPeriod = 1, - /// PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - /// period. - VotingPeriod = 2, - /// PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - /// passed. - Passed = 3, - /// PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - /// been rejected. - Rejected = 4, - /// PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - /// failed. - Failed = 5, -} -impl ProposalStatus { - /// 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 { - ProposalStatus::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", - ProposalStatus::DepositPeriod => "PROPOSAL_STATUS_DEPOSIT_PERIOD", - ProposalStatus::VotingPeriod => "PROPOSAL_STATUS_VOTING_PERIOD", - ProposalStatus::Passed => "PROPOSAL_STATUS_PASSED", - ProposalStatus::Rejected => "PROPOSAL_STATUS_REJECTED", - ProposalStatus::Failed => "PROPOSAL_STATUS_FAILED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "PROPOSAL_STATUS_UNSPECIFIED" => Some(Self::Unspecified), - "PROPOSAL_STATUS_DEPOSIT_PERIOD" => Some(Self::DepositPeriod), - "PROPOSAL_STATUS_VOTING_PERIOD" => Some(Self::VotingPeriod), - "PROPOSAL_STATUS_PASSED" => Some(Self::Passed), - "PROPOSAL_STATUS_REJECTED" => Some(Self::Rejected), - "PROPOSAL_STATUS_FAILED" => Some(Self::Failed), - _ => None, - } - } -} -/// GenesisState defines the gov module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.GenesisState")] -pub struct GenesisState { - /// starting_proposal_id is the ID of the starting proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "starting_proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub starting_proposal_id: u64, - /// deposits defines all the deposits present at genesis. - #[prost(message, repeated, tag = "2")] - pub deposits: ::prost::alloc::vec::Vec, - /// votes defines all the votes present at genesis. - #[prost(message, repeated, tag = "3")] - pub votes: ::prost::alloc::vec::Vec, - /// proposals defines all the proposals present at genesis. - #[prost(message, repeated, tag = "4")] - pub proposals: ::prost::alloc::vec::Vec, - /// Deprecated: Prefer to use `params` instead. - /// deposit_params defines all the paramaters of related to deposit. - #[deprecated] - #[prost(message, optional, tag = "5")] - pub deposit_params: ::core::option::Option, - /// Deprecated: Prefer to use `params` instead. - /// voting_params defines all the paramaters of related to voting. - #[deprecated] - #[prost(message, optional, tag = "6")] - pub voting_params: ::core::option::Option, - /// Deprecated: Prefer to use `params` instead. - /// tally_params defines all the paramaters of related to tally. - #[deprecated] - #[prost(message, optional, tag = "7")] - pub tally_params: ::core::option::Option, - /// params defines all the paramaters of x/gov module. - /// - /// Since: cosmos-sdk 0.47 - #[prost(message, optional, tag = "8")] - pub params: ::core::option::Option, - /// The constitution allows builders to lay a foundation and define purpose. - /// This is an immutable string set in genesis. - /// There are no amendments, to go outside of scope, just fork. - /// constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. - /// - /// Since: cosmos-sdk 0.50 - #[prost(string, tag = "9")] - pub constitution: ::prost::alloc::string::String, -} -/// QueryConstitutionRequest is the request type for the Query/Constitution 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 = "/cosmos.gov.v1.QueryConstitutionRequest")] -#[proto_query( - path = "/cosmos.gov.v1.Query/Constitution", - response_type = QueryConstitutionResponse -)] -pub struct QueryConstitutionRequest {} -/// QueryConstitutionResponse is the response type for the Query/Constitution 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 = "/cosmos.gov.v1.QueryConstitutionResponse")] -pub struct QueryConstitutionResponse { - #[prost(string, tag = "1")] - pub constitution: ::prost::alloc::string::String, -} -/// QueryProposalRequest is the request type for the Query/Proposal 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 = "/cosmos.gov.v1.QueryProposalRequest")] -#[proto_query( - path = "/cosmos.gov.v1.Query/Proposal", - response_type = QueryProposalResponse -)] -pub struct QueryProposalRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// QueryProposalResponse is the response type for the Query/Proposal 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 = "/cosmos.gov.v1.QueryProposalResponse")] -pub struct QueryProposalResponse { - /// proposal is the requested governance proposal. - #[prost(message, optional, tag = "1")] - pub proposal: ::core::option::Option, -} -/// QueryProposalsRequest is the request type for the Query/Proposals 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 = "/cosmos.gov.v1.QueryProposalsRequest")] -#[proto_query( - path = "/cosmos.gov.v1.Query/Proposals", - response_type = QueryProposalsResponse -)] -pub struct QueryProposalsRequest { - /// proposal_status defines the status of the proposals. - #[prost(enumeration = "ProposalStatus", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_status: i32, - /// voter defines the voter address for the proposals. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "3")] - pub depositor: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "4")] - pub pagination: ::core::option::Option, -} -/// QueryProposalsResponse is the response type for the Query/Proposals 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 = "/cosmos.gov.v1.QueryProposalsResponse")] -pub struct QueryProposalsResponse { - /// proposals defines all the requested governance proposals. - #[prost(message, repeated, tag = "1")] - pub proposals: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVoteRequest is the request type for the Query/Vote 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 = "/cosmos.gov.v1.QueryVoteRequest")] -#[proto_query(path = "/cosmos.gov.v1.Query/Vote", response_type = QueryVoteResponse)] -pub struct QueryVoteRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter defines the voter address for the proposals. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, -} -/// QueryVoteResponse is the response type for the Query/Vote 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 = "/cosmos.gov.v1.QueryVoteResponse")] -pub struct QueryVoteResponse { - /// vote defines the queried vote. - #[prost(message, optional, tag = "1")] - pub vote: ::core::option::Option, -} -/// QueryVotesRequest is the request type for the Query/Votes 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 = "/cosmos.gov.v1.QueryVotesRequest")] -#[proto_query(path = "/cosmos.gov.v1.Query/Votes", response_type = QueryVotesResponse)] -pub struct QueryVotesRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVotesResponse is the response type for the Query/Votes 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 = "/cosmos.gov.v1.QueryVotesResponse")] -pub struct QueryVotesResponse { - /// votes defines the queried votes. - #[prost(message, repeated, tag = "1")] - pub votes: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmos.gov.v1.QueryParamsRequest")] -#[proto_query(path = "/cosmos.gov.v1.Query/Params", response_type = QueryParamsResponse)] -pub struct QueryParamsRequest { - /// params_type defines which parameters to query for, can be one of "voting", - /// "tallying" or "deposit". - #[prost(string, tag = "1")] - pub params_type: ::prost::alloc::string::String, -} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmos.gov.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// Deprecated: Prefer to use `params` instead. - /// voting_params defines the parameters related to voting. - #[deprecated] - #[prost(message, optional, tag = "1")] - pub voting_params: ::core::option::Option, - /// Deprecated: Prefer to use `params` instead. - /// deposit_params defines the parameters related to deposit. - #[deprecated] - #[prost(message, optional, tag = "2")] - pub deposit_params: ::core::option::Option, - /// Deprecated: Prefer to use `params` instead. - /// tally_params defines the parameters related to tally. - #[deprecated] - #[prost(message, optional, tag = "3")] - pub tally_params: ::core::option::Option, - /// params defines all the paramaters of x/gov module. - /// - /// Since: cosmos-sdk 0.47 - #[prost(message, optional, tag = "4")] - pub params: ::core::option::Option, -} -/// QueryDepositRequest is the request type for the Query/Deposit 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 = "/cosmos.gov.v1.QueryDepositRequest")] -#[proto_query( - path = "/cosmos.gov.v1.Query/Deposit", - response_type = QueryDepositResponse -)] -pub struct QueryDepositRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, -} -/// QueryDepositResponse is the response type for the Query/Deposit 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 = "/cosmos.gov.v1.QueryDepositResponse")] -pub struct QueryDepositResponse { - /// deposit defines the requested deposit. - #[prost(message, optional, tag = "1")] - pub deposit: ::core::option::Option, -} -/// QueryDepositsRequest is the request type for the Query/Deposits 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 = "/cosmos.gov.v1.QueryDepositsRequest")] -#[proto_query( - path = "/cosmos.gov.v1.Query/Deposits", - response_type = QueryDepositsResponse -)] -pub struct QueryDepositsRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDepositsResponse is the response type for the Query/Deposits 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 = "/cosmos.gov.v1.QueryDepositsResponse")] -pub struct QueryDepositsResponse { - /// deposits defines the requested deposits. - #[prost(message, repeated, tag = "1")] - pub deposits: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryTallyResultRequest is the request type for the Query/Tally 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 = "/cosmos.gov.v1.QueryTallyResultRequest")] -#[proto_query( - path = "/cosmos.gov.v1.Query/TallyResult", - response_type = QueryTallyResultResponse -)] -pub struct QueryTallyResultRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// QueryTallyResultResponse is the response type for the Query/Tally 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 = "/cosmos.gov.v1.QueryTallyResultResponse")] -pub struct QueryTallyResultResponse { - /// tally defines the requested tally. - #[prost(message, optional, tag = "1")] - pub tally: ::core::option::Option, -} -/// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary -/// proposal Content. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgSubmitProposal")] -pub struct MsgSubmitProposal { - /// messages are the arbitrary messages to be executed if proposal passes. - #[prost(message, repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec, - /// initial_deposit is the deposit value that must be paid at proposal submission. - #[prost(message, repeated, tag = "2")] - pub initial_deposit: ::prost::alloc::vec::Vec, - /// proposer is the account address of the proposer. - #[prost(string, tag = "3")] - pub proposer: ::prost::alloc::string::String, - /// metadata is any arbitrary metadata attached to the proposal. - #[prost(string, tag = "4")] - pub metadata: ::prost::alloc::string::String, - /// title is the title of the proposal. - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "5")] - pub title: ::prost::alloc::string::String, - /// summary is the summary of the proposal - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "6")] - pub summary: ::prost::alloc::string::String, - /// expedited defines if the proposal is expedited or not - /// - /// Since: cosmos-sdk 0.50 - #[prost(bool, tag = "7")] - pub expedited: bool, -} -/// MsgSubmitProposalResponse defines the Msg/SubmitProposal response 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 = "/cosmos.gov.v1.MsgSubmitProposalResponse")] -pub struct MsgSubmitProposalResponse { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// MsgExecLegacyContent is used to wrap the legacy content field into a message. -/// This ensures backwards compatibility with v1beta1.MsgSubmitProposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgExecLegacyContent")] -pub struct MsgExecLegacyContent { - /// content is the proposal's content. - #[prost(message, optional, tag = "1")] - pub content: ::core::option::Option, - /// authority must be the gov module address. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} -/// MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response 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 = "/cosmos.gov.v1.MsgExecLegacyContentResponse")] -pub struct MsgExecLegacyContentResponse {} -/// MsgVote defines a message to cast a vote. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgVote")] -pub struct MsgVote { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter address for the proposal. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// option defines the vote option. - #[prost(enumeration = "VoteOption", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, - /// metadata is any arbitrary metadata attached to the Vote. - #[prost(string, tag = "4")] - pub metadata: ::prost::alloc::string::String, -} -/// MsgVoteResponse defines the Msg/Vote response 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 = "/cosmos.gov.v1.MsgVoteResponse")] -pub struct MsgVoteResponse {} -/// MsgVoteWeighted defines a message to cast a vote. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgVoteWeighted")] -pub struct MsgVoteWeighted { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter address for the proposal. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// options defines the weighted vote options. - #[prost(message, repeated, tag = "3")] - pub options: ::prost::alloc::vec::Vec, - /// metadata is any arbitrary metadata attached to the VoteWeighted. - #[prost(string, tag = "4")] - pub metadata: ::prost::alloc::string::String, -} -/// MsgVoteWeightedResponse defines the Msg/VoteWeighted response 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 = "/cosmos.gov.v1.MsgVoteWeightedResponse")] -pub struct MsgVoteWeightedResponse {} -/// MsgDeposit defines a message to submit a deposit to an existing proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgDeposit")] -pub struct MsgDeposit { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, - /// amount to be deposited by depositor. - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgDepositResponse defines the Msg/Deposit response 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 = "/cosmos.gov.v1.MsgDepositResponse")] -pub struct MsgDepositResponse {} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/gov parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -/// MsgCancelProposal is the Msg/CancelProposal request type. -/// -/// Since: cosmos-sdk 0.50 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgCancelProposal")] -pub struct MsgCancelProposal { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// proposer is the account address of the proposer. - #[prost(string, tag = "2")] - pub proposer: ::prost::alloc::string::String, -} -/// MsgCancelProposalResponse defines the response structure for executing a -/// MsgCancelProposal message. -/// -/// Since: cosmos-sdk 0.50 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1.MsgCancelProposalResponse")] -pub struct MsgCancelProposalResponse { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// canceled_time is the time when proposal is canceled. - #[prost(message, optional, tag = "2")] - pub canceled_time: ::core::option::Option, - /// canceled_height defines the block height at which the proposal is canceled. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub canceled_height: u64, -} -pub struct GovQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> GovQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn constitution(&self) -> Result { - QueryConstitutionRequest {}.query(self.querier) - } - pub fn proposal( - &self, - proposal_id: u64, - ) -> Result { - QueryProposalRequest { proposal_id }.query(self.querier) - } - pub fn proposals( - &self, - proposal_status: i32, - voter: ::prost::alloc::string::String, - depositor: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryProposalsRequest { - proposal_status, - voter, - depositor, - pagination, - } - .query(self.querier) - } - pub fn vote( - &self, - proposal_id: u64, - voter: ::prost::alloc::string::String, - ) -> Result { - QueryVoteRequest { proposal_id, voter }.query(self.querier) - } - pub fn votes( - &self, - proposal_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryVotesRequest { - proposal_id, - pagination, - } - .query(self.querier) - } - pub fn params( - &self, - params_type: ::prost::alloc::string::String, - ) -> Result { - QueryParamsRequest { params_type }.query(self.querier) - } - pub fn deposit( - &self, - proposal_id: u64, - depositor: ::prost::alloc::string::String, - ) -> Result { - QueryDepositRequest { - proposal_id, - depositor, - } - .query(self.querier) - } - pub fn deposits( - &self, - proposal_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryDepositsRequest { - proposal_id, - pagination, - } - .query(self.querier) - } - pub fn tally_result( - &self, - proposal_id: u64, - ) -> Result { - QueryTallyResultRequest { proposal_id }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/gov/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/gov/v1beta1.rs deleted file mode 100644 index 76f0ccaa..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/gov/v1beta1.rs +++ /dev/null @@ -1,1071 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// WeightedVoteOption defines a unit of vote for vote split. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.WeightedVoteOption")] -pub struct WeightedVoteOption { - /// option defines the valid vote options, it must not contain duplicate vote options. - #[prost(enumeration = "VoteOption", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, - /// weight is the vote weight associated with the vote option. - #[prost(string, tag = "2")] - pub weight: ::prost::alloc::string::String, -} -/// TextProposal defines a standard text proposal whose changes need to be -/// manually updated in case of approval. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.TextProposal")] -pub struct TextProposal { - /// title of the proposal. - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// description associated with the proposal. - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, -} -/// Deposit defines an amount deposited by an account address to an active -/// proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.Deposit")] -pub struct Deposit { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, - /// amount to be deposited by depositor. - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// Proposal defines the core field members of a governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.Proposal")] -pub struct Proposal { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// content is the proposal's content. - #[prost(message, optional, tag = "2")] - pub content: ::core::option::Option, - /// status defines the proposal status. - #[prost(enumeration = "ProposalStatus", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, - /// final_tally_result is the final tally result of the proposal. When - /// querying a proposal via gRPC, this field is not populated until the - /// proposal's voting period has ended. - #[prost(message, optional, tag = "4")] - pub final_tally_result: ::core::option::Option, - /// submit_time is the time of proposal submission. - #[prost(message, optional, tag = "5")] - pub submit_time: ::core::option::Option, - /// deposit_end_time is the end time for deposition. - #[prost(message, optional, tag = "6")] - pub deposit_end_time: ::core::option::Option, - /// total_deposit is the total deposit on the proposal. - #[prost(message, repeated, tag = "7")] - pub total_deposit: ::prost::alloc::vec::Vec, - /// voting_start_time is the starting time to vote on a proposal. - #[prost(message, optional, tag = "8")] - pub voting_start_time: ::core::option::Option, - /// voting_end_time is the end time of voting on a proposal. - #[prost(message, optional, tag = "9")] - pub voting_end_time: ::core::option::Option, -} -/// TallyResult defines a standard tally for a governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.TallyResult")] -pub struct TallyResult { - /// yes is the number of yes votes on a proposal. - #[prost(string, tag = "1")] - pub yes: ::prost::alloc::string::String, - /// abstain is the number of abstain votes on a proposal. - #[prost(string, tag = "2")] - pub abstain: ::prost::alloc::string::String, - /// no is the number of no votes on a proposal. - #[prost(string, tag = "3")] - pub no: ::prost::alloc::string::String, - /// no_with_veto is the number of no with veto votes on a proposal. - #[prost(string, tag = "4")] - pub no_with_veto: ::prost::alloc::string::String, -} -/// Vote defines a vote on a governance proposal. -/// A Vote consists of a proposal ID, the voter, and the vote option. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.Vote")] -pub struct Vote { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter address of the proposal. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// Deprecated: Prefer to use `options` instead. This field is set in queries - /// if and only if `len(options) == 1` and that option has weight 1. In all - /// other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - #[deprecated] - #[prost(enumeration = "VoteOption", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, - /// options is the weighted vote options. - /// - /// Since: cosmos-sdk 0.43 - #[prost(message, repeated, tag = "4")] - pub options: ::prost::alloc::vec::Vec, -} -/// DepositParams defines the params for deposits on governance proposals. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.DepositParams")] -pub struct DepositParams { - /// Minimum deposit for a proposal to enter voting period. - #[prost(message, repeated, tag = "1")] - pub min_deposit: ::prost::alloc::vec::Vec, - /// Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - /// months. - #[prost(message, optional, tag = "2")] - pub max_deposit_period: ::core::option::Option, -} -/// VotingParams defines the params for voting on governance proposals. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.VotingParams")] -pub struct VotingParams { - /// Duration of the voting period. - #[prost(message, optional, tag = "1")] - pub voting_period: ::core::option::Option, -} -/// TallyParams defines the params for tallying votes on governance proposals. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.TallyParams")] -pub struct TallyParams { - /// Minimum percentage of total stake needed to vote for a result to be - /// considered valid. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub quorum: ::prost::alloc::vec::Vec, - /// Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub threshold: ::prost::alloc::vec::Vec, - /// Minimum value of Veto votes to Total votes ratio for proposal to be - /// vetoed. Default value: 1/3. - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub veto_threshold: ::prost::alloc::vec::Vec, -} -/// VoteOption enumerates the valid vote options for a given governance proposal. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum VoteOption { - /// VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - Unspecified = 0, - /// VOTE_OPTION_YES defines a yes vote option. - Yes = 1, - /// VOTE_OPTION_ABSTAIN defines an abstain vote option. - Abstain = 2, - /// VOTE_OPTION_NO defines a no vote option. - No = 3, - /// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - NoWithVeto = 4, -} -impl VoteOption { - /// 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 { - VoteOption::Unspecified => "VOTE_OPTION_UNSPECIFIED", - VoteOption::Yes => "VOTE_OPTION_YES", - VoteOption::Abstain => "VOTE_OPTION_ABSTAIN", - VoteOption::No => "VOTE_OPTION_NO", - VoteOption::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VOTE_OPTION_UNSPECIFIED" => Some(Self::Unspecified), - "VOTE_OPTION_YES" => Some(Self::Yes), - "VOTE_OPTION_ABSTAIN" => Some(Self::Abstain), - "VOTE_OPTION_NO" => Some(Self::No), - "VOTE_OPTION_NO_WITH_VETO" => Some(Self::NoWithVeto), - _ => None, - } - } -} -/// ProposalStatus enumerates the valid statuses of a proposal. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum ProposalStatus { - /// PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - Unspecified = 0, - /// PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - /// period. - DepositPeriod = 1, - /// PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - /// period. - VotingPeriod = 2, - /// PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - /// passed. - Passed = 3, - /// PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - /// been rejected. - Rejected = 4, - /// PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - /// failed. - Failed = 5, -} -impl ProposalStatus { - /// 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 { - ProposalStatus::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", - ProposalStatus::DepositPeriod => "PROPOSAL_STATUS_DEPOSIT_PERIOD", - ProposalStatus::VotingPeriod => "PROPOSAL_STATUS_VOTING_PERIOD", - ProposalStatus::Passed => "PROPOSAL_STATUS_PASSED", - ProposalStatus::Rejected => "PROPOSAL_STATUS_REJECTED", - ProposalStatus::Failed => "PROPOSAL_STATUS_FAILED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "PROPOSAL_STATUS_UNSPECIFIED" => Some(Self::Unspecified), - "PROPOSAL_STATUS_DEPOSIT_PERIOD" => Some(Self::DepositPeriod), - "PROPOSAL_STATUS_VOTING_PERIOD" => Some(Self::VotingPeriod), - "PROPOSAL_STATUS_PASSED" => Some(Self::Passed), - "PROPOSAL_STATUS_REJECTED" => Some(Self::Rejected), - "PROPOSAL_STATUS_FAILED" => Some(Self::Failed), - _ => None, - } - } -} -/// GenesisState defines the gov module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.GenesisState")] -pub struct GenesisState { - /// starting_proposal_id is the ID of the starting proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "starting_proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub starting_proposal_id: u64, - /// deposits defines all the deposits present at genesis. - #[prost(message, repeated, tag = "2")] - pub deposits: ::prost::alloc::vec::Vec, - /// votes defines all the votes present at genesis. - #[prost(message, repeated, tag = "3")] - pub votes: ::prost::alloc::vec::Vec, - /// proposals defines all the proposals present at genesis. - #[prost(message, repeated, tag = "4")] - pub proposals: ::prost::alloc::vec::Vec, - /// deposit_params defines all the parameters related to deposit. - #[prost(message, optional, tag = "5")] - pub deposit_params: ::core::option::Option, - /// voting_params defines all the parameters related to voting. - #[prost(message, optional, tag = "6")] - pub voting_params: ::core::option::Option, - /// tally_params defines all the parameters related to tally. - #[prost(message, optional, tag = "7")] - pub tally_params: ::core::option::Option, -} -/// QueryProposalRequest is the request type for the Query/Proposal 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 = "/cosmos.gov.v1beta1.QueryProposalRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Proposal", - response_type = QueryProposalResponse -)] -pub struct QueryProposalRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// QueryProposalResponse is the response type for the Query/Proposal 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 = "/cosmos.gov.v1beta1.QueryProposalResponse")] -pub struct QueryProposalResponse { - #[prost(message, optional, tag = "1")] - pub proposal: ::core::option::Option, -} -/// QueryProposalsRequest is the request type for the Query/Proposals 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 = "/cosmos.gov.v1beta1.QueryProposalsRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Proposals", - response_type = QueryProposalsResponse -)] -pub struct QueryProposalsRequest { - /// proposal_status defines the status of the proposals. - #[prost(enumeration = "ProposalStatus", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_status: i32, - /// voter defines the voter address for the proposals. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "3")] - pub depositor: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "4")] - pub pagination: ::core::option::Option, -} -/// QueryProposalsResponse is the response type for the Query/Proposals 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 = "/cosmos.gov.v1beta1.QueryProposalsResponse")] -pub struct QueryProposalsResponse { - /// proposals defines all the requested governance proposals. - #[prost(message, repeated, tag = "1")] - pub proposals: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVoteRequest is the request type for the Query/Vote 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 = "/cosmos.gov.v1beta1.QueryVoteRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Vote", - response_type = QueryVoteResponse -)] -pub struct QueryVoteRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter defines the voter address for the proposals. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, -} -/// QueryVoteResponse is the response type for the Query/Vote 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 = "/cosmos.gov.v1beta1.QueryVoteResponse")] -pub struct QueryVoteResponse { - /// vote defines the queried vote. - #[prost(message, optional, tag = "1")] - pub vote: ::core::option::Option, -} -/// QueryVotesRequest is the request type for the Query/Votes 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 = "/cosmos.gov.v1beta1.QueryVotesRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Votes", - response_type = QueryVotesResponse -)] -pub struct QueryVotesRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVotesResponse is the response type for the Query/Votes 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 = "/cosmos.gov.v1beta1.QueryVotesResponse")] -pub struct QueryVotesResponse { - /// votes defines the queried votes. - #[prost(message, repeated, tag = "1")] - pub votes: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmos.gov.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest { - /// params_type defines which parameters to query for, can be one of "voting", - /// "tallying" or "deposit". - #[prost(string, tag = "1")] - pub params_type: ::prost::alloc::string::String, -} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmos.gov.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// voting_params defines the parameters related to voting. - #[prost(message, optional, tag = "1")] - pub voting_params: ::core::option::Option, - /// deposit_params defines the parameters related to deposit. - #[prost(message, optional, tag = "2")] - pub deposit_params: ::core::option::Option, - /// tally_params defines the parameters related to tally. - #[prost(message, optional, tag = "3")] - pub tally_params: ::core::option::Option, -} -/// QueryDepositRequest is the request type for the Query/Deposit 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 = "/cosmos.gov.v1beta1.QueryDepositRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Deposit", - response_type = QueryDepositResponse -)] -pub struct QueryDepositRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, -} -/// QueryDepositResponse is the response type for the Query/Deposit 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 = "/cosmos.gov.v1beta1.QueryDepositResponse")] -pub struct QueryDepositResponse { - /// deposit defines the requested deposit. - #[prost(message, optional, tag = "1")] - pub deposit: ::core::option::Option, -} -/// QueryDepositsRequest is the request type for the Query/Deposits 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 = "/cosmos.gov.v1beta1.QueryDepositsRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/Deposits", - response_type = QueryDepositsResponse -)] -pub struct QueryDepositsRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDepositsResponse is the response type for the Query/Deposits 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 = "/cosmos.gov.v1beta1.QueryDepositsResponse")] -pub struct QueryDepositsResponse { - /// deposits defines the requested deposits. - #[prost(message, repeated, tag = "1")] - pub deposits: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryTallyResultRequest is the request type for the Query/Tally 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 = "/cosmos.gov.v1beta1.QueryTallyResultRequest")] -#[proto_query( - path = "/cosmos.gov.v1beta1.Query/TallyResult", - response_type = QueryTallyResultResponse -)] -pub struct QueryTallyResultRequest { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// QueryTallyResultResponse is the response type for the Query/Tally 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 = "/cosmos.gov.v1beta1.QueryTallyResultResponse")] -pub struct QueryTallyResultResponse { - /// tally defines the requested tally. - #[prost(message, optional, tag = "1")] - pub tally: ::core::option::Option, -} -/// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary -/// proposal Content. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.MsgSubmitProposal")] -pub struct MsgSubmitProposal { - /// content is the proposal's content. - #[prost(message, optional, tag = "1")] - pub content: ::core::option::Option, - /// initial_deposit is the deposit value that must be paid at proposal submission. - #[prost(message, repeated, tag = "2")] - pub initial_deposit: ::prost::alloc::vec::Vec, - /// proposer is the account address of the proposer. - #[prost(string, tag = "3")] - pub proposer: ::prost::alloc::string::String, -} -/// MsgSubmitProposalResponse defines the Msg/SubmitProposal response 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 = "/cosmos.gov.v1beta1.MsgSubmitProposalResponse")] -pub struct MsgSubmitProposalResponse { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// MsgVote defines a message to cast a vote. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.MsgVote")] -pub struct MsgVote { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter address for the proposal. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// option defines the vote option. - #[prost(enumeration = "VoteOption", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, -} -/// MsgVoteResponse defines the Msg/Vote response 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 = "/cosmos.gov.v1beta1.MsgVoteResponse")] -pub struct MsgVoteResponse {} -/// MsgVoteWeighted defines a message to cast a vote. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.MsgVoteWeighted")] -pub struct MsgVoteWeighted { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter address for the proposal. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// options defines the weighted vote options. - #[prost(message, repeated, tag = "3")] - pub options: ::prost::alloc::vec::Vec, -} -/// MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.MsgVoteWeightedResponse")] -pub struct MsgVoteWeightedResponse {} -/// MsgDeposit defines a message to submit a deposit to an existing proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.gov.v1beta1.MsgDeposit")] -pub struct MsgDeposit { - /// proposal_id defines the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// depositor defines the deposit addresses from the proposals. - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, - /// amount to be deposited by depositor. - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgDepositResponse defines the Msg/Deposit response 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 = "/cosmos.gov.v1beta1.MsgDepositResponse")] -pub struct MsgDepositResponse {} -pub struct GovQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> GovQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn proposal( - &self, - proposal_id: u64, - ) -> Result { - QueryProposalRequest { proposal_id }.query(self.querier) - } - pub fn proposals( - &self, - proposal_status: i32, - voter: ::prost::alloc::string::String, - depositor: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryProposalsRequest { - proposal_status, - voter, - depositor, - pagination, - } - .query(self.querier) - } - pub fn vote( - &self, - proposal_id: u64, - voter: ::prost::alloc::string::String, - ) -> Result { - QueryVoteRequest { proposal_id, voter }.query(self.querier) - } - pub fn votes( - &self, - proposal_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryVotesRequest { - proposal_id, - pagination, - } - .query(self.querier) - } - pub fn params( - &self, - params_type: ::prost::alloc::string::String, - ) -> Result { - QueryParamsRequest { params_type }.query(self.querier) - } - pub fn deposit( - &self, - proposal_id: u64, - depositor: ::prost::alloc::string::String, - ) -> Result { - QueryDepositRequest { - proposal_id, - depositor, - } - .query(self.querier) - } - pub fn deposits( - &self, - proposal_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryDepositsRequest { - proposal_id, - pagination, - } - .query(self.querier) - } - pub fn tally_result( - &self, - proposal_id: u64, - ) -> Result { - QueryTallyResultRequest { proposal_id }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/group/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/group/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/group/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/group/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/group/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/group/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/group/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/group/module/v1.rs deleted file mode 100644 index 951c2e33..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/group/module/v1.rs +++ /dev/null @@ -1,28 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the group module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.module.v1.Module")] -pub struct Module { - /// max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec - /// to execute the proposal. - #[prost(message, optional, tag = "1")] - pub max_execution_period: ::core::option::Option, - /// max_metadata_len defines the max length of the metadata bytes field for various entities within the group module. - /// Defaults to 255 if not explicitly set. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_metadata_len: u64, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/group/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/group/v1.rs deleted file mode 100644 index d09d2a7a..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/group/v1.rs +++ /dev/null @@ -1,2319 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Member represents a group member with an account address, -/// non-zero weight, metadata and added_at timestamp. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.Member")] -pub struct Member { - /// address is the member's account address. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// weight is the member's voting weight that should be greater than 0. - #[prost(string, tag = "2")] - pub weight: ::prost::alloc::string::String, - /// metadata is any arbitrary metadata attached to the member. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, - /// added_at is a timestamp specifying when a member was added. - #[prost(message, optional, tag = "4")] - pub added_at: ::core::option::Option, -} -/// MemberRequest represents a group member to be used in Msg server requests. -/// Contrary to `Member`, it doesn't have any `added_at` field -/// since this field cannot be set as part of requests. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.MemberRequest")] -pub struct MemberRequest { - /// address is the member's account address. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// weight is the member's voting weight that should be greater than 0. - #[prost(string, tag = "2")] - pub weight: ::prost::alloc::string::String, - /// metadata is any arbitrary metadata attached to the member. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, -} -/// ThresholdDecisionPolicy is a decision policy where a proposal passes when it -/// satisfies the two following conditions: -/// 1. The sum of all `YES` voter's weights is greater or equal than the defined -/// `threshold`. -/// 2. The voting and execution periods of the proposal respect the parameters -/// given by `windows`. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.ThresholdDecisionPolicy")] -pub struct ThresholdDecisionPolicy { - /// threshold is the minimum weighted sum of `YES` votes that must be met or - /// exceeded for a proposal to succeed. - #[prost(string, tag = "1")] - pub threshold: ::prost::alloc::string::String, - /// windows defines the different windows for voting and execution. - #[prost(message, optional, tag = "2")] - pub windows: ::core::option::Option, -} -/// PercentageDecisionPolicy is a decision policy where a proposal passes when -/// it satisfies the two following conditions: -/// 1. The percentage of all `YES` voters' weights out of the total group weight -/// is greater or equal than the given `percentage`. -/// 2. The voting and execution periods of the proposal respect the parameters -/// given by `windows`. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.PercentageDecisionPolicy")] -pub struct PercentageDecisionPolicy { - /// percentage is the minimum percentage of the weighted sum of `YES` votes must - /// meet for a proposal to succeed. - #[prost(string, tag = "1")] - pub percentage: ::prost::alloc::string::String, - /// windows defines the different windows for voting and execution. - #[prost(message, optional, tag = "2")] - pub windows: ::core::option::Option, -} -/// DecisionPolicyWindows defines the different windows for voting and execution. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.DecisionPolicyWindows")] -pub struct DecisionPolicyWindows { - /// voting_period is the duration from submission of a proposal to the end of voting period - /// Within this times votes can be submitted with MsgVote. - #[prost(message, optional, tag = "1")] - pub voting_period: ::core::option::Option, - /// min_execution_period is the minimum duration after the proposal submission - /// where members can start sending MsgExec. This means that the window for - /// sending a MsgExec transaction is: - /// `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` - /// where max_execution_period is a app-specific config, defined in the keeper. - /// If not set, min_execution_period will default to 0. - /// - /// Please make sure to set a `min_execution_period` that is smaller than - /// `voting_period + max_execution_period`, or else the above execution window - /// is empty, meaning that all proposals created with this decision policy - /// won't be able to be executed. - #[prost(message, optional, tag = "2")] - pub min_execution_period: ::core::option::Option, -} -/// GroupInfo represents the high-level on-chain information for a group. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.GroupInfo")] -pub struct GroupInfo { - /// id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - /// admin is the account address of the group's admin. - #[prost(string, tag = "2")] - pub admin: ::prost::alloc::string::String, - /// metadata is any arbitrary metadata to attached to the group. - /// the recommended format of the metadata is to be found here: - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, - /// version is used to track changes to a group's membership structure that - /// would break existing proposals. Whenever any members weight is changed, - /// or any member is added or removed this version is incremented and will - /// cause proposals based on older versions of this group to fail - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub version: u64, - /// total_weight is the sum of the group members' weights. - #[prost(string, tag = "5")] - pub total_weight: ::prost::alloc::string::String, - /// created_at is a timestamp specifying when a group was created. - #[prost(message, optional, tag = "6")] - pub created_at: ::core::option::Option, -} -/// GroupMember represents the relationship between a group and a member. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.GroupMember")] -pub struct GroupMember { - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// member is the member data. - #[prost(message, optional, tag = "2")] - pub member: ::core::option::Option, -} -/// GroupPolicyInfo represents the high-level on-chain information for a group policy. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.GroupPolicyInfo")] -pub struct GroupPolicyInfo { - /// address is the account address of group policy. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "2")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// admin is the account address of the group admin. - #[prost(string, tag = "3")] - pub admin: ::prost::alloc::string::String, - /// metadata is any arbitrary metadata attached to the group policy. - /// the recommended format of the metadata is to be found here: - /// - #[prost(string, tag = "4")] - pub metadata: ::prost::alloc::string::String, - /// version is used to track changes to a group's GroupPolicyInfo structure that - /// would create a different result on a running proposal. - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub version: u64, - /// decision_policy specifies the group policy's decision policy. - #[prost(message, optional, tag = "6")] - pub decision_policy: ::core::option::Option, - /// created_at is a timestamp specifying when a group policy was created. - #[prost(message, optional, tag = "7")] - pub created_at: ::core::option::Option, -} -/// Proposal defines a group proposal. Any member of a group can submit a proposal -/// for a group policy to decide upon. -/// A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal -/// passes as well as some optional metadata associated with the proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.Proposal")] -pub struct Proposal { - /// id is the unique id of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - /// group_policy_address is the account address of group policy. - #[prost(string, tag = "2")] - pub group_policy_address: ::prost::alloc::string::String, - /// metadata is any arbitrary metadata attached to the proposal. - /// the recommended format of the metadata is to be found here: - /// - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, - /// proposers are the account addresses of the proposers. - #[prost(string, repeated, tag = "4")] - pub proposers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// submit_time is a timestamp specifying when a proposal was submitted. - #[prost(message, optional, tag = "5")] - pub submit_time: ::core::option::Option, - /// group_version tracks the version of the group at proposal submission. - /// This field is here for informational purposes only. - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_version: u64, - /// group_policy_version tracks the version of the group policy at proposal submission. - /// When a decision policy is changed, existing proposals from previous policy - /// versions will become invalid with the `ABORTED` status. - /// This field is here for informational purposes only. - #[prost(uint64, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_policy_version: u64, - /// status represents the high level position in the life cycle of the proposal. Initial value is Submitted. - #[prost(enumeration = "ProposalStatus", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, - /// final_tally_result contains the sums of all weighted votes for this - /// proposal for each vote option. It is empty at submission, and only - /// populated after tallying, at voting period end or at proposal execution, - /// whichever happens first. - #[prost(message, optional, tag = "9")] - pub final_tally_result: ::core::option::Option, - /// voting_period_end is the timestamp before which voting must be done. - /// Unless a successful MsgExec is called before (to execute a proposal whose - /// tally is successful before the voting period ends), tallying will be done - /// at this point, and the `final_tally_result`and `status` fields will be - /// accordingly updated. - #[prost(message, optional, tag = "10")] - pub voting_period_end: ::core::option::Option, - /// executor_result is the final result of the proposal execution. Initial value is NotRun. - #[prost(enumeration = "ProposalExecutorResult", tag = "11")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub executor_result: i32, - /// messages is a list of `sdk.Msg`s that will be executed if the proposal passes. - #[prost(message, repeated, tag = "12")] - pub messages: ::prost::alloc::vec::Vec, - /// title is the title of the proposal - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "13")] - pub title: ::prost::alloc::string::String, - /// summary is a short summary of the proposal - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "14")] - pub summary: ::prost::alloc::string::String, -} -/// TallyResult represents the sum of weighted votes for each vote option. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.TallyResult")] -pub struct TallyResult { - /// yes_count is the weighted sum of yes votes. - #[prost(string, tag = "1")] - pub yes_count: ::prost::alloc::string::String, - /// abstain_count is the weighted sum of abstainers. - #[prost(string, tag = "2")] - pub abstain_count: ::prost::alloc::string::String, - /// no_count is the weighted sum of no votes. - #[prost(string, tag = "3")] - pub no_count: ::prost::alloc::string::String, - /// no_with_veto_count is the weighted sum of veto. - #[prost(string, tag = "4")] - pub no_with_veto_count: ::prost::alloc::string::String, -} -/// Vote represents a vote for a proposal.string metadata -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.Vote")] -pub struct Vote { - /// proposal is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the account address of the voter. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// option is the voter's choice on the proposal. - #[prost(enumeration = "VoteOption", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, - /// metadata is any arbitrary metadata attached to the vote. - /// the recommended format of the metadata is to be found here: - #[prost(string, tag = "4")] - pub metadata: ::prost::alloc::string::String, - /// submit_time is the timestamp when the vote was submitted. - #[prost(message, optional, tag = "5")] - pub submit_time: ::core::option::Option, -} -/// VoteOption enumerates the valid vote options for a given proposal. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum VoteOption { - /// VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will - /// return an error. - Unspecified = 0, - /// VOTE_OPTION_YES defines a yes vote option. - Yes = 1, - /// VOTE_OPTION_ABSTAIN defines an abstain vote option. - Abstain = 2, - /// VOTE_OPTION_NO defines a no vote option. - No = 3, - /// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - NoWithVeto = 4, -} -impl VoteOption { - /// 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 { - VoteOption::Unspecified => "VOTE_OPTION_UNSPECIFIED", - VoteOption::Yes => "VOTE_OPTION_YES", - VoteOption::Abstain => "VOTE_OPTION_ABSTAIN", - VoteOption::No => "VOTE_OPTION_NO", - VoteOption::NoWithVeto => "VOTE_OPTION_NO_WITH_VETO", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VOTE_OPTION_UNSPECIFIED" => Some(Self::Unspecified), - "VOTE_OPTION_YES" => Some(Self::Yes), - "VOTE_OPTION_ABSTAIN" => Some(Self::Abstain), - "VOTE_OPTION_NO" => Some(Self::No), - "VOTE_OPTION_NO_WITH_VETO" => Some(Self::NoWithVeto), - _ => None, - } - } -} -/// ProposalStatus defines proposal statuses. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum ProposalStatus { - /// An empty value is invalid and not allowed. - Unspecified = 0, - /// Initial status of a proposal when submitted. - Submitted = 1, - /// Final status of a proposal when the final tally is done and the outcome - /// passes the group policy's decision policy. - Accepted = 2, - /// Final status of a proposal when the final tally is done and the outcome - /// is rejected by the group policy's decision policy. - Rejected = 3, - /// Final status of a proposal when the group policy is modified before the - /// final tally. - Aborted = 4, - /// A proposal can be withdrawn before the voting start time by the owner. - /// When this happens the final status is Withdrawn. - Withdrawn = 5, -} -impl ProposalStatus { - /// 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 { - ProposalStatus::Unspecified => "PROPOSAL_STATUS_UNSPECIFIED", - ProposalStatus::Submitted => "PROPOSAL_STATUS_SUBMITTED", - ProposalStatus::Accepted => "PROPOSAL_STATUS_ACCEPTED", - ProposalStatus::Rejected => "PROPOSAL_STATUS_REJECTED", - ProposalStatus::Aborted => "PROPOSAL_STATUS_ABORTED", - ProposalStatus::Withdrawn => "PROPOSAL_STATUS_WITHDRAWN", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "PROPOSAL_STATUS_UNSPECIFIED" => Some(Self::Unspecified), - "PROPOSAL_STATUS_SUBMITTED" => Some(Self::Submitted), - "PROPOSAL_STATUS_ACCEPTED" => Some(Self::Accepted), - "PROPOSAL_STATUS_REJECTED" => Some(Self::Rejected), - "PROPOSAL_STATUS_ABORTED" => Some(Self::Aborted), - "PROPOSAL_STATUS_WITHDRAWN" => Some(Self::Withdrawn), - _ => None, - } - } -} -/// ProposalExecutorResult defines types of proposal executor results. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum ProposalExecutorResult { - /// An empty value is not allowed. - Unspecified = 0, - /// We have not yet run the executor. - NotRun = 1, - /// The executor was successful and proposed action updated state. - Success = 2, - /// The executor returned an error and proposed action didn't update state. - Failure = 3, -} -impl ProposalExecutorResult { - /// 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 { - ProposalExecutorResult::Unspecified => "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED", - ProposalExecutorResult::NotRun => "PROPOSAL_EXECUTOR_RESULT_NOT_RUN", - ProposalExecutorResult::Success => "PROPOSAL_EXECUTOR_RESULT_SUCCESS", - ProposalExecutorResult::Failure => "PROPOSAL_EXECUTOR_RESULT_FAILURE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED" => Some(Self::Unspecified), - "PROPOSAL_EXECUTOR_RESULT_NOT_RUN" => Some(Self::NotRun), - "PROPOSAL_EXECUTOR_RESULT_SUCCESS" => Some(Self::Success), - "PROPOSAL_EXECUTOR_RESULT_FAILURE" => Some(Self::Failure), - _ => None, - } - } -} -/// EventCreateGroup is an event emitted when a group is created. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventCreateGroup")] -pub struct EventCreateGroup { - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, -} -/// EventUpdateGroup is an event emitted when a group is updated. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventUpdateGroup")] -pub struct EventUpdateGroup { - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, -} -/// EventCreateGroupPolicy is an event emitted when a group policy is created. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventCreateGroupPolicy")] -pub struct EventCreateGroupPolicy { - /// address is the account address of the group policy. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// EventUpdateGroupPolicy is an event emitted when a group policy is updated. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventUpdateGroupPolicy")] -pub struct EventUpdateGroupPolicy { - /// address is the account address of the group policy. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// EventSubmitProposal is an event emitted when a proposal is created. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventSubmitProposal")] -pub struct EventSubmitProposal { - /// proposal_id is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// EventWithdrawProposal is an event emitted when a proposal is withdrawn. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventWithdrawProposal")] -pub struct EventWithdrawProposal { - /// proposal_id is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// EventVote is an event emitted when a voter votes on a proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventVote")] -pub struct EventVote { - /// proposal_id is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// EventExec is an event emitted when a proposal is executed. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventExec")] -pub struct EventExec { - /// proposal_id is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// result is the proposal execution result. - #[prost(enumeration = "ProposalExecutorResult", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, - /// logs contains error logs in case the execution result is FAILURE. - #[prost(string, tag = "3")] - pub logs: ::prost::alloc::string::String, -} -/// EventLeaveGroup is an event emitted when group member leaves the group. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventLeaveGroup")] -pub struct EventLeaveGroup { - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// address is the account address of the group member. - #[prost(string, tag = "2")] - pub address: ::prost::alloc::string::String, -} -/// EventProposalPruned is an event emitted when a proposal is pruned. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.EventProposalPruned")] -pub struct EventProposalPruned { - /// proposal_id is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// status is the proposal status (UNSPECIFIED, SUBMITTED, ACCEPTED, REJECTED, ABORTED, WITHDRAWN). - #[prost(enumeration = "ProposalStatus", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, - /// tally_result is the proposal tally result (when applicable). - #[prost(message, optional, tag = "3")] - pub tally_result: ::core::option::Option, -} -/// GenesisState defines the group module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.GenesisState")] -pub struct GenesisState { - /// group_seq is the group table orm.Sequence, - /// it is used to get the next group ID. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_seq: u64, - /// groups is the list of groups info. - #[prost(message, repeated, tag = "2")] - pub groups: ::prost::alloc::vec::Vec, - /// group_members is the list of groups members. - #[prost(message, repeated, tag = "3")] - pub group_members: ::prost::alloc::vec::Vec, - /// group_policy_seq is the group policy table orm.Sequence, - /// it is used to generate the next group policy account address. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_policy_seq: u64, - /// group_policies is the list of group policies info. - #[prost(message, repeated, tag = "5")] - pub group_policies: ::prost::alloc::vec::Vec, - /// proposal_seq is the proposal table orm.Sequence, - /// it is used to get the next proposal ID. - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_seq: u64, - /// proposals is the list of proposals. - #[prost(message, repeated, tag = "7")] - pub proposals: ::prost::alloc::vec::Vec, - /// votes is the list of votes. - #[prost(message, repeated, tag = "8")] - pub votes: ::prost::alloc::vec::Vec, -} -/// QueryGroupInfoRequest is the Query/GroupInfo 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 = "/cosmos.group.v1.QueryGroupInfoRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupInfo", - response_type = QueryGroupInfoResponse -)] -pub struct QueryGroupInfoRequest { - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, -} -/// QueryGroupInfoResponse is the Query/GroupInfo response 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 = "/cosmos.group.v1.QueryGroupInfoResponse")] -pub struct QueryGroupInfoResponse { - /// info is the GroupInfo of the group. - #[prost(message, optional, tag = "1")] - pub info: ::core::option::Option, -} -/// QueryGroupPolicyInfoRequest is the Query/GroupPolicyInfo 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 = "/cosmos.group.v1.QueryGroupPolicyInfoRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupPolicyInfo", - response_type = QueryGroupPolicyInfoResponse -)] -pub struct QueryGroupPolicyInfoRequest { - /// address is the account address of the group policy. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// QueryGroupPolicyInfoResponse is the Query/GroupPolicyInfo response 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 = "/cosmos.group.v1.QueryGroupPolicyInfoResponse")] -pub struct QueryGroupPolicyInfoResponse { - /// info is the GroupPolicyInfo of the group policy. - #[prost(message, optional, tag = "1")] - pub info: ::core::option::Option, -} -/// QueryGroupMembersRequest is the Query/GroupMembers 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 = "/cosmos.group.v1.QueryGroupMembersRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupMembers", - response_type = QueryGroupMembersResponse -)] -pub struct QueryGroupMembersRequest { - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupMembersResponse is the Query/GroupMembersResponse response 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 = "/cosmos.group.v1.QueryGroupMembersResponse")] -pub struct QueryGroupMembersResponse { - /// members are the members of the group with given group_id. - #[prost(message, repeated, tag = "1")] - pub members: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupsByAdminRequest is the Query/GroupsByAdmin 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 = "/cosmos.group.v1.QueryGroupsByAdminRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupsByAdmin", - response_type = QueryGroupsByAdminResponse -)] -pub struct QueryGroupsByAdminRequest { - /// admin is the account address of a group's admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupsByAdminResponse is the Query/GroupsByAdminResponse response 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 = "/cosmos.group.v1.QueryGroupsByAdminResponse")] -pub struct QueryGroupsByAdminResponse { - /// groups are the groups info with the provided admin. - #[prost(message, repeated, tag = "1")] - pub groups: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupPoliciesByGroupRequest is the Query/GroupPoliciesByGroup 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 = "/cosmos.group.v1.QueryGroupPoliciesByGroupRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupPoliciesByGroup", - response_type = QueryGroupPoliciesByGroupResponse -)] -pub struct QueryGroupPoliciesByGroupRequest { - /// group_id is the unique ID of the group policy's group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupPoliciesByGroupResponse is the Query/GroupPoliciesByGroup response 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 = "/cosmos.group.v1.QueryGroupPoliciesByGroupResponse")] -pub struct QueryGroupPoliciesByGroupResponse { - /// group_policies are the group policies info associated with the provided group. - #[prost(message, repeated, tag = "1")] - pub group_policies: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupPoliciesByAdminRequest is the Query/GroupPoliciesByAdmin 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 = "/cosmos.group.v1.QueryGroupPoliciesByAdminRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupPoliciesByAdmin", - response_type = QueryGroupPoliciesByAdminResponse -)] -pub struct QueryGroupPoliciesByAdminRequest { - /// admin is the admin address of the group policy. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupPoliciesByAdminResponse is the Query/GroupPoliciesByAdmin response 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 = "/cosmos.group.v1.QueryGroupPoliciesByAdminResponse")] -pub struct QueryGroupPoliciesByAdminResponse { - /// group_policies are the group policies info with provided admin. - #[prost(message, repeated, tag = "1")] - pub group_policies: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryProposalRequest is the Query/Proposal 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 = "/cosmos.group.v1.QueryProposalRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/Proposal", - response_type = QueryProposalResponse -)] -pub struct QueryProposalRequest { - /// proposal_id is the unique ID of a proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// QueryProposalResponse is the Query/Proposal response 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 = "/cosmos.group.v1.QueryProposalResponse")] -pub struct QueryProposalResponse { - /// proposal is the proposal info. - #[prost(message, optional, tag = "1")] - pub proposal: ::core::option::Option, -} -/// QueryProposalsByGroupPolicyRequest is the Query/ProposalByGroupPolicy 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 = "/cosmos.group.v1.QueryProposalsByGroupPolicyRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/ProposalsByGroupPolicy", - response_type = QueryProposalsByGroupPolicyResponse -)] -pub struct QueryProposalsByGroupPolicyRequest { - /// address is the account address of the group policy related to proposals. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryProposalsByGroupPolicyResponse is the Query/ProposalByGroupPolicy response 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 = "/cosmos.group.v1.QueryProposalsByGroupPolicyResponse")] -pub struct QueryProposalsByGroupPolicyResponse { - /// proposals are the proposals with given group policy. - #[prost(message, repeated, tag = "1")] - pub proposals: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVoteByProposalVoterRequest is the Query/VoteByProposalVoter 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 = "/cosmos.group.v1.QueryVoteByProposalVoterRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/VoteByProposalVoter", - response_type = QueryVoteByProposalVoterResponse -)] -pub struct QueryVoteByProposalVoterRequest { - /// proposal_id is the unique ID of a proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is a proposal voter account address. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, -} -/// QueryVoteByProposalVoterResponse is the Query/VoteByProposalVoter response 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 = "/cosmos.group.v1.QueryVoteByProposalVoterResponse")] -pub struct QueryVoteByProposalVoterResponse { - /// vote is the vote with given proposal_id and voter. - #[prost(message, optional, tag = "1")] - pub vote: ::core::option::Option, -} -/// QueryVotesByProposalRequest is the Query/VotesByProposal 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 = "/cosmos.group.v1.QueryVotesByProposalRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/VotesByProposal", - response_type = QueryVotesByProposalResponse -)] -pub struct QueryVotesByProposalRequest { - /// proposal_id is the unique ID of a proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVotesByProposalResponse is the Query/VotesByProposal response 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 = "/cosmos.group.v1.QueryVotesByProposalResponse")] -pub struct QueryVotesByProposalResponse { - /// votes are the list of votes for given proposal_id. - #[prost(message, repeated, tag = "1")] - pub votes: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVotesByVoterRequest is the Query/VotesByVoter 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 = "/cosmos.group.v1.QueryVotesByVoterRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/VotesByVoter", - response_type = QueryVotesByVoterResponse -)] -pub struct QueryVotesByVoterRequest { - /// voter is a proposal voter account address. - #[prost(string, tag = "1")] - pub voter: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryVotesByVoterResponse is the Query/VotesByVoter response 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 = "/cosmos.group.v1.QueryVotesByVoterResponse")] -pub struct QueryVotesByVoterResponse { - /// votes are the list of votes by given voter. - #[prost(message, repeated, tag = "1")] - pub votes: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupsByMemberRequest is the Query/GroupsByMember 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 = "/cosmos.group.v1.QueryGroupsByMemberRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/GroupsByMember", - response_type = QueryGroupsByMemberResponse -)] -pub struct QueryGroupsByMemberRequest { - /// address is the group member address. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupsByMemberResponse is the Query/GroupsByMember response 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 = "/cosmos.group.v1.QueryGroupsByMemberResponse")] -pub struct QueryGroupsByMemberResponse { - /// groups are the groups info with the provided group member. - #[prost(message, repeated, tag = "1")] - pub groups: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryTallyResultRequest is the Query/TallyResult 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 = "/cosmos.group.v1.QueryTallyResultRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/TallyResult", - response_type = QueryTallyResultResponse -)] -pub struct QueryTallyResultRequest { - /// proposal_id is the unique id of a proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// QueryTallyResultResponse is the Query/TallyResult response 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 = "/cosmos.group.v1.QueryTallyResultResponse")] -pub struct QueryTallyResultResponse { - /// tally defines the requested tally. - #[prost(message, optional, tag = "1")] - pub tally: ::core::option::Option, -} -/// QueryGroupsRequest is the Query/Groups request type. -/// -/// Since: cosmos-sdk 0.47.1 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.QueryGroupsRequest")] -#[proto_query( - path = "/cosmos.group.v1.Query/Groups", - response_type = QueryGroupsResponse -)] -pub struct QueryGroupsRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryGroupsResponse is the Query/Groups response type. -/// -/// Since: cosmos-sdk 0.47.1 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.group.v1.QueryGroupsResponse")] -pub struct QueryGroupsResponse { - /// `groups` is all the groups present in state. - #[prost(message, repeated, tag = "1")] - pub groups: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// MsgCreateGroup is the Msg/CreateGroup 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 = "/cosmos.group.v1.MsgCreateGroup")] -pub struct MsgCreateGroup { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// members defines the group members. - #[prost(message, repeated, tag = "2")] - pub members: ::prost::alloc::vec::Vec, - /// metadata is any arbitrary metadata to attached to the group. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, -} -/// MsgCreateGroupResponse is the Msg/CreateGroup response 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 = "/cosmos.group.v1.MsgCreateGroupResponse")] -pub struct MsgCreateGroupResponse { - /// group_id is the unique ID of the newly created group. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, -} -/// MsgUpdateGroupMembers is the Msg/UpdateGroupMembers 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 = "/cosmos.group.v1.MsgUpdateGroupMembers")] -pub struct MsgUpdateGroupMembers { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "2")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// member_updates is the list of members to update, - /// set weight to 0 to remove a member. - #[prost(message, repeated, tag = "3")] - pub member_updates: ::prost::alloc::vec::Vec, -} -/// MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response 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 = "/cosmos.group.v1.MsgUpdateGroupMembersResponse")] -pub struct MsgUpdateGroupMembersResponse {} -/// MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin 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 = "/cosmos.group.v1.MsgUpdateGroupAdmin")] -pub struct MsgUpdateGroupAdmin { - /// admin is the current account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "2")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// new_admin is the group new admin account address. - #[prost(string, tag = "3")] - pub new_admin: ::prost::alloc::string::String, -} -/// MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response 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 = "/cosmos.group.v1.MsgUpdateGroupAdminResponse")] -pub struct MsgUpdateGroupAdminResponse {} -/// MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata 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 = "/cosmos.group.v1.MsgUpdateGroupMetadata")] -pub struct MsgUpdateGroupMetadata { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "2")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// metadata is the updated group's metadata. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, -} -/// MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response 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 = "/cosmos.group.v1.MsgUpdateGroupMetadataResponse")] -pub struct MsgUpdateGroupMetadataResponse {} -/// MsgCreateGroupPolicy is the Msg/CreateGroupPolicy 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 = "/cosmos.group.v1.MsgCreateGroupPolicy")] -pub struct MsgCreateGroupPolicy { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "2")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// metadata is any arbitrary metadata attached to the group policy. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, - /// decision_policy specifies the group policy's decision policy. - #[prost(message, optional, tag = "4")] - pub decision_policy: ::core::option::Option, -} -/// MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response 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 = "/cosmos.group.v1.MsgCreateGroupPolicyResponse")] -pub struct MsgCreateGroupPolicyResponse { - /// address is the account address of the newly created group policy. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin 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 = "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin")] -pub struct MsgUpdateGroupPolicyAdmin { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_policy_address is the account address of the group policy. - #[prost(string, tag = "2")] - pub group_policy_address: ::prost::alloc::string::String, - /// new_admin is the new group policy admin. - #[prost(string, tag = "3")] - pub new_admin: ::prost::alloc::string::String, -} -/// MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response 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 = "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse")] -pub struct MsgUpdateGroupPolicyAdminResponse {} -/// MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy 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 = "/cosmos.group.v1.MsgCreateGroupWithPolicy")] -pub struct MsgCreateGroupWithPolicy { - /// admin is the account address of the group and group policy admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// members defines the group members. - #[prost(message, repeated, tag = "2")] - pub members: ::prost::alloc::vec::Vec, - /// group_metadata is any arbitrary metadata attached to the group. - #[prost(string, tag = "3")] - pub group_metadata: ::prost::alloc::string::String, - /// group_policy_metadata is any arbitrary metadata attached to the group policy. - #[prost(string, tag = "4")] - pub group_policy_metadata: ::prost::alloc::string::String, - /// group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group - /// and group policy admin. - #[prost(bool, tag = "5")] - pub group_policy_as_admin: bool, - /// decision_policy specifies the group policy's decision policy. - #[prost(message, optional, tag = "6")] - pub decision_policy: ::core::option::Option, -} -/// MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response 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 = "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse")] -pub struct MsgCreateGroupWithPolicyResponse { - /// group_id is the unique ID of the newly created group with policy. - #[prost(uint64, tag = "1")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, - /// group_policy_address is the account address of the newly created group policy. - #[prost(string, tag = "2")] - pub group_policy_address: ::prost::alloc::string::String, -} -/// MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy 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 = "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy")] -pub struct MsgUpdateGroupPolicyDecisionPolicy { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_policy_address is the account address of group policy. - #[prost(string, tag = "2")] - pub group_policy_address: ::prost::alloc::string::String, - /// decision_policy is the updated group policy's decision policy. - #[prost(message, optional, tag = "3")] - pub decision_policy: ::core::option::Option, -} -/// MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response 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 = "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse")] -pub struct MsgUpdateGroupPolicyDecisionPolicyResponse {} -/// MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata 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 = "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata")] -pub struct MsgUpdateGroupPolicyMetadata { - /// admin is the account address of the group admin. - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, - /// group_policy_address is the account address of group policy. - #[prost(string, tag = "2")] - pub group_policy_address: ::prost::alloc::string::String, - /// metadata is the group policy metadata to be updated. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, -} -/// MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response 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 = "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse")] -pub struct MsgUpdateGroupPolicyMetadataResponse {} -/// MsgSubmitProposal is the Msg/SubmitProposal 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 = "/cosmos.group.v1.MsgSubmitProposal")] -pub struct MsgSubmitProposal { - /// group_policy_address is the account address of group policy. - #[prost(string, tag = "1")] - pub group_policy_address: ::prost::alloc::string::String, - /// proposers are the account addresses of the proposers. - /// Proposers signatures will be counted as yes votes. - #[prost(string, repeated, tag = "2")] - pub proposers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// metadata is any arbitrary metadata attached to the proposal. - #[prost(string, tag = "3")] - pub metadata: ::prost::alloc::string::String, - /// messages is a list of `sdk.Msg`s that will be executed if the proposal passes. - #[prost(message, repeated, tag = "4")] - pub messages: ::prost::alloc::vec::Vec, - /// exec defines the mode of execution of the proposal, - /// whether it should be executed immediately on creation or not. - /// If so, proposers signatures are considered as Yes votes. - #[prost(enumeration = "Exec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub exec: i32, - /// title is the title of the proposal. - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "6")] - pub title: ::prost::alloc::string::String, - /// summary is the summary of the proposal. - /// - /// Since: cosmos-sdk 0.47 - #[prost(string, tag = "7")] - pub summary: ::prost::alloc::string::String, -} -/// MsgSubmitProposalResponse is the Msg/SubmitProposal response 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 = "/cosmos.group.v1.MsgSubmitProposalResponse")] -pub struct MsgSubmitProposalResponse { - /// proposal is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, -} -/// MsgWithdrawProposal is the Msg/WithdrawProposal 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 = "/cosmos.group.v1.MsgWithdrawProposal")] -pub struct MsgWithdrawProposal { - /// proposal is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// address is the admin of the group policy or one of the proposer of the proposal. - #[prost(string, tag = "2")] - pub address: ::prost::alloc::string::String, -} -/// MsgWithdrawProposalResponse is the Msg/WithdrawProposal response 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 = "/cosmos.group.v1.MsgWithdrawProposalResponse")] -pub struct MsgWithdrawProposalResponse {} -/// MsgVote is the Msg/Vote 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 = "/cosmos.group.v1.MsgVote")] -pub struct MsgVote { - /// proposal is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// voter is the voter account address. - #[prost(string, tag = "2")] - pub voter: ::prost::alloc::string::String, - /// option is the voter's choice on the proposal. - #[prost(enumeration = "VoteOption", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub option: i32, - /// metadata is any arbitrary metadata attached to the vote. - #[prost(string, tag = "4")] - pub metadata: ::prost::alloc::string::String, - /// exec defines whether the proposal should be executed - /// immediately after voting or not. - #[prost(enumeration = "Exec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub exec: i32, -} -/// MsgVoteResponse is the Msg/Vote response 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 = "/cosmos.group.v1.MsgVoteResponse")] -pub struct MsgVoteResponse {} -/// MsgExec is the Msg/Exec 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 = "/cosmos.group.v1.MsgExec")] -pub struct MsgExec { - /// proposal is the unique ID of the proposal. - #[prost(uint64, tag = "1")] - #[serde(alias = "proposalID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_id: u64, - /// executor is the account address used to execute the proposal. - #[prost(string, tag = "2")] - pub executor: ::prost::alloc::string::String, -} -/// MsgExecResponse is the Msg/Exec 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 = "/cosmos.group.v1.MsgExecResponse")] -pub struct MsgExecResponse { - /// result is the final result of the proposal execution. - #[prost(enumeration = "ProposalExecutorResult", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgLeaveGroup is the Msg/LeaveGroup 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 = "/cosmos.group.v1.MsgLeaveGroup")] -pub struct MsgLeaveGroup { - /// address is the account address of the group member. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// group_id is the unique ID of the group. - #[prost(uint64, tag = "2")] - #[serde(alias = "groupID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub group_id: u64, -} -/// MsgLeaveGroupResponse is the Msg/LeaveGroup response 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 = "/cosmos.group.v1.MsgLeaveGroupResponse")] -pub struct MsgLeaveGroupResponse {} -/// Exec defines modes of execution of a proposal on creation or on new vote. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum Exec { - /// An empty value means that there should be a separate - /// MsgExec request for the proposal to execute. - Unspecified = 0, - /// Try to execute the proposal immediately. - /// If the proposal is not allowed per the DecisionPolicy, - /// the proposal will still be open and could - /// be executed at a later point. - Try = 1, -} -impl Exec { - /// 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 { - Exec::Unspecified => "EXEC_UNSPECIFIED", - Exec::Try => "EXEC_TRY", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "EXEC_UNSPECIFIED" => Some(Self::Unspecified), - "EXEC_TRY" => Some(Self::Try), - _ => None, - } - } -} -pub struct GroupQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> GroupQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn group_info( - &self, - group_id: u64, - ) -> Result { - QueryGroupInfoRequest { group_id }.query(self.querier) - } - pub fn group_policy_info( - &self, - address: ::prost::alloc::string::String, - ) -> Result { - QueryGroupPolicyInfoRequest { address }.query(self.querier) - } - pub fn group_members( - &self, - group_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryGroupMembersRequest { - group_id, - pagination, - } - .query(self.querier) - } - pub fn groups_by_admin( - &self, - admin: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryGroupsByAdminRequest { admin, pagination }.query(self.querier) - } - pub fn group_policies_by_group( - &self, - group_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryGroupPoliciesByGroupRequest { - group_id, - pagination, - } - .query(self.querier) - } - pub fn group_policies_by_admin( - &self, - admin: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryGroupPoliciesByAdminRequest { admin, pagination }.query(self.querier) - } - pub fn proposal( - &self, - proposal_id: u64, - ) -> Result { - QueryProposalRequest { proposal_id }.query(self.querier) - } - pub fn proposals_by_group_policy( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryProposalsByGroupPolicyRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn vote_by_proposal_voter( - &self, - proposal_id: u64, - voter: ::prost::alloc::string::String, - ) -> Result { - QueryVoteByProposalVoterRequest { proposal_id, voter }.query(self.querier) - } - pub fn votes_by_proposal( - &self, - proposal_id: u64, - pagination: ::core::option::Option, - ) -> Result { - QueryVotesByProposalRequest { - proposal_id, - pagination, - } - .query(self.querier) - } - pub fn votes_by_voter( - &self, - voter: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryVotesByVoterRequest { voter, pagination }.query(self.querier) - } - pub fn groups_by_member( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryGroupsByMemberRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn tally_result( - &self, - proposal_id: u64, - ) -> Result { - QueryTallyResultRequest { proposal_id }.query(self.querier) - } - pub fn groups( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryGroupsRequest { pagination }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/ics23/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/ics23/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/ics23/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/ics23/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/ics23/v1.rs deleted file mode 100644 index a6c6dcd6..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/ics23/v1.rs +++ /dev/null @@ -1,618 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// * -/// ExistenceProof takes a key and a value and a set of steps to perform on it. -/// The result of peforming all these steps will provide a "root hash", which can -/// be compared to the value in a header. -/// -/// Since it is computationally infeasible to produce a hash collission for any of the used -/// cryptographic hash functions, if someone can provide a series of operations to transform -/// a given key and value into a root hash that matches some trusted root, these key and values -/// must be in the referenced merkle tree. -/// -/// The only possible issue is maliablity in LeafOp, such as providing extra prefix data, -/// which should be controlled by a spec. Eg. with lengthOp as NONE, -/// prefix = FOO, key = BAR, value = CHOICE -/// and -/// prefix = F, key = OOBAR, value = CHOICE -/// would produce the same value. -/// -/// With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field -/// in the ProofSpec is valuable to prevent this mutability. And why all trees should -/// length-prefix the data before hashing it. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.ExistenceProof")] -pub struct ExistenceProof { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub leaf: ::core::option::Option, - #[prost(message, repeated, tag = "4")] - pub path: ::prost::alloc::vec::Vec, -} -/// -/// NonExistenceProof takes a proof of two neighbors, one left of the desired key, -/// one right of the desired key. If both proofs are valid AND they are neighbors, -/// then there is no valid proof for the given key. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.NonExistenceProof")] -pub struct NonExistenceProof { - /// TODO: remove this as unnecessary??? we prove a range - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub left: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub right: ::core::option::Option, -} -/// -/// CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.CommitmentProof")] -pub struct CommitmentProof { - #[prost(oneof = "commitment_proof::Proof", tags = "1, 2, 3, 4")] - pub proof: ::core::option::Option, -} -/// Nested message and enum types in `CommitmentProof`. -pub mod commitment_proof { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Proof { - #[prost(message, tag = "1")] - Exist(super::ExistenceProof), - #[prost(message, tag = "2")] - Nonexist(super::NonExistenceProof), - #[prost(message, tag = "3")] - Batch(super::BatchProof), - #[prost(message, tag = "4")] - Compressed(super::CompressedBatchProof), - } -} -/// * -/// LeafOp represents the raw key-value data we wish to prove, and -/// must be flexible to represent the internal transformation from -/// the original key-value pairs into the basis hash, for many existing -/// merkle trees. -/// -/// key and value are passed in. So that the signature of this operation is: -/// leafOp(key, value) -> output -/// -/// To process this, first prehash the keys and values if needed (ANY means no hash in this case): -/// hkey = prehashKey(key) -/// hvalue = prehashValue(value) -/// -/// Then combine the bytes, and hash it -/// output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.LeafOp")] -pub struct LeafOp { - #[prost(enumeration = "HashOp", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub hash: i32, - #[prost(enumeration = "HashOp", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub prehash_key: i32, - #[prost(enumeration = "HashOp", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub prehash_value: i32, - #[prost(enumeration = "LengthOp", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub length: i32, - /// prefix is a fixed bytes that may optionally be included at the beginning to differentiate - /// a leaf node from an inner node. - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub prefix: ::prost::alloc::vec::Vec, -} -/// * -/// InnerOp represents a merkle-proof step that is not a leaf. -/// It represents concatenating two children and hashing them to provide the next result. -/// -/// The result of the previous step is passed in, so the signature of this op is: -/// innerOp(child) -> output -/// -/// The result of applying InnerOp should be: -/// output = op.hash(op.prefix || child || op.suffix) -/// -/// where the || operator is concatenation of binary data, -/// and child is the result of hashing all the tree below this step. -/// -/// Any special data, like prepending child with the length, or prepending the entire operation with -/// some value to differentiate from leaf nodes, should be included in prefix and suffix. -/// If either of prefix or suffix is empty, we just treat it as an empty 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 = "/cosmos.ics23.v1.InnerOp")] -pub struct InnerOp { - #[prost(enumeration = "HashOp", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub hash: i32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub prefix: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub suffix: ::prost::alloc::vec::Vec, -} -/// * -/// ProofSpec defines what the expected parameters are for a given proof type. -/// This can be stored in the client and used to validate any incoming proofs. -/// -/// verify(ProofSpec, Proof) -> Proof | Error -/// -/// As demonstrated in tests, if we don't fix the algorithm used to calculate the -/// LeafHash for a given tree, there are many possible key-value pairs that can -/// generate a given hash (by interpretting the preimage differently). -/// We need this for proper security, requires client knows a priori what -/// tree format server uses. But not in code, rather a configuration object. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.ProofSpec")] -pub struct ProofSpec { - /// any field in the ExistenceProof must be the same as in this spec. - /// except Prefix, which is just the first bytes of prefix (spec can be longer) - #[prost(message, optional, tag = "1")] - pub leaf_spec: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub inner_spec: ::core::option::Option, - /// max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) - #[prost(int32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_depth: i32, - /// min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) - #[prost(int32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub min_depth: i32, - /// prehash_key_before_comparison is a flag that indicates whether to use the - /// prehash_key specified by LeafOp to compare lexical ordering of keys for - /// non-existence proofs. - #[prost(bool, tag = "5")] - pub prehash_key_before_comparison: bool, -} -/// -/// InnerSpec contains all store-specific structure info to determine if two proofs from a -/// given store are neighbors. -/// -/// This enables: -/// -/// isLeftMost(spec: InnerSpec, op: InnerOp) -/// isRightMost(spec: InnerSpec, op: InnerOp) -/// isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.InnerSpec")] -pub struct InnerSpec { - /// Child order is the ordering of the children node, must count from 0 - /// iavl tree is [0, 1] (left then right) - /// merk is [0, 2, 1] (left, right, here) - #[prost(int32, repeated, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub child_order: ::prost::alloc::vec::Vec, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub child_size: i32, - #[prost(int32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub min_prefix_length: i32, - #[prost(int32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_prefix_length: i32, - /// empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub empty_child: ::prost::alloc::vec::Vec, - /// hash is the algorithm that must be used for each InnerOp - #[prost(enumeration = "HashOp", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub hash: i32, -} -/// -/// BatchProof is a group of multiple proof types than can be compressed -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.BatchProof")] -pub struct BatchProof { - #[prost(message, repeated, tag = "1")] - pub entries: ::prost::alloc::vec::Vec, -} -/// Use BatchEntry not CommitmentProof, to avoid recursion -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.BatchEntry")] -pub struct BatchEntry { - #[prost(oneof = "batch_entry::Proof", tags = "1, 2")] - pub proof: ::core::option::Option, -} -/// Nested message and enum types in `BatchEntry`. -pub mod batch_entry { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Proof { - #[prost(message, tag = "1")] - Exist(super::ExistenceProof), - #[prost(message, tag = "2")] - Nonexist(super::NonExistenceProof), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.CompressedBatchProof")] -pub struct CompressedBatchProof { - #[prost(message, repeated, tag = "1")] - pub entries: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub lookup_inners: ::prost::alloc::vec::Vec, -} -/// Use BatchEntry not CommitmentProof, to avoid recursion -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.CompressedBatchEntry")] -pub struct CompressedBatchEntry { - #[prost(oneof = "compressed_batch_entry::Proof", tags = "1, 2")] - pub proof: ::core::option::Option, -} -/// Nested message and enum types in `CompressedBatchEntry`. -pub mod compressed_batch_entry { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Proof { - #[prost(message, tag = "1")] - Exist(super::CompressedExistenceProof), - #[prost(message, tag = "2")] - Nonexist(super::CompressedNonExistenceProof), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.CompressedExistenceProof")] -pub struct CompressedExistenceProof { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub leaf: ::core::option::Option, - /// these are indexes into the lookup_inners table in CompressedBatchProof - #[prost(int32, repeated, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.ics23.v1.CompressedNonExistenceProof")] -pub struct CompressedNonExistenceProof { - /// TODO: remove this as unnecessary??? we prove a range - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub left: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub right: ::core::option::Option, -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum HashOp { - /// NO_HASH is the default if no data passed. Note this is an illegal argument some places. - NoHash = 0, - Sha256 = 1, - Sha512 = 2, - Keccak = 3, - Ripemd160 = 4, - /// ripemd160(sha256(x)) - Bitcoin = 5, - Sha512256 = 6, -} -impl HashOp { - /// 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 { - HashOp::NoHash => "NO_HASH", - HashOp::Sha256 => "SHA256", - HashOp::Sha512 => "SHA512", - HashOp::Keccak => "KECCAK", - HashOp::Ripemd160 => "RIPEMD160", - HashOp::Bitcoin => "BITCOIN", - HashOp::Sha512256 => "SHA512_256", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NO_HASH" => Some(Self::NoHash), - "SHA256" => Some(Self::Sha256), - "SHA512" => Some(Self::Sha512), - "KECCAK" => Some(Self::Keccak), - "RIPEMD160" => Some(Self::Ripemd160), - "BITCOIN" => Some(Self::Bitcoin), - "SHA512_256" => Some(Self::Sha512256), - _ => None, - } - } -} -/// * -/// LengthOp defines how to process the key and value of the LeafOp -/// to include length information. After encoding the length with the given -/// algorithm, the length will be prepended to the key and value bytes. -/// (Each one with it's own encoded length) -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum LengthOp { - /// NO_PREFIX don't include any length info - NoPrefix = 0, - /// VAR_PROTO uses protobuf (and go-amino) varint encoding of the length - VarProto = 1, - /// VAR_RLP uses rlp int encoding of the length - VarRlp = 2, - /// FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer - Fixed32Big = 3, - /// FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer - Fixed32Little = 4, - /// FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer - Fixed64Big = 5, - /// FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer - Fixed64Little = 6, - /// REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) - Require32Bytes = 7, - /// REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) - Require64Bytes = 8, -} -impl LengthOp { - /// 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 { - LengthOp::NoPrefix => "NO_PREFIX", - LengthOp::VarProto => "VAR_PROTO", - LengthOp::VarRlp => "VAR_RLP", - LengthOp::Fixed32Big => "FIXED32_BIG", - LengthOp::Fixed32Little => "FIXED32_LITTLE", - LengthOp::Fixed64Big => "FIXED64_BIG", - LengthOp::Fixed64Little => "FIXED64_LITTLE", - LengthOp::Require32Bytes => "REQUIRE_32_BYTES", - LengthOp::Require64Bytes => "REQUIRE_64_BYTES", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NO_PREFIX" => Some(Self::NoPrefix), - "VAR_PROTO" => Some(Self::VarProto), - "VAR_RLP" => Some(Self::VarRlp), - "FIXED32_BIG" => Some(Self::Fixed32Big), - "FIXED32_LITTLE" => Some(Self::Fixed32Little), - "FIXED64_BIG" => Some(Self::Fixed64Big), - "FIXED64_LITTLE" => Some(Self::Fixed64Little), - "REQUIRE_32_BYTES" => Some(Self::Require32Bytes), - "REQUIRE_64_BYTES" => Some(Self::Require64Bytes), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/mint/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/mint/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/mint/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/mint/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/mint/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/mint/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/mint/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/mint/module/v1.rs deleted file mode 100644 index b076395a..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/mint/module/v1.rs +++ /dev/null @@ -1,21 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the mint module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.mint.module.v1.Module")] -pub struct Module { - #[prost(string, tag = "1")] - pub fee_collector_name: ::prost::alloc::string::String, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/mint/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/mint/v1beta1.rs deleted file mode 100644 index b0d6b68d..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/mint/v1beta1.rs +++ /dev/null @@ -1,260 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Minter represents the minting state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.mint.v1beta1.Minter")] -pub struct Minter { - /// current annual inflation rate - #[prost(string, tag = "1")] - pub inflation: ::prost::alloc::string::String, - /// current annual expected provisions - #[prost(string, tag = "2")] - pub annual_provisions: ::prost::alloc::string::String, -} -/// Params defines the parameters for the x/mint module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.mint.v1beta1.Params")] -pub struct Params { - /// type of coin to mint - #[prost(string, tag = "1")] - pub mint_denom: ::prost::alloc::string::String, - /// maximum annual change in inflation rate - #[prost(string, tag = "2")] - pub inflation_rate_change: ::prost::alloc::string::String, - /// maximum inflation rate - #[prost(string, tag = "3")] - pub inflation_max: ::prost::alloc::string::String, - /// minimum inflation rate - #[prost(string, tag = "4")] - pub inflation_min: ::prost::alloc::string::String, - /// goal of percent bonded atoms - #[prost(string, tag = "5")] - pub goal_bonded: ::prost::alloc::string::String, - /// expected blocks per year - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub blocks_per_year: u64, -} -/// GenesisState defines the mint module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.mint.v1beta1.GenesisState")] -pub struct GenesisState { - /// minter is a space for holding current inflation information. - #[prost(message, optional, tag = "1")] - pub minter: ::core::option::Option, - /// params defines all the parameters of the module. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmos.mint.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.mint.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmos.mint.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryInflationRequest is the request type for the Query/Inflation 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 = "/cosmos.mint.v1beta1.QueryInflationRequest")] -#[proto_query( - path = "/cosmos.mint.v1beta1.Query/Inflation", - response_type = QueryInflationResponse -)] -pub struct QueryInflationRequest {} -/// QueryInflationResponse is the response type for the Query/Inflation 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 = "/cosmos.mint.v1beta1.QueryInflationResponse")] -pub struct QueryInflationResponse { - /// inflation is the current minting inflation value. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub inflation: ::prost::alloc::vec::Vec, -} -/// QueryAnnualProvisionsRequest is the request type for the -/// Query/AnnualProvisions 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 = "/cosmos.mint.v1beta1.QueryAnnualProvisionsRequest")] -#[proto_query( - path = "/cosmos.mint.v1beta1.Query/AnnualProvisions", - response_type = QueryAnnualProvisionsResponse -)] -pub struct QueryAnnualProvisionsRequest {} -/// QueryAnnualProvisionsResponse is the response type for the -/// Query/AnnualProvisions 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 = "/cosmos.mint.v1beta1.QueryAnnualProvisionsResponse")] -pub struct QueryAnnualProvisionsResponse { - /// annual_provisions is the current minting annual provisions value. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub annual_provisions: ::prost::alloc::vec::Vec, -} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.mint.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/mint parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.mint.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct MintQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> MintQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn inflation(&self) -> Result { - QueryInflationRequest {}.query(self.querier) - } - pub fn annual_provisions( - &self, - ) -> Result { - QueryAnnualProvisionsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/mod.rs deleted file mode 100644 index 13633234..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -pub mod app; -pub mod auth; -pub mod authz; -pub mod bank; -pub mod base; -pub mod circuit; -pub mod consensus; -pub mod crisis; -pub mod crypto; -pub mod distribution; -pub mod evidence; -pub mod feegrant; -pub mod genutil; -pub mod gov; -pub mod group; -pub mod ics23; -pub mod mint; -pub mod nft; -pub mod orm; -pub mod params; -pub mod slashing; -pub mod staking; -pub mod store; -pub mod tx; -pub mod upgrade; -pub mod vesting; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/nft/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/nft/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/nft/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/nft/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/nft/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/nft/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/nft/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/nft/module/v1.rs deleted file mode 100644 index 5869f740..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/nft/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the nft module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/nft/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/nft/v1beta1.rs deleted file mode 100644 index 8be1e5b2..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/nft/v1beta1.rs +++ /dev/null @@ -1,610 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// EventSend is emitted on Msg/Send -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.EventSend")] -pub struct EventSend { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id is a unique identifier of the nft - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// sender is the address of the owner of nft - #[prost(string, tag = "3")] - pub sender: ::prost::alloc::string::String, - /// receiver is the receiver address of nft - #[prost(string, tag = "4")] - pub receiver: ::prost::alloc::string::String, -} -/// EventMint is emitted on Mint -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.EventMint")] -pub struct EventMint { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id is a unique identifier of the nft - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// owner is the owner address of the nft - #[prost(string, tag = "3")] - pub owner: ::prost::alloc::string::String, -} -/// EventBurn is emitted on Burn -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.EventBurn")] -pub struct EventBurn { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id is a unique identifier of the nft - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// owner is the owner address of the nft - #[prost(string, tag = "3")] - pub owner: ::prost::alloc::string::String, -} -/// Class defines the class of the nft 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 = "/cosmos.nft.v1beta1.Class")] -pub struct Class { - /// id defines the unique identifier of the NFT classification, similar to the contract address of ERC721 - #[prost(string, tag = "1")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// name defines the human-readable name of the NFT classification. Optional - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, - /// symbol is an abbreviated name for nft classification. Optional - #[prost(string, tag = "3")] - pub symbol: ::prost::alloc::string::String, - /// description is a brief description of nft classification. Optional - #[prost(string, tag = "4")] - pub description: ::prost::alloc::string::String, - /// uri for the class metadata stored off chain. It can define schema for Class and NFT `Data` attributes. Optional - #[prost(string, tag = "5")] - pub uri: ::prost::alloc::string::String, - /// uri_hash is a hash of the document pointed by uri. Optional - #[prost(string, tag = "6")] - pub uri_hash: ::prost::alloc::string::String, - /// data is the app specific metadata of the NFT class. Optional - #[prost(message, optional, tag = "7")] - pub data: ::core::option::Option, -} -/// NFT defines the NFT. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.NFT")] -pub struct Nft { - /// class_id associated with the NFT, similar to the contract address of ERC721 - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id is a unique identifier of the NFT - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// uri for the NFT metadata stored off chain - #[prost(string, tag = "3")] - pub uri: ::prost::alloc::string::String, - /// uri_hash is a hash of the document pointed by uri - #[prost(string, tag = "4")] - pub uri_hash: ::prost::alloc::string::String, - /// data is an app specific data of the NFT. Optional - #[prost(message, optional, tag = "10")] - pub data: ::core::option::Option, -} -/// GenesisState defines the nft module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.GenesisState")] -pub struct GenesisState { - /// class defines the class of the nft type. - #[prost(message, repeated, tag = "1")] - pub classes: ::prost::alloc::vec::Vec, - /// entry defines all nft owned by a person. - #[prost(message, repeated, tag = "2")] - pub entries: ::prost::alloc::vec::Vec, -} -/// Entry Defines all nft owned by a person -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.Entry")] -pub struct Entry { - /// owner is the owner address of the following nft - #[prost(string, tag = "1")] - pub owner: ::prost::alloc::string::String, - /// nfts is a group of nfts of the same owner - #[prost(message, repeated, tag = "2")] - pub nfts: ::prost::alloc::vec::Vec, -} -/// QueryBalanceRequest is the request type for the Query/Balance 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 = "/cosmos.nft.v1beta1.QueryBalanceRequest")] -#[proto_query( - path = "/cosmos.nft.v1beta1.Query/Balance", - response_type = QueryBalanceResponse -)] -pub struct QueryBalanceRequest { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// owner is the owner address of the nft - #[prost(string, tag = "2")] - pub owner: ::prost::alloc::string::String, -} -/// QueryBalanceResponse is the response type for the Query/Balance 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 = "/cosmos.nft.v1beta1.QueryBalanceResponse")] -pub struct QueryBalanceResponse { - /// amount is the number of all NFTs of a given class owned by the owner - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub amount: u64, -} -/// QueryOwnerRequest is the request type for the Query/Owner 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 = "/cosmos.nft.v1beta1.QueryOwnerRequest")] -#[proto_query( - path = "/cosmos.nft.v1beta1.Query/Owner", - response_type = QueryOwnerResponse -)] -pub struct QueryOwnerRequest { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id is a unique identifier of the NFT - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, -} -/// QueryOwnerResponse is the response type for the Query/Owner 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 = "/cosmos.nft.v1beta1.QueryOwnerResponse")] -pub struct QueryOwnerResponse { - /// owner is the owner address of the nft - #[prost(string, tag = "1")] - pub owner: ::prost::alloc::string::String, -} -/// QuerySupplyRequest is the request type for the Query/Supply 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 = "/cosmos.nft.v1beta1.QuerySupplyRequest")] -#[proto_query( - path = "/cosmos.nft.v1beta1.Query/Supply", - response_type = QuerySupplyResponse -)] -pub struct QuerySupplyRequest { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, -} -/// QuerySupplyResponse is the response type for the Query/Supply 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 = "/cosmos.nft.v1beta1.QuerySupplyResponse")] -pub struct QuerySupplyResponse { - /// amount is the number of all NFTs from the given class - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub amount: u64, -} -/// QueryNFTstRequest is the request type for the Query/NFTs 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 = "/cosmos.nft.v1beta1.QueryNFTsRequest")] -#[proto_query( - path = "/cosmos.nft.v1beta1.Query/NFTs", - response_type = QueryNfTsResponse -)] -pub struct QueryNfTsRequest { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// owner is the owner address of the nft - #[prost(string, tag = "2")] - pub owner: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -/// QueryNFTsResponse is the response type for the Query/NFTs RPC methods -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.QueryNFTsResponse")] -pub struct QueryNfTsResponse { - /// NFT defines the NFT - #[prost(message, repeated, tag = "1")] - pub nfts: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryNFTRequest is the request type for the Query/NFT 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 = "/cosmos.nft.v1beta1.QueryNFTRequest")] -#[proto_query(path = "/cosmos.nft.v1beta1.Query/NFT", response_type = QueryNftResponse)] -pub struct QueryNftRequest { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id is a unique identifier of the NFT - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, -} -/// QueryNFTResponse is the response type for the Query/NFT 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 = "/cosmos.nft.v1beta1.QueryNFTResponse")] -pub struct QueryNftResponse { - /// owner is the owner address of the nft - #[prost(message, optional, tag = "1")] - pub nft: ::core::option::Option, -} -/// QueryClassRequest is the request type for the Query/Class 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 = "/cosmos.nft.v1beta1.QueryClassRequest")] -#[proto_query( - path = "/cosmos.nft.v1beta1.Query/Class", - response_type = QueryClassResponse -)] -pub struct QueryClassRequest { - /// class_id associated with the nft - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, -} -/// QueryClassResponse is the response type for the Query/Class 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 = "/cosmos.nft.v1beta1.QueryClassResponse")] -pub struct QueryClassResponse { - /// class defines the class of the nft type. - #[prost(message, optional, tag = "1")] - pub class: ::core::option::Option, -} -/// QueryClassesRequest is the request type for the Query/Classes 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 = "/cosmos.nft.v1beta1.QueryClassesRequest")] -#[proto_query( - path = "/cosmos.nft.v1beta1.Query/Classes", - response_type = QueryClassesResponse -)] -pub struct QueryClassesRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// QueryClassesResponse is the response type for the Query/Classes 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 = "/cosmos.nft.v1beta1.QueryClassesResponse")] -pub struct QueryClassesResponse { - /// class defines the class of the nft type. - #[prost(message, repeated, tag = "1")] - pub classes: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// MsgSend represents a message to send a nft from one account to another account. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.nft.v1beta1.MsgSend")] -pub struct MsgSend { - /// class_id defines the unique identifier of the nft classification, similar to the contract address of ERC721 - #[prost(string, tag = "1")] - #[serde(alias = "classID")] - pub class_id: ::prost::alloc::string::String, - /// id defines the unique identification of nft - #[prost(string, tag = "2")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// sender is the address of the owner of nft - #[prost(string, tag = "3")] - pub sender: ::prost::alloc::string::String, - /// receiver is the receiver address of nft - #[prost(string, tag = "4")] - pub receiver: ::prost::alloc::string::String, -} -/// MsgSendResponse defines the Msg/Send response 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 = "/cosmos.nft.v1beta1.MsgSendResponse")] -pub struct MsgSendResponse {} -pub struct NftQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> NftQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn balance( - &self, - class_id: ::prost::alloc::string::String, - owner: ::prost::alloc::string::String, - ) -> Result { - QueryBalanceRequest { class_id, owner }.query(self.querier) - } - pub fn owner( - &self, - class_id: ::prost::alloc::string::String, - id: ::prost::alloc::string::String, - ) -> Result { - QueryOwnerRequest { class_id, id }.query(self.querier) - } - pub fn supply( - &self, - class_id: ::prost::alloc::string::String, - ) -> Result { - QuerySupplyRequest { class_id }.query(self.querier) - } - pub fn nf_ts( - &self, - class_id: ::prost::alloc::string::String, - owner: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryNfTsRequest { - class_id, - owner, - pagination, - } - .query(self.querier) - } - pub fn nft( - &self, - class_id: ::prost::alloc::string::String, - id: ::prost::alloc::string::String, - ) -> Result { - QueryNftRequest { class_id, id }.query(self.querier) - } - pub fn class( - &self, - class_id: ::prost::alloc::string::String, - ) -> Result { - QueryClassRequest { class_id }.query(self.querier) - } - pub fn classes( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryClassesRequest { pagination }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/mod.rs deleted file mode 100644 index 381cd4d2..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod module; -pub mod query; -pub mod v1; -pub mod v1alpha1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/module/mod.rs deleted file mode 100644 index 32a5a9d4..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1alpha1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/module/v1alpha1.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/module/v1alpha1.rs deleted file mode 100644 index 8feeb6e9..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/module/v1alpha1.rs +++ /dev/null @@ -1,17 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module defines the ORM module which adds providers to the app container for -/// ORM ModuleDB's and in the future will automatically register query -/// services for modules that use the ORM. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.module.v1alpha1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/query/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/query/mod.rs deleted file mode 100644 index 32a5a9d4..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/query/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1alpha1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/query/v1alpha1.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/query/v1alpha1.rs deleted file mode 100644 index 6701d16c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/query/v1alpha1.rs +++ /dev/null @@ -1,273 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GetRequest is the Query/Get 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 = "/cosmos.orm.query.v1alpha1.GetRequest")] -#[proto_query( - path = "/cosmos.orm.query.v1alpha1.Query/Get", - response_type = GetResponse -)] -pub struct GetRequest { - /// message_name is the fully-qualified message name of the ORM table being queried. - #[prost(string, tag = "1")] - pub message_name: ::prost::alloc::string::String, - /// index is the index fields expression used in orm definitions. If it - /// is empty, the table's primary key is assumed. If it is non-empty, it must - /// refer to an unique index. - #[prost(string, tag = "2")] - pub index: ::prost::alloc::string::String, - /// values are the values of the fields corresponding to the requested index. - /// There must be as many values provided as there are fields in the index and - /// these values must correspond to the index field types. - #[prost(message, repeated, tag = "3")] - pub values: ::prost::alloc::vec::Vec, -} -/// GetResponse is the Query/Get response 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 = "/cosmos.orm.query.v1alpha1.GetResponse")] -pub struct GetResponse { - /// result is the result of the get query. If no value is found, the gRPC - /// status code NOT_FOUND will be returned. - #[prost(message, optional, tag = "1")] - pub result: ::core::option::Option, -} -/// ListRequest is the Query/List 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 = "/cosmos.orm.query.v1alpha1.ListRequest")] -#[proto_query( - path = "/cosmos.orm.query.v1alpha1.Query/List", - response_type = ListResponse -)] -pub struct ListRequest { - /// message_name is the fully-qualified message name of the ORM table being queried. - #[prost(string, tag = "1")] - pub message_name: ::prost::alloc::string::String, - /// index is the index fields expression used in orm definitions. If it - /// is empty, the table's primary key is assumed. - #[prost(string, tag = "2")] - pub index: ::prost::alloc::string::String, - /// pagination is the pagination request. - #[prost(message, optional, tag = "5")] - pub pagination: ::core::option::Option, - /// query is the query expression corresponding to the provided index. If - /// neither prefix nor range is specified, the query will list all the fields - /// in the index. - #[prost(oneof = "list_request::Query", tags = "3, 4")] - pub query: ::core::option::Option, -} -/// Nested message and enum types in `ListRequest`. -pub mod list_request { - use neutron_std_derive::CosmwasmExt; - /// Prefix specifies the arguments to a prefix query. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.orm.query.v1alpha1.ListRequest.Prefix")] - pub struct Prefix { - /// values specifies the index values for the prefix query. - /// It is valid to special a partial prefix with fewer values than - /// the number of fields in the index. - #[prost(message, repeated, tag = "1")] - pub values: ::prost::alloc::vec::Vec, - } - /// Range specifies the arguments to a range query. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.orm.query.v1alpha1.ListRequest.Range")] - pub struct Range { - /// start specifies the starting index values for the range query. - /// It is valid to provide fewer values than the number of fields in the - /// index. - #[prost(message, repeated, tag = "1")] - pub start: ::prost::alloc::vec::Vec, - /// end specifies the inclusive ending index values for the range query. - /// It is valid to provide fewer values than the number of fields in the - /// index. - #[prost(message, repeated, tag = "2")] - pub end: ::prost::alloc::vec::Vec, - } - /// query is the query expression corresponding to the provided index. If - /// neither prefix nor range is specified, the query will list all the fields - /// in the index. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Query { - /// prefix defines a prefix query. - #[prost(message, tag = "3")] - Prefix(Prefix), - /// range defines a range query. - #[prost(message, tag = "4")] - Range(Range), - } -} -/// ListResponse is the Query/List response 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 = "/cosmos.orm.query.v1alpha1.ListResponse")] -pub struct ListResponse { - /// results are the results of the query. - #[prost(message, repeated, tag = "1")] - pub results: ::prost::alloc::vec::Vec, - /// pagination is the pagination response. - #[prost(message, optional, tag = "5")] - pub pagination: ::core::option::Option, -} -/// IndexValue represents the value of a field in an ORM index expression. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.query.v1alpha1.IndexValue")] -pub struct IndexValue { - /// value specifies the index value - #[prost(oneof = "index_value::Value", tags = "1, 2, 3, 4, 5, 6, 7, 8")] - pub value: ::core::option::Option, -} -/// Nested message and enum types in `IndexValue`. -pub mod index_value { - /// value specifies the index value - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Value { - /// uint specifies a value for an uint32, fixed32, uint64, or fixed64 - /// index field. - #[prost(uint64, tag = "1")] - Uint(u64), - /// int64 specifies a value for an int32, sfixed32, int64, or sfixed64 - /// index field. - #[prost(int64, tag = "2")] - Int(i64), - /// str specifies a value for a string index field. - #[prost(string, tag = "3")] - Str(::prost::alloc::string::String), - /// bytes specifies a value for a bytes index field. - #[prost(bytes, tag = "4")] - Bytes(::prost::alloc::vec::Vec), - /// enum specifies a value for an enum index field. - #[prost(string, tag = "5")] - Enum(::prost::alloc::string::String), - /// bool specifies a value for a bool index field. - #[prost(bool, tag = "6")] - Bool(bool), - /// timestamp specifies a value for a timestamp index field. - #[prost(message, tag = "7")] - Timestamp(crate::shim::Timestamp), - /// duration specifies a value for a duration index field. - #[prost(message, tag = "8")] - Duration(crate::shim::Duration), - } -} -pub struct V1alpha1Querier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> V1alpha1Querier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn get( - &self, - message_name: ::prost::alloc::string::String, - index: ::prost::alloc::string::String, - values: ::prost::alloc::vec::Vec, - ) -> Result { - GetRequest { - message_name, - index, - values, - } - .query(self.querier) - } - pub fn list( - &self, - message_name: ::prost::alloc::string::String, - index: ::prost::alloc::string::String, - pagination: ::core::option::Option, - query: ::core::option::Option, - ) -> Result { - ListRequest { - message_name, - index, - pagination, - query, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/v1.rs deleted file mode 100644 index 0c20c1f8..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/v1.rs +++ /dev/null @@ -1,151 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// TableDescriptor describes an ORM table. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.v1.TableDescriptor")] -pub struct TableDescriptor { - /// primary_key defines the primary key for the table. - #[prost(message, optional, tag = "1")] - pub primary_key: ::core::option::Option, - /// index defines one or more secondary indexes. - #[prost(message, repeated, tag = "2")] - pub index: ::prost::alloc::vec::Vec, - /// id is a non-zero integer ID that must be unique within the - /// tables and singletons in this file. It may be deprecated in the future when this - /// can be auto-generated. - #[prost(uint32, tag = "3")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u32, -} -/// PrimaryKeyDescriptor describes a table primary key. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.v1.PrimaryKeyDescriptor")] -pub struct PrimaryKeyDescriptor { - /// fields is a comma-separated list of fields in the primary key. Spaces are - /// not allowed. Supported field types, their encodings, and any applicable constraints - /// are described below. - /// - uint32 are encoded as 2,3,4 or 5 bytes using a compact encoding that - /// is suitable for sorted iteration (not varint encoding). This type is - /// well-suited for small integers. - /// - uint64 are encoded as 2,4,6 or 9 bytes using a compact encoding that - /// is suitable for sorted iteration (not varint encoding). This type is - /// well-suited for small integers such as auto-incrementing sequences. - /// - fixed32, fixed64 are encoded as big-endian fixed width bytes and support - /// sorted iteration. These types are well-suited for encoding fixed with - /// decimals as integers. - /// - string's are encoded as raw bytes in terminal key segments and null-terminated - /// in non-terminal segments. Null characters are thus forbidden in strings. - /// string fields support sorted iteration. - /// - bytes are encoded as raw bytes in terminal segments and length-prefixed - /// with a 32-bit unsigned varint in non-terminal segments. - /// - int32, sint32, int64, sint64, sfixed32, sfixed64 are encoded as fixed width bytes with - /// an encoding that enables sorted iteration. - /// - google.protobuf.Timestamp is encoded such that values with only seconds occupy 6 bytes, - /// values including nanos occupy 9 bytes, and nil values occupy 1 byte. When iterating, nil - /// values will always be ordered last. Seconds and nanos values must conform to the officially - /// specified ranges of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z and 0 to 999,999,999 respectively. - /// - google.protobuf.Duration is encoded as 12 bytes using an encoding that enables sorted iteration. - /// - enum fields are encoded using varint encoding and do not support sorted - /// iteration. - /// - bool fields are encoded as a single byte 0 or 1. - /// - /// All other fields types are unsupported in keys including repeated and - /// oneof fields. - /// - /// Primary keys are prefixed by the varint encoded table id and the byte 0x0 - /// plus any additional prefix specified by the schema. - #[prost(string, tag = "1")] - pub fields: ::prost::alloc::string::String, - /// auto_increment specifies that the primary key is generated by an - /// auto-incrementing integer. If this is set to true fields must only - /// contain one field of that is of type uint64. - #[prost(bool, tag = "2")] - pub auto_increment: bool, -} -/// PrimaryKeyDescriptor describes a table secondary index. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.v1.SecondaryIndexDescriptor")] -pub struct SecondaryIndexDescriptor { - /// fields is a comma-separated list of fields in the index. The supported - /// field types are the same as those for PrimaryKeyDescriptor.fields. - /// Index keys are prefixed by the varint encoded table id and the varint - /// encoded index id plus any additional prefix specified by the schema. - /// - /// In addition the field segments, non-unique index keys are suffixed with - /// any additional primary key fields not present in the index fields so that the - /// primary key can be reconstructed. Unique indexes instead of being suffixed - /// store the remaining primary key fields in the value.. - #[prost(string, tag = "1")] - pub fields: ::prost::alloc::string::String, - /// id is a non-zero integer ID that must be unique within the indexes for this - /// table and less than 32768. It may be deprecated in the future when this can - /// be auto-generated. - #[prost(uint32, tag = "2")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u32, - /// unique specifies that this an unique index. - #[prost(bool, tag = "3")] - pub unique: bool, -} -/// TableDescriptor describes an ORM singleton table which has at most one instance. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.v1.SingletonDescriptor")] -pub struct SingletonDescriptor { - /// id is a non-zero integer ID that must be unique within the - /// tables and singletons in this file. It may be deprecated in the future when this - /// can be auto-generated. - #[prost(uint32, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u32, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/orm/v1alpha1.rs b/packages/neutron-sdk/src/proto_types/cosmos/orm/v1alpha1.rs deleted file mode 100644 index 0cea52a6..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/orm/v1alpha1.rs +++ /dev/null @@ -1,109 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ModuleSchemaDescriptor describe's a module's ORM schema. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor")] -pub struct ModuleSchemaDescriptor { - #[prost(message, repeated, tag = "1")] - pub schema_file: ::prost::alloc::vec::Vec, - /// prefix is an optional prefix that precedes all keys in this module's - /// store. - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub prefix: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `ModuleSchemaDescriptor`. -pub mod module_schema_descriptor { - use neutron_std_derive::CosmwasmExt; - /// FileEntry describes an ORM file used in a module. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.orm.v1alpha1.ModuleSchemaDescriptor.FileEntry")] - pub struct FileEntry { - /// id is a prefix that will be varint encoded and prepended to all the - /// table keys specified in the file's tables. - #[prost(uint32, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u32, - /// proto_file_name is the name of a file .proto in that contains - /// table definitions. The .proto file must be in a package that the - /// module has referenced using cosmos.app.v1.ModuleDescriptor.use_package. - #[prost(string, tag = "2")] - pub proto_file_name: ::prost::alloc::string::String, - /// storage_type optionally indicates the type of storage this file's - /// tables should used. If it is left unspecified, the default KV-storage - /// of the app will be used. - #[prost(enumeration = "super::StorageType", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub storage_type: i32, - } -} -/// StorageType -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum StorageType { - /// STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent storage where all - /// data is stored in the regular Merkle-tree backed KV-store. - DefaultUnspecified = 0, - /// STORAGE_TYPE_MEMORY indicates in-memory storage that will be - /// reloaded every time an app restarts. Tables with this type of storage - /// will by default be ignored when importing and exporting a module's - /// state from JSON. - Memory = 1, - /// STORAGE_TYPE_TRANSIENT indicates transient storage that is reset - /// at the end of every block. Tables with this type of storage - /// will by default be ignored when importing and exporting a module's - /// state from JSON. - Transient = 2, -} -impl StorageType { - /// 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 { - StorageType::DefaultUnspecified => "STORAGE_TYPE_DEFAULT_UNSPECIFIED", - StorageType::Memory => "STORAGE_TYPE_MEMORY", - StorageType::Transient => "STORAGE_TYPE_TRANSIENT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "STORAGE_TYPE_DEFAULT_UNSPECIFIED" => Some(Self::DefaultUnspecified), - "STORAGE_TYPE_MEMORY" => Some(Self::Memory), - "STORAGE_TYPE_TRANSIENT" => Some(Self::Transient), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/params/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/params/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/params/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/params/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/params/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/params/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/params/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/params/module/v1.rs deleted file mode 100644 index 067e8090..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/params/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the params module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.params.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/params/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/params/v1beta1.rs deleted file mode 100644 index c6366e90..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/params/v1beta1.rs +++ /dev/null @@ -1,168 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ParameterChangeProposal defines a proposal to change one or more parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.params.v1beta1.ParameterChangeProposal")] -pub struct ParameterChangeProposal { - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub changes: ::prost::alloc::vec::Vec, -} -/// ParamChange defines an individual parameter change, for use in -/// ParameterChangeProposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.params.v1beta1.ParamChange")] -pub struct ParamChange { - #[prost(string, tag = "1")] - pub subspace: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub key: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub value: ::prost::alloc::string::String, -} -/// QueryParamsRequest is request type for the Query/Params 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 = "/cosmos.params.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.params.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest { - /// subspace defines the module to query the parameter for. - #[prost(string, tag = "1")] - pub subspace: ::prost::alloc::string::String, - /// key defines the key of the parameter in the subspace. - #[prost(string, tag = "2")] - pub key: ::prost::alloc::string::String, -} -/// QueryParamsResponse is response type for the Query/Params 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 = "/cosmos.params.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// param defines the queried parameter. - #[prost(message, optional, tag = "1")] - pub param: ::core::option::Option, -} -/// QuerySubspacesRequest defines a request type for querying for all registered -/// subspaces and all keys for a subspace. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.params.v1beta1.QuerySubspacesRequest")] -#[proto_query( - path = "/cosmos.params.v1beta1.Query/Subspaces", - response_type = QuerySubspacesResponse -)] -pub struct QuerySubspacesRequest {} -/// QuerySubspacesResponse defines the response types for querying for all -/// registered subspaces and all keys for a subspace. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.params.v1beta1.QuerySubspacesResponse")] -pub struct QuerySubspacesResponse { - #[prost(message, repeated, tag = "1")] - pub subspaces: ::prost::alloc::vec::Vec, -} -/// Subspace defines a parameter subspace name and all the keys that exist for -/// the subspace. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.params.v1beta1.Subspace")] -pub struct Subspace { - #[prost(string, tag = "1")] - pub subspace: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "2")] - pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -pub struct ParamsQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ParamsQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params( - &self, - subspace: ::prost::alloc::string::String, - key: ::prost::alloc::string::String, - ) -> Result { - QueryParamsRequest { subspace, key }.query(self.querier) - } - pub fn subspaces(&self) -> Result { - QuerySubspacesRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/slashing/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/slashing/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/slashing/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/slashing/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/slashing/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/slashing/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/slashing/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/slashing/module/v1.rs deleted file mode 100644 index 9803b313..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/slashing/module/v1.rs +++ /dev/null @@ -1,19 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the slashing module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.module.v1.Module")] -pub struct Module { - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/slashing/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/slashing/v1beta1.rs deleted file mode 100644 index 59aa7be6..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/slashing/v1beta1.rs +++ /dev/null @@ -1,402 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ValidatorSigningInfo defines a validator's signing info for monitoring their -/// liveness activity. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.ValidatorSigningInfo")] -pub struct ValidatorSigningInfo { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// Height at which validator was first a candidate OR was un-jailed - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub start_height: i64, - /// Index which is incremented every time a validator is bonded in a block and - /// _may_ have signed a pre-commit or not. This in conjunction with the - /// signed_blocks_window param determines the index in the missed block bitmap. - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index_offset: i64, - /// Timestamp until which the validator is jailed due to liveness downtime. - #[prost(message, optional, tag = "4")] - pub jailed_until: ::core::option::Option, - /// Whether or not a validator has been tombstoned (killed out of validator - /// set). It is set once the validator commits an equivocation or for any other - /// configured misbehavior. - #[prost(bool, tag = "5")] - pub tombstoned: bool, - /// A counter of missed (unsigned) blocks. It is used to avoid unnecessary - /// reads in the missed block bitmap. - #[prost(int64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub missed_blocks_counter: i64, -} -/// Params represents the parameters used for by the slashing module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.Params")] -pub struct Params { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub signed_blocks_window: i64, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub min_signed_per_window: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub downtime_jail_duration: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub slash_fraction_double_sign: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub slash_fraction_downtime: ::prost::alloc::vec::Vec, -} -/// GenesisState defines the slashing module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.GenesisState")] -pub struct GenesisState { - /// params defines all the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// signing_infos represents a map between validator addresses and their - /// signing infos. - #[prost(message, repeated, tag = "2")] - pub signing_infos: ::prost::alloc::vec::Vec, - /// missed_blocks represents a map between validator addresses and their - /// missed blocks. - #[prost(message, repeated, tag = "3")] - pub missed_blocks: ::prost::alloc::vec::Vec, -} -/// SigningInfo stores validator signing info of corresponding address. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.SigningInfo")] -pub struct SigningInfo { - /// address is the validator address. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// validator_signing_info represents the signing info of this validator. - #[prost(message, optional, tag = "2")] - pub validator_signing_info: ::core::option::Option, -} -/// ValidatorMissedBlocks contains array of missed blocks of corresponding -/// address. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.ValidatorMissedBlocks")] -pub struct ValidatorMissedBlocks { - /// address is the validator address. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// missed_blocks is an array of missed blocks by the validator. - #[prost(message, repeated, tag = "2")] - pub missed_blocks: ::prost::alloc::vec::Vec, -} -/// MissedBlock contains height and missed status as boolean. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.MissedBlock")] -pub struct MissedBlock { - /// index is the height at which the block was missed. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: i64, - /// missed is the missed status. - #[prost(bool, tag = "2")] - pub missed: bool, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmos.slashing.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.slashing.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmos.slashing.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QuerySigningInfoRequest is the request type for the Query/SigningInfo 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 = "/cosmos.slashing.v1beta1.QuerySigningInfoRequest")] -#[proto_query( - path = "/cosmos.slashing.v1beta1.Query/SigningInfo", - response_type = QuerySigningInfoResponse -)] -pub struct QuerySigningInfoRequest { - /// cons_address is the address to query signing info of - #[prost(string, tag = "1")] - pub cons_address: ::prost::alloc::string::String, -} -/// QuerySigningInfoResponse is the response type for the Query/SigningInfo 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 = "/cosmos.slashing.v1beta1.QuerySigningInfoResponse")] -pub struct QuerySigningInfoResponse { - /// val_signing_info is the signing info of requested val cons address - #[prost(message, optional, tag = "1")] - pub val_signing_info: ::core::option::Option, -} -/// QuerySigningInfosRequest is the request type for the Query/SigningInfos 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 = "/cosmos.slashing.v1beta1.QuerySigningInfosRequest")] -#[proto_query( - path = "/cosmos.slashing.v1beta1.Query/SigningInfos", - response_type = QuerySigningInfosResponse -)] -pub struct QuerySigningInfosRequest { - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// QuerySigningInfosResponse is the response type for the Query/SigningInfos 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 = "/cosmos.slashing.v1beta1.QuerySigningInfosResponse")] -pub struct QuerySigningInfosResponse { - /// info is the signing info of all validators - #[prost(message, repeated, tag = "1")] - pub info: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// MsgUnjail defines the Msg/Unjail 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 = "/cosmos.slashing.v1beta1.MsgUnjail")] -pub struct MsgUnjail { - #[prost(string, tag = "1")] - pub validator_addr: ::prost::alloc::string::String, -} -/// MsgUnjailResponse defines the Msg/Unjail response 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 = "/cosmos.slashing.v1beta1.MsgUnjailResponse")] -pub struct MsgUnjailResponse {} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/slashing parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.slashing.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct SlashingQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> SlashingQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn signing_info( - &self, - cons_address: ::prost::alloc::string::String, - ) -> Result { - QuerySigningInfoRequest { cons_address }.query(self.querier) - } - pub fn signing_infos( - &self, - pagination: ::core::option::Option, - ) -> Result { - QuerySigningInfosRequest { pagination }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/staking/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/staking/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/staking/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/staking/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/staking/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/staking/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/staking/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/staking/module/v1.rs deleted file mode 100644 index a7d80086..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/staking/module/v1.rs +++ /dev/null @@ -1,30 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the staking module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.module.v1.Module")] -pub struct Module { - /// hooks_order specifies the order of staking hooks and should be a list - /// of module names which provide a staking hooks instance. If no order is - /// provided, then hooks will be applied in alphabetical order of module names. - #[prost(string, repeated, tag = "1")] - pub hooks_order: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, - /// bech32_prefix_validator is the bech32 validator prefix for the app. - #[prost(string, tag = "3")] - pub bech32_prefix_validator: ::prost::alloc::string::String, - /// bech32_prefix_consensus is the bech32 consensus node prefix for the app. - #[prost(string, tag = "4")] - pub bech32_prefix_consensus: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/staking/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/staking/v1beta1.rs deleted file mode 100644 index 9cbeae02..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/staking/v1beta1.rs +++ /dev/null @@ -1,1918 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// StakeAuthorization defines authorization for delegate/undelegate/redelegate. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.StakeAuthorization")] -pub struct StakeAuthorization { - /// max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is - /// empty, there is no spend limit and any amount of coins can be delegated. - #[prost(message, optional, tag = "1")] - pub max_tokens: ::core::option::Option, - /// authorization_type defines one of AuthorizationType. - #[prost(enumeration = "AuthorizationType", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub authorization_type: i32, - /// validators is the oneof that represents either allow_list or deny_list - #[prost(oneof = "stake_authorization::Validators", tags = "2, 3")] - pub validators: ::core::option::Option, -} -/// Nested message and enum types in `StakeAuthorization`. -pub mod stake_authorization { - use neutron_std_derive::CosmwasmExt; - /// Validators defines list of validator addresses. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.staking.v1beta1.")] - pub struct Validators_ { - #[prost(string, repeated, tag = "1")] - pub address: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - } - /// validators is the oneof that represents either allow_list or deny_list - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Validators { - /// allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's - /// account. - #[prost(message, tag = "2")] - AllowList(Validators_), - /// deny_list specifies list of validator addresses to whom grantee can not delegate tokens. - #[prost(message, tag = "3")] - DenyList(Validators_), - } -} -/// AuthorizationType defines the type of staking module authorization type -/// -/// Since: cosmos-sdk 0.43 -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum AuthorizationType { - /// AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type - Unspecified = 0, - /// AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate - Delegate = 1, - /// AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate - Undelegate = 2, - /// AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate - Redelegate = 3, - /// AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION defines an authorization type for Msg/MsgCancelUnbondingDelegation - CancelUnbondingDelegation = 4, -} -impl AuthorizationType { - /// 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 { - AuthorizationType::Unspecified => "AUTHORIZATION_TYPE_UNSPECIFIED", - AuthorizationType::Delegate => "AUTHORIZATION_TYPE_DELEGATE", - AuthorizationType::Undelegate => "AUTHORIZATION_TYPE_UNDELEGATE", - AuthorizationType::Redelegate => "AUTHORIZATION_TYPE_REDELEGATE", - AuthorizationType::CancelUnbondingDelegation => { - "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION" - } - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "AUTHORIZATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "AUTHORIZATION_TYPE_DELEGATE" => Some(Self::Delegate), - "AUTHORIZATION_TYPE_UNDELEGATE" => Some(Self::Undelegate), - "AUTHORIZATION_TYPE_REDELEGATE" => Some(Self::Redelegate), - "AUTHORIZATION_TYPE_CANCEL_UNBONDING_DELEGATION" => { - Some(Self::CancelUnbondingDelegation) - } - _ => None, - } - } -} -/// HistoricalInfo contains header and validator information for a given block. -/// It is stored as part of staking module's state, which persists the `n` most -/// recent HistoricalInfo -/// (`n` is set by the staking module's `historical_entries` parameter). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.HistoricalInfo")] -pub struct HistoricalInfo { - #[prost(message, optional, tag = "1")] - pub header: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub valset: ::prost::alloc::vec::Vec, -} -/// CommissionRates defines the initial commission rates to be used for creating -/// a validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.CommissionRates")] -pub struct CommissionRates { - /// rate is the commission rate charged to delegators, as a fraction. - #[prost(string, tag = "1")] - pub rate: ::prost::alloc::string::String, - /// max_rate defines the maximum commission rate which validator can ever charge, as a fraction. - #[prost(string, tag = "2")] - pub max_rate: ::prost::alloc::string::String, - /// max_change_rate defines the maximum daily increase of the validator commission, as a fraction. - #[prost(string, tag = "3")] - pub max_change_rate: ::prost::alloc::string::String, -} -/// Commission defines commission parameters for a given validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Commission")] -pub struct Commission { - /// commission_rates defines the initial commission rates to be used for creating a validator. - #[prost(message, optional, tag = "1")] - pub commission_rates: ::core::option::Option, - /// update_time is the last time the commission rate was changed. - #[prost(message, optional, tag = "2")] - pub update_time: ::core::option::Option, -} -/// Description defines a validator description. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Description")] -pub struct Description { - /// moniker defines a human-readable name for the validator. - #[prost(string, tag = "1")] - pub moniker: ::prost::alloc::string::String, - /// identity defines an optional identity signature (ex. UPort or Keybase). - #[prost(string, tag = "2")] - pub identity: ::prost::alloc::string::String, - /// website defines an optional website link. - #[prost(string, tag = "3")] - pub website: ::prost::alloc::string::String, - /// security_contact defines an optional email for security contact. - #[prost(string, tag = "4")] - pub security_contact: ::prost::alloc::string::String, - /// details define other optional details. - #[prost(string, tag = "5")] - pub details: ::prost::alloc::string::String, -} -/// Validator defines a validator, together with the total amount of the -/// Validator's bond shares and their exchange rate to coins. Slashing results in -/// a decrease in the exchange rate, allowing correct calculation of future -/// undelegations without iterating over delegators. When coins are delegated to -/// this validator, the validator is credited with a delegation whose number of -/// bond shares is based on the amount of coins delegated divided by the current -/// exchange rate. Voting power can be calculated as total bonded shares -/// multiplied by exchange rate. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Validator")] -pub struct Validator { - /// operator_address defines the address of the validator's operator; bech encoded in JSON. - #[prost(string, tag = "1")] - pub operator_address: ::prost::alloc::string::String, - /// consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. - #[prost(message, optional, tag = "2")] - pub consensus_pubkey: ::core::option::Option, - /// jailed defined whether the validator has been jailed from bonded status or not. - #[prost(bool, tag = "3")] - pub jailed: bool, - /// status is the validator status (bonded/unbonding/unbonded). - #[prost(enumeration = "BondStatus", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, - /// tokens define the delegated tokens (incl. self-delegation). - #[prost(string, tag = "5")] - pub tokens: ::prost::alloc::string::String, - /// delegator_shares defines total shares issued to a validator's delegators. - #[prost(string, tag = "6")] - pub delegator_shares: ::prost::alloc::string::String, - /// description defines the description terms for the validator. - #[prost(message, optional, tag = "7")] - pub description: ::core::option::Option, - /// unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. - #[prost(int64, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub unbonding_height: i64, - /// unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. - #[prost(message, optional, tag = "9")] - pub unbonding_time: ::core::option::Option, - /// commission defines the commission parameters. - #[prost(message, optional, tag = "10")] - pub commission: ::core::option::Option, - /// min_self_delegation is the validator's self declared minimum self delegation. - /// - /// Since: cosmos-sdk 0.46 - #[prost(string, tag = "11")] - pub min_self_delegation: ::prost::alloc::string::String, - /// strictly positive if this validator's unbonding has been stopped by external modules - #[prost(int64, tag = "12")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub unbonding_on_hold_ref_count: i64, - /// list of unbonding ids, each uniquely identifing an unbonding of this validator - #[prost(uint64, repeated, tag = "13")] - #[serde(alias = "unbondingIDs")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub unbonding_ids: ::prost::alloc::vec::Vec, -} -/// ValAddresses defines a repeated set of validator addresses. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.ValAddresses")] -pub struct ValAddresses { - #[prost(string, repeated, tag = "1")] - pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// DVPair is struct that just has a delegator-validator pair with no other data. -/// It is intended to be used as a marshalable pointer. For example, a DVPair can -/// be used to construct the key to getting an UnbondingDelegation from state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.DVPair")] -pub struct DvPair { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, -} -/// DVPairs defines an array of DVPair objects. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.DVPairs")] -pub struct DvPairs { - #[prost(message, repeated, tag = "1")] - pub pairs: ::prost::alloc::vec::Vec, -} -/// DVVTriplet is struct that just has a delegator-validator-validator triplet -/// with no other data. It is intended to be used as a marshalable pointer. For -/// example, a DVVTriplet can be used to construct the key to getting a -/// Redelegation from state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.DVVTriplet")] -pub struct DvvTriplet { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_src_address: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub validator_dst_address: ::prost::alloc::string::String, -} -/// DVVTriplets defines an array of DVVTriplet objects. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.DVVTriplets")] -pub struct DvvTriplets { - #[prost(message, repeated, tag = "1")] - pub triplets: ::prost::alloc::vec::Vec, -} -/// Delegation represents the bond with tokens held by an account. It is -/// owned by one delegator, and is associated with the voting power of one -/// validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Delegation")] -pub struct Delegation { - /// delegator_address is the encoded address of the delegator. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - /// validator_address is the encoded address of the validator. - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - /// shares define the delegation shares received. - #[prost(string, tag = "3")] - pub shares: ::prost::alloc::string::String, -} -/// UnbondingDelegation stores all of a single delegator's unbonding bonds -/// for a single validator in an time-ordered list. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.UnbondingDelegation")] -pub struct UnbondingDelegation { - /// delegator_address is the encoded address of the delegator. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - /// validator_address is the encoded address of the validator. - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - /// entries are the unbonding delegation entries. - /// - /// unbonding delegation entries - #[prost(message, repeated, tag = "3")] - pub entries: ::prost::alloc::vec::Vec, -} -/// UnbondingDelegationEntry defines an unbonding object with relevant metadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.UnbondingDelegationEntry")] -pub struct UnbondingDelegationEntry { - /// creation_height is the height which the unbonding took place. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub creation_height: i64, - /// completion_time is the unix time for unbonding completion. - #[prost(message, optional, tag = "2")] - pub completion_time: ::core::option::Option, - /// initial_balance defines the tokens initially scheduled to receive at completion. - #[prost(string, tag = "3")] - pub initial_balance: ::prost::alloc::string::String, - /// balance defines the tokens to receive at completion. - #[prost(string, tag = "4")] - pub balance: ::prost::alloc::string::String, - /// Incrementing id that uniquely identifies this entry - #[prost(uint64, tag = "5")] - #[serde(alias = "unbondingID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub unbonding_id: u64, - /// Strictly positive if this entry's unbonding has been stopped by external modules - #[prost(int64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub unbonding_on_hold_ref_count: i64, -} -/// RedelegationEntry defines a redelegation object with relevant metadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.RedelegationEntry")] -pub struct RedelegationEntry { - /// creation_height defines the height which the redelegation took place. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub creation_height: i64, - /// completion_time defines the unix time for redelegation completion. - #[prost(message, optional, tag = "2")] - pub completion_time: ::core::option::Option, - /// initial_balance defines the initial balance when redelegation started. - #[prost(string, tag = "3")] - pub initial_balance: ::prost::alloc::string::String, - /// shares_dst is the amount of destination-validator shares created by redelegation. - #[prost(string, tag = "4")] - pub shares_dst: ::prost::alloc::string::String, - /// Incrementing id that uniquely identifies this entry - #[prost(uint64, tag = "5")] - #[serde(alias = "unbondingID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub unbonding_id: u64, - /// Strictly positive if this entry's unbonding has been stopped by external modules - #[prost(int64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub unbonding_on_hold_ref_count: i64, -} -/// Redelegation contains the list of a particular delegator's redelegating bonds -/// from a particular source validator to a particular destination validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Redelegation")] -pub struct Redelegation { - /// delegator_address is the bech32-encoded address of the delegator. - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - /// validator_src_address is the validator redelegation source operator address. - #[prost(string, tag = "2")] - pub validator_src_address: ::prost::alloc::string::String, - /// validator_dst_address is the validator redelegation destination operator address. - #[prost(string, tag = "3")] - pub validator_dst_address: ::prost::alloc::string::String, - /// entries are the redelegation entries. - /// - /// redelegation entries - #[prost(message, repeated, tag = "4")] - pub entries: ::prost::alloc::vec::Vec, -} -/// Params defines the parameters for the x/staking module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Params")] -pub struct Params { - /// unbonding_time is the time duration of unbonding. - #[prost(message, optional, tag = "1")] - pub unbonding_time: ::core::option::Option, - /// max_validators is the maximum number of validators. - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_validators: u32, - /// max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_entries: u32, - /// historical_entries is the number of historical entries to persist. - #[prost(uint32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub historical_entries: u32, - /// bond_denom defines the bondable coin denomination. - #[prost(string, tag = "5")] - pub bond_denom: ::prost::alloc::string::String, - /// min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators - #[prost(string, tag = "6")] - pub min_commission_rate: ::prost::alloc::string::String, -} -/// DelegationResponse is equivalent to Delegation except that it contains a -/// balance in addition to shares which is more suitable for client responses. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.DelegationResponse")] -pub struct DelegationResponse { - #[prost(message, optional, tag = "1")] - pub delegation: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub balance: ::core::option::Option, -} -/// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it -/// contains a balance in addition to shares which is more suitable for client -/// responses. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.RedelegationEntryResponse")] -pub struct RedelegationEntryResponse { - #[prost(message, optional, tag = "1")] - pub redelegation_entry: ::core::option::Option, - #[prost(string, tag = "4")] - pub balance: ::prost::alloc::string::String, -} -/// RedelegationResponse is equivalent to a Redelegation except that its entries -/// contain a balance in addition to shares which is more suitable for client -/// responses. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.RedelegationResponse")] -pub struct RedelegationResponse { - #[prost(message, optional, tag = "1")] - pub redelegation: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub entries: ::prost::alloc::vec::Vec, -} -/// Pool is used for tracking bonded and not-bonded token supply of the bond -/// denomination. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.Pool")] -pub struct Pool { - #[prost(string, tag = "1")] - pub not_bonded_tokens: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub bonded_tokens: ::prost::alloc::string::String, -} -/// ValidatorUpdates defines an array of abci.ValidatorUpdate objects. -/// TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.ValidatorUpdates")] -pub struct ValidatorUpdates { - #[prost(message, repeated, tag = "1")] - pub updates: ::prost::alloc::vec::Vec, -} -/// BondStatus is the status of a validator. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum BondStatus { - /// UNSPECIFIED defines an invalid validator status. - Unspecified = 0, - /// UNBONDED defines a validator that is not bonded. - Unbonded = 1, - /// UNBONDING defines a validator that is unbonding. - Unbonding = 2, - /// BONDED defines a validator that is bonded. - Bonded = 3, -} -impl BondStatus { - /// 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 { - BondStatus::Unspecified => "BOND_STATUS_UNSPECIFIED", - BondStatus::Unbonded => "BOND_STATUS_UNBONDED", - BondStatus::Unbonding => "BOND_STATUS_UNBONDING", - BondStatus::Bonded => "BOND_STATUS_BONDED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "BOND_STATUS_UNSPECIFIED" => Some(Self::Unspecified), - "BOND_STATUS_UNBONDED" => Some(Self::Unbonded), - "BOND_STATUS_UNBONDING" => Some(Self::Unbonding), - "BOND_STATUS_BONDED" => Some(Self::Bonded), - _ => None, - } - } -} -/// Infraction indicates the infraction a validator commited. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum Infraction { - /// UNSPECIFIED defines an empty infraction. - Unspecified = 0, - /// DOUBLE_SIGN defines a validator that double-signs a block. - DoubleSign = 1, - /// DOWNTIME defines a validator that missed signing too many blocks. - Downtime = 2, -} -impl Infraction { - /// 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 { - Infraction::Unspecified => "INFRACTION_UNSPECIFIED", - Infraction::DoubleSign => "INFRACTION_DOUBLE_SIGN", - Infraction::Downtime => "INFRACTION_DOWNTIME", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "INFRACTION_UNSPECIFIED" => Some(Self::Unspecified), - "INFRACTION_DOUBLE_SIGN" => Some(Self::DoubleSign), - "INFRACTION_DOWNTIME" => Some(Self::Downtime), - _ => None, - } - } -} -/// GenesisState defines the staking module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.GenesisState")] -pub struct GenesisState { - /// params defines all the parameters of related to deposit. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// last_total_power tracks the total amounts of bonded tokens recorded during - /// the previous end block. - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_total_power: ::prost::alloc::vec::Vec, - /// last_validator_powers is a special index that provides a historical list - /// of the last-block's bonded validators. - #[prost(message, repeated, tag = "3")] - pub last_validator_powers: ::prost::alloc::vec::Vec, - /// validators defines the validator set at genesis. - #[prost(message, repeated, tag = "4")] - pub validators: ::prost::alloc::vec::Vec, - /// delegations defines the delegations active at genesis. - #[prost(message, repeated, tag = "5")] - pub delegations: ::prost::alloc::vec::Vec, - /// unbonding_delegations defines the unbonding delegations active at genesis. - #[prost(message, repeated, tag = "6")] - pub unbonding_delegations: ::prost::alloc::vec::Vec, - /// redelegations defines the redelegations active at genesis. - #[prost(message, repeated, tag = "7")] - pub redelegations: ::prost::alloc::vec::Vec, - /// exported defines a bool to identify whether the chain dealing with exported or initialized genesis. - #[prost(bool, tag = "8")] - pub exported: bool, -} -/// LastValidatorPower required for validator set update logic. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.LastValidatorPower")] -pub struct LastValidatorPower { - /// address is the address of the validator. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// power defines the power of the validator. - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub power: i64, -} -/// QueryValidatorsRequest is request type for Query/Validators 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 = "/cosmos.staking.v1beta1.QueryValidatorsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/Validators", - response_type = QueryValidatorsResponse -)] -pub struct QueryValidatorsRequest { - /// status enables to query for validators matching a given status. - #[prost(string, tag = "1")] - pub status: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryValidatorsResponse is response type for the Query/Validators 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 = "/cosmos.staking.v1beta1.QueryValidatorsResponse")] -pub struct QueryValidatorsResponse { - /// validators contains all the queried validators. - #[prost(message, repeated, tag = "1")] - pub validators: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryValidatorRequest is response type for the Query/Validator 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 = "/cosmos.staking.v1beta1.QueryValidatorRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/Validator", - response_type = QueryValidatorResponse -)] -pub struct QueryValidatorRequest { - /// validator_addr defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_addr: ::prost::alloc::string::String, -} -/// QueryValidatorResponse is response type for the Query/Validator 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 = "/cosmos.staking.v1beta1.QueryValidatorResponse")] -pub struct QueryValidatorResponse { - /// validator defines the validator info. - #[prost(message, optional, tag = "1")] - pub validator: ::core::option::Option, -} -/// QueryValidatorDelegationsRequest is request type for the -/// Query/ValidatorDelegations 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 = "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/ValidatorDelegations", - response_type = QueryValidatorDelegationsResponse -)] -pub struct QueryValidatorDelegationsRequest { - /// validator_addr defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_addr: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryValidatorDelegationsResponse is response type for the -/// Query/ValidatorDelegations 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 = "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse")] -pub struct QueryValidatorDelegationsResponse { - #[prost(message, repeated, tag = "1")] - pub delegation_responses: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryValidatorUnbondingDelegationsRequest is required type for the -/// Query/ValidatorUnbondingDelegations 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 = "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", - response_type = QueryValidatorUnbondingDelegationsResponse -)] -pub struct QueryValidatorUnbondingDelegationsRequest { - /// validator_addr defines the validator address to query for. - #[prost(string, tag = "1")] - pub validator_addr: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryValidatorUnbondingDelegationsResponse is response type for the -/// Query/ValidatorUnbondingDelegations 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 = "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse")] -pub struct QueryValidatorUnbondingDelegationsResponse { - #[prost(message, repeated, tag = "1")] - pub unbonding_responses: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegationRequest is request type for the Query/Delegation 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 = "/cosmos.staking.v1beta1.QueryDelegationRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/Delegation", - response_type = QueryDelegationResponse -)] -pub struct QueryDelegationRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// validator_addr defines the validator address to query for. - #[prost(string, tag = "2")] - pub validator_addr: ::prost::alloc::string::String, -} -/// QueryDelegationResponse is response type for the Query/Delegation 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 = "/cosmos.staking.v1beta1.QueryDelegationResponse")] -pub struct QueryDelegationResponse { - /// delegation_responses defines the delegation info of a delegation. - #[prost(message, optional, tag = "1")] - pub delegation_response: ::core::option::Option, -} -/// QueryUnbondingDelegationRequest is request type for the -/// Query/UnbondingDelegation 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 = "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/UnbondingDelegation", - response_type = QueryUnbondingDelegationResponse -)] -pub struct QueryUnbondingDelegationRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// validator_addr defines the validator address to query for. - #[prost(string, tag = "2")] - pub validator_addr: ::prost::alloc::string::String, -} -/// QueryDelegationResponse is response type for the Query/UnbondingDelegation -/// 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 = "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse")] -pub struct QueryUnbondingDelegationResponse { - /// unbond defines the unbonding information of a delegation. - #[prost(message, optional, tag = "1")] - pub unbond: ::core::option::Option, -} -/// QueryDelegatorDelegationsRequest is request type for the -/// Query/DelegatorDelegations 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 = "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/DelegatorDelegations", - response_type = QueryDelegatorDelegationsResponse -)] -pub struct QueryDelegatorDelegationsRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegatorDelegationsResponse is response type for the -/// Query/DelegatorDelegations 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 = "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse")] -pub struct QueryDelegatorDelegationsResponse { - /// delegation_responses defines all the delegations' info of a delegator. - #[prost(message, repeated, tag = "1")] - pub delegation_responses: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegatorUnbondingDelegationsRequest is request type for the -/// Query/DelegatorUnbondingDelegations 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 = "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", - response_type = QueryDelegatorUnbondingDelegationsResponse -)] -pub struct QueryDelegatorUnbondingDelegationsRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryUnbondingDelegatorDelegationsResponse is response type for the -/// Query/UnbondingDelegatorDelegations 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 = "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse")] -pub struct QueryDelegatorUnbondingDelegationsResponse { - #[prost(message, repeated, tag = "1")] - pub unbonding_responses: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryRedelegationsRequest is request type for the Query/Redelegations 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 = "/cosmos.staking.v1beta1.QueryRedelegationsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/Redelegations", - response_type = QueryRedelegationsResponse -)] -pub struct QueryRedelegationsRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// src_validator_addr defines the validator address to redelegate from. - #[prost(string, tag = "2")] - pub src_validator_addr: ::prost::alloc::string::String, - /// dst_validator_addr defines the validator address to redelegate to. - #[prost(string, tag = "3")] - pub dst_validator_addr: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "4")] - pub pagination: ::core::option::Option, -} -/// QueryRedelegationsResponse is response type for the Query/Redelegations 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 = "/cosmos.staking.v1beta1.QueryRedelegationsResponse")] -pub struct QueryRedelegationsResponse { - #[prost(message, repeated, tag = "1")] - pub redelegation_responses: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegatorValidatorsRequest is request type for the -/// Query/DelegatorValidators 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 = "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/DelegatorValidators", - response_type = QueryDelegatorValidatorsResponse -)] -pub struct QueryDelegatorValidatorsRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegatorValidatorsResponse is response type for the -/// Query/DelegatorValidators 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 = "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse")] -pub struct QueryDelegatorValidatorsResponse { - /// validators defines the validators' info of a delegator. - #[prost(message, repeated, tag = "1")] - pub validators: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// QueryDelegatorValidatorRequest is request type for the -/// Query/DelegatorValidator 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 = "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/DelegatorValidator", - response_type = QueryDelegatorValidatorResponse -)] -pub struct QueryDelegatorValidatorRequest { - /// delegator_addr defines the delegator address to query for. - #[prost(string, tag = "1")] - pub delegator_addr: ::prost::alloc::string::String, - /// validator_addr defines the validator address to query for. - #[prost(string, tag = "2")] - pub validator_addr: ::prost::alloc::string::String, -} -/// QueryDelegatorValidatorResponse response type for the -/// Query/DelegatorValidator 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 = "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse")] -pub struct QueryDelegatorValidatorResponse { - /// validator defines the validator info. - #[prost(message, optional, tag = "1")] - pub validator: ::core::option::Option, -} -/// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo 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 = "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/HistoricalInfo", - response_type = QueryHistoricalInfoResponse -)] -pub struct QueryHistoricalInfoRequest { - /// height defines at which height to query the historical info. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} -/// QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo 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 = "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse")] -pub struct QueryHistoricalInfoResponse { - /// hist defines the historical info at the given height. - #[prost(message, optional, tag = "1")] - pub hist: ::core::option::Option, -} -/// QueryPoolRequest is request type for the Query/Pool 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 = "/cosmos.staking.v1beta1.QueryPoolRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/Pool", - response_type = QueryPoolResponse -)] -pub struct QueryPoolRequest {} -/// QueryPoolResponse is response type for the Query/Pool 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 = "/cosmos.staking.v1beta1.QueryPoolResponse")] -pub struct QueryPoolResponse { - /// pool defines the pool info. - #[prost(message, optional, tag = "1")] - pub pool: ::core::option::Option, -} -/// QueryParamsRequest is request type for the Query/Params 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 = "/cosmos.staking.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/cosmos.staking.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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 = "/cosmos.staking.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgCreateValidator defines a SDK message for creating a new validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgCreateValidator")] -pub struct MsgCreateValidator { - #[prost(message, optional, tag = "1")] - pub description: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub commission: ::core::option::Option, - #[prost(string, tag = "3")] - pub min_self_delegation: ::prost::alloc::string::String, - /// Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. - /// The validator address bytes and delegator address bytes refer to the same account while creating validator (defer - /// only in bech32 notation). - #[deprecated] - #[prost(string, tag = "4")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub validator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "6")] - pub pubkey: ::core::option::Option, - #[prost(message, optional, tag = "7")] - pub value: ::core::option::Option, -} -/// MsgCreateValidatorResponse defines the Msg/CreateValidator response 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 = "/cosmos.staking.v1beta1.MsgCreateValidatorResponse")] -pub struct MsgCreateValidatorResponse {} -/// MsgEditValidator defines a SDK message for editing an existing validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgEditValidator")] -pub struct MsgEditValidator { - #[prost(message, optional, tag = "1")] - pub description: ::core::option::Option, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - /// We pass a reference to the new commission rate and min self delegation as - /// it's not mandatory to update. If not updated, the deserialized rate will be - /// zero with no way to distinguish if an update was intended. - /// REF: #2373 - #[prost(string, tag = "3")] - pub commission_rate: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub min_self_delegation: ::prost::alloc::string::String, -} -/// MsgEditValidatorResponse defines the Msg/EditValidator response 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 = "/cosmos.staking.v1beta1.MsgEditValidatorResponse")] -pub struct MsgEditValidatorResponse {} -/// MsgDelegate defines a SDK message for performing a delegation of coins -/// from a delegator to a validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgDelegate")] -pub struct MsgDelegate { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub amount: ::core::option::Option, -} -/// MsgDelegateResponse defines the Msg/Delegate response 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 = "/cosmos.staking.v1beta1.MsgDelegateResponse")] -pub struct MsgDelegateResponse {} -/// MsgBeginRedelegate defines a SDK message for performing a redelegation -/// of coins from a delegator and source validator to a destination validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgBeginRedelegate")] -pub struct MsgBeginRedelegate { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_src_address: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub validator_dst_address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "4")] - pub amount: ::core::option::Option, -} -/// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response 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 = "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse")] -pub struct MsgBeginRedelegateResponse { - #[prost(message, optional, tag = "1")] - pub completion_time: ::core::option::Option, -} -/// MsgUndelegate defines a SDK message for performing an undelegation from a -/// delegate and a validator. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgUndelegate")] -pub struct MsgUndelegate { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub amount: ::core::option::Option, -} -/// MsgUndelegateResponse defines the Msg/Undelegate response 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 = "/cosmos.staking.v1beta1.MsgUndelegateResponse")] -pub struct MsgUndelegateResponse { - #[prost(message, optional, tag = "1")] - pub completion_time: ::core::option::Option, - /// amount returns the amount of undelegated coins - /// - /// Since: cosmos-sdk 0.50 - #[prost(message, optional, tag = "2")] - pub amount: ::core::option::Option, -} -/// MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation")] -pub struct MsgCancelUnbondingDelegation { - #[prost(string, tag = "1")] - pub delegator_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub validator_address: ::prost::alloc::string::String, - /// amount is always less than or equal to unbonding delegation entry balance - #[prost(message, optional, tag = "3")] - pub amount: ::core::option::Option, - /// creation_height is the height which the unbonding took place. - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub creation_height: i64, -} -/// MsgCancelUnbondingDelegationResponse -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse")] -pub struct MsgCancelUnbondingDelegationResponse {} -/// MsgUpdateParams is the Msg/UpdateParams request type. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/staking parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.staking.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct StakingQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> StakingQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn validators( - &self, - status: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryValidatorsRequest { status, pagination }.query(self.querier) - } - pub fn validator( - &self, - validator_addr: ::prost::alloc::string::String, - ) -> Result { - QueryValidatorRequest { validator_addr }.query(self.querier) - } - pub fn validator_delegations( - &self, - validator_addr: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryValidatorDelegationsRequest { - validator_addr, - pagination, - } - .query(self.querier) - } - pub fn validator_unbonding_delegations( - &self, - validator_addr: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryValidatorUnbondingDelegationsRequest { - validator_addr, - pagination, - } - .query(self.querier) - } - pub fn delegation( - &self, - delegator_addr: ::prost::alloc::string::String, - validator_addr: ::prost::alloc::string::String, - ) -> Result { - QueryDelegationRequest { - delegator_addr, - validator_addr, - } - .query(self.querier) - } - pub fn unbonding_delegation( - &self, - delegator_addr: ::prost::alloc::string::String, - validator_addr: ::prost::alloc::string::String, - ) -> Result { - QueryUnbondingDelegationRequest { - delegator_addr, - validator_addr, - } - .query(self.querier) - } - pub fn delegator_delegations( - &self, - delegator_addr: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryDelegatorDelegationsRequest { - delegator_addr, - pagination, - } - .query(self.querier) - } - pub fn delegator_unbonding_delegations( - &self, - delegator_addr: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryDelegatorUnbondingDelegationsRequest { - delegator_addr, - pagination, - } - .query(self.querier) - } - pub fn redelegations( - &self, - delegator_addr: ::prost::alloc::string::String, - src_validator_addr: ::prost::alloc::string::String, - dst_validator_addr: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryRedelegationsRequest { - delegator_addr, - src_validator_addr, - dst_validator_addr, - pagination, - } - .query(self.querier) - } - pub fn delegator_validators( - &self, - delegator_addr: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryDelegatorValidatorsRequest { - delegator_addr, - pagination, - } - .query(self.querier) - } - pub fn delegator_validator( - &self, - delegator_addr: ::prost::alloc::string::String, - validator_addr: ::prost::alloc::string::String, - ) -> Result { - QueryDelegatorValidatorRequest { - delegator_addr, - validator_addr, - } - .query(self.querier) - } - pub fn historical_info( - &self, - height: i64, - ) -> Result { - QueryHistoricalInfoRequest { height }.query(self.querier) - } - pub fn pool(&self) -> Result { - QueryPoolRequest {}.query(self.querier) - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/v1beta1.rs deleted file mode 100644 index 7c60cd18..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/internal/kv/v1beta1.rs +++ /dev/null @@ -1,45 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Pairs defines a repeated slice of Pair objects. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.internal.kv.v1beta1.Pairs")] -pub struct Pairs { - #[prost(message, repeated, tag = "1")] - pub pairs: ::prost::alloc::vec::Vec, -} -/// Pair defines a key/value bytes tuple. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.internal.kv.v1beta1.Pair")] -pub struct Pair { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/internal/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/internal/mod.rs deleted file mode 100644 index 05c6d5b9..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/internal/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod kv; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/mod.rs deleted file mode 100644 index b772b151..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod internal; -pub mod snapshots; -pub mod streaming; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/v1.rs deleted file mode 100644 index 5ab9ded5..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/snapshots/v1.rs +++ /dev/null @@ -1,214 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Snapshot contains Tendermint state sync snapshot info. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.Snapshot")] -pub struct Snapshot { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub chunks: u32, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "5")] - pub metadata: ::core::option::Option, -} -/// Metadata contains SDK-specific snapshot metadata. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.Metadata")] -pub struct Metadata { - /// SHA-256 chunk hashes - #[prost(bytes = "vec", repeated, tag = "1")] - pub chunk_hashes: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// SnapshotItem is an item contained in a rootmulti.Store snapshot. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.SnapshotItem")] -pub struct SnapshotItem { - /// item is the specific type of snapshot item. - #[prost(oneof = "snapshot_item::Item", tags = "1, 2, 3, 4")] - pub item: ::core::option::Option, -} -/// Nested message and enum types in `SnapshotItem`. -pub mod snapshot_item { - /// item is the specific type of snapshot item. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Item { - #[prost(message, tag = "1")] - Store(super::SnapshotStoreItem), - #[prost(message, tag = "2")] - Iavl(super::SnapshotIavlItem), - #[prost(message, tag = "3")] - Extension(super::SnapshotExtensionMeta), - #[prost(message, tag = "4")] - ExtensionPayload(super::SnapshotExtensionPayload), - } -} -/// SnapshotStoreItem contains metadata about a snapshotted store. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.SnapshotStoreItem")] -pub struct SnapshotStoreItem { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, -} -/// SnapshotIAVLItem is an exported IAVL node. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.SnapshotIAVLItem")] -pub struct SnapshotIavlItem { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, - /// version is block height - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub version: i64, - /// height is depth of the tree. - #[prost(int32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i32, -} -/// SnapshotExtensionMeta contains metadata about an external snapshotter. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.SnapshotExtensionMeta")] -pub struct SnapshotExtensionMeta { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, -} -/// SnapshotExtensionPayload contains payloads of an external snapshotter. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.snapshots.v1.SnapshotExtensionPayload")] -pub struct SnapshotExtensionPayload { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub payload: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/streaming/abci.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/streaming/abci.rs deleted file mode 100644 index 5e285c7d..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/streaming/abci.rs +++ /dev/null @@ -1,76 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ListenEndBlockRequest is the request type for the ListenEndBlock 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 = "/cosmos.store.streaming.abci.ListenFinalizeBlockRequest")] -pub struct ListenFinalizeBlockRequest { - #[prost(message, optional, tag = "1")] - pub req: - ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub res: - ::core::option::Option, -} -/// ListenEndBlockResponse is the response type for the ListenEndBlock 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 = "/cosmos.store.streaming.abci.ListenFinalizeBlockResponse")] -pub struct ListenFinalizeBlockResponse {} -/// ListenCommitRequest is the request type for the ListenCommit 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 = "/cosmos.store.streaming.abci.ListenCommitRequest")] -pub struct ListenCommitRequest { - /// explicitly pass in block height as ResponseCommit does not contain this info - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_height: i64, - #[prost(message, optional, tag = "2")] - pub res: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub change_set: ::prost::alloc::vec::Vec, -} -/// ListenCommitResponse is the response type for the ListenCommit 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 = "/cosmos.store.streaming.abci.ListenCommitResponse")] -pub struct ListenCommitResponse {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/streaming/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/streaming/mod.rs deleted file mode 100644 index c52eb0a4..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/streaming/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod abci; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/store/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/store/v1beta1.rs deleted file mode 100644 index f3a675c4..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/store/v1beta1.rs +++ /dev/null @@ -1,139 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) -/// It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and -/// Deletes -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.v1beta1.StoreKVPair")] -pub struct StoreKvPair { - /// the store key for the KVStore this pair originates from - #[prost(string, tag = "1")] - pub store_key: ::prost::alloc::string::String, - /// true indicates a delete operation, false indicates a set operation - #[prost(bool, tag = "2")] - pub delete: bool, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, -} -/// BlockMetadata contains all the abci event data of a block -/// the file streamer dump them into files together with the state changes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.v1beta1.BlockMetadata")] -pub struct BlockMetadata { - #[prost(message, optional, tag = "6")] - pub response_commit: - ::core::option::Option, - #[prost(message, optional, tag = "7")] - pub request_finalize_block: - ::core::option::Option, - /// TODO: should we renumber this? - #[prost(message, optional, tag = "8")] - pub response_finalize_block: - ::core::option::Option, -} -/// CommitInfo defines commit information used by the multi-store when committing -/// a version/height. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.v1beta1.CommitInfo")] -pub struct CommitInfo { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub version: i64, - #[prost(message, repeated, tag = "2")] - pub store_infos: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub timestamp: ::core::option::Option, -} -/// StoreInfo defines store-specific commit information. It contains a reference -/// between a store name and the commit ID. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.v1beta1.StoreInfo")] -pub struct StoreInfo { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - #[serde(alias = "commitID")] - pub commit_id: ::core::option::Option, -} -/// CommitID defines the commitment information when a specific store is -/// committed. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.store.v1beta1.CommitID")] -pub struct CommitId { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub version: i64, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/tx/config/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/tx/config/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/tx/config/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/tx/config/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/tx/config/v1.rs deleted file mode 100644 index 872abbdc..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/tx/config/v1.rs +++ /dev/null @@ -1,24 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Config is the config object of the x/auth/tx package. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.config.v1.Config")] -pub struct Config { - /// skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override - /// this functionality. - #[prost(bool, tag = "1")] - pub skip_ante_handler: bool, - /// skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override - /// this functionality. - #[prost(bool, tag = "2")] - pub skip_post_handler: bool, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/tx/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/tx/mod.rs deleted file mode 100644 index 404cbb51..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/tx/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod config; -pub mod signing; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/tx/signing/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/tx/signing/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/tx/signing/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/tx/signing/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/tx/signing/v1beta1.rs deleted file mode 100644 index 09bcfc74..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/tx/signing/v1beta1.rs +++ /dev/null @@ -1,221 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// SignatureDescriptors wraps multiple SignatureDescriptor's. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.signing.v1beta1.SignatureDescriptors")] -pub struct SignatureDescriptors { - /// signatures are the signature descriptors - #[prost(message, repeated, tag = "1")] - pub signatures: ::prost::alloc::vec::Vec, -} -/// SignatureDescriptor is a convenience type which represents the full data for -/// a signature including the public key of the signer, signing modes and the -/// signature itself. It is primarily used for coordinating signatures between -/// clients. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.signing.v1beta1.SignatureDescriptor")] -pub struct SignatureDescriptor { - /// public_key is the public key of the signer - #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub data: ::core::option::Option, - /// sequence is the sequence of the account, which describes the - /// number of committed transactions signed by a given address. It is used to prevent - /// replay attacks. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// Nested message and enum types in `SignatureDescriptor`. -pub mod signature_descriptor { - use neutron_std_derive::CosmwasmExt; - /// Data represents signature data - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.tx.signing.v1beta1.SignatureDescriptor.Data")] - pub struct Data { - /// sum is the oneof that specifies whether this represents single or multi-signature data - #[prost(oneof = "data::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, - } - /// Nested message and enum types in `Data`. - pub mod data { - use neutron_std_derive::CosmwasmExt; - /// Single is the signature data for a single signer - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single")] - pub struct Single { - /// mode is the signing mode of the single signer - #[prost(enumeration = "super::super::SignMode", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub mode: i32, - /// signature is the raw signature bytes - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - } - /// Multi is the signature data for a multisig public key - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi")] - pub struct Multi { - /// bitarray specifies which keys within the multisig are signing - #[prost(message, optional, tag = "1")] - pub bitarray: ::core::option::Option< - super::super::super::super::super::crypto::multisig::v1beta1::CompactBitArray, - >, - /// signatures is the signatures of the multi-signature - #[prost(message, repeated, tag = "2")] - pub signatures: ::prost::alloc::vec::Vec, - } - /// sum is the oneof that specifies whether this represents single or multi-signature data - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - /// single represents a single signer - #[prost(message, tag = "1")] - Single(Single), - /// multi represents a multisig signer - #[prost(message, tag = "2")] - Multi(Multi), - } - } -} -/// SignMode represents a signing mode with its own security guarantees. -/// -/// This enum should be considered a registry of all known sign modes -/// in the Cosmos ecosystem. Apps are not expected to support all known -/// sign modes. Apps that would like to support custom sign modes are -/// encouraged to open a small PR against this file to add a new case -/// to this SignMode enum describing their sign mode so that different -/// apps have a consistent version of this enum. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum SignMode { - /// SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - /// rejected. - Unspecified = 0, - /// SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - /// verified with raw bytes from Tx. - Direct = 1, - /// SIGN_MODE_TEXTUAL is a future signing mode that will verify some - /// human-readable textual representation on top of the binary representation - /// from SIGN_MODE_DIRECT. - /// - /// Since: cosmos-sdk 0.50 - Textual = 2, - /// SIGN_MODE_DIRECT_AUX specifies a signing mode which uses - /// SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not - /// require signers signing over other signers' `signer_info`. - /// - /// Since: cosmos-sdk 0.46 - DirectAux = 3, - /// SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - /// Amino JSON and will be removed in the future. - LegacyAminoJson = 127, - /// SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos - /// SDK. Ref: - /// - /// Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, - /// but is not implemented on the SDK by default. To enable EIP-191, you need - /// to pass a custom `TxConfig` that has an implementation of - /// `SignModeHandler` for EIP-191. The SDK may decide to fully support - /// EIP-191 in the future. - /// - /// Since: cosmos-sdk 0.45.2 - Eip191 = 191, -} -impl SignMode { - /// 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 { - SignMode::Unspecified => "SIGN_MODE_UNSPECIFIED", - SignMode::Direct => "SIGN_MODE_DIRECT", - SignMode::Textual => "SIGN_MODE_TEXTUAL", - SignMode::DirectAux => "SIGN_MODE_DIRECT_AUX", - SignMode::LegacyAminoJson => "SIGN_MODE_LEGACY_AMINO_JSON", - SignMode::Eip191 => "SIGN_MODE_EIP_191", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SIGN_MODE_UNSPECIFIED" => Some(Self::Unspecified), - "SIGN_MODE_DIRECT" => Some(Self::Direct), - "SIGN_MODE_TEXTUAL" => Some(Self::Textual), - "SIGN_MODE_DIRECT_AUX" => Some(Self::DirectAux), - "SIGN_MODE_LEGACY_AMINO_JSON" => Some(Self::LegacyAminoJson), - "SIGN_MODE_EIP_191" => Some(Self::Eip191), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/tx/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/tx/v1beta1.rs deleted file mode 100644 index 5c539983..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/tx/v1beta1.rs +++ /dev/null @@ -1,1022 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Tx is the standard type used for broadcasting transactions. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.Tx")] -pub struct Tx { - /// body is the processable content of the transaction - #[prost(message, optional, tag = "1")] - pub body: ::core::option::Option, - /// auth_info is the authorization related content of the transaction, - /// specifically signers, signer modes and fee - #[prost(message, optional, tag = "2")] - pub auth_info: ::core::option::Option, - /// signatures is a list of signatures that matches the length and order of - /// AuthInfo's signer_infos to allow connecting signature meta information like - /// public key and signing mode by position. - #[prost(bytes = "vec", repeated, tag = "3")] - pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// TxRaw is a variant of Tx that pins the signer's exact binary representation -/// of body and auth_info. This is used for signing, broadcasting and -/// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and -/// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used -/// as the transaction ID. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxRaw")] -pub struct TxRaw { - /// body_bytes is a protobuf serialization of a TxBody that matches the - /// representation in SignDoc. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub body_bytes: ::prost::alloc::vec::Vec, - /// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - /// representation in SignDoc. - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub auth_info_bytes: ::prost::alloc::vec::Vec, - /// signatures is a list of signatures that matches the length and order of - /// AuthInfo's signer_infos to allow connecting signature meta information like - /// public key and signing mode by position. - #[prost(bytes = "vec", repeated, tag = "3")] - pub signatures: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.SignDoc")] -pub struct SignDoc { - /// body_bytes is protobuf serialization of a TxBody that matches the - /// representation in TxRaw. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub body_bytes: ::prost::alloc::vec::Vec, - /// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - /// representation in TxRaw. - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub auth_info_bytes: ::prost::alloc::vec::Vec, - /// chain_id is the unique identifier of the chain this transaction targets. - /// It prevents signed transactions from being used on another chain by an - /// attacker - #[prost(string, tag = "3")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - /// account_number is the account number of the account in state - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub account_number: u64, -} -/// SignDocDirectAux is the type used for generating sign bytes for -/// SIGN_MODE_DIRECT_AUX. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.SignDocDirectAux")] -pub struct SignDocDirectAux { - /// body_bytes is protobuf serialization of a TxBody that matches the - /// representation in TxRaw. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub body_bytes: ::prost::alloc::vec::Vec, - /// public_key is the public key of the signing account. - #[prost(message, optional, tag = "2")] - pub public_key: ::core::option::Option, - /// chain_id is the identifier of the chain this transaction targets. - /// It prevents signed transactions from being used on another chain by an - /// attacker. - #[prost(string, tag = "3")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - /// account_number is the account number of the account in state. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub account_number: u64, - /// sequence is the sequence number of the signing account. - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// tips have been depreacted and should not be used - #[deprecated] - #[prost(message, optional, tag = "6")] - pub tip: ::core::option::Option, -} -/// TxBody is the body of a transaction that all signers sign over. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxBody")] -pub struct TxBody { - /// messages is a list of messages to be executed. The required signers of - /// those messages define the number and order of elements in AuthInfo's - /// signer_infos and Tx's signatures. Each required signer address is added to - /// the list only the first time it occurs. - /// By convention, the first required signer (usually from the first message) - /// is referred to as the primary signer and pays the fee for the whole - /// transaction. - #[prost(message, repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec, - /// memo is any arbitrary note/comment to be added to the transaction. - /// WARNING: in clients, any publicly exposed text should not be called memo, - /// but should be called `note` instead (see ). - #[prost(string, tag = "2")] - pub memo: ::prost::alloc::string::String, - /// timeout is the block height after which this transaction will not - /// be processed by the chain - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout_height: u64, - /// extension_options are arbitrary options that can be added by chains - /// when the default options are not sufficient. If any of these are present - /// and can't be handled, the transaction will be rejected - #[prost(message, repeated, tag = "1023")] - pub extension_options: ::prost::alloc::vec::Vec, - /// extension_options are arbitrary options that can be added by chains - /// when the default options are not sufficient. If any of these are present - /// and can't be handled, they will be ignored - #[prost(message, repeated, tag = "2047")] - pub non_critical_extension_options: ::prost::alloc::vec::Vec, -} -/// AuthInfo describes the fee and signer modes that are used to sign a -/// transaction. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.AuthInfo")] -pub struct AuthInfo { - /// signer_infos defines the signing modes for the required signers. The number - /// and order of elements must match the required signers from TxBody's - /// messages. The first element is the primary signer and the one which pays - /// the fee. - #[prost(message, repeated, tag = "1")] - pub signer_infos: ::prost::alloc::vec::Vec, - /// Fee is the fee and gas limit for the transaction. The first signer is the - /// primary signer and the one which pays the fee. The fee can be calculated - /// based on the cost of evaluating the body and doing signature verification - /// of the signers. This can be estimated via simulation. - #[prost(message, optional, tag = "2")] - pub fee: ::core::option::Option, - /// Tip is the optional tip used for transactions fees paid in another denom. - /// - /// This field is ignored if the chain didn't enable tips, i.e. didn't add the - /// `TipDecorator` in its posthandler. - /// - /// Since: cosmos-sdk 0.46 - #[deprecated] - #[prost(message, optional, tag = "3")] - pub tip: ::core::option::Option, -} -/// SignerInfo describes the public key and signing mode of a single top-level -/// signer. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.SignerInfo")] -pub struct SignerInfo { - /// public_key is the public key of the signer. It is optional for accounts - /// that already exist in state. If unset, the verifier can use the required \ - /// signer address for this position and lookup the public key. - #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option, - /// mode_info describes the signing mode of the signer and is a nested - /// structure to support nested multisig pubkey's - #[prost(message, optional, tag = "2")] - pub mode_info: ::core::option::Option, - /// sequence is the sequence of the account, which describes the - /// number of committed transactions signed by a given address. It is used to - /// prevent replay attacks. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// ModeInfo describes the signing mode of a single or nested multisig signer. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.ModeInfo")] -pub struct ModeInfo { - /// sum is the oneof that specifies whether this represents a single or nested - /// multisig signer - #[prost(oneof = "mode_info::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `ModeInfo`. -pub mod mode_info { - use neutron_std_derive::CosmwasmExt; - /// Single is the mode info for a single signer. It is structured as a message - /// to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - /// future - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.tx.v1beta1.ModeInfo.Single")] - pub struct Single { - /// mode is the signing mode of the single signer - #[prost(enumeration = "super::super::signing::v1beta1::SignMode", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub mode: i32, - } - /// Multi is the mode info for a multisig public key - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmos.tx.v1beta1.ModeInfo.Multi")] - pub struct Multi { - /// bitarray specifies which keys within the multisig are signing - #[prost(message, optional, tag = "1")] - pub bitarray: - ::core::option::Option, - /// mode_infos is the corresponding modes of the signers of the multisig - /// which could include nested multisig public keys - #[prost(message, repeated, tag = "2")] - pub mode_infos: ::prost::alloc::vec::Vec, - } - /// sum is the oneof that specifies whether this represents a single or nested - /// multisig signer - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - /// single represents a single signer - #[prost(message, tag = "1")] - Single(Single), - /// multi represents a nested multisig signer - #[prost(message, tag = "2")] - Multi(Multi), - } -} -/// Fee includes the amount of coins paid in fees and the maximum -/// gas to be used by the transaction. The ratio yields an effective "gasprice", -/// which must be above some miminum to be accepted into the mempool. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.Fee")] -pub struct Fee { - /// amount is the amount of coins to be paid as a fee - #[prost(message, repeated, tag = "1")] - pub amount: ::prost::alloc::vec::Vec, - /// gas_limit is the maximum gas that can be used in transaction processing - /// before an out of gas error occurs - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_limit: u64, - /// if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - /// the payer must be a tx signer (and thus have signed this field in AuthInfo). - /// setting this field does *not* change the ordering of required signers for the transaction. - #[prost(string, tag = "3")] - pub payer: ::prost::alloc::string::String, - /// if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - /// to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - /// not support fee grants, this will fail - #[prost(string, tag = "4")] - pub granter: ::prost::alloc::string::String, -} -/// Tip is the tip used for meta-transactions. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.Tip")] -#[deprecated] -pub struct Tip { - /// amount is the amount of the tip - #[prost(message, repeated, tag = "1")] - pub amount: ::prost::alloc::vec::Vec, - /// tipper is the address of the account paying for the tip - #[prost(string, tag = "2")] - pub tipper: ::prost::alloc::string::String, -} -/// AuxSignerData is the intermediary format that an auxiliary signer (e.g. a -/// tipper) builds and sends to the fee payer (who will build and broadcast the -/// actual tx). AuxSignerData is not a valid tx in itself, and will be rejected -/// by the node if sent directly as-is. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.AuxSignerData")] -pub struct AuxSignerData { - /// address is the bech32-encoded address of the auxiliary signer. If using - /// AuxSignerData across different chains, the bech32 prefix of the target - /// chain (where the final transaction is broadcasted) should be used. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer - /// signs. Note: we use the same sign doc even if we're signing with - /// LEGACY_AMINO_JSON. - #[prost(message, optional, tag = "2")] - pub sign_doc: ::core::option::Option, - /// mode is the signing mode of the single signer. - #[prost(enumeration = "super::signing::v1beta1::SignMode", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub mode: i32, - /// sig is the signature of the sign doc. - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub sig: ::prost::alloc::vec::Vec, -} -/// GetTxsEventRequest is the request type for the Service.TxsByEvents -/// 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 = "/cosmos.tx.v1beta1.GetTxsEventRequest")] -pub struct GetTxsEventRequest { - /// events is the list of transaction event type. - /// Deprecated post v0.47.x: use query instead, which should contain a valid - /// events query. - #[deprecated] - #[prost(string, repeated, tag = "1")] - pub events: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// pagination defines a pagination for the request. - /// Deprecated post v0.46.x: use page and limit instead. - #[deprecated] - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, - #[prost(enumeration = "OrderBy", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub order_by: i32, - /// page is the page number to query, starts at 1. If not provided, will - /// default to first page. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub page: u64, - /// limit is the total number of results to be returned in the result page. - /// If left empty it will default to a value to be set by each app. - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub limit: u64, - /// query defines the transaction event query that is proxied to Tendermint's - /// TxSearch RPC method. The query must be valid. - /// - /// Since cosmos-sdk 0.50 - #[prost(string, tag = "6")] - pub query: ::prost::alloc::string::String, -} -/// GetTxsEventResponse is the response type for the Service.TxsByEvents -/// 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 = "/cosmos.tx.v1beta1.GetTxsEventResponse")] -pub struct GetTxsEventResponse { - /// txs is the list of queried transactions. - #[prost(message, repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec, - /// tx_responses is the list of queried TxResponses. - #[prost(message, repeated, tag = "2")] - pub tx_responses: ::prost::alloc::vec::Vec, - /// pagination defines a pagination for the response. - /// Deprecated post v0.46.x: use total instead. - #[deprecated] - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, - /// total is total number of results available - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total: u64, -} -/// BroadcastTxRequest is the request type for the Service.BroadcastTxRequest -/// 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 = "/cosmos.tx.v1beta1.BroadcastTxRequest")] -pub struct BroadcastTxRequest { - /// tx_bytes is the raw transaction. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx_bytes: ::prost::alloc::vec::Vec, - #[prost(enumeration = "BroadcastMode", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub mode: i32, -} -/// BroadcastTxResponse is the response type for the -/// Service.BroadcastTx 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 = "/cosmos.tx.v1beta1.BroadcastTxResponse")] -pub struct BroadcastTxResponse { - /// tx_response is the queried TxResponses. - #[prost(message, optional, tag = "1")] - pub tx_response: ::core::option::Option, -} -/// SimulateRequest is the request type for the Service.Simulate -/// 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 = "/cosmos.tx.v1beta1.SimulateRequest")] -pub struct SimulateRequest { - /// tx is the transaction to simulate. - /// Deprecated. Send raw tx bytes instead. - #[deprecated] - #[prost(message, optional, tag = "1")] - pub tx: ::core::option::Option, - /// tx_bytes is the raw transaction. - /// - /// Since: cosmos-sdk 0.43 - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx_bytes: ::prost::alloc::vec::Vec, -} -/// SimulateResponse is the response type for the -/// Service.SimulateRPC 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 = "/cosmos.tx.v1beta1.SimulateResponse")] -pub struct SimulateResponse { - /// gas_info is the information about gas used in the simulation. - #[prost(message, optional, tag = "1")] - pub gas_info: ::core::option::Option, - /// result is the result of the simulation. - #[prost(message, optional, tag = "2")] - pub result: ::core::option::Option, -} -/// GetTxRequest is the request type for the Service.GetTx -/// 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 = "/cosmos.tx.v1beta1.GetTxRequest")] -pub struct GetTxRequest { - /// hash is the tx hash to query, encoded as a hex string. - #[prost(string, tag = "1")] - pub hash: ::prost::alloc::string::String, -} -/// GetTxResponse is the response type for the Service.GetTx 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 = "/cosmos.tx.v1beta1.GetTxResponse")] -pub struct GetTxResponse { - /// tx is the queried transaction. - #[prost(message, optional, tag = "1")] - pub tx: ::core::option::Option, - /// tx_response is the queried TxResponses. - #[prost(message, optional, tag = "2")] - pub tx_response: ::core::option::Option, -} -/// GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs -/// RPC method. -/// -/// Since: cosmos-sdk 0.45.2 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.GetBlockWithTxsRequest")] -pub struct GetBlockWithTxsRequest { - /// height is the height of the block to query. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// pagination defines a pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -/// GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs -/// method. -/// -/// Since: cosmos-sdk 0.45.2 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.GetBlockWithTxsResponse")] -pub struct GetBlockWithTxsResponse { - /// txs are the transactions in the block. - #[prost(message, repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub block: ::core::option::Option, - /// pagination defines a pagination for the response. - #[prost(message, optional, tag = "4")] - pub pagination: ::core::option::Option, -} -/// TxDecodeRequest is the request type for the Service.TxDecode -/// RPC method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxDecodeRequest")] -pub struct TxDecodeRequest { - /// tx_bytes is the raw transaction. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx_bytes: ::prost::alloc::vec::Vec, -} -/// TxDecodeResponse is the response type for the -/// Service.TxDecode method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxDecodeResponse")] -pub struct TxDecodeResponse { - /// tx is the decoded transaction. - #[prost(message, optional, tag = "1")] - pub tx: ::core::option::Option, -} -/// TxEncodeRequest is the request type for the Service.TxEncode -/// RPC method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxEncodeRequest")] -pub struct TxEncodeRequest { - /// tx is the transaction to encode. - #[prost(message, optional, tag = "1")] - pub tx: ::core::option::Option, -} -/// TxEncodeResponse is the response type for the -/// Service.TxEncode method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxEncodeResponse")] -pub struct TxEncodeResponse { - /// tx_bytes is the encoded transaction bytes. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx_bytes: ::prost::alloc::vec::Vec, -} -/// TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino -/// RPC method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxEncodeAminoRequest")] -pub struct TxEncodeAminoRequest { - #[prost(string, tag = "1")] - pub amino_json: ::prost::alloc::string::String, -} -/// TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino -/// RPC method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxEncodeAminoResponse")] -pub struct TxEncodeAminoResponse { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub amino_binary: ::prost::alloc::vec::Vec, -} -/// TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino -/// RPC method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxDecodeAminoRequest")] -pub struct TxDecodeAminoRequest { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub amino_binary: ::prost::alloc::vec::Vec, -} -/// TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino -/// RPC method. -/// -/// Since: cosmos-sdk 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.tx.v1beta1.TxDecodeAminoResponse")] -pub struct TxDecodeAminoResponse { - #[prost(string, tag = "1")] - pub amino_json: ::prost::alloc::string::String, -} -/// OrderBy defines the sorting order -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum OrderBy { - /// ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults - /// to ASC in this case. - Unspecified = 0, - /// ORDER_BY_ASC defines ascending order - Asc = 1, - /// ORDER_BY_DESC defines descending order - Desc = 2, -} -impl OrderBy { - /// 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 { - OrderBy::Unspecified => "ORDER_BY_UNSPECIFIED", - OrderBy::Asc => "ORDER_BY_ASC", - OrderBy::Desc => "ORDER_BY_DESC", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ORDER_BY_UNSPECIFIED" => Some(Self::Unspecified), - "ORDER_BY_ASC" => Some(Self::Asc), - "ORDER_BY_DESC" => Some(Self::Desc), - _ => None, - } - } -} -/// BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC -/// method. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum BroadcastMode { - /// zero-value for mode ordering - Unspecified = 0, - /// DEPRECATED: use BROADCAST_MODE_SYNC instead, - /// BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. - Block = 1, - /// BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits - /// for a CheckTx execution response only. - Sync = 2, - /// BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client - /// returns immediately. - Async = 3, -} -impl BroadcastMode { - /// 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 { - BroadcastMode::Unspecified => "BROADCAST_MODE_UNSPECIFIED", - BroadcastMode::Block => "BROADCAST_MODE_BLOCK", - BroadcastMode::Sync => "BROADCAST_MODE_SYNC", - BroadcastMode::Async => "BROADCAST_MODE_ASYNC", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "BROADCAST_MODE_UNSPECIFIED" => Some(Self::Unspecified), - "BROADCAST_MODE_BLOCK" => Some(Self::Block), - "BROADCAST_MODE_SYNC" => Some(Self::Sync), - "BROADCAST_MODE_ASYNC" => Some(Self::Async), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/upgrade/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/v1.rs deleted file mode 100644 index f65891a2..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/module/v1.rs +++ /dev/null @@ -1,19 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the upgrade module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.module.v1.Module")] -pub struct Module { - /// authority defines the custom module authority. If not set, defaults to the governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/upgrade/v1beta1.rs deleted file mode 100644 index da377b6f..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/upgrade/v1beta1.rs +++ /dev/null @@ -1,460 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Plan specifies information about a planned upgrade and when it should occur. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.Plan")] -pub struct Plan { - /// Sets the name for the upgrade. This name will be used by the upgraded - /// version of the software to apply any special "on-upgrade" commands during - /// the first BeginBlock method after the upgrade is applied. It is also used - /// to detect whether a software version can handle a given upgrade. If no - /// upgrade handler with this name has been set in the software, it will be - /// assumed that the software is out-of-date when the upgrade Time or Height is - /// reached and the software will exit. - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// Deprecated: Time based upgrades have been deprecated. Time based upgrade logic - /// has been removed from the SDK. - /// If this field is not empty, an error will be thrown. - #[deprecated] - #[prost(message, optional, tag = "2")] - pub time: ::core::option::Option, - /// The height at which the upgrade must be performed. - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// Any application specific upgrade info to be included on-chain - /// such as a git commit that validators could automatically upgrade to - #[prost(string, tag = "4")] - pub info: ::prost::alloc::string::String, - /// Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been - /// moved to the IBC module in the sub module 02-client. - /// If this field is not empty, an error will be thrown. - #[deprecated] - #[prost(message, optional, tag = "5")] - pub upgraded_client_state: ::core::option::Option, -} -/// SoftwareUpgradeProposal is a gov Content type for initiating a software -/// upgrade. -/// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov -/// proposals, see MsgSoftwareUpgrade. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal")] -#[deprecated] -pub struct SoftwareUpgradeProposal { - /// title of the proposal - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// description of the proposal - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// plan of the proposal - #[prost(message, optional, tag = "3")] - pub plan: ::core::option::Option, -} -/// CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software -/// upgrade. -/// Deprecated: This legacy proposal is deprecated in favor of Msg-based gov -/// proposals, see MsgCancelUpgrade. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal")] -#[deprecated] -pub struct CancelSoftwareUpgradeProposal { - /// title of the proposal - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// description of the proposal - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, -} -/// ModuleVersion specifies a module and its consensus version. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.ModuleVersion")] -pub struct ModuleVersion { - /// name of the app module - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// consensus version of the app module - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub version: u64, -} -/// QueryCurrentPlanRequest is the request type for the Query/CurrentPlan 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 = "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest")] -#[proto_query( - path = "/cosmos.upgrade.v1beta1.Query/CurrentPlan", - response_type = QueryCurrentPlanResponse -)] -pub struct QueryCurrentPlanRequest {} -/// QueryCurrentPlanResponse is the response type for the Query/CurrentPlan 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 = "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse")] -pub struct QueryCurrentPlanResponse { - /// plan is the current upgrade plan. - #[prost(message, optional, tag = "1")] - pub plan: ::core::option::Option, -} -/// QueryCurrentPlanRequest is the request type for the Query/AppliedPlan 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 = "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest")] -#[proto_query( - path = "/cosmos.upgrade.v1beta1.Query/AppliedPlan", - response_type = QueryAppliedPlanResponse -)] -pub struct QueryAppliedPlanRequest { - /// name is the name of the applied plan to query for. - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, -} -/// QueryAppliedPlanResponse is the response type for the Query/AppliedPlan 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 = "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse")] -pub struct QueryAppliedPlanResponse { - /// height is the block height at which the plan was applied. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} -/// QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState -/// 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 = "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest")] -#[proto_query( - path = "/cosmos.upgrade.v1beta1.Query/UpgradedConsensusState", - response_type = QueryUpgradedConsensusStateResponse -)] -#[deprecated] -pub struct QueryUpgradedConsensusStateRequest { - /// last height of the current chain must be sent in request - /// as this is the height under which next consensus state is stored - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_height: i64, -} -/// QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState -/// 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 = "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse")] -#[deprecated] -pub struct QueryUpgradedConsensusStateResponse { - /// Since: cosmos-sdk 0.43 - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub upgraded_consensus_state: ::prost::alloc::vec::Vec, -} -/// QueryModuleVersionsRequest is the request type for the Query/ModuleVersions -/// RPC method. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest")] -#[proto_query( - path = "/cosmos.upgrade.v1beta1.Query/ModuleVersions", - response_type = QueryModuleVersionsResponse -)] -pub struct QueryModuleVersionsRequest { - /// module_name is a field to query a specific module - /// consensus version from state. Leaving this empty will - /// fetch the full list of module versions from state - #[prost(string, tag = "1")] - pub module_name: ::prost::alloc::string::String, -} -/// QueryModuleVersionsResponse is the response type for the Query/ModuleVersions -/// RPC method. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse")] -pub struct QueryModuleVersionsResponse { - /// module_versions is a list of module names with their consensus versions. - #[prost(message, repeated, tag = "1")] - pub module_versions: ::prost::alloc::vec::Vec, -} -/// QueryAuthorityRequest is the request type for Query/Authority -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.QueryAuthorityRequest")] -#[proto_query( - path = "/cosmos.upgrade.v1beta1.Query/Authority", - response_type = QueryAuthorityResponse -)] -pub struct QueryAuthorityRequest {} -/// QueryAuthorityResponse is the response type for Query/Authority -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.QueryAuthorityResponse")] -pub struct QueryAuthorityResponse { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade")] -pub struct MsgSoftwareUpgrade { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// plan is the upgrade plan. - #[prost(message, optional, tag = "2")] - pub plan: ::core::option::Option, -} -/// MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse")] -pub struct MsgSoftwareUpgradeResponse {} -/// MsgCancelUpgrade is the Msg/CancelUpgrade request type. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.MsgCancelUpgrade")] -pub struct MsgCancelUpgrade { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} -/// MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse")] -pub struct MsgCancelUpgradeResponse {} -pub struct UpgradeQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> UpgradeQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn current_plan(&self) -> Result { - QueryCurrentPlanRequest {}.query(self.querier) - } - pub fn applied_plan( - &self, - name: ::prost::alloc::string::String, - ) -> Result { - QueryAppliedPlanRequest { name }.query(self.querier) - } - #[deprecated] - pub fn upgraded_consensus_state( - &self, - last_height: i64, - ) -> Result { - QueryUpgradedConsensusStateRequest { last_height }.query(self.querier) - } - pub fn module_versions( - &self, - module_name: ::prost::alloc::string::String, - ) -> Result { - QueryModuleVersionsRequest { module_name }.query(self.querier) - } - pub fn authority(&self) -> Result { - QueryAuthorityRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/vesting/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/vesting/mod.rs deleted file mode 100644 index 537a3360..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/vesting/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/vesting/module/mod.rs b/packages/neutron-sdk/src/proto_types/cosmos/vesting/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/vesting/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmos/vesting/module/v1.rs b/packages/neutron-sdk/src/proto_types/cosmos/vesting/module/v1.rs deleted file mode 100644 index 122b386b..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/vesting/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the vesting module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/cosmos/vesting/v1beta1.rs b/packages/neutron-sdk/src/proto_types/cosmos/vesting/v1beta1.rs deleted file mode 100644 index 4cf45af8..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmos/vesting/v1beta1.rs +++ /dev/null @@ -1,280 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// BaseVestingAccount implements the VestingAccount interface. It contains all -/// the necessary fields needed for any vesting account implementation. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.BaseVestingAccount")] -pub struct BaseVestingAccount { - #[prost(message, optional, tag = "1")] - pub base_account: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub original_vesting: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub delegated_free: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub delegated_vesting: ::prost::alloc::vec::Vec, - /// Vesting end time, as unix timestamp (in seconds). - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub end_time: i64, -} -/// ContinuousVestingAccount implements the VestingAccount interface. It -/// continuously vests by unlocking coins linearly with respect to time. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.ContinuousVestingAccount")] -pub struct ContinuousVestingAccount { - #[prost(message, optional, tag = "1")] - pub base_vesting_account: ::core::option::Option, - /// Vesting start time, as unix timestamp (in seconds). - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub start_time: i64, -} -/// DelayedVestingAccount implements the VestingAccount interface. It vests all -/// coins after a specific time, but non prior. In other words, it keeps them -/// locked until a specified time. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.DelayedVestingAccount")] -pub struct DelayedVestingAccount { - #[prost(message, optional, tag = "1")] - pub base_vesting_account: ::core::option::Option, -} -/// Period defines a length of time and amount of coins that will vest. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.Period")] -pub struct Period { - /// Period duration in seconds. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub length: i64, - #[prost(message, repeated, tag = "2")] - pub amount: ::prost::alloc::vec::Vec, -} -/// PeriodicVestingAccount implements the VestingAccount interface. It -/// periodically vests by unlocking coins during each specified period. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.PeriodicVestingAccount")] -pub struct PeriodicVestingAccount { - #[prost(message, optional, tag = "1")] - pub base_vesting_account: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub start_time: i64, - #[prost(message, repeated, tag = "3")] - pub vesting_periods: ::prost::alloc::vec::Vec, -} -/// PermanentLockedAccount implements the VestingAccount interface. It does -/// not ever release coins, locking them indefinitely. Coins in this account can -/// still be used for delegating and for governance votes even while locked. -/// -/// Since: cosmos-sdk 0.43 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.PermanentLockedAccount")] -pub struct PermanentLockedAccount { - #[prost(message, optional, tag = "1")] - pub base_vesting_account: ::core::option::Option, -} -/// MsgCreateVestingAccount defines a message that enables creating a vesting -/// account. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.MsgCreateVestingAccount")] -pub struct MsgCreateVestingAccount { - #[prost(string, tag = "1")] - pub from_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub to_address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, - /// end of vesting as unix time (in seconds). - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub end_time: i64, - #[prost(bool, tag = "5")] - pub delayed: bool, -} -/// MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response 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 = "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse")] -pub struct MsgCreateVestingAccountResponse {} -/// MsgCreatePermanentLockedAccount defines a message that enables creating a permanent -/// locked account. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount")] -pub struct MsgCreatePermanentLockedAccount { - #[prost(string, tag = "1")] - pub from_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub to_address: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub amount: ::prost::alloc::vec::Vec, -} -/// MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse")] -pub struct MsgCreatePermanentLockedAccountResponse {} -/// MsgCreateVestingAccount defines a message that enables creating a vesting -/// account. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount")] -pub struct MsgCreatePeriodicVestingAccount { - #[prost(string, tag = "1")] - pub from_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub to_address: ::prost::alloc::string::String, - /// start of vesting as unix time (in seconds). - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub start_time: i64, - #[prost(message, repeated, tag = "4")] - pub vesting_periods: ::prost::alloc::vec::Vec, -} -/// MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount -/// response type. -/// -/// Since: cosmos-sdk 0.46 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse")] -pub struct MsgCreatePeriodicVestingAccountResponse {} diff --git a/packages/neutron-sdk/src/proto_types/cosmwasm/mod.rs b/packages/neutron-sdk/src/proto_types/cosmwasm/mod.rs deleted file mode 100644 index ce1d9f82..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmwasm/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod wasm; diff --git a/packages/neutron-sdk/src/proto_types/cosmwasm/wasm/mod.rs b/packages/neutron-sdk/src/proto_types/cosmwasm/wasm/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmwasm/wasm/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/cosmwasm/wasm/v1.rs b/packages/neutron-sdk/src/proto_types/cosmwasm/wasm/v1.rs deleted file mode 100644 index d85c3a9e..00000000 --- a/packages/neutron-sdk/src/proto_types/cosmwasm/wasm/v1.rs +++ /dev/null @@ -1,2988 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// AccessTypeParam -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.AccessTypeParam")] -pub struct AccessTypeParam { - #[prost(enumeration = "AccessType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub value: i32, -} -/// AccessConfig access control 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 = "/cosmwasm.wasm.v1.AccessConfig")] -pub struct AccessConfig { - #[prost(enumeration = "AccessType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub permission: i32, - #[prost(string, repeated, tag = "3")] - pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Params defines the set of wasm parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.Params")] -pub struct Params { - #[prost(message, optional, tag = "1")] - pub code_upload_access: ::core::option::Option, - #[prost(enumeration = "AccessType", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub instantiate_default_permission: i32, -} -/// CodeInfo is data for the uploaded contract WASM code -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.CodeInfo")] -pub struct CodeInfo { - /// CodeHash is the unique identifier created by wasmvm - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_hash: ::prost::alloc::vec::Vec, - /// Creator address who initially stored the code - #[prost(string, tag = "2")] - pub creator: ::prost::alloc::string::String, - /// InstantiateConfig access control to apply on contract creation, optional - #[prost(message, optional, tag = "5")] - pub instantiate_config: ::core::option::Option, -} -/// ContractInfo stores a WASM contract instance -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ContractInfo")] -pub struct ContractInfo { - /// CodeID is the reference to the stored Wasm code - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Creator address who initially instantiated the contract - #[prost(string, tag = "2")] - pub creator: ::prost::alloc::string::String, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "3")] - pub admin: ::prost::alloc::string::String, - /// Label is optional metadata to be stored with a contract instance. - #[prost(string, tag = "4")] - pub label: ::prost::alloc::string::String, - /// Created Tx position when the contract was instantiated. - #[prost(message, optional, tag = "5")] - pub created: ::core::option::Option, - #[prost(string, tag = "6")] - #[serde(alias = "ibc_portID")] - pub ibc_port_id: ::prost::alloc::string::String, - /// Extension is an extension point to store custom metadata within the - /// persistence model. - #[prost(message, optional, tag = "7")] - pub extension: ::core::option::Option, -} -/// ContractCodeHistoryEntry metadata to a contract. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ContractCodeHistoryEntry")] -pub struct ContractCodeHistoryEntry { - #[prost(enumeration = "ContractCodeHistoryOperationType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub operation: i32, - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "2")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Updated Tx position when the operation was executed. - #[prost(message, optional, tag = "3")] - pub updated: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// AbsoluteTxPosition is a unique transaction position that allows for global -/// ordering of transactions. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.AbsoluteTxPosition")] -pub struct AbsoluteTxPosition { - /// BlockHeight is the block the contract was created at - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_height: u64, - /// TxIndex is a monotonic counter within the block (actual transaction index, - /// or gas consumed) - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tx_index: u64, -} -/// Model is a struct that holds a KV pair -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.Model")] -pub struct Model { - /// hex-encode key to read it better (this is often ascii) - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - /// base64-encode raw value - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, -} -/// AccessType permission types -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum AccessType { - /// AccessTypeUnspecified placeholder for empty value - Unspecified = 0, - /// AccessTypeNobody forbidden - Nobody = 1, - /// AccessTypeEverybody unrestricted - Everybody = 3, - /// AccessTypeAnyOfAddresses allow any of the addresses - AnyOfAddresses = 4, -} -impl AccessType { - /// 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 { - AccessType::Unspecified => "ACCESS_TYPE_UNSPECIFIED", - AccessType::Nobody => "ACCESS_TYPE_NOBODY", - AccessType::Everybody => "ACCESS_TYPE_EVERYBODY", - AccessType::AnyOfAddresses => "ACCESS_TYPE_ANY_OF_ADDRESSES", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ACCESS_TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "ACCESS_TYPE_NOBODY" => Some(Self::Nobody), - "ACCESS_TYPE_EVERYBODY" => Some(Self::Everybody), - "ACCESS_TYPE_ANY_OF_ADDRESSES" => Some(Self::AnyOfAddresses), - _ => None, - } - } -} -/// ContractCodeHistoryOperationType actions that caused a code change -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum ContractCodeHistoryOperationType { - /// ContractCodeHistoryOperationTypeUnspecified placeholder for empty value - Unspecified = 0, - /// ContractCodeHistoryOperationTypeInit on chain contract instantiation - Init = 1, - /// ContractCodeHistoryOperationTypeMigrate code migration - Migrate = 2, - /// ContractCodeHistoryOperationTypeGenesis based on genesis data - Genesis = 3, -} -impl ContractCodeHistoryOperationType { - /// 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 { - ContractCodeHistoryOperationType::Unspecified => { - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED" - } - ContractCodeHistoryOperationType::Init => "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT", - ContractCodeHistoryOperationType::Migrate => { - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE" - } - ContractCodeHistoryOperationType::Genesis => { - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS" - } - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT" => Some(Self::Init), - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE" => Some(Self::Migrate), - "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS" => Some(Self::Genesis), - _ => None, - } - } -} -/// StoreCodeAuthorization defines authorization for wasm code upload. -/// Since: wasmd 0.42 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.StoreCodeAuthorization")] -pub struct StoreCodeAuthorization { - /// Grants for code upload - #[prost(message, repeated, tag = "1")] - pub grants: ::prost::alloc::vec::Vec, -} -/// ContractExecutionAuthorization defines authorization for wasm execute. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ContractExecutionAuthorization")] -pub struct ContractExecutionAuthorization { - /// Grants for contract executions - #[prost(message, repeated, tag = "1")] - pub grants: ::prost::alloc::vec::Vec, -} -/// ContractMigrationAuthorization defines authorization for wasm contract -/// migration. Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ContractMigrationAuthorization")] -pub struct ContractMigrationAuthorization { - /// Grants for contract migrations - #[prost(message, repeated, tag = "1")] - pub grants: ::prost::alloc::vec::Vec, -} -/// CodeGrant a granted permission for a single code -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.CodeGrant")] -pub struct CodeGrant { - /// CodeHash is the unique identifier created by wasmvm - /// Wildcard "*" is used to specify any kind of grant. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_hash: ::prost::alloc::vec::Vec, - /// InstantiatePermission is the superset access control to apply - /// on contract creation. - /// Optional - #[prost(message, optional, tag = "2")] - pub instantiate_permission: ::core::option::Option, -} -/// ContractGrant a granted permission for a single contract -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ContractGrant")] -pub struct ContractGrant { - /// Contract is the bech32 address of the smart contract - #[prost(string, tag = "1")] - pub contract: ::prost::alloc::string::String, - /// Limit defines execution limits that are enforced and updated when the grant - /// is applied. When the limit lapsed the grant is removed. - #[prost(message, optional, tag = "2")] - pub limit: ::core::option::Option, - /// Filter define more fine-grained control on the message payload passed - /// to the contract in the operation. When no filter applies on execution, the - /// operation is prohibited. - #[prost(message, optional, tag = "3")] - pub filter: ::core::option::Option, -} -/// MaxCallsLimit limited number of calls to the contract. No funds transferable. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MaxCallsLimit")] -pub struct MaxCallsLimit { - /// Remaining number that is decremented on each execution - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub remaining: u64, -} -/// MaxFundsLimit defines the maximal amounts that can be sent to the contract. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MaxFundsLimit")] -pub struct MaxFundsLimit { - /// Amounts is the maximal amount of tokens transferable to the contract. - #[prost(message, repeated, tag = "1")] - pub amounts: ::prost::alloc::vec::Vec, -} -/// CombinedLimit defines the maximal amounts that can be sent to a contract and -/// the maximal number of calls executable. Both need to remain >0 to be valid. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.CombinedLimit")] -pub struct CombinedLimit { - /// Remaining number that is decremented on each execution - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub calls_remaining: u64, - /// Amounts is the maximal amount of tokens transferable to the contract. - #[prost(message, repeated, tag = "2")] - pub amounts: ::prost::alloc::vec::Vec, -} -/// AllowAllMessagesFilter is a wildcard to allow any type of contract payload -/// message. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.AllowAllMessagesFilter")] -pub struct AllowAllMessagesFilter {} -/// AcceptedMessageKeysFilter accept only the specific contract message keys in -/// the json object to be executed. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.AcceptedMessageKeysFilter")] -pub struct AcceptedMessageKeysFilter { - /// Messages is the list of unique keys - #[prost(string, repeated, tag = "1")] - pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// AcceptedMessagesFilter accept only the specific raw contract messages to be -/// executed. -/// Since: wasmd 0.30 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.AcceptedMessagesFilter")] -pub struct AcceptedMessagesFilter { - /// Messages is the list of raw contract messages - #[prost(bytes = "vec", repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// MsgStoreCode submit Wasm code to the system -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgStoreCode")] -pub struct MsgStoreCode { - /// Sender is the actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// WASMByteCode can be raw or gzip compressed - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub wasm_byte_code: ::prost::alloc::vec::Vec, - /// InstantiatePermission access control to apply on contract creation, - /// optional - #[prost(message, optional, tag = "5")] - pub instantiate_permission: ::core::option::Option, -} -/// MsgStoreCodeResponse returns store result data. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgStoreCodeResponse")] -pub struct MsgStoreCodeResponse { - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Checksum is the sha256 hash of the stored code - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub checksum: ::prost::alloc::vec::Vec, -} -/// MsgInstantiateContract create a new smart contract instance for the given -/// code id. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgInstantiateContract")] -pub struct MsgInstantiateContract { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "2")] - pub admin: ::prost::alloc::string::String, - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "3")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Label is optional metadata to be stored with a contract instance. - #[prost(string, tag = "4")] - pub label: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract on instantiation - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on instantiation - #[prost(message, repeated, tag = "6")] - pub funds: ::prost::alloc::vec::Vec, -} -/// MsgInstantiateContractResponse return instantiation result data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgInstantiateContractResponse")] -pub struct MsgInstantiateContractResponse { - /// Address is the bech32 address of the new contract instance. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// Data contains bytes to returned from the contract - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgInstantiateContract2 create a new smart contract instance for the given -/// code id with a predicable address. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgInstantiateContract2")] -pub struct MsgInstantiateContract2 { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "2")] - pub admin: ::prost::alloc::string::String, - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "3")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Label is optional metadata to be stored with a contract instance. - #[prost(string, tag = "4")] - pub label: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract on instantiation - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on instantiation - #[prost(message, repeated, tag = "6")] - pub funds: ::prost::alloc::vec::Vec, - /// Salt is an arbitrary value provided by the sender. Size can be 1 to 64. - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub salt: ::prost::alloc::vec::Vec, - /// FixMsg include the msg value into the hash for the predictable address. - /// Default is false - #[prost(bool, tag = "8")] - pub fix_msg: bool, -} -/// MsgInstantiateContract2Response return instantiation result data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgInstantiateContract2Response")] -pub struct MsgInstantiateContract2Response { - /// Address is the bech32 address of the new contract instance. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// Data contains bytes to returned from the contract - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgExecuteContract submits the given message data to a smart contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgExecuteContract")] -pub struct MsgExecuteContract { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "2")] - pub contract: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on execution - #[prost(message, repeated, tag = "5")] - pub funds: ::prost::alloc::vec::Vec, -} -/// MsgExecuteContractResponse returns execution result data. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgExecuteContractResponse")] -pub struct MsgExecuteContractResponse { - /// Data contains bytes to returned from the contract - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgMigrateContract")] -pub struct MsgMigrateContract { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "2")] - pub contract: ::prost::alloc::string::String, - /// CodeID references the new WASM code - #[prost(uint64, tag = "3")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Msg json encoded message to be passed to the contract on migration - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// MsgMigrateContractResponse returns contract migration result data. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgMigrateContractResponse")] -pub struct MsgMigrateContractResponse { - /// Data contains same raw bytes returned as data from the wasm contract. - /// (May be empty) - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgUpdateAdmin sets a new admin for a smart contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateAdmin")] -pub struct MsgUpdateAdmin { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// NewAdmin address to be set - #[prost(string, tag = "2")] - pub new_admin: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "3")] - pub contract: ::prost::alloc::string::String, -} -/// MsgUpdateAdminResponse returns empty data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateAdminResponse")] -pub struct MsgUpdateAdminResponse {} -/// MsgClearAdmin removes any admin stored for a smart contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgClearAdmin")] -pub struct MsgClearAdmin { - /// Sender is the actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "3")] - pub contract: ::prost::alloc::string::String, -} -/// MsgClearAdminResponse returns empty data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgClearAdminResponse")] -pub struct MsgClearAdminResponse {} -/// MsgUpdateInstantiateConfig updates instantiate config for a smart contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig")] -pub struct MsgUpdateInstantiateConfig { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// CodeID references the stored WASM code - #[prost(uint64, tag = "2")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// NewInstantiatePermission is the new access control - #[prost(message, optional, tag = "3")] - pub new_instantiate_permission: ::core::option::Option, -} -/// MsgUpdateInstantiateConfigResponse returns empty data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse")] -pub struct MsgUpdateInstantiateConfigResponse {} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/wasm parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -/// MsgSudoContract is the MsgSudoContract request type. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgSudoContract")] -pub struct MsgSudoContract { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "2")] - pub contract: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract as sudo - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// MsgSudoContractResponse defines the response structure for executing a -/// MsgSudoContract message. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgSudoContractResponse")] -pub struct MsgSudoContractResponse { - /// Data contains bytes to returned from the contract - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgPinCodes is the MsgPinCodes request type. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgPinCodes")] -pub struct MsgPinCodes { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// CodeIDs references the new WASM codes - #[prost(uint64, repeated, packed = "false", tag = "2")] - #[serde(alias = "codeIDs")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub code_ids: ::prost::alloc::vec::Vec, -} -/// MsgPinCodesResponse defines the response structure for executing a -/// MsgPinCodes message. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgPinCodesResponse")] -pub struct MsgPinCodesResponse {} -/// MsgUnpinCodes is the MsgUnpinCodes request type. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUnpinCodes")] -pub struct MsgUnpinCodes { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// CodeIDs references the WASM codes - #[prost(uint64, repeated, packed = "false", tag = "2")] - #[serde(alias = "codeIDs")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub code_ids: ::prost::alloc::vec::Vec, -} -/// MsgUnpinCodesResponse defines the response structure for executing a -/// MsgUnpinCodes message. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUnpinCodesResponse")] -pub struct MsgUnpinCodesResponse {} -/// MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract -/// request type. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract")] -pub struct MsgStoreAndInstantiateContract { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// WASMByteCode can be raw or gzip compressed - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub wasm_byte_code: ::prost::alloc::vec::Vec, - /// InstantiatePermission to apply on contract creation, optional - #[prost(message, optional, tag = "4")] - pub instantiate_permission: ::core::option::Option, - /// UnpinCode code on upload, optional. As default the uploaded contract is - /// pinned to cache. - #[prost(bool, tag = "5")] - pub unpin_code: bool, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "6")] - pub admin: ::prost::alloc::string::String, - /// Label is optional metadata to be stored with a constract instance. - #[prost(string, tag = "7")] - pub label: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract on instantiation - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred from the authority account to the contract - /// on instantiation - #[prost(message, repeated, tag = "9")] - pub funds: ::prost::alloc::vec::Vec, - /// Source is the URL where the code is hosted - #[prost(string, tag = "10")] - pub source: ::prost::alloc::string::String, - /// Builder is the docker image used to build the code deterministically, used - /// for smart contract verification - #[prost(string, tag = "11")] - pub builder: ::prost::alloc::string::String, - /// CodeHash is the SHA256 sum of the code outputted by builder, used for smart - /// contract verification - #[prost(bytes = "vec", tag = "12")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_hash: ::prost::alloc::vec::Vec, -} -/// MsgStoreAndInstantiateContractResponse defines the response structure -/// for executing a MsgStoreAndInstantiateContract message. -/// -/// Since: 0.40 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse")] -pub struct MsgStoreAndInstantiateContractResponse { - /// Address is the bech32 address of the new contract instance. - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// Data contains bytes to returned from the contract - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgAddCodeUploadParamsAddresses is the -/// MsgAddCodeUploadParamsAddresses 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 = "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses")] -pub struct MsgAddCodeUploadParamsAddresses { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "2")] - pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgAddCodeUploadParamsAddressesResponse defines the response -/// structure for executing a MsgAddCodeUploadParamsAddresses 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 = "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse")] -pub struct MsgAddCodeUploadParamsAddressesResponse {} -/// MsgRemoveCodeUploadParamsAddresses is the -/// MsgRemoveCodeUploadParamsAddresses 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 = "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses")] -pub struct MsgRemoveCodeUploadParamsAddresses { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "2")] - pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgRemoveCodeUploadParamsAddressesResponse defines the response -/// structure for executing a MsgRemoveCodeUploadParamsAddresses 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 = "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse")] -pub struct MsgRemoveCodeUploadParamsAddressesResponse {} -/// MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract -/// request type. -/// -/// Since: 0.42 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract")] -pub struct MsgStoreAndMigrateContract { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// WASMByteCode can be raw or gzip compressed - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub wasm_byte_code: ::prost::alloc::vec::Vec, - /// InstantiatePermission to apply on contract creation, optional - #[prost(message, optional, tag = "3")] - pub instantiate_permission: ::core::option::Option, - /// Contract is the address of the smart contract - #[prost(string, tag = "4")] - pub contract: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract on migration - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// MsgStoreAndMigrateContractResponse defines the response structure -/// for executing a MsgStoreAndMigrateContract message. -/// -/// Since: 0.42 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse")] -pub struct MsgStoreAndMigrateContractResponse { - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Checksum is the sha256 hash of the stored code - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub checksum: ::prost::alloc::vec::Vec, - /// Data contains bytes to returned from the contract - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgUpdateContractLabel sets a new label for a smart contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateContractLabel")] -pub struct MsgUpdateContractLabel { - /// Sender is the that actor that signed the messages - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// NewLabel string to be set - #[prost(string, tag = "2")] - pub new_label: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "3")] - pub contract: ::prost::alloc::string::String, -} -/// MsgUpdateContractLabelResponse returns empty data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse")] -pub struct MsgUpdateContractLabelResponse {} -/// GenesisState - genesis state of x/wasm -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub codes: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub contracts: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub sequences: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub gen_msgs: ::prost::alloc::vec::Vec, -} -/// Nested message and enum types in `GenesisState`. -pub mod genesis_state { - use neutron_std_derive::CosmwasmExt; - /// GenMsgs define the messages that can be executed during genesis phase in - /// order. The intention is to have more human readable data that is auditable. - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, - )] - #[proto_message(type_url = "/cosmwasm.wasm.v1.GenesisState.GenMsgs")] - pub struct GenMsgs { - /// sum is a single message - #[prost(oneof = "gen_msgs::Sum", tags = "1, 2, 3")] - pub sum: ::core::option::Option, - } - /// Nested message and enum types in `GenMsgs`. - pub mod gen_msgs { - /// sum is a single message - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - StoreCode(super::super::MsgStoreCode), - #[prost(message, tag = "2")] - InstantiateContract(super::super::MsgInstantiateContract), - /// MsgInstantiateContract2 intentionally not supported - /// see - #[prost(message, tag = "3")] - ExecuteContract(super::super::MsgExecuteContract), - } - } -} -/// Code struct encompasses CodeInfo and CodeBytes -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.Code")] -pub struct Code { - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - #[prost(message, optional, tag = "2")] - pub code_info: ::core::option::Option, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_bytes: ::prost::alloc::vec::Vec, - /// Pinned to wasmvm cache - #[prost(bool, tag = "4")] - pub pinned: bool, -} -/// Contract struct encompasses ContractAddress, ContractInfo, and ContractState -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.Contract")] -pub struct Contract { - #[prost(string, tag = "1")] - pub contract_address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub contract_info: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub contract_state: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub contract_code_history: ::prost::alloc::vec::Vec, -} -/// Sequence key and value of an id generation counter -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.Sequence")] -pub struct Sequence { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub id_key: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub value: u64, -} -/// MsgIBCSend -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgIBCSend")] -pub struct MsgIbcSend { - /// the channel by which the packet will be sent - #[prost(string, tag = "2")] - pub channel: ::prost::alloc::string::String, - /// Timeout height relative to the current block height. - /// The timeout is disabled when set to 0. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout_height: u64, - /// Timeout timestamp (in nanoseconds) relative to the current block timestamp. - /// The timeout is disabled when set to 0. - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout_timestamp: u64, - /// Data is the payload to transfer. We must not make assumption what format or - /// content is in here. - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgIBCSendResponse -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgIBCSendResponse")] -pub struct MsgIbcSendResponse { - /// Sequence number of the IBC packet sent - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// MsgIBCCloseChannel port and channel need to be owned by the contract -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MsgIBCCloseChannel")] -pub struct MsgIbcCloseChannel { - #[prost(string, tag = "2")] - pub channel: ::prost::alloc::string::String, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit StoreCodeProposal. To submit WASM code to the system, -/// a simple MsgStoreCode can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.StoreCodeProposal")] -#[deprecated] -pub struct StoreCodeProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// RunAs is the address that is passed to the contract's environment as sender - #[prost(string, tag = "3")] - pub run_as: ::prost::alloc::string::String, - /// WASMByteCode can be raw or gzip compressed - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub wasm_byte_code: ::prost::alloc::vec::Vec, - /// InstantiatePermission to apply on contract creation, optional - #[prost(message, optional, tag = "7")] - pub instantiate_permission: ::core::option::Option, - /// UnpinCode code on upload, optional - #[prost(bool, tag = "8")] - pub unpin_code: bool, - /// Source is the URL where the code is hosted - #[prost(string, tag = "9")] - pub source: ::prost::alloc::string::String, - /// Builder is the docker image used to build the code deterministically, used - /// for smart contract verification - #[prost(string, tag = "10")] - pub builder: ::prost::alloc::string::String, - /// CodeHash is the SHA256 sum of the code outputted by builder, used for smart - /// contract verification - #[prost(bytes = "vec", tag = "11")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_hash: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit InstantiateContractProposal. To instantiate a contract, -/// a simple MsgInstantiateContract can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.InstantiateContractProposal")] -#[deprecated] -pub struct InstantiateContractProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// RunAs is the address that is passed to the contract's environment as sender - #[prost(string, tag = "3")] - pub run_as: ::prost::alloc::string::String, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "4")] - pub admin: ::prost::alloc::string::String, - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "5")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Label is optional metadata to be stored with a constract instance. - #[prost(string, tag = "6")] - pub label: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract on instantiation - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on instantiation - #[prost(message, repeated, tag = "8")] - pub funds: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit InstantiateContract2Proposal. To instantiate contract 2, -/// a simple MsgInstantiateContract2 can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.InstantiateContract2Proposal")] -#[deprecated] -pub struct InstantiateContract2Proposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// RunAs is the address that is passed to the contract's enviroment as sender - #[prost(string, tag = "3")] - pub run_as: ::prost::alloc::string::String, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "4")] - pub admin: ::prost::alloc::string::String, - /// CodeID is the reference to the stored WASM code - #[prost(uint64, tag = "5")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Label is optional metadata to be stored with a constract instance. - #[prost(string, tag = "6")] - pub label: ::prost::alloc::string::String, - /// Msg json encode message to be passed to the contract on instantiation - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on instantiation - #[prost(message, repeated, tag = "8")] - pub funds: ::prost::alloc::vec::Vec, - /// Salt is an arbitrary value provided by the sender. Size can be 1 to 64. - #[prost(bytes = "vec", tag = "9")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub salt: ::prost::alloc::vec::Vec, - /// FixMsg include the msg value into the hash for the predictable address. - /// Default is false - #[prost(bool, tag = "10")] - pub fix_msg: bool, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit MigrateContractProposal. To migrate a contract, -/// a simple MsgMigrateContract can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.MigrateContractProposal")] -#[deprecated] -pub struct MigrateContractProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - /// - /// Note: skipping 3 as this was previously used for unneeded run_as - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "4")] - pub contract: ::prost::alloc::string::String, - /// CodeID references the new WASM code - #[prost(uint64, tag = "5")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// Msg json encoded message to be passed to the contract on migration - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit SudoContractProposal. To call sudo on a contract, -/// a simple MsgSudoContract can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.SudoContractProposal")] -#[deprecated] -pub struct SudoContractProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "3")] - pub contract: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract as sudo - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit ExecuteContractProposal. To call execute on a contract, -/// a simple MsgExecuteContract can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ExecuteContractProposal")] -#[deprecated] -pub struct ExecuteContractProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// RunAs is the address that is passed to the contract's environment as sender - #[prost(string, tag = "3")] - pub run_as: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "4")] - pub contract: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract as execute - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on instantiation - #[prost(message, repeated, tag = "6")] - pub funds: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit UpdateAdminProposal. To set an admin for a contract, -/// a simple MsgUpdateAdmin can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.UpdateAdminProposal")] -#[deprecated] -pub struct UpdateAdminProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// NewAdmin address to be set - #[prost(string, tag = "3")] - pub new_admin: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "4")] - pub contract: ::prost::alloc::string::String, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit ClearAdminProposal. To clear the admin of a contract, -/// a simple MsgClearAdmin can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.ClearAdminProposal")] -#[deprecated] -pub struct ClearAdminProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// Contract is the address of the smart contract - #[prost(string, tag = "3")] - pub contract: ::prost::alloc::string::String, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit PinCodesProposal. To pin a set of code ids in the wasmvm -/// cache, a simple MsgPinCodes can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.PinCodesProposal")] -#[deprecated] -pub struct PinCodesProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// CodeIDs references the new WASM codes - #[prost(uint64, repeated, packed = "false", tag = "3")] - #[serde(alias = "codeIDs")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub code_ids: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit UnpinCodesProposal. To unpin a set of code ids in the wasmvm -/// cache, a simple MsgUnpinCodes can be invoked from the x/gov module via -/// a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.UnpinCodesProposal")] -#[deprecated] -pub struct UnpinCodesProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// CodeIDs references the WASM codes - #[prost(uint64, repeated, packed = "false", tag = "3")] - #[serde(alias = "codeIDs")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub code_ids: ::prost::alloc::vec::Vec, -} -/// AccessConfigUpdate contains the code id and the access config to be -/// applied. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.AccessConfigUpdate")] -pub struct AccessConfigUpdate { - /// CodeID is the reference to the stored WASM code to be updated - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// InstantiatePermission to apply to the set of code ids - #[prost(message, optional, tag = "2")] - pub instantiate_permission: ::core::option::Option, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit UpdateInstantiateConfigProposal. To update instantiate config -/// to a set of code ids, a simple MsgUpdateInstantiateConfig can be invoked from -/// the x/gov module via a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.UpdateInstantiateConfigProposal")] -#[deprecated] -pub struct UpdateInstantiateConfigProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// AccessConfigUpdate contains the list of code ids and the access config - /// to be applied. - #[prost(message, repeated, tag = "3")] - pub access_config_updates: ::prost::alloc::vec::Vec, -} -/// Deprecated: Do not use. Since wasmd v0.40, there is no longer a need for -/// an explicit StoreAndInstantiateContractProposal. To store and instantiate -/// the contract, a simple MsgStoreAndInstantiateContract can be invoked from -/// the x/gov module via a v1 governance proposal. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.StoreAndInstantiateContractProposal")] -#[deprecated] -pub struct StoreAndInstantiateContractProposal { - /// Title is a short summary - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// Description is a human readable text - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// RunAs is the address that is passed to the contract's environment as sender - #[prost(string, tag = "3")] - pub run_as: ::prost::alloc::string::String, - /// WASMByteCode can be raw or gzip compressed - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub wasm_byte_code: ::prost::alloc::vec::Vec, - /// InstantiatePermission to apply on contract creation, optional - #[prost(message, optional, tag = "5")] - pub instantiate_permission: ::core::option::Option, - /// UnpinCode code on upload, optional - #[prost(bool, tag = "6")] - pub unpin_code: bool, - /// Admin is an optional address that can execute migrations - #[prost(string, tag = "7")] - pub admin: ::prost::alloc::string::String, - /// Label is optional metadata to be stored with a constract instance. - #[prost(string, tag = "8")] - pub label: ::prost::alloc::string::String, - /// Msg json encoded message to be passed to the contract on instantiation - #[prost(bytes = "vec", tag = "9")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, - /// Funds coins that are transferred to the contract on instantiation - #[prost(message, repeated, tag = "10")] - pub funds: ::prost::alloc::vec::Vec, - /// Source is the URL where the code is hosted - #[prost(string, tag = "11")] - pub source: ::prost::alloc::string::String, - /// Builder is the docker image used to build the code deterministically, used - /// for smart contract verification - #[prost(string, tag = "12")] - pub builder: ::prost::alloc::string::String, - /// CodeHash is the SHA256 sum of the code outputted by builder, used for smart - /// contract verification - #[prost(bytes = "vec", tag = "13")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_hash: ::prost::alloc::vec::Vec, -} -/// QueryContractInfoRequest is the request type for the Query/ContractInfo 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 = "/cosmwasm.wasm.v1.QueryContractInfoRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/ContractInfo", - response_type = QueryContractInfoResponse -)] -pub struct QueryContractInfoRequest { - /// address is the address of the contract to query - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// QueryContractInfoResponse is the response type for the Query/ContractInfo 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 = "/cosmwasm.wasm.v1.QueryContractInfoResponse")] -pub struct QueryContractInfoResponse { - /// address is the address of the contract - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub contract_info: ::core::option::Option, -} -/// QueryContractHistoryRequest is the request type for the Query/ContractHistory -/// 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 = "/cosmwasm.wasm.v1.QueryContractHistoryRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/ContractHistory", - response_type = QueryContractHistoryResponse -)] -pub struct QueryContractHistoryRequest { - /// address is the address of the contract to query - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryContractHistoryResponse is the response type for the -/// Query/ContractHistory 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 = "/cosmwasm.wasm.v1.QueryContractHistoryResponse")] -pub struct QueryContractHistoryResponse { - #[prost(message, repeated, tag = "1")] - pub entries: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryContractsByCodeRequest is the request type for the Query/ContractsByCode -/// 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 = "/cosmwasm.wasm.v1.QueryContractsByCodeRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/ContractsByCode", - response_type = QueryContractsByCodeResponse -)] -pub struct QueryContractsByCodeRequest { - /// grpc-gateway_out does not support Go style CodID - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryContractsByCodeResponse is the response type for the -/// Query/ContractsByCode 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 = "/cosmwasm.wasm.v1.QueryContractsByCodeResponse")] -pub struct QueryContractsByCodeResponse { - /// contracts are a set of contract addresses - #[prost(string, repeated, tag = "1")] - pub contracts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryAllContractStateRequest is the request type for the -/// Query/AllContractState 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 = "/cosmwasm.wasm.v1.QueryAllContractStateRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/AllContractState", - response_type = QueryAllContractStateResponse -)] -pub struct QueryAllContractStateRequest { - /// address is the address of the contract - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryAllContractStateResponse is the response type for the -/// Query/AllContractState 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 = "/cosmwasm.wasm.v1.QueryAllContractStateResponse")] -pub struct QueryAllContractStateResponse { - #[prost(message, repeated, tag = "1")] - pub models: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryRawContractStateRequest is the request type for the -/// Query/RawContractState 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 = "/cosmwasm.wasm.v1.QueryRawContractStateRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/RawContractState", - response_type = QueryRawContractStateResponse -)] -pub struct QueryRawContractStateRequest { - /// address is the address of the contract - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub query_data: ::prost::alloc::vec::Vec, -} -/// QueryRawContractStateResponse is the response type for the -/// Query/RawContractState 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 = "/cosmwasm.wasm.v1.QueryRawContractStateResponse")] -pub struct QueryRawContractStateResponse { - /// Data contains the raw store data - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// QuerySmartContractStateRequest is the request type for the -/// Query/SmartContractState 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 = "/cosmwasm.wasm.v1.QuerySmartContractStateRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/SmartContractState", - response_type = QuerySmartContractStateResponse -)] -pub struct QuerySmartContractStateRequest { - /// address is the address of the contract - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// QueryData contains the query data passed to the contract - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub query_data: ::prost::alloc::vec::Vec, -} -/// QuerySmartContractStateResponse is the response type for the -/// Query/SmartContractState 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 = "/cosmwasm.wasm.v1.QuerySmartContractStateResponse")] -pub struct QuerySmartContractStateResponse { - /// Data contains the json data returned from the smart contract - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// QueryCodeRequest is the request type for the Query/Code 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 = "/cosmwasm.wasm.v1.QueryCodeRequest")] -#[proto_query(path = "/cosmwasm.wasm.v1.Query/Code", response_type = QueryCodeResponse)] -pub struct QueryCodeRequest { - /// grpc-gateway_out does not support Go style CodID - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, -} -/// CodeInfoResponse contains code meta data from CodeInfo -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/cosmwasm.wasm.v1.CodeInfoResponse")] -pub struct CodeInfoResponse { - /// id for legacy support - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - #[prost(string, tag = "2")] - pub creator: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data_hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "6")] - pub instantiate_permission: ::core::option::Option, -} -/// QueryCodeResponse is the response type for the Query/Code 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 = "/cosmwasm.wasm.v1.QueryCodeResponse")] -pub struct QueryCodeResponse { - #[prost(message, optional, tag = "1")] - pub code_info: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// QueryCodesRequest is the request type for the Query/Codes 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 = "/cosmwasm.wasm.v1.QueryCodesRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/Codes", - response_type = QueryCodesResponse -)] -pub struct QueryCodesRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: - ::core::option::Option, -} -/// QueryCodesResponse is the response type for the Query/Codes 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 = "/cosmwasm.wasm.v1.QueryCodesResponse")] -pub struct QueryCodesResponse { - #[prost(message, repeated, tag = "1")] - pub code_infos: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryPinnedCodesRequest is the request type for the Query/PinnedCodes -/// 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 = "/cosmwasm.wasm.v1.QueryPinnedCodesRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/PinnedCodes", - response_type = QueryPinnedCodesResponse -)] -pub struct QueryPinnedCodesRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryPinnedCodesResponse is the response type for the -/// Query/PinnedCodes 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 = "/cosmwasm.wasm.v1.QueryPinnedCodesResponse")] -pub struct QueryPinnedCodesResponse { - #[prost(uint64, repeated, packed = "false", tag = "1")] - #[serde(alias = "codeIDs")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub code_ids: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/cosmwasm.wasm.v1.QueryParamsRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/cosmwasm.wasm.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryContractsByCreatorRequest is the request type for the -/// Query/ContractsByCreator 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 = "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/ContractsByCreator", - response_type = QueryContractsByCreatorResponse -)] -pub struct QueryContractsByCreatorRequest { - /// CreatorAddress is the address of contract creator - #[prost(string, tag = "1")] - pub creator_address: ::prost::alloc::string::String, - /// Pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryContractsByCreatorResponse is the response type for the -/// Query/ContractsByCreator 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 = "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse")] -pub struct QueryContractsByCreatorResponse { - /// ContractAddresses result set - #[prost(string, repeated, tag = "1")] - pub contract_addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// QueryBuildAddressRequest is the request type for the Query/BuildAddress 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 = "/cosmwasm.wasm.v1.QueryBuildAddressRequest")] -#[proto_query( - path = "/cosmwasm.wasm.v1.Query/BuildAddress", - response_type = QueryBuildAddressResponse -)] -pub struct QueryBuildAddressRequest { - /// CodeHash is the hash of the code - #[prost(string, tag = "1")] - pub code_hash: ::prost::alloc::string::String, - /// CreatorAddress is the address of the contract instantiator - #[prost(string, tag = "2")] - pub creator_address: ::prost::alloc::string::String, - /// Salt is a hex encoded salt - #[prost(string, tag = "3")] - pub salt: ::prost::alloc::string::String, - /// InitArgs are optional json encoded init args to be used in contract address - /// building if provided - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub init_args: ::prost::alloc::vec::Vec, -} -/// QueryBuildAddressResponse is the response type for the Query/BuildAddress 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 = "/cosmwasm.wasm.v1.QueryBuildAddressResponse")] -pub struct QueryBuildAddressResponse { - /// Address is the contract address - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -pub struct WasmQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> WasmQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn contract_info( - &self, - address: ::prost::alloc::string::String, - ) -> Result { - QueryContractInfoRequest { address }.query(self.querier) - } - pub fn contract_history( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryContractHistoryRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn contracts_by_code( - &self, - code_id: u64, - pagination: ::core::option::Option< - super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryContractsByCodeRequest { - code_id, - pagination, - } - .query(self.querier) - } - pub fn all_contract_state( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryAllContractStateRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn raw_contract_state( - &self, - address: ::prost::alloc::string::String, - query_data: ::prost::alloc::vec::Vec, - ) -> Result { - QueryRawContractStateRequest { - address, - query_data, - } - .query(self.querier) - } - pub fn smart_contract_state( - &self, - address: ::prost::alloc::string::String, - query_data: ::prost::alloc::vec::Vec, - ) -> Result { - QuerySmartContractStateRequest { - address, - query_data, - } - .query(self.querier) - } - pub fn code(&self, code_id: u64) -> Result { - QueryCodeRequest { code_id }.query(self.querier) - } - pub fn codes( - &self, - pagination: ::core::option::Option< - super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryCodesRequest { pagination }.query(self.querier) - } - pub fn pinned_codes( - &self, - pagination: ::core::option::Option< - super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryPinnedCodesRequest { pagination }.query(self.querier) - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn contracts_by_creator( - &self, - creator_address: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryContractsByCreatorRequest { - creator_address, - pagination, - } - .query(self.querier) - } - pub fn build_address( - &self, - code_hash: ::prost::alloc::string::String, - creator_address: ::prost::alloc::string::String, - salt: ::prost::alloc::string::String, - init_args: ::prost::alloc::vec::Vec, - ) -> Result { - QueryBuildAddressRequest { - code_hash, - creator_address, - salt, - init_args, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/mod.rs b/packages/neutron-sdk/src/proto_types/feemarket/feemarket/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/mod.rs b/packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/v1.rs b/packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/v1.rs deleted file mode 100644 index a1f44e70..00000000 --- a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/module/v1.rs +++ /dev/null @@ -1,20 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the builder module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.module.v1.Module")] -pub struct Module { - /// Authority defines the custom module authority. If not set, defaults to the - /// governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/v1.rs b/packages/neutron-sdk/src/proto_types/feemarket/feemarket/v1.rs deleted file mode 100644 index b289f9b2..00000000 --- a/packages/neutron-sdk/src/proto_types/feemarket/feemarket/v1.rs +++ /dev/null @@ -1,347 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params contains the required set of parameters for the EIP1559 fee market -/// plugin implementation. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.v1.Params")] -pub struct Params { - /// Alpha is the amount we additively increase the learning rate - /// when it is above or below the target +/- threshold. - /// - /// Must be > 0. - #[prost(string, tag = "1")] - pub alpha: ::prost::alloc::string::String, - /// Beta is the amount we multiplicatively decrease the learning rate - /// when it is within the target +/- threshold. - /// - /// Must be [0, 1]. - #[prost(string, tag = "2")] - pub beta: ::prost::alloc::string::String, - /// Gamma is the threshold for the learning rate. If the learning rate is - /// above or below the target +/- threshold, we additively increase the - /// learning rate by Alpha. Otherwise, we multiplicatively decrease the - /// learning rate by Beta. - /// - /// Must be [0, 0.5]. - #[prost(string, tag = "3")] - pub gamma: ::prost::alloc::string::String, - /// Delta is the amount we additively increase/decrease the gas price when the - /// net block utilization difference in the window is above/below the target - /// utilization. - #[prost(string, tag = "4")] - pub delta: ::prost::alloc::string::String, - /// MinBaseGasPrice determines the initial gas price of the module and the - /// global minimum for the network. - #[prost(string, tag = "5")] - pub min_base_gas_price: ::prost::alloc::string::String, - /// MinLearningRate is the lower bound for the learning rate. - #[prost(string, tag = "6")] - pub min_learning_rate: ::prost::alloc::string::String, - /// MaxLearningRate is the upper bound for the learning rate. - #[prost(string, tag = "7")] - pub max_learning_rate: ::prost::alloc::string::String, - /// MaxBlockUtilization is the maximum block utilization. - #[prost(uint64, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_block_utilization: u64, - /// Window defines the window size for calculating an adaptive learning rate - /// over a moving window of blocks. - #[prost(uint64, tag = "9")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub window: u64, - /// FeeDenom is the denom that will be used for all fee payments. - #[prost(string, tag = "10")] - pub fee_denom: ::prost::alloc::string::String, - /// Enabled is a boolean that determines whether the EIP1559 fee market is - /// enabled. - #[prost(bool, tag = "11")] - pub enabled: bool, - /// DistributeFees is a boolean that determines whether the fees are burned or - /// distributed to all stakers. - #[prost(bool, tag = "12")] - pub distribute_fees: bool, -} -/// GenesisState defines the feemarket module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.v1.GenesisState")] -pub struct GenesisState { - /// Params are the parameters for the feemarket module. These parameters - /// can be utilized to implement both the base EIP-1559 fee market and - /// and the AIMD EIP-1559 fee market. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// State contains the current state of the AIMD fee market. - #[prost(message, optional, tag = "2")] - pub state: ::core::option::Option, -} -/// State is utilized to track the current state of the fee market. This includes -/// the current base fee, learning rate, and block utilization within the -/// specified AIMD window. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.v1.State")] -pub struct State { - /// BaseGasPrice is the current base fee. This is denominated in the fee per - /// gas unit. - #[prost(string, tag = "1")] - pub base_gas_price: ::prost::alloc::string::String, - /// LearningRate is the current learning rate. - #[prost(string, tag = "2")] - pub learning_rate: ::prost::alloc::string::String, - /// Window contains a list of the last blocks' utilization values. This is used - /// to calculate the next base fee. This stores the number of units of gas - /// consumed per block. - #[prost(uint64, repeated, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub window: ::prost::alloc::vec::Vec, - /// Index is the index of the current block in the block utilization window. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u64, -} -/// ParamsRequest is the request type for the Query/Params 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 = "/feemarket.feemarket.v1.ParamsRequest")] -#[proto_query( - path = "/feemarket.feemarket.v1.Query/Params", - response_type = ParamsResponse -)] -pub struct ParamsRequest {} -/// ParamsResponse is the response type for the Query/Params 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 = "/feemarket.feemarket.v1.ParamsResponse")] -pub struct ParamsResponse { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// StateRequest is the request type for the Query/State 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 = "/feemarket.feemarket.v1.StateRequest")] -#[proto_query( - path = "/feemarket.feemarket.v1.Query/State", - response_type = StateResponse -)] -pub struct StateRequest {} -/// StateResponse is the response type for the Query/State 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 = "/feemarket.feemarket.v1.StateResponse")] -pub struct StateResponse { - #[prost(message, optional, tag = "1")] - pub state: ::core::option::Option, -} -/// GasPriceRequest is the request type for the Query/GasPrice 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 = "/feemarket.feemarket.v1.GasPriceRequest")] -#[proto_query( - path = "/feemarket.feemarket.v1.Query/GasPrice", - response_type = GasPriceResponse -)] -pub struct GasPriceRequest { - /// denom we are querying gas price in - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, -} -/// GasPriceResponse is the response type for the Query/GasPrice RPC method. -/// Returns a gas price in specified denom. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.v1.GasPriceResponse")] -pub struct GasPriceResponse { - #[prost(message, optional, tag = "1")] - pub price: ::core::option::Option, -} -/// GasPriceRequest is the request type for the Query/GasPrices 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 = "/feemarket.feemarket.v1.GasPricesRequest")] -#[proto_query( - path = "/feemarket.feemarket.v1.Query/GasPrices", - response_type = GasPricesResponse -)] -pub struct GasPricesRequest {} -/// GasPricesResponse is the response type for the Query/GasPrices RPC method. -/// Returns a gas price in all available denoms. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.v1.GasPricesResponse")] -pub struct GasPricesResponse { - #[prost(message, repeated, tag = "1")] - pub prices: ::prost::alloc::vec::Vec, -} -/// MsgParams defines the Msg/Params request type. It contains the -/// new parameters for the feemarket module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/feemarket.feemarket.v1.MsgParams")] -pub struct MsgParams { - /// Params defines the new parameters for the feemarket module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// Authority defines the authority that is updating the feemarket module - /// parameters. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} -/// MsgParamsResponse defines the Msg/Params response 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 = "/feemarket.feemarket.v1.MsgParamsResponse")] -pub struct MsgParamsResponse {} -pub struct FeemarketQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> FeemarketQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - ParamsRequest {}.query(self.querier) - } - pub fn state(&self) -> Result { - StateRequest {}.query(self.querier) - } - pub fn gas_price( - &self, - denom: ::prost::alloc::string::String, - ) -> Result { - GasPriceRequest { denom }.query(self.querier) - } - pub fn gas_prices(&self) -> Result { - GasPricesRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/feemarket/mod.rs b/packages/neutron-sdk/src/proto_types/feemarket/mod.rs deleted file mode 100644 index 262ae30a..00000000 --- a/packages/neutron-sdk/src/proto_types/feemarket/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod feemarket; diff --git a/packages/neutron-sdk/src/proto_types/gaia/globalfee/mod.rs b/packages/neutron-sdk/src/proto_types/gaia/globalfee/mod.rs deleted file mode 100644 index 9f64fc82..00000000 --- a/packages/neutron-sdk/src/proto_types/gaia/globalfee/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1beta1; diff --git a/packages/neutron-sdk/src/proto_types/gaia/globalfee/v1beta1.rs b/packages/neutron-sdk/src/proto_types/gaia/globalfee/v1beta1.rs deleted file mode 100644 index ea843ba7..00000000 --- a/packages/neutron-sdk/src/proto_types/gaia/globalfee/v1beta1.rs +++ /dev/null @@ -1,145 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the set of module parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/gaia.globalfee.v1beta1.Params")] -pub struct Params { - /// minimum_gas_prices stores the minimum gas price(s) for all TX on the chain. - /// When multiple coins are defined then they are accepted alternatively. - /// The list must be sorted by denoms asc. No duplicate denoms or zero amount - /// values allowed. For more information see - /// - #[prost(message, repeated, tag = "1")] - pub minimum_gas_prices: - ::prost::alloc::vec::Vec, - /// bypass_min_fee_msg_types defines a list of message type urls - /// that are free of fee charge. - #[prost(string, repeated, tag = "2")] - pub bypass_min_fee_msg_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// max_total_bypass_min_fee_msg_gas_usage defines the total maximum gas usage - /// allowed for a transaction containing only messages of types in bypass_min_fee_msg_types - /// to bypass fee charge. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_total_bypass_min_fee_msg_gas_usage: u64, -} -/// GenesisState - initial state of module -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/gaia.globalfee.v1beta1.GenesisState")] -pub struct GenesisState { - /// Params of this module - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryMinimumGasPricesRequest is the request type for the -/// Query/MinimumGasPrices 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 = "/gaia.globalfee.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/gaia.globalfee.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryMinimumGasPricesResponse is the response type for the -/// Query/MinimumGasPrices 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 = "/gaia.globalfee.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/gaia.globalfee.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/globalfee parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/gaia.globalfee.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct GlobalfeeQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> GlobalfeeQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/gaia/mod.rs b/packages/neutron-sdk/src/proto_types/gaia/mod.rs deleted file mode 100644 index 60178878..00000000 --- a/packages/neutron-sdk/src/proto_types/gaia/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod globalfee; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/fee/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/fee/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/fee/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/fee/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/fee/v1.rs deleted file mode 100644 index ec506386..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/fee/v1.rs +++ /dev/null @@ -1,1025 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.IncentivizedAcknowledgement")] -pub struct IncentivizedAcknowledgement { - /// the underlying app acknowledgement bytes - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_acknowledgement: ::prost::alloc::vec::Vec, - /// the relayer address which submits the recv packet message - #[prost(string, tag = "2")] - pub forward_relayer_address: ::prost::alloc::string::String, - /// success flag of the base application callback - #[prost(bool, tag = "3")] - pub underlying_app_success: bool, -} -/// Fee defines the ICS29 receive, acknowledgement and timeout fees -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.Fee")] -pub struct Fee { - /// the packet receive fee - #[prost(message, repeated, tag = "1")] - pub recv_fee: ::prost::alloc::vec::Vec, - /// the packet acknowledgement fee - #[prost(message, repeated, tag = "2")] - pub ack_fee: ::prost::alloc::vec::Vec, - /// the packet timeout fee - #[prost(message, repeated, tag = "3")] - pub timeout_fee: - ::prost::alloc::vec::Vec, -} -/// PacketFee contains ICS29 relayer fees, refund address and optional list of permitted relayers -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.PacketFee")] -pub struct PacketFee { - /// fee encapsulates the recv, ack and timeout fees associated with an IBC packet - #[prost(message, optional, tag = "1")] - pub fee: ::core::option::Option, - /// the refund address for unspent fees - #[prost(string, tag = "2")] - pub refund_address: ::prost::alloc::string::String, - /// optional list of relayers permitted to receive fees - #[prost(string, repeated, tag = "3")] - pub relayers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// PacketFees contains a list of type PacketFee -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.PacketFees")] -pub struct PacketFees { - /// list of packet fees - #[prost(message, repeated, tag = "1")] - pub packet_fees: ::prost::alloc::vec::Vec, -} -/// IdentifiedPacketFees contains a list of type PacketFee and associated PacketId -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.IdentifiedPacketFees")] -pub struct IdentifiedPacketFees { - /// unique packet identifier comprised of the channel ID, port ID and sequence - #[prost(message, optional, tag = "1")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, - /// list of packet fees - #[prost(message, repeated, tag = "2")] - pub packet_fees: ::prost::alloc::vec::Vec, -} -/// GenesisState defines the ICS29 fee middleware genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.GenesisState")] -pub struct GenesisState { - /// list of identified packet fees - #[prost(message, repeated, tag = "1")] - pub identified_fees: ::prost::alloc::vec::Vec, - /// list of fee enabled channels - #[prost(message, repeated, tag = "2")] - pub fee_enabled_channels: ::prost::alloc::vec::Vec, - /// list of registered payees - #[prost(message, repeated, tag = "3")] - pub registered_payees: ::prost::alloc::vec::Vec, - /// list of registered counterparty payees - #[prost(message, repeated, tag = "4")] - pub registered_counterparty_payees: ::prost::alloc::vec::Vec, - /// list of forward relayer addresses - #[prost(message, repeated, tag = "5")] - pub forward_relayers: ::prost::alloc::vec::Vec, -} -/// FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.FeeEnabledChannel")] -pub struct FeeEnabledChannel { - /// unique port identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// unique channel identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// RegisteredPayee contains the relayer address and payee address for a specific channel -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.RegisteredPayee")] -pub struct RegisteredPayee { - /// unique channel identifier - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// the relayer address - #[prost(string, tag = "2")] - pub relayer: ::prost::alloc::string::String, - /// the payee address - #[prost(string, tag = "3")] - pub payee: ::prost::alloc::string::String, -} -/// RegisteredCounterpartyPayee contains the relayer address and counterparty payee address for a specific channel (used -/// for recv fee distribution) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.RegisteredCounterpartyPayee")] -pub struct RegisteredCounterpartyPayee { - /// unique channel identifier - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// the relayer address - #[prost(string, tag = "2")] - pub relayer: ::prost::alloc::string::String, - /// the counterparty payee address - #[prost(string, tag = "3")] - pub counterparty_payee: ::prost::alloc::string::String, -} -/// ForwardRelayerAddress contains the forward relayer address and PacketId used for async acknowledgements -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.ForwardRelayerAddress")] -pub struct ForwardRelayerAddress { - /// the forward relayer address - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// unique packet identifer comprised of the channel ID, port ID and sequence - #[prost(message, optional, tag = "2")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, -} -/// Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring -/// See ICS004: -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.Metadata")] -pub struct Metadata { - /// fee_version defines the ICS29 fee version - #[prost(string, tag = "1")] - pub fee_version: ::prost::alloc::string::String, - /// app_version defines the underlying application version, which may or may not be a JSON encoded bytestring - #[prost(string, tag = "2")] - pub app_version: ::prost::alloc::string::String, -} -/// QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryIncentivizedPacketsRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/IncentivizedPackets", - response_type = QueryIncentivizedPacketsResponse -)] -pub struct QueryIncentivizedPacketsRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - /// block height at which to query - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_height: u64, -} -/// QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPackets rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryIncentivizedPacketsResponse")] -pub struct QueryIncentivizedPacketsResponse { - /// list of identified fees for incentivized packets - #[prost(message, repeated, tag = "1")] - pub incentivized_packets: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryIncentivizedPacketRequest defines the request type for the IncentivizedPacket rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryIncentivizedPacketRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/IncentivizedPacket", - response_type = QueryIncentivizedPacketResponse -)] -pub struct QueryIncentivizedPacketRequest { - /// unique packet identifier comprised of channel ID, port ID and sequence - #[prost(message, optional, tag = "1")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, - /// block height at which to query - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_height: u64, -} -/// QueryIncentivizedPacketsResponse defines the response type for the IncentivizedPacket rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryIncentivizedPacketResponse")] -pub struct QueryIncentivizedPacketResponse { - /// the identified fees for the incentivized packet - #[prost(message, optional, tag = "1")] - pub incentivized_packet: ::core::option::Option, -} -/// QueryIncentivizedPacketsForChannelRequest defines the request type for querying for all incentivized packets -/// for a specific channel -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/IncentivizedPacketsForChannel", - response_type = QueryIncentivizedPacketsForChannelResponse -)] -pub struct QueryIncentivizedPacketsForChannelRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// Height to query at - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_height: u64, -} -/// QueryIncentivizedPacketsResponse defines the response type for the incentivized packets RPC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse")] -pub struct QueryIncentivizedPacketsForChannelResponse { - /// Map of all incentivized_packets - #[prost(message, repeated, tag = "1")] - pub incentivized_packets: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryTotalRecvFeesRequest defines the request type for the TotalRecvFees rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryTotalRecvFeesRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/TotalRecvFees", - response_type = QueryTotalRecvFeesResponse -)] -pub struct QueryTotalRecvFeesRequest { - /// the packet identifier for the associated fees - #[prost(message, optional, tag = "1")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, -} -/// QueryTotalRecvFeesResponse defines the response type for the TotalRecvFees rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryTotalRecvFeesResponse")] -pub struct QueryTotalRecvFeesResponse { - /// the total packet receive fees - #[prost(message, repeated, tag = "1")] - pub recv_fees: - ::prost::alloc::vec::Vec, -} -/// QueryTotalAckFeesRequest defines the request type for the TotalAckFees rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryTotalAckFeesRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/TotalAckFees", - response_type = QueryTotalAckFeesResponse -)] -pub struct QueryTotalAckFeesRequest { - /// the packet identifier for the associated fees - #[prost(message, optional, tag = "1")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, -} -/// QueryTotalAckFeesResponse defines the response type for the TotalAckFees rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryTotalAckFeesResponse")] -pub struct QueryTotalAckFeesResponse { - /// the total packet acknowledgement fees - #[prost(message, repeated, tag = "1")] - pub ack_fees: ::prost::alloc::vec::Vec, -} -/// QueryTotalTimeoutFeesRequest defines the request type for the TotalTimeoutFees rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/TotalTimeoutFees", - response_type = QueryTotalTimeoutFeesResponse -)] -pub struct QueryTotalTimeoutFeesRequest { - /// the packet identifier for the associated fees - #[prost(message, optional, tag = "1")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, -} -/// QueryTotalTimeoutFeesResponse defines the response type for the TotalTimeoutFees rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse")] -pub struct QueryTotalTimeoutFeesResponse { - /// the total packet timeout fees - #[prost(message, repeated, tag = "1")] - pub timeout_fees: - ::prost::alloc::vec::Vec, -} -/// QueryPayeeRequest defines the request type for the Payee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryPayeeRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/Payee", - response_type = QueryPayeeResponse -)] -pub struct QueryPayeeRequest { - /// unique channel identifier - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// the relayer address to which the distribution address is registered - #[prost(string, tag = "2")] - pub relayer: ::prost::alloc::string::String, -} -/// QueryPayeeResponse defines the response type for the Payee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryPayeeResponse")] -pub struct QueryPayeeResponse { - /// the payee address to which packet fees are paid out - #[prost(string, tag = "1")] - pub payee_address: ::prost::alloc::string::String, -} -/// QueryCounterpartyPayeeRequest defines the request type for the CounterpartyPayee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryCounterpartyPayeeRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/CounterpartyPayee", - response_type = QueryCounterpartyPayeeResponse -)] -pub struct QueryCounterpartyPayeeRequest { - /// unique channel identifier - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// the relayer address to which the counterparty is registered - #[prost(string, tag = "2")] - pub relayer: ::prost::alloc::string::String, -} -/// QueryCounterpartyPayeeResponse defines the response type for the CounterpartyPayee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryCounterpartyPayeeResponse")] -pub struct QueryCounterpartyPayeeResponse { - /// the counterparty payee address used to compensate forward relaying - #[prost(string, tag = "1")] - pub counterparty_payee: ::prost::alloc::string::String, -} -/// QueryFeeEnabledChannelsRequest defines the request type for the FeeEnabledChannels rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryFeeEnabledChannelsRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/FeeEnabledChannels", - response_type = QueryFeeEnabledChannelsResponse -)] -pub struct QueryFeeEnabledChannelsRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - /// block height at which to query - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_height: u64, -} -/// QueryFeeEnabledChannelsResponse defines the response type for the FeeEnabledChannels rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryFeeEnabledChannelsResponse")] -pub struct QueryFeeEnabledChannelsResponse { - /// list of fee enabled channels - #[prost(message, repeated, tag = "1")] - pub fee_enabled_channels: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryFeeEnabledChannelRequest defines the request type for the FeeEnabledChannel rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryFeeEnabledChannelRequest")] -#[proto_query( - path = "/ibc.applications.fee.v1.Query/FeeEnabledChannel", - response_type = QueryFeeEnabledChannelResponse -)] -pub struct QueryFeeEnabledChannelRequest { - /// unique port identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// unique channel identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryFeeEnabledChannelResponse defines the response type for the FeeEnabledChannel rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.QueryFeeEnabledChannelResponse")] -pub struct QueryFeeEnabledChannelResponse { - /// boolean flag representing the fee enabled channel status - #[prost(bool, tag = "1")] - pub fee_enabled: bool, -} -/// MsgRegisterPayee defines the request type for the RegisterPayee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgRegisterPayee")] -pub struct MsgRegisterPayee { - /// unique port identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// unique channel identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// the relayer address - #[prost(string, tag = "3")] - pub relayer: ::prost::alloc::string::String, - /// the payee address - #[prost(string, tag = "4")] - pub payee: ::prost::alloc::string::String, -} -/// MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgRegisterPayeeResponse")] -pub struct MsgRegisterPayeeResponse {} -/// MsgRegisterCounterpartyPayee defines the request type for the RegisterCounterpartyPayee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee")] -pub struct MsgRegisterCounterpartyPayee { - /// unique port identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// unique channel identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// the relayer address - #[prost(string, tag = "3")] - pub relayer: ::prost::alloc::string::String, - /// the counterparty payee address - #[prost(string, tag = "4")] - pub counterparty_payee: ::prost::alloc::string::String, -} -/// MsgRegisterCounterpartyPayeeResponse defines the response type for the RegisterCounterpartyPayee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgRegisterCounterpartyPayeeResponse")] -pub struct MsgRegisterCounterpartyPayeeResponse {} -/// MsgPayPacketFee defines the request type for the PayPacketFee rpc -/// This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be -/// paid for -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgPayPacketFee")] -pub struct MsgPayPacketFee { - /// fee encapsulates the recv, ack and timeout fees associated with an IBC packet - #[prost(message, optional, tag = "1")] - pub fee: ::core::option::Option, - /// the source port unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "source_portID")] - pub source_port_id: ::prost::alloc::string::String, - /// the source channel unique identifer - #[prost(string, tag = "3")] - #[serde(alias = "source_channelID")] - pub source_channel_id: ::prost::alloc::string::String, - /// account address to refund fee if necessary - #[prost(string, tag = "4")] - pub signer: ::prost::alloc::string::String, - /// optional list of relayers permitted to the receive packet fees - #[prost(string, repeated, tag = "5")] - pub relayers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MsgPayPacketFeeResponse defines the response type for the PayPacketFee rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgPayPacketFeeResponse")] -pub struct MsgPayPacketFeeResponse {} -/// MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync rpc -/// This Msg can be used to pay for a packet at a specified sequence (instead of the next sequence send) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgPayPacketFeeAsync")] -pub struct MsgPayPacketFeeAsync { - /// unique packet identifier comprised of the channel ID, port ID and sequence - #[prost(message, optional, tag = "1")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, - /// the packet fee associated with a particular IBC packet - #[prost(message, optional, tag = "2")] - pub packet_fee: ::core::option::Option, -} -/// MsgPayPacketFeeAsyncResponse defines the response type for the PayPacketFeeAsync rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse")] -pub struct MsgPayPacketFeeAsyncResponse {} -pub struct FeeQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> FeeQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn incentivized_packets( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - query_height: u64, - ) -> Result { - QueryIncentivizedPacketsRequest { - pagination, - query_height, - } - .query(self.querier) - } - pub fn incentivized_packet( - &self, - packet_id: ::core::option::Option, - query_height: u64, - ) -> Result { - QueryIncentivizedPacketRequest { - packet_id, - query_height, - } - .query(self.querier) - } - pub fn incentivized_packets_for_channel( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - query_height: u64, - ) -> Result { - QueryIncentivizedPacketsForChannelRequest { - pagination, - port_id, - channel_id, - query_height, - } - .query(self.querier) - } - pub fn total_recv_fees( - &self, - packet_id: ::core::option::Option, - ) -> Result { - QueryTotalRecvFeesRequest { packet_id }.query(self.querier) - } - pub fn total_ack_fees( - &self, - packet_id: ::core::option::Option, - ) -> Result { - QueryTotalAckFeesRequest { packet_id }.query(self.querier) - } - pub fn total_timeout_fees( - &self, - packet_id: ::core::option::Option, - ) -> Result { - QueryTotalTimeoutFeesRequest { packet_id }.query(self.querier) - } - pub fn payee( - &self, - channel_id: ::prost::alloc::string::String, - relayer: ::prost::alloc::string::String, - ) -> Result { - QueryPayeeRequest { - channel_id, - relayer, - } - .query(self.querier) - } - pub fn counterparty_payee( - &self, - channel_id: ::prost::alloc::string::String, - relayer: ::prost::alloc::string::String, - ) -> Result { - QueryCounterpartyPayeeRequest { - channel_id, - relayer, - } - .query(self.querier) - } - pub fn fee_enabled_channels( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - query_height: u64, - ) -> Result { - QueryFeeEnabledChannelsRequest { - pagination, - query_height, - } - .query(self.querier) - } - pub fn fee_enabled_channel( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryFeeEnabledChannelRequest { - port_id, - channel_id, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/v1.rs deleted file mode 100644 index 43edd0cc..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/controller/v1.rs +++ /dev/null @@ -1,273 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the set of on-chain interchain accounts parameters. -/// The following parameters may be used to disable the controller submodule. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.controller.v1.Params")] -pub struct Params { - /// controller_enabled enables or disables the controller submodule. - #[prost(bool, tag = "1")] - pub controller_enabled: bool, -} -/// QueryInterchainAccountRequest is the request type for the Query/InterchainAccount 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 = "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountRequest" -)] -#[proto_query( - path = "/ibc.applications.interchain_accounts.controller.v1.Query/InterchainAccount", - response_type = QueryInterchainAccountResponse -)] -pub struct QueryInterchainAccountRequest { - #[prost(string, tag = "1")] - pub owner: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, -} -/// QueryInterchainAccountResponse the response type for the Query/InterchainAccount 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 = "/ibc.applications.interchain_accounts.controller.v1.QueryInterchainAccountResponse" -)] -pub struct QueryInterchainAccountResponse { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/ibc.applications.interchain_accounts.controller.v1.QueryParamsRequest" -)] -#[proto_query( - path = "/ibc.applications.interchain_accounts.controller.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/ibc.applications.interchain_accounts.controller.v1.QueryParamsResponse" -)] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message( - type_url = "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount" -)] -pub struct MsgRegisterInterchainAccount { - #[prost(string, tag = "1")] - pub owner: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub version: ::prost::alloc::string::String, - #[prost( - enumeration = "super::super::super::super::core::channel::v1::Order", - tag = "4" - )] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub ordering: i32, -} -/// MsgRegisterInterchainAccountResponse defines the response for Msg/RegisterAccount -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message( - type_url = "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccountResponse" -)] -pub struct MsgRegisterInterchainAccountResponse { - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, -} -/// MsgSendTx defines the payload for Msg/SendTx -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx")] -pub struct MsgSendTx { - #[prost(string, tag = "1")] - pub owner: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub packet_data: ::core::option::Option, - /// Relative timeout timestamp provided will be added to the current block time during transaction execution. - /// The timeout timestamp must be non-zero. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub relative_timeout: u64, -} -/// MsgSendTxResponse defines the response for MsgSendTx -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.controller.v1.MsgSendTxResponse")] -pub struct MsgSendTxResponse { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// MsgUpdateParams defines the payload for Msg/UpdateParams -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// params defines the 27-interchain-accounts/controller parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response for Msg/UpdateParams -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message( - type_url = "/ibc.applications.interchain_accounts.controller.v1.MsgUpdateParamsResponse" -)] -pub struct MsgUpdateParamsResponse {} -pub struct ControllerQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ControllerQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn interchain_account( - &self, - owner: ::prost::alloc::string::String, - connection_id: ::prost::alloc::string::String, - ) -> Result { - QueryInterchainAccountRequest { - owner, - connection_id, - } - .query(self.querier) - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/v1.rs deleted file mode 100644 index e7413b33..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/genesis/v1.rs +++ /dev/null @@ -1,120 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenesisState defines the interchain accounts genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.genesis.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub controller_genesis_state: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub host_genesis_state: ::core::option::Option, -} -/// ControllerGenesisState defines the interchain accounts controller genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message( - type_url = "/ibc.applications.interchain_accounts.genesis.v1.ControllerGenesisState" -)] -pub struct ControllerGenesisState { - #[prost(message, repeated, tag = "1")] - pub active_channels: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub interchain_accounts: ::prost::alloc::vec::Vec, - #[prost(string, repeated, tag = "3")] - pub ports: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, optional, tag = "4")] - pub params: ::core::option::Option, -} -/// HostGenesisState defines the interchain accounts host genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.genesis.v1.HostGenesisState")] -pub struct HostGenesisState { - #[prost(message, repeated, tag = "1")] - pub active_channels: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub interchain_accounts: ::prost::alloc::vec::Vec, - #[prost(string, tag = "3")] - pub port: ::prost::alloc::string::String, - #[prost(message, optional, tag = "4")] - pub params: ::core::option::Option, -} -/// ActiveChannel contains a connection ID, port ID and associated active channel ID, as well as a boolean flag to -/// indicate if the channel is middleware enabled -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.genesis.v1.ActiveChannel")] -pub struct ActiveChannel { - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(bool, tag = "4")] - pub is_middleware_enabled: bool, -} -/// RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message( - type_url = "/ibc.applications.interchain_accounts.genesis.v1.RegisteredInterchainAccount" -)] -pub struct RegisteredInterchainAccount { - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub account_address: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/v1.rs deleted file mode 100644 index 1536cc63..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/host/v1.rs +++ /dev/null @@ -1,107 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the set of on-chain interchain accounts parameters. -/// The following parameters may be used to disable the host submodule. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.host.v1.Params")] -pub struct Params { - /// host_enabled enables or disables the host submodule. - #[prost(bool, tag = "1")] - pub host_enabled: bool, - /// allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. - #[prost(string, repeated, tag = "2")] - pub allow_messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/ibc.applications.interchain_accounts.host.v1.QueryParamsRequest")] -#[proto_query( - path = "/ibc.applications.interchain_accounts.host.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/ibc.applications.interchain_accounts.host.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgUpdateParams defines the payload for Msg/UpdateParams -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// params defines the 27-interchain-accounts/host parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response for Msg/UpdateParams -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct HostQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> HostQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/mod.rs deleted file mode 100644 index c91312e3..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod controller; -pub mod genesis; -pub mod host; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/v1.rs deleted file mode 100644 index 84d70c33..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/interchain_accounts/v1.rs +++ /dev/null @@ -1,135 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.v1.InterchainAccountPacketData")] -pub struct InterchainAccountPacketData { - #[prost(enumeration = "Type", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(string, tag = "3")] - pub memo: ::prost::alloc::string::String, -} -/// CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.v1.CosmosTx")] -pub struct CosmosTx { - #[prost(message, repeated, tag = "1")] - pub messages: ::prost::alloc::vec::Vec, -} -/// Type defines a classification of message issued from a controller chain to its associated interchain accounts -/// host -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum Type { - /// Default zero value enumeration - Unspecified = 0, - /// Execute a transaction on an interchain accounts host chain - ExecuteTx = 1, -} -impl Type { - /// 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 { - Type::Unspecified => "TYPE_UNSPECIFIED", - Type::ExecuteTx => "TYPE_EXECUTE_TX", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "TYPE_EXECUTE_TX" => Some(Self::ExecuteTx), - _ => None, - } - } -} -/// An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.v1.InterchainAccount")] -pub struct InterchainAccount { - #[prost(message, optional, tag = "1")] - pub base_account: - ::core::option::Option, - #[prost(string, tag = "2")] - pub account_owner: ::prost::alloc::string::String, -} -/// Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring -/// See ICS004: -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.interchain_accounts.v1.Metadata")] -pub struct Metadata { - /// version defines the ICS27 protocol version - #[prost(string, tag = "1")] - pub version: ::prost::alloc::string::String, - /// controller_connection_id is the connection identifier associated with the controller chain - #[prost(string, tag = "2")] - #[serde(alias = "controller_connectionID")] - pub controller_connection_id: ::prost::alloc::string::String, - /// host_connection_id is the connection identifier associated with the host chain - #[prost(string, tag = "3")] - #[serde(alias = "host_connectionID")] - pub host_connection_id: ::prost::alloc::string::String, - /// address defines the interchain account address to be fulfilled upon the OnChanOpenTry handshake step - /// NOTE: the address field is empty on the OnChanOpenInit handshake step - #[prost(string, tag = "4")] - pub address: ::prost::alloc::string::String, - /// encoding defines the supported codec format - #[prost(string, tag = "5")] - pub encoding: ::prost::alloc::string::String, - /// tx_type defines the type of transactions the interchain account can execute - #[prost(string, tag = "6")] - pub tx_type: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/mod.rs deleted file mode 100644 index a56db2d8..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod fee; -pub mod interchain_accounts; -pub mod transfer; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/mod.rs deleted file mode 100644 index ae6adc7c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod v1; -pub mod v2; diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v1.rs deleted file mode 100644 index e9936655..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v1.rs +++ /dev/null @@ -1,535 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Allocation defines the spend limit for a particular port and channel -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v1.Allocation")] -pub struct Allocation { - /// the port on which the packet will be sent - #[prost(string, tag = "1")] - pub source_port: ::prost::alloc::string::String, - /// the channel by which the packet will be sent - #[prost(string, tag = "2")] - pub source_channel: ::prost::alloc::string::String, - /// spend limitation on the channel - #[prost(message, repeated, tag = "3")] - pub spend_limit: - ::prost::alloc::vec::Vec, - /// allow list of receivers, an empty allow list permits any receiver address - #[prost(string, repeated, tag = "4")] - pub allow_list: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// allow list of packet data keys, an empty list prohibits all packet data keys; - /// a list only with "*" permits any packet data key - #[prost(string, repeated, tag = "5")] - pub allowed_packet_data: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// TransferAuthorization allows the grantee to spend up to spend_limit coins from -/// the granter's account for ibc transfer on a specific channel -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v1.TransferAuthorization")] -pub struct TransferAuthorization { - /// port and channel amounts - #[prost(message, repeated, tag = "1")] - pub allocations: ::prost::alloc::vec::Vec, -} -/// DenomTrace contains the base denomination for ICS20 fungible tokens and the -/// source tracing information path. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v1.DenomTrace")] -pub struct DenomTrace { - /// path defines the chain of port/channel identifiers used for tracing the - /// source of the fungible token. - #[prost(string, tag = "1")] - pub path: ::prost::alloc::string::String, - /// base denomination of the relayed fungible token. - #[prost(string, tag = "2")] - pub base_denom: ::prost::alloc::string::String, -} -/// Params defines the set of IBC transfer parameters. -/// NOTE: To prevent a single token from being transferred, set the -/// TransfersEnabled parameter to true and then set the bank module's SendEnabled -/// parameter for the denomination to false. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v1.Params")] -pub struct Params { - /// send_enabled enables or disables all cross-chain token transfers from this - /// chain. - #[prost(bool, tag = "1")] - pub send_enabled: bool, - /// receive_enabled enables or disables all cross-chain token transfers to this - /// chain. - #[prost(bool, tag = "2")] - pub receive_enabled: bool, -} -/// GenesisState defines the ibc-transfer genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v1.GenesisState")] -pub struct GenesisState { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub denom_traces: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub params: ::core::option::Option, - /// total_escrowed contains the total amount of tokens escrowed - /// by the transfer module - #[prost(message, repeated, tag = "4")] - pub total_escrowed: - ::prost::alloc::vec::Vec, -} -/// QueryDenomTraceRequest is the request type for the Query/DenomTrace 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 = "/ibc.applications.transfer.v1.QueryDenomTraceRequest")] -#[proto_query( - path = "/ibc.applications.transfer.v1.Query/DenomTrace", - response_type = QueryDenomTraceResponse -)] -pub struct QueryDenomTraceRequest { - /// hash (in hex format) or denom (full denom with ibc prefix) of the denomination trace information. - #[prost(string, tag = "1")] - pub hash: ::prost::alloc::string::String, -} -/// QueryDenomTraceResponse is the response type for the Query/DenomTrace 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 = "/ibc.applications.transfer.v1.QueryDenomTraceResponse")] -pub struct QueryDenomTraceResponse { - /// denom_trace returns the requested denomination trace information. - #[prost(message, optional, tag = "1")] - pub denom_trace: ::core::option::Option, -} -/// QueryConnectionsRequest is the request type for the Query/DenomTraces 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 = "/ibc.applications.transfer.v1.QueryDenomTracesRequest")] -#[proto_query( - path = "/ibc.applications.transfer.v1.Query/DenomTraces", - response_type = QueryDenomTracesResponse -)] -pub struct QueryDenomTracesRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryConnectionsResponse is the response type for the Query/DenomTraces 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 = "/ibc.applications.transfer.v1.QueryDenomTracesResponse")] -pub struct QueryDenomTracesResponse { - /// denom_traces returns all denominations trace information. - #[prost(message, repeated, tag = "1")] - pub denom_traces: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/ibc.applications.transfer.v1.QueryParamsRequest")] -#[proto_query( - path = "/ibc.applications.transfer.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/ibc.applications.transfer.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryDenomHashRequest is the request type for the Query/DenomHash 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 = "/ibc.applications.transfer.v1.QueryDenomHashRequest")] -#[proto_query( - path = "/ibc.applications.transfer.v1.Query/DenomHash", - response_type = QueryDenomHashResponse -)] -pub struct QueryDenomHashRequest { - /// The denomination trace (\[port_id]/[channel_id])+/[denom\] - #[prost(string, tag = "1")] - pub trace: ::prost::alloc::string::String, -} -/// QueryDenomHashResponse is the response type for the Query/DenomHash 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 = "/ibc.applications.transfer.v1.QueryDenomHashResponse")] -pub struct QueryDenomHashResponse { - /// hash (in hex format) of the denomination trace information. - #[prost(string, tag = "1")] - pub hash: ::prost::alloc::string::String, -} -/// QueryEscrowAddressRequest is the request type for the EscrowAddress 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 = "/ibc.applications.transfer.v1.QueryEscrowAddressRequest")] -#[proto_query( - path = "/ibc.applications.transfer.v1.Query/EscrowAddress", - response_type = QueryEscrowAddressResponse -)] -pub struct QueryEscrowAddressRequest { - /// unique port identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// unique channel identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryEscrowAddressResponse is the response type of the EscrowAddress 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 = "/ibc.applications.transfer.v1.QueryEscrowAddressResponse")] -pub struct QueryEscrowAddressResponse { - /// the escrow account address - #[prost(string, tag = "1")] - pub escrow_address: ::prost::alloc::string::String, -} -/// QueryTotalEscrowForDenomRequest is the request type for TotalEscrowForDenom 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 = "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomRequest")] -#[proto_query( - path = "/ibc.applications.transfer.v1.Query/TotalEscrowForDenom", - response_type = QueryTotalEscrowForDenomResponse -)] -pub struct QueryTotalEscrowForDenomRequest { - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, -} -/// QueryTotalEscrowForDenomResponse is the response type for TotalEscrowForDenom 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 = "/ibc.applications.transfer.v1.QueryTotalEscrowForDenomResponse")] -pub struct QueryTotalEscrowForDenomResponse { - #[prost(message, optional, tag = "1")] - pub amount: ::core::option::Option, -} -/// MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between -/// ICS20 enabled chains. See ICS Spec here: -/// -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v1.MsgTransfer")] -pub struct MsgTransfer { - /// the port on which the packet will be sent - #[prost(string, tag = "1")] - pub source_port: ::prost::alloc::string::String, - /// the channel by which the packet will be sent - #[prost(string, tag = "2")] - pub source_channel: ::prost::alloc::string::String, - /// the tokens to be transferred - #[prost(message, optional, tag = "3")] - pub token: ::core::option::Option, - /// the sender address - #[prost(string, tag = "4")] - pub sender: ::prost::alloc::string::String, - /// the recipient address on the destination chain - #[prost(string, tag = "5")] - pub receiver: ::prost::alloc::string::String, - /// Timeout height relative to the current block height. - /// The timeout is disabled when set to 0. - #[prost(message, optional, tag = "6")] - pub timeout_height: ::core::option::Option, - /// Timeout timestamp in absolute nanoseconds since unix epoch. - /// The timeout is disabled when set to 0. - #[prost(uint64, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout_timestamp: u64, - /// optional memo - #[prost(string, tag = "8")] - pub memo: ::prost::alloc::string::String, -} -/// MsgTransferResponse defines the Msg/Transfer response 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 = "/ibc.applications.transfer.v1.MsgTransferResponse")] -pub struct MsgTransferResponse { - /// sequence number of the transfer packet sent - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// MsgUpdateParams is the Msg/UpdateParams 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 = "/ibc.applications.transfer.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// params defines the transfer parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams 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 = "/ibc.applications.transfer.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct TransferQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> TransferQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn denom_traces( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryDenomTracesRequest { pagination }.query(self.querier) - } - pub fn denom_trace( - &self, - hash: ::prost::alloc::string::String, - ) -> Result { - QueryDenomTraceRequest { hash }.query(self.querier) - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn denom_hash( - &self, - trace: ::prost::alloc::string::String, - ) -> Result { - QueryDenomHashRequest { trace }.query(self.querier) - } - pub fn escrow_address( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryEscrowAddressRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn total_escrow_for_denom( - &self, - denom: ::prost::alloc::string::String, - ) -> Result { - QueryTotalEscrowForDenomRequest { denom }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v2.rs b/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v2.rs deleted file mode 100644 index 8ad23139..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/applications/transfer/v2.rs +++ /dev/null @@ -1,33 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// FungibleTokenPacketData defines a struct for the packet payload -/// See FungibleTokenPacketData spec: -/// -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.applications.transfer.v2.FungibleTokenPacketData")] -pub struct FungibleTokenPacketData { - /// the token denomination to be transferred - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - /// the token amount to be transferred - #[prost(string, tag = "2")] - pub amount: ::prost::alloc::string::String, - /// the sender address - #[prost(string, tag = "3")] - pub sender: ::prost::alloc::string::String, - /// the recipient address on the destination chain - #[prost(string, tag = "4")] - pub receiver: ::prost::alloc::string::String, - /// optional memo - #[prost(string, tag = "5")] - pub memo: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/channel/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/core/channel/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/channel/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs deleted file mode 100644 index 5b5f0c9b..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs +++ /dev/null @@ -1,2849 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Channel defines pipeline for exactly-once packet delivery between specific -/// modules on separate blockchains, which has at least one end capable of -/// sending packets and one end capable of receiving packets. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Channel")] -pub struct Channel { - /// current state of the channel end - #[prost(enumeration = "State", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub state: i32, - /// whether the channel is ordered or unordered - #[prost(enumeration = "Order", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub ordering: i32, - /// counterparty channel end - #[prost(message, optional, tag = "3")] - pub counterparty: ::core::option::Option, - /// list of connection identifiers, in order, along which packets sent on - /// this channel will travel - #[prost(string, repeated, tag = "4")] - pub connection_hops: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// opaque channel version, which is agreed upon during the handshake - #[prost(string, tag = "5")] - pub version: ::prost::alloc::string::String, - /// upgrade sequence indicates the latest upgrade attempt performed by this channel - /// the value of 0 indicates the channel has never been upgraded - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub upgrade_sequence: u64, -} -/// IdentifiedChannel defines a channel with additional port and channel -/// identifier fields. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.IdentifiedChannel")] -pub struct IdentifiedChannel { - /// current state of the channel end - #[prost(enumeration = "State", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub state: i32, - /// whether the channel is ordered or unordered - #[prost(enumeration = "Order", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub ordering: i32, - /// counterparty channel end - #[prost(message, optional, tag = "3")] - pub counterparty: ::core::option::Option, - /// list of connection identifiers, in order, along which packets sent on - /// this channel will travel - #[prost(string, repeated, tag = "4")] - pub connection_hops: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// opaque channel version, which is agreed upon during the handshake - #[prost(string, tag = "5")] - pub version: ::prost::alloc::string::String, - /// port identifier - #[prost(string, tag = "6")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel identifier - #[prost(string, tag = "7")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// upgrade sequence indicates the latest upgrade attempt performed by this channel - /// the value of 0 indicates the channel has never been upgraded - #[prost(uint64, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub upgrade_sequence: u64, -} -/// Counterparty defines a channel end counterparty -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Counterparty")] -pub struct Counterparty { - /// port on the counterparty chain which owns the other end of the channel. - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel end on the counterparty chain - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// Packet defines a type that carries data across different chains through IBC -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Packet")] -pub struct Packet { - /// number corresponds to the order of sends and receives, where a Packet - /// with an earlier sequence number must be sent and received before a Packet - /// with a later sequence number. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// identifies the port on the sending chain. - #[prost(string, tag = "2")] - pub source_port: ::prost::alloc::string::String, - /// identifies the channel end on the sending chain. - #[prost(string, tag = "3")] - pub source_channel: ::prost::alloc::string::String, - /// identifies the port on the receiving chain. - #[prost(string, tag = "4")] - pub destination_port: ::prost::alloc::string::String, - /// identifies the channel end on the receiving chain. - #[prost(string, tag = "5")] - pub destination_channel: ::prost::alloc::string::String, - /// actual opaque bytes transferred directly to the application module - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - /// block height after which the packet times out - #[prost(message, optional, tag = "7")] - pub timeout_height: ::core::option::Option, - /// block timestamp (in nanoseconds) after which the packet times out - #[prost(uint64, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout_timestamp: u64, -} -/// PacketState defines the generic type necessary to retrieve and store -/// packet commitments, acknowledgements, and receipts. -/// Caller is responsible for knowing the context necessary to interpret this -/// state as a commitment, acknowledgement, or a receipt. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.PacketState")] -pub struct PacketState { - /// channel port identifier. - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier. - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// packet sequence. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// embedded data that represents packet state. - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// PacketId is an identifer for a unique Packet -/// Source chains refer to packets by source port/channel -/// Destination chains refer to packets by destination port/channel -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.PacketId")] -pub struct PacketId { - /// channel port identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// packet sequence - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// Acknowledgement is the recommended acknowledgement format to be used by -/// app-specific protocols. -/// NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental -/// conflicts with other protobuf message formats used for acknowledgements. -/// The first byte of any message with this format will be the non-ASCII values -/// `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: -/// -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Acknowledgement")] -pub struct Acknowledgement { - /// response contains either a result or an error and must be non-empty - #[prost(oneof = "acknowledgement::Response", tags = "21, 22")] - pub response: ::core::option::Option, -} -/// Nested message and enum types in `Acknowledgement`. -pub mod acknowledgement { - /// response contains either a result or an error and must be non-empty - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Response { - #[prost(bytes, tag = "21")] - Result(::prost::alloc::vec::Vec), - #[prost(string, tag = "22")] - Error(::prost::alloc::string::String), - } -} -/// Timeout defines an execution deadline structure for 04-channel handlers. -/// This includes packet lifecycle handlers as well as the upgrade handshake handlers. -/// A valid Timeout contains either one or both of a timestamp and block height (sequence). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Timeout")] -pub struct Timeout { - /// block height after which the packet or upgrade times out - #[prost(message, optional, tag = "1")] - pub height: ::core::option::Option, - /// block timestamp (in nanoseconds) after which the packet or upgrade times out - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// Params defines the set of IBC channel parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Params")] -pub struct Params { - /// the relative timeout after which channel upgrades will time out. - #[prost(message, optional, tag = "1")] - pub upgrade_timeout: ::core::option::Option, -} -/// State defines if a channel is in one of the following states: -/// CLOSED, INIT, TRYOPEN, OPEN, FLUSHING, FLUSHCOMPLETE or UNINITIALIZED. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum State { - /// Default State - UninitializedUnspecified = 0, - /// A channel has just started the opening handshake. - Init = 1, - /// A channel has acknowledged the handshake step on the counterparty chain. - Tryopen = 2, - /// A channel has completed the handshake. Open channels are - /// ready to send and receive packets. - Open = 3, - /// A channel has been closed and can no longer be used to send or receive - /// packets. - Closed = 4, - /// A channel has just accepted the upgrade handshake attempt and is flushing in-flight packets. - Flushing = 5, - /// A channel has just completed flushing any in-flight packets. - Flushcomplete = 6, -} -impl State { - /// 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 { - State::UninitializedUnspecified => "STATE_UNINITIALIZED_UNSPECIFIED", - State::Init => "STATE_INIT", - State::Tryopen => "STATE_TRYOPEN", - State::Open => "STATE_OPEN", - State::Closed => "STATE_CLOSED", - State::Flushing => "STATE_FLUSHING", - State::Flushcomplete => "STATE_FLUSHCOMPLETE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "STATE_UNINITIALIZED_UNSPECIFIED" => Some(Self::UninitializedUnspecified), - "STATE_INIT" => Some(Self::Init), - "STATE_TRYOPEN" => Some(Self::Tryopen), - "STATE_OPEN" => Some(Self::Open), - "STATE_CLOSED" => Some(Self::Closed), - "STATE_FLUSHING" => Some(Self::Flushing), - "STATE_FLUSHCOMPLETE" => Some(Self::Flushcomplete), - _ => None, - } - } -} -/// Order defines if a channel is ORDERED or UNORDERED -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum Order { - /// zero-value for channel ordering - NoneUnspecified = 0, - /// packets can be delivered in any order, which may differ from the order in - /// which they were sent. - Unordered = 1, - /// packets are delivered exactly in the order which they were sent - Ordered = 2, -} -impl Order { - /// 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 { - Order::NoneUnspecified => "ORDER_NONE_UNSPECIFIED", - Order::Unordered => "ORDER_UNORDERED", - Order::Ordered => "ORDER_ORDERED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ORDER_NONE_UNSPECIFIED" => Some(Self::NoneUnspecified), - "ORDER_UNORDERED" => Some(Self::Unordered), - "ORDER_ORDERED" => Some(Self::Ordered), - _ => None, - } - } -} -/// GenesisState defines the ibc channel submodule's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, repeated, tag = "1")] - pub channels: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub acknowledgements: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub commitments: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub receipts: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub send_sequences: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "6")] - pub recv_sequences: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "7")] - pub ack_sequences: ::prost::alloc::vec::Vec, - /// the sequence for the next generated channel identifier - #[prost(uint64, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_channel_sequence: u64, - #[prost(message, optional, tag = "9")] - pub params: ::core::option::Option, -} -/// PacketSequence defines the genesis type necessary to retrieve and store -/// next send and receive sequences. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.PacketSequence")] -pub struct PacketSequence { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// Upgrade is a verifiable type which contains the relevant information -/// for an attempted upgrade. It provides the proposed changes to the channel -/// end, the timeout for this upgrade attempt and the next packet sequence -/// which allows the counterparty to efficiently know the highest sequence it has received. -/// The next sequence send is used for pruning and upgrading from unordered to ordered channels. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.Upgrade")] -pub struct Upgrade { - #[prost(message, optional, tag = "1")] - pub fields: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub timeout: ::core::option::Option, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_sequence_send: u64, -} -/// UpgradeFields are the fields in a channel end which may be changed -/// during a channel upgrade. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.UpgradeFields")] -pub struct UpgradeFields { - #[prost(enumeration = "Order", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub ordering: i32, - #[prost(string, repeated, tag = "2")] - pub connection_hops: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(string, tag = "3")] - pub version: ::prost::alloc::string::String, -} -/// ErrorReceipt defines a type which encapsulates the upgrade sequence and error associated with the -/// upgrade handshake failure. When a channel upgrade handshake is aborted both chains are expected to increment to the -/// next sequence. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.ErrorReceipt")] -pub struct ErrorReceipt { - /// the channel upgrade sequence - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// the error message detailing the cause of failure - #[prost(string, tag = "2")] - pub message: ::prost::alloc::string::String, -} -/// QueryChannelRequest is the request type for the Query/Channel 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 = "/ibc.core.channel.v1.QueryChannelRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/Channel", - response_type = QueryChannelResponse -)] -pub struct QueryChannelRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryChannelResponse is the response type for the Query/Channel RPC method. -/// Besides the Channel end, it includes a proof and the height from which the -/// proof was retrieved. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.QueryChannelResponse")] -pub struct QueryChannelResponse { - /// channel associated with the request identifiers - #[prost(message, optional, tag = "1")] - pub channel: ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryChannelsRequest is the request type for the Query/Channels 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 = "/ibc.core.channel.v1.QueryChannelsRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/Channels", - response_type = QueryChannelsResponse -)] -pub struct QueryChannelsRequest { - /// pagination request - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryChannelsResponse is the response type for the Query/Channels 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 = "/ibc.core.channel.v1.QueryChannelsResponse")] -pub struct QueryChannelsResponse { - /// list of stored channels of the chain. - #[prost(message, repeated, tag = "1")] - pub channels: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, - /// query block height - #[prost(message, optional, tag = "3")] - pub height: ::core::option::Option, -} -/// QueryConnectionChannelsRequest is the request type for the -/// Query/QueryConnectionChannels 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 = "/ibc.core.channel.v1.QueryConnectionChannelsRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/ConnectionChannels", - response_type = QueryConnectionChannelsResponse -)] -pub struct QueryConnectionChannelsRequest { - /// connection unique identifier - #[prost(string, tag = "1")] - pub connection: ::prost::alloc::string::String, - /// pagination request - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryConnectionChannelsResponse is the Response type for the -/// Query/QueryConnectionChannels 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 = "/ibc.core.channel.v1.QueryConnectionChannelsResponse")] -pub struct QueryConnectionChannelsResponse { - /// list of channels associated with a connection. - #[prost(message, repeated, tag = "1")] - pub channels: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, - /// query block height - #[prost(message, optional, tag = "3")] - pub height: ::core::option::Option, -} -/// QueryChannelClientStateRequest is the request type for the Query/ClientState -/// 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 = "/ibc.core.channel.v1.QueryChannelClientStateRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/ChannelClientState", - response_type = QueryChannelClientStateResponse -)] -pub struct QueryChannelClientStateRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryChannelClientStateResponse is the Response type for the -/// Query/QueryChannelClientState 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 = "/ibc.core.channel.v1.QueryChannelClientStateResponse")] -pub struct QueryChannelClientStateResponse { - /// client state associated with the channel - #[prost(message, optional, tag = "1")] - pub identified_client_state: - ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryChannelConsensusStateRequest is the request type for the -/// Query/ConsensusState 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 = "/ibc.core.channel.v1.QueryChannelConsensusStateRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/ChannelConsensusState", - response_type = QueryChannelConsensusStateResponse -)] -pub struct QueryChannelConsensusStateRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// revision number of the consensus state - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_number: u64, - /// revision height of the consensus state - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_height: u64, -} -/// QueryChannelClientStateResponse is the Response type for the -/// Query/QueryChannelClientState 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 = "/ibc.core.channel.v1.QueryChannelConsensusStateResponse")] -pub struct QueryChannelConsensusStateResponse { - /// consensus state associated with the channel - #[prost(message, optional, tag = "1")] - pub consensus_state: ::core::option::Option, - /// client ID associated with the consensus state - #[prost(string, tag = "2")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, -} -/// QueryPacketCommitmentRequest is the request type for the -/// Query/PacketCommitment 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 = "/ibc.core.channel.v1.QueryPacketCommitmentRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/PacketCommitment", - response_type = QueryPacketCommitmentResponse -)] -pub struct QueryPacketCommitmentRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// packet sequence - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// QueryPacketCommitmentResponse defines the client query response for a packet -/// which also includes a proof and the height from which the proof was -/// retrieved -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.QueryPacketCommitmentResponse")] -pub struct QueryPacketCommitmentResponse { - /// packet associated with the request fields - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub commitment: ::prost::alloc::vec::Vec, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryPacketCommitmentsRequest is the request type for the -/// Query/QueryPacketCommitments 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 = "/ibc.core.channel.v1.QueryPacketCommitmentsRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/PacketCommitments", - response_type = QueryPacketCommitmentsResponse -)] -pub struct QueryPacketCommitmentsRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// pagination request - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryPacketCommitmentsResponse is the request type for the -/// Query/QueryPacketCommitments 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 = "/ibc.core.channel.v1.QueryPacketCommitmentsResponse")] -pub struct QueryPacketCommitmentsResponse { - #[prost(message, repeated, tag = "1")] - pub commitments: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, - /// query block height - #[prost(message, optional, tag = "3")] - pub height: ::core::option::Option, -} -/// QueryPacketReceiptRequest is the request type for the -/// Query/PacketReceipt 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 = "/ibc.core.channel.v1.QueryPacketReceiptRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/PacketReceipt", - response_type = QueryPacketReceiptResponse -)] -pub struct QueryPacketReceiptRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// packet sequence - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// QueryPacketReceiptResponse defines the client query response for a packet -/// receipt which also includes a proof, and the height from which the proof was -/// retrieved -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.QueryPacketReceiptResponse")] -pub struct QueryPacketReceiptResponse { - /// success flag for if receipt exists - #[prost(bool, tag = "2")] - pub received: bool, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, -} -/// QueryPacketAcknowledgementRequest is the request type for the -/// Query/PacketAcknowledgement 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 = "/ibc.core.channel.v1.QueryPacketAcknowledgementRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/PacketAcknowledgement", - response_type = QueryPacketAcknowledgementResponse -)] -pub struct QueryPacketAcknowledgementRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// packet sequence - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// QueryPacketAcknowledgementResponse defines the client query response for a -/// packet which also includes a proof and the height from which the -/// proof was retrieved -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.QueryPacketAcknowledgementResponse")] -pub struct QueryPacketAcknowledgementResponse { - /// packet associated with the request fields - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub acknowledgement: ::prost::alloc::vec::Vec, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryPacketAcknowledgementsRequest is the request type for the -/// Query/QueryPacketCommitments 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 = "/ibc.core.channel.v1.QueryPacketAcknowledgementsRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/PacketAcknowledgements", - response_type = QueryPacketAcknowledgementsResponse -)] -pub struct QueryPacketAcknowledgementsRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// pagination request - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - /// list of packet sequences - #[prost(uint64, repeated, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub packet_commitment_sequences: ::prost::alloc::vec::Vec, -} -/// QueryPacketAcknowledgemetsResponse is the request type for the -/// Query/QueryPacketAcknowledgements 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 = "/ibc.core.channel.v1.QueryPacketAcknowledgementsResponse")] -pub struct QueryPacketAcknowledgementsResponse { - #[prost(message, repeated, tag = "1")] - pub acknowledgements: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, - /// query block height - #[prost(message, optional, tag = "3")] - pub height: ::core::option::Option, -} -/// QueryUnreceivedPacketsRequest is the request type for the -/// Query/UnreceivedPackets 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 = "/ibc.core.channel.v1.QueryUnreceivedPacketsRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/UnreceivedPackets", - response_type = QueryUnreceivedPacketsResponse -)] -pub struct QueryUnreceivedPacketsRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// list of packet sequences - #[prost(uint64, repeated, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub packet_commitment_sequences: ::prost::alloc::vec::Vec, -} -/// QueryUnreceivedPacketsResponse is the response type for the -/// Query/UnreceivedPacketCommitments 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 = "/ibc.core.channel.v1.QueryUnreceivedPacketsResponse")] -pub struct QueryUnreceivedPacketsResponse { - /// list of unreceived packet sequences - #[prost(uint64, repeated, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub sequences: ::prost::alloc::vec::Vec, - /// query block height - #[prost(message, optional, tag = "2")] - pub height: ::core::option::Option, -} -/// QueryUnreceivedAcks is the request type for the -/// Query/UnreceivedAcks 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 = "/ibc.core.channel.v1.QueryUnreceivedAcksRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/UnreceivedAcks", - response_type = QueryUnreceivedAcksResponse -)] -pub struct QueryUnreceivedAcksRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// list of acknowledgement sequences - #[prost(uint64, repeated, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub packet_ack_sequences: ::prost::alloc::vec::Vec, -} -/// QueryUnreceivedAcksResponse is the response type for the -/// Query/UnreceivedAcks 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 = "/ibc.core.channel.v1.QueryUnreceivedAcksResponse")] -pub struct QueryUnreceivedAcksResponse { - /// list of unreceived acknowledgement sequences - #[prost(uint64, repeated, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub sequences: ::prost::alloc::vec::Vec, - /// query block height - #[prost(message, optional, tag = "2")] - pub height: ::core::option::Option, -} -/// QueryNextSequenceReceiveRequest is the request type for the -/// Query/QueryNextSequenceReceiveRequest 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 = "/ibc.core.channel.v1.QueryNextSequenceReceiveRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/NextSequenceReceive", - response_type = QueryNextSequenceReceiveResponse -)] -pub struct QueryNextSequenceReceiveRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QuerySequenceResponse is the response type for the -/// Query/QueryNextSequenceReceiveResponse 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 = "/ibc.core.channel.v1.QueryNextSequenceReceiveResponse")] -pub struct QueryNextSequenceReceiveResponse { - /// next sequence receive number - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_sequence_receive: u64, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryNextSequenceSendRequest is the request type for the -/// Query/QueryNextSequenceSend 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 = "/ibc.core.channel.v1.QueryNextSequenceSendRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/NextSequenceSend", - response_type = QueryNextSequenceSendResponse -)] -pub struct QueryNextSequenceSendRequest { - /// port unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// channel unique identifier - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryNextSequenceSendResponse is the request type for the -/// Query/QueryNextSequenceSend 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 = "/ibc.core.channel.v1.QueryNextSequenceSendResponse")] -pub struct QueryNextSequenceSendResponse { - /// next sequence send number - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_sequence_send: u64, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryUpgradeErrorRequest is the request type for the Query/QueryUpgradeError 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 = "/ibc.core.channel.v1.QueryUpgradeErrorRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/UpgradeError", - response_type = QueryUpgradeErrorResponse -)] -pub struct QueryUpgradeErrorRequest { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryUpgradeErrorResponse is the response type for the Query/QueryUpgradeError 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 = "/ibc.core.channel.v1.QueryUpgradeErrorResponse")] -pub struct QueryUpgradeErrorResponse { - #[prost(message, optional, tag = "1")] - pub error_receipt: ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryUpgradeRequest is the request type for the QueryUpgradeRequest 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 = "/ibc.core.channel.v1.QueryUpgradeRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/Upgrade", - response_type = QueryUpgradeResponse -)] -pub struct QueryUpgradeRequest { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// QueryUpgradeResponse is the response type for the QueryUpgradeResponse 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 = "/ibc.core.channel.v1.QueryUpgradeResponse")] -pub struct QueryUpgradeResponse { - #[prost(message, optional, tag = "1")] - pub upgrade: ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryChannelParamsRequest is the request type for the Query/ChannelParams 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 = "/ibc.core.channel.v1.QueryChannelParamsRequest")] -#[proto_query( - path = "/ibc.core.channel.v1.Query/ChannelParams", - response_type = QueryChannelParamsResponse -)] -pub struct QueryChannelParamsRequest {} -/// QueryChannelParamsResponse is the response type for the Query/ChannelParams 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 = "/ibc.core.channel.v1.QueryChannelParamsResponse")] -pub struct QueryChannelParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It -/// is called by a relayer on Chain A. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelOpenInit")] -pub struct MsgChannelOpenInit { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub channel: ::core::option::Option, - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response 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 = "/ibc.core.channel.v1.MsgChannelOpenInitResponse")] -pub struct MsgChannelOpenInitResponse { - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub version: ::prost::alloc::string::String, -} -/// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel -/// on Chain B. The version field within the Channel field has been deprecated. Its -/// value will be ignored by core IBC. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelOpenTry")] -pub struct MsgChannelOpenTry { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - /// Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. - #[deprecated] - #[prost(string, tag = "2")] - #[serde(alias = "previous_channelID")] - pub previous_channel_id: ::prost::alloc::string::String, - /// NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. - #[prost(message, optional, tag = "3")] - pub channel: ::core::option::Option, - #[prost(string, tag = "4")] - pub counterparty_version: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_init: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "6")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "7")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response 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 = "/ibc.core.channel.v1.MsgChannelOpenTryResponse")] -pub struct MsgChannelOpenTryResponse { - #[prost(string, tag = "1")] - pub version: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, -} -/// MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge -/// the change of channel state to TRYOPEN on Chain B. -/// WARNING: a channel upgrade MUST NOT initialize an upgrade for this channel -/// in the same block as executing this message otherwise the counterparty will -/// be incapable of opening. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelOpenAck")] -pub struct MsgChannelOpenAck { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - #[serde(alias = "counterparty_channelID")] - pub counterparty_channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub counterparty_version: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_try: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "6")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "7")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response 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 = "/ibc.core.channel.v1.MsgChannelOpenAckResponse")] -pub struct MsgChannelOpenAckResponse {} -/// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to -/// acknowledge the change of channel state to OPEN on Chain A. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelOpenConfirm")] -pub struct MsgChannelOpenConfirm { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_ack: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "5")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response -/// 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 = "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse")] -pub struct MsgChannelOpenConfirmResponse {} -/// MsgChannelCloseInit defines a msg sent by a Relayer to Chain A -/// to close a channel with Chain B. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelCloseInit")] -pub struct MsgChannelCloseInit { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response 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 = "/ibc.core.channel.v1.MsgChannelCloseInitResponse")] -pub struct MsgChannelCloseInitResponse {} -/// MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B -/// to acknowledge the change of channel state to CLOSED on Chain A. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelCloseConfirm")] -pub struct MsgChannelCloseConfirm { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_init: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "5")] - pub signer: ::prost::alloc::string::String, - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub counterparty_upgrade_sequence: u64, -} -/// MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response -/// 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 = "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse")] -pub struct MsgChannelCloseConfirmResponse {} -/// MsgRecvPacket receives incoming IBC packet -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgRecvPacket")] -pub struct MsgRecvPacket { - #[prost(message, optional, tag = "1")] - pub packet: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_commitment: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "4")] - pub signer: ::prost::alloc::string::String, -} -/// MsgRecvPacketResponse defines the Msg/RecvPacket response 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 = "/ibc.core.channel.v1.MsgRecvPacketResponse")] -pub struct MsgRecvPacketResponse { - #[prost(enumeration = "ResponseResultType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgTimeout receives timed-out packet -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgTimeout")] -pub struct MsgTimeout { - #[prost(message, optional, tag = "1")] - pub packet: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_unreceived: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_sequence_recv: u64, - #[prost(string, tag = "5")] - pub signer: ::prost::alloc::string::String, -} -/// MsgTimeoutResponse defines the Msg/Timeout response 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 = "/ibc.core.channel.v1.MsgTimeoutResponse")] -pub struct MsgTimeoutResponse { - #[prost(enumeration = "ResponseResultType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgTimeoutOnClose timed-out packet upon counterparty channel closure. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgTimeoutOnClose")] -pub struct MsgTimeoutOnClose { - #[prost(message, optional, tag = "1")] - pub packet: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_unreceived: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_close: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_sequence_recv: u64, - #[prost(string, tag = "6")] - pub signer: ::prost::alloc::string::String, - #[prost(uint64, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub counterparty_upgrade_sequence: u64, -} -/// MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response 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 = "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse")] -pub struct MsgTimeoutOnCloseResponse { - #[prost(enumeration = "ResponseResultType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgAcknowledgement receives incoming IBC acknowledgement -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgAcknowledgement")] -pub struct MsgAcknowledgement { - #[prost(message, optional, tag = "1")] - pub packet: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub acknowledgement: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_acked: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "5")] - pub signer: ::prost::alloc::string::String, -} -/// MsgAcknowledgementResponse defines the Msg/Acknowledgement response 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 = "/ibc.core.channel.v1.MsgAcknowledgementResponse")] -pub struct MsgAcknowledgementResponse { - #[prost(enumeration = "ResponseResultType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgChannelUpgradeInit defines the request type for the ChannelUpgradeInit rpc -/// WARNING: Initializing a channel upgrade in the same block as opening the channel -/// may result in the counterparty being incapable of opening. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeInit")] -pub struct MsgChannelUpgradeInit { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub fields: ::core::option::Option, - #[prost(string, tag = "4")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeInitResponse defines the MsgChannelUpgradeInit response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeInitResponse")] -pub struct MsgChannelUpgradeInitResponse { - #[prost(message, optional, tag = "1")] - pub upgrade: ::core::option::Option, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub upgrade_sequence: u64, -} -/// MsgChannelUpgradeTry defines the request type for the ChannelUpgradeTry rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeTry")] -pub struct MsgChannelUpgradeTry { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "3")] - pub proposed_upgrade_connection_hops: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, optional, tag = "4")] - pub counterparty_upgrade_fields: ::core::option::Option, - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub counterparty_upgrade_sequence: u64, - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_channel: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_upgrade: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "8")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "9")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeTryResponse defines the MsgChannelUpgradeTry response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeTryResponse")] -pub struct MsgChannelUpgradeTryResponse { - #[prost(message, optional, tag = "1")] - pub upgrade: ::core::option::Option, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub upgrade_sequence: u64, - #[prost(enumeration = "ResponseResultType", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgChannelUpgradeAck defines the request type for the ChannelUpgradeAck rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeAck")] -pub struct MsgChannelUpgradeAck { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub counterparty_upgrade: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_channel: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_upgrade: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "6")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "7")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeAckResponse defines MsgChannelUpgradeAck response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeAckResponse")] -pub struct MsgChannelUpgradeAckResponse { - #[prost(enumeration = "ResponseResultType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgChannelUpgradeConfirm defines the request type for the ChannelUpgradeConfirm rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeConfirm")] -pub struct MsgChannelUpgradeConfirm { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(enumeration = "State", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub counterparty_channel_state: i32, - #[prost(message, optional, tag = "4")] - pub counterparty_upgrade: ::core::option::Option, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_channel: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_upgrade: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "7")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "8")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeConfirmResponse defines MsgChannelUpgradeConfirm response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse")] -pub struct MsgChannelUpgradeConfirmResponse { - #[prost(enumeration = "ResponseResultType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// MsgChannelUpgradeOpen defines the request type for the ChannelUpgradeOpen rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeOpen")] -pub struct MsgChannelUpgradeOpen { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(enumeration = "State", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub counterparty_channel_state: i32, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub counterparty_upgrade_sequence: u64, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_channel: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "6")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "7")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeOpenResponse defines the MsgChannelUpgradeOpen response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse")] -pub struct MsgChannelUpgradeOpenResponse {} -/// MsgChannelUpgradeTimeout defines the request type for the ChannelUpgradeTimeout rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeTimeout")] -pub struct MsgChannelUpgradeTimeout { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub counterparty_channel: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_channel: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "5")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "6")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeTimeoutRepsonse defines the MsgChannelUpgradeTimeout response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse")] -pub struct MsgChannelUpgradeTimeoutResponse {} -/// MsgChannelUpgradeCancel defines the request type for the ChannelUpgradeCancel rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgChannelUpgradeCancel")] -pub struct MsgChannelUpgradeCancel { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub error_receipt: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_error_receipt: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "5")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "6")] - pub signer: ::prost::alloc::string::String, -} -/// MsgChannelUpgradeCancelResponse defines the MsgChannelUpgradeCancel response 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 = "/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse")] -pub struct MsgChannelUpgradeCancelResponse {} -/// MsgUpdateParams is the MsgUpdateParams 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 = "/ibc.core.channel.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address that controls the module (defaults to x/gov unless overwritten). - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the channel parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the MsgUpdateParams response 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 = "/ibc.core.channel.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -/// MsgPruneAcknowledgements defines the request type for the PruneAcknowledgements rpc. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgPruneAcknowledgements")] -pub struct MsgPruneAcknowledgements { - #[prost(string, tag = "1")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub limit: u64, - #[prost(string, tag = "4")] - pub signer: ::prost::alloc::string::String, -} -/// MsgPruneAcknowledgementsResponse defines the response type for the PruneAcknowledgements rpc. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse")] -pub struct MsgPruneAcknowledgementsResponse { - /// Number of sequences pruned (includes both packet acknowledgements and packet receipts where appropriate). - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_pruned_sequences: u64, - /// Number of sequences left after pruning. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_remaining_sequences: u64, -} -/// ResponseResultType defines the possible outcomes of the execution of a message -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum ResponseResultType { - /// Default zero value enumeration - Unspecified = 0, - /// The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) - Noop = 1, - /// The message was executed successfully - Success = 2, - /// The message was executed unsuccessfully - Failure = 3, -} -impl ResponseResultType { - /// 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 { - ResponseResultType::Unspecified => "RESPONSE_RESULT_TYPE_UNSPECIFIED", - ResponseResultType::Noop => "RESPONSE_RESULT_TYPE_NOOP", - ResponseResultType::Success => "RESPONSE_RESULT_TYPE_SUCCESS", - ResponseResultType::Failure => "RESPONSE_RESULT_TYPE_FAILURE", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "RESPONSE_RESULT_TYPE_UNSPECIFIED" => Some(Self::Unspecified), - "RESPONSE_RESULT_TYPE_NOOP" => Some(Self::Noop), - "RESPONSE_RESULT_TYPE_SUCCESS" => Some(Self::Success), - "RESPONSE_RESULT_TYPE_FAILURE" => Some(Self::Failure), - _ => None, - } - } -} -pub struct ChannelQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ChannelQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn channel( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryChannelRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn channels( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryChannelsRequest { pagination }.query(self.querier) - } - pub fn connection_channels( - &self, - connection: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryConnectionChannelsRequest { - connection, - pagination, - } - .query(self.querier) - } - pub fn channel_client_state( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryChannelClientStateRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn channel_consensus_state( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - revision_number: u64, - revision_height: u64, - ) -> Result { - QueryChannelConsensusStateRequest { - port_id, - channel_id, - revision_number, - revision_height, - } - .query(self.querier) - } - pub fn packet_commitment( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - sequence: u64, - ) -> Result { - QueryPacketCommitmentRequest { - port_id, - channel_id, - sequence, - } - .query(self.querier) - } - pub fn packet_commitments( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryPacketCommitmentsRequest { - port_id, - channel_id, - pagination, - } - .query(self.querier) - } - pub fn packet_receipt( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - sequence: u64, - ) -> Result { - QueryPacketReceiptRequest { - port_id, - channel_id, - sequence, - } - .query(self.querier) - } - pub fn packet_acknowledgement( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - sequence: u64, - ) -> Result { - QueryPacketAcknowledgementRequest { - port_id, - channel_id, - sequence, - } - .query(self.querier) - } - pub fn packet_acknowledgements( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - packet_commitment_sequences: ::prost::alloc::vec::Vec, - ) -> Result { - QueryPacketAcknowledgementsRequest { - port_id, - channel_id, - pagination, - packet_commitment_sequences, - } - .query(self.querier) - } - pub fn unreceived_packets( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - packet_commitment_sequences: ::prost::alloc::vec::Vec, - ) -> Result { - QueryUnreceivedPacketsRequest { - port_id, - channel_id, - packet_commitment_sequences, - } - .query(self.querier) - } - pub fn unreceived_acks( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - packet_ack_sequences: ::prost::alloc::vec::Vec, - ) -> Result { - QueryUnreceivedAcksRequest { - port_id, - channel_id, - packet_ack_sequences, - } - .query(self.querier) - } - pub fn next_sequence_receive( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryNextSequenceReceiveRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn next_sequence_send( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryNextSequenceSendRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn upgrade_error( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryUpgradeErrorRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn upgrade( - &self, - port_id: ::prost::alloc::string::String, - channel_id: ::prost::alloc::string::String, - ) -> Result { - QueryUpgradeRequest { - port_id, - channel_id, - } - .query(self.querier) - } - pub fn channel_params(&self) -> Result { - QueryChannelParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/client/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/core/client/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/client/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/client/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/core/client/v1.rs deleted file mode 100644 index 137c2650..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/client/v1.rs +++ /dev/null @@ -1,1106 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// IdentifiedClientState defines a client state with an additional client -/// identifier field. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.IdentifiedClientState")] -pub struct IdentifiedClientState { - /// client identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// client state - #[prost(message, optional, tag = "2")] - pub client_state: ::core::option::Option, -} -/// ConsensusStateWithHeight defines a consensus state with an additional height -/// field. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.ConsensusStateWithHeight")] -pub struct ConsensusStateWithHeight { - /// consensus state height - #[prost(message, optional, tag = "1")] - pub height: ::core::option::Option, - /// consensus state - #[prost(message, optional, tag = "2")] - pub consensus_state: ::core::option::Option, -} -/// ClientConsensusStates defines all the stored consensus states for a given -/// client. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.ClientConsensusStates")] -pub struct ClientConsensusStates { - /// client identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// consensus states and their heights associated with the client - #[prost(message, repeated, tag = "2")] - pub consensus_states: ::prost::alloc::vec::Vec, -} -/// Height is a monotonically increasing data type -/// that can be compared against another Height for the purposes of updating and -/// freezing clients -/// -/// Normally the RevisionHeight is incremented at each height while keeping -/// RevisionNumber the same. However some consensus algorithms may choose to -/// reset the height in certain conditions e.g. hard forks, state-machine -/// breaking changes In these cases, the RevisionNumber is incremented so that -/// height continues to be monitonically increasing even as the RevisionHeight -/// gets reset -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.Height")] -pub struct Height { - /// the revision that the client is currently on - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_number: u64, - /// the height within the given revision - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_height: u64, -} -/// Params defines the set of IBC light client parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.Params")] -pub struct Params { - /// allowed_clients defines the list of allowed client state types which can be created - /// and interacted with. If a client type is removed from the allowed clients list, usage - /// of this client will be disabled until it is added again to the list. - #[prost(string, repeated, tag = "1")] - pub allowed_clients: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// ClientUpdateProposal is a legacy governance proposal. If it passes, the substitute -/// client's latest consensus state is copied over to the subject client. The proposal -/// handler may fail if the subject and the substitute do not match in client and -/// chain parameters (with exception to latest height, frozen height, and chain-id). -/// -/// Deprecated: Please use MsgRecoverClient in favour of this message 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 = "/ibc.core.client.v1.ClientUpdateProposal")] -#[deprecated] -pub struct ClientUpdateProposal { - /// the title of the update proposal - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - /// the description of the proposal - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - /// the client identifier for the client to be updated if the proposal passes - #[prost(string, tag = "3")] - #[serde(alias = "subject_clientID")] - pub subject_client_id: ::prost::alloc::string::String, - /// the substitute client identifier for the client standing in for the subject - /// client - #[prost(string, tag = "4")] - #[serde(alias = "substitute_clientID")] - pub substitute_client_id: ::prost::alloc::string::String, -} -/// UpgradeProposal is a gov Content type for initiating an IBC breaking -/// upgrade. -/// -/// Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message 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 = "/ibc.core.client.v1.UpgradeProposal")] -#[deprecated] -pub struct UpgradeProposal { - #[prost(string, tag = "1")] - pub title: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub plan: ::core::option::Option, - /// An UpgradedClientState must be provided to perform an IBC breaking upgrade. - /// This will make the chain commit to the correct upgraded (self) client state - /// before the upgrade occurs, so that connecting chains can verify that the - /// new upgraded client is valid by verifying a proof on the previous version - /// of the chain. This will allow IBC connections to persist smoothly across - /// planned chain upgrades - #[prost(message, optional, tag = "4")] - pub upgraded_client_state: ::core::option::Option, -} -/// GenesisState defines the ibc client submodule's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.GenesisState")] -pub struct GenesisState { - /// client states with their corresponding identifiers - #[prost(message, repeated, tag = "1")] - pub clients: ::prost::alloc::vec::Vec, - /// consensus states from each client - #[prost(message, repeated, tag = "2")] - pub clients_consensus: ::prost::alloc::vec::Vec, - /// metadata from each client - #[prost(message, repeated, tag = "3")] - pub clients_metadata: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub params: ::core::option::Option, - /// Deprecated: create_localhost has been deprecated. - /// The localhost client is automatically created at genesis. - #[deprecated] - #[prost(bool, tag = "5")] - pub create_localhost: bool, - /// the sequence for the next generated client identifier - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_client_sequence: u64, -} -/// GenesisMetadata defines the genesis type for metadata that clients may return -/// with ExportMetadata -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.GenesisMetadata")] -pub struct GenesisMetadata { - /// store key of metadata without clientID-prefix - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - /// metadata value - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, -} -/// IdentifiedGenesisMetadata has the client metadata with the corresponding -/// client id. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.IdentifiedGenesisMetadata")] -pub struct IdentifiedGenesisMetadata { - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub client_metadata: ::prost::alloc::vec::Vec, -} -/// QueryClientStateRequest is the request type for the Query/ClientState 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 = "/ibc.core.client.v1.QueryClientStateRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ClientState", - response_type = QueryClientStateResponse -)] -pub struct QueryClientStateRequest { - /// client state unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, -} -/// QueryClientStateResponse is the response type for the Query/ClientState RPC -/// method. Besides the client state, it includes a proof and the height from -/// which the proof was retrieved. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.QueryClientStateResponse")] -pub struct QueryClientStateResponse { - /// client state associated with the request identifier - #[prost(message, optional, tag = "1")] - pub client_state: ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryClientStatesRequest is the request type for the Query/ClientStates 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 = "/ibc.core.client.v1.QueryClientStatesRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ClientStates", - response_type = QueryClientStatesResponse -)] -pub struct QueryClientStatesRequest { - /// pagination request - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryClientStatesResponse is the response type for the Query/ClientStates 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 = "/ibc.core.client.v1.QueryClientStatesResponse")] -pub struct QueryClientStatesResponse { - /// list of stored ClientStates of the chain. - #[prost(message, repeated, tag = "1")] - pub client_states: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryConsensusStateRequest is the request type for the Query/ConsensusState -/// RPC method. Besides the consensus state, it includes a proof and the height -/// from which the proof was retrieved. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.QueryConsensusStateRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ConsensusState", - response_type = QueryConsensusStateResponse -)] -pub struct QueryConsensusStateRequest { - /// client identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// consensus state revision number - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_number: u64, - /// consensus state revision height - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_height: u64, - /// latest_height overrrides the height field and queries the latest stored - /// ConsensusState - #[prost(bool, tag = "4")] - pub latest_height: bool, -} -/// QueryConsensusStateResponse is the response type for the Query/ConsensusState -/// 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 = "/ibc.core.client.v1.QueryConsensusStateResponse")] -pub struct QueryConsensusStateResponse { - /// consensus state associated with the client identifier at the given height - #[prost(message, optional, tag = "1")] - pub consensus_state: ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryConsensusStatesRequest is the request type for the Query/ConsensusStates -/// 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 = "/ibc.core.client.v1.QueryConsensusStatesRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ConsensusStates", - response_type = QueryConsensusStatesResponse -)] -pub struct QueryConsensusStatesRequest { - /// client identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// pagination request - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryConsensusStatesResponse is the response type for the -/// Query/ConsensusStates 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 = "/ibc.core.client.v1.QueryConsensusStatesResponse")] -pub struct QueryConsensusStatesResponse { - /// consensus states associated with the identifier - #[prost(message, repeated, tag = "1")] - pub consensus_states: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights -/// 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 = "/ibc.core.client.v1.QueryConsensusStateHeightsRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ConsensusStateHeights", - response_type = QueryConsensusStateHeightsResponse -)] -pub struct QueryConsensusStateHeightsRequest { - /// client identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// pagination request - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryConsensusStateHeightsResponse is the response type for the -/// Query/ConsensusStateHeights 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 = "/ibc.core.client.v1.QueryConsensusStateHeightsResponse")] -pub struct QueryConsensusStateHeightsResponse { - /// consensus state heights - #[prost(message, repeated, tag = "1")] - pub consensus_state_heights: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryClientStatusRequest is the request type for the Query/ClientStatus 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 = "/ibc.core.client.v1.QueryClientStatusRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ClientStatus", - response_type = QueryClientStatusResponse -)] -pub struct QueryClientStatusRequest { - /// client unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, -} -/// QueryClientStatusResponse is the response type for the Query/ClientStatus RPC -/// method. It returns the current status of the IBC client. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.QueryClientStatusResponse")] -pub struct QueryClientStatusResponse { - #[prost(string, tag = "1")] - pub status: ::prost::alloc::string::String, -} -/// QueryClientParamsRequest is the request type for the Query/ClientParams 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 = "/ibc.core.client.v1.QueryClientParamsRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/ClientParams", - response_type = QueryClientParamsResponse -)] -pub struct QueryClientParamsRequest {} -/// QueryClientParamsResponse is the response type for the Query/ClientParams 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 = "/ibc.core.client.v1.QueryClientParamsResponse")] -pub struct QueryClientParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryUpgradedClientStateRequest is the request type for the -/// Query/UpgradedClientState 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 = "/ibc.core.client.v1.QueryUpgradedClientStateRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/UpgradedClientState", - response_type = QueryUpgradedClientStateResponse -)] -pub struct QueryUpgradedClientStateRequest {} -/// QueryUpgradedClientStateResponse is the response type for the -/// Query/UpgradedClientState 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 = "/ibc.core.client.v1.QueryUpgradedClientStateResponse")] -pub struct QueryUpgradedClientStateResponse { - /// client state associated with the request identifier - #[prost(message, optional, tag = "1")] - pub upgraded_client_state: ::core::option::Option, -} -/// QueryUpgradedConsensusStateRequest is the request type for the -/// Query/UpgradedConsensusState 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 = "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest")] -#[proto_query( - path = "/ibc.core.client.v1.Query/UpgradedConsensusState", - response_type = QueryUpgradedConsensusStateResponse -)] -pub struct QueryUpgradedConsensusStateRequest {} -/// QueryUpgradedConsensusStateResponse is the response type for the -/// Query/UpgradedConsensusState 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 = "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse")] -pub struct QueryUpgradedConsensusStateResponse { - /// Consensus state associated with the request identifier - #[prost(message, optional, tag = "1")] - pub upgraded_consensus_state: ::core::option::Option, -} -/// MsgCreateClient defines a message to create an IBC client -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.MsgCreateClient")] -pub struct MsgCreateClient { - /// light client state - #[prost(message, optional, tag = "1")] - pub client_state: ::core::option::Option, - /// consensus state associated with the client that corresponds to a given - /// height. - #[prost(message, optional, tag = "2")] - pub consensus_state: ::core::option::Option, - /// signer address - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgCreateClientResponse defines the Msg/CreateClient response 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 = "/ibc.core.client.v1.MsgCreateClientResponse")] -pub struct MsgCreateClientResponse {} -/// MsgUpdateClient defines an sdk.Msg to update a IBC client state using -/// the given client 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 = "/ibc.core.client.v1.MsgUpdateClient")] -pub struct MsgUpdateClient { - /// client unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// client message to update the light client - #[prost(message, optional, tag = "2")] - pub client_message: ::core::option::Option, - /// signer address - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgUpdateClientResponse defines the Msg/UpdateClient response 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 = "/ibc.core.client.v1.MsgUpdateClientResponse")] -pub struct MsgUpdateClientResponse {} -/// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client -/// state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.MsgUpgradeClient")] -pub struct MsgUpgradeClient { - /// client unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// upgraded client state - #[prost(message, optional, tag = "2")] - pub client_state: ::core::option::Option, - /// upgraded consensus state, only contains enough information to serve as a - /// basis of trust in update logic - #[prost(message, optional, tag = "3")] - pub consensus_state: ::core::option::Option, - /// proof that old chain committed to new client - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_upgrade_client: ::prost::alloc::vec::Vec, - /// proof that old chain committed to new consensus state - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_upgrade_consensus_state: ::prost::alloc::vec::Vec, - /// signer address - #[prost(string, tag = "6")] - pub signer: ::prost::alloc::string::String, -} -/// MsgUpgradeClientResponse defines the Msg/UpgradeClient response 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 = "/ibc.core.client.v1.MsgUpgradeClientResponse")] -pub struct MsgUpgradeClientResponse {} -/// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for -/// light client misbehaviour. -/// This message has been deprecated. Use MsgUpdateClient instead. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.MsgSubmitMisbehaviour")] -#[deprecated] -pub struct MsgSubmitMisbehaviour { - /// client unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// misbehaviour used for freezing the light client - #[prost(message, optional, tag = "2")] - pub misbehaviour: ::core::option::Option, - /// signer address - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response -/// 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 = "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse")] -pub struct MsgSubmitMisbehaviourResponse {} -/// MsgRecoverClient defines the message used to recover a frozen or expired client. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.MsgRecoverClient")] -pub struct MsgRecoverClient { - /// the client identifier for the client to be updated if the proposal passes - #[prost(string, tag = "1")] - #[serde(alias = "subject_clientID")] - pub subject_client_id: ::prost::alloc::string::String, - /// the substitute client identifier for the client which will replace the subject - /// client - #[prost(string, tag = "2")] - #[serde(alias = "substitute_clientID")] - pub substitute_client_id: ::prost::alloc::string::String, - /// signer address - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgRecoverClientResponse defines the Msg/RecoverClient response 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 = "/ibc.core.client.v1.MsgRecoverClientResponse")] -pub struct MsgRecoverClientResponse {} -/// MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.MsgIBCSoftwareUpgrade")] -pub struct MsgIbcSoftwareUpgrade { - #[prost(message, optional, tag = "1")] - pub plan: ::core::option::Option, - /// An UpgradedClientState must be provided to perform an IBC breaking upgrade. - /// This will make the chain commit to the correct upgraded (self) client state - /// before the upgrade occurs, so that connecting chains can verify that the - /// new upgraded client is valid by verifying a proof on the previous version - /// of the chain. This will allow IBC connections to persist smoothly across - /// planned chain upgrades. Correspondingly, the UpgradedClientState field has been - /// deprecated in the Cosmos SDK to allow for this logic to exist solely in - /// the 02-client module. - #[prost(message, optional, tag = "2")] - pub upgraded_client_state: ::core::option::Option, - /// signer address - #[prost(string, tag = "3")] - pub signer: ::prost::alloc::string::String, -} -/// MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response 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 = "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse")] -pub struct MsgIbcSoftwareUpgradeResponse {} -/// MsgUpdateParams defines the sdk.Msg type to update the client parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.client.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// params defines the client parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the MsgUpdateParams response 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 = "/ibc.core.client.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct ClientQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ClientQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn client_state( - &self, - client_id: ::prost::alloc::string::String, - ) -> Result { - QueryClientStateRequest { client_id }.query(self.querier) - } - pub fn client_states( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryClientStatesRequest { pagination }.query(self.querier) - } - pub fn consensus_state( - &self, - client_id: ::prost::alloc::string::String, - revision_number: u64, - revision_height: u64, - latest_height: bool, - ) -> Result { - QueryConsensusStateRequest { - client_id, - revision_number, - revision_height, - latest_height, - } - .query(self.querier) - } - pub fn consensus_states( - &self, - client_id: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryConsensusStatesRequest { - client_id, - pagination, - } - .query(self.querier) - } - pub fn consensus_state_heights( - &self, - client_id: ::prost::alloc::string::String, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryConsensusStateHeightsRequest { - client_id, - pagination, - } - .query(self.querier) - } - pub fn client_status( - &self, - client_id: ::prost::alloc::string::String, - ) -> Result { - QueryClientStatusRequest { client_id }.query(self.querier) - } - pub fn client_params(&self) -> Result { - QueryClientParamsRequest {}.query(self.querier) - } - pub fn upgraded_client_state( - &self, - ) -> Result { - QueryUpgradedClientStateRequest {}.query(self.querier) - } - pub fn upgraded_consensus_state( - &self, - ) -> Result { - QueryUpgradedConsensusStateRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/commitment/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/core/commitment/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/commitment/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/commitment/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/core/commitment/v1.rs deleted file mode 100644 index 8327cc9f..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/commitment/v1.rs +++ /dev/null @@ -1,87 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// MerkleRoot defines a merkle root hash. -/// In the Cosmos SDK, the AppHash of a block header becomes the root. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.commitment.v1.MerkleRoot")] -pub struct MerkleRoot { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, -} -/// MerklePrefix is merkle path prefixed to the key. -/// The constructed key from the Path and the key will be append(Path.KeyPath, -/// append(Path.KeyPrefix, key...)) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.commitment.v1.MerklePrefix")] -pub struct MerklePrefix { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key_prefix: ::prost::alloc::vec::Vec, -} -/// MerklePath is the path used to verify commitment proofs, which can be an -/// arbitrary structured object (defined by a commitment type). -/// MerklePath is represented from root-to-leaf -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.commitment.v1.MerklePath")] -pub struct MerklePath { - #[prost(string, repeated, tag = "1")] - pub key_path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// MerkleProof is a wrapper type over a chain of CommitmentProofs. -/// It demonstrates membership or non-membership for an element or set of -/// elements, verifiable in conjunction with a known commitment root. Proofs -/// should be succinct. -/// MerkleProofs are ordered from leaf-to-root -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.commitment.v1.MerkleProof")] -pub struct MerkleProof { - #[prost(message, repeated, tag = "1")] - pub proofs: - ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/connection/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/core/connection/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/connection/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/connection/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/core/connection/v1.rs deleted file mode 100644 index 14417bff..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/connection/v1.rs +++ /dev/null @@ -1,930 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ConnectionEnd defines a stateful object on a chain connected to another -/// separate one. -/// NOTE: there must only be 2 defined ConnectionEnds to establish -/// a connection between two chains. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.ConnectionEnd")] -pub struct ConnectionEnd { - /// client associated with this connection. - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// IBC version which can be utilised to determine encodings or protocols for - /// channels or packets utilising this connection. - #[prost(message, repeated, tag = "2")] - pub versions: ::prost::alloc::vec::Vec, - /// current state of the connection end. - #[prost(enumeration = "State", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub state: i32, - /// counterparty chain associated with this connection. - #[prost(message, optional, tag = "4")] - pub counterparty: ::core::option::Option, - /// delay period that must pass before a consensus state can be used for - /// packet-verification NOTE: delay period logic is only implemented by some - /// clients. - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub delay_period: u64, -} -/// IdentifiedConnection defines a connection with additional connection -/// identifier field. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.IdentifiedConnection")] -pub struct IdentifiedConnection { - /// connection identifier. - #[prost(string, tag = "1")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - /// client associated with this connection. - #[prost(string, tag = "2")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// IBC version which can be utilised to determine encodings or protocols for - /// channels or packets utilising this connection - #[prost(message, repeated, tag = "3")] - pub versions: ::prost::alloc::vec::Vec, - /// current state of the connection end. - #[prost(enumeration = "State", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub state: i32, - /// counterparty chain associated with this connection. - #[prost(message, optional, tag = "5")] - pub counterparty: ::core::option::Option, - /// delay period associated with this connection. - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub delay_period: u64, -} -/// Counterparty defines the counterparty chain associated with a connection end. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.Counterparty")] -pub struct Counterparty { - /// identifies the client on the counterparty chain associated with a given - /// connection. - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// identifies the connection end on the counterparty chain associated with a - /// given connection. - #[prost(string, tag = "2")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - /// commitment merkle prefix of the counterparty chain. - #[prost(message, optional, tag = "3")] - pub prefix: ::core::option::Option, -} -/// ClientPaths define all the connection paths for a client state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.ClientPaths")] -pub struct ClientPaths { - /// list of connection paths - #[prost(string, repeated, tag = "1")] - pub paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// ConnectionPaths define all the connection paths for a given client state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.ConnectionPaths")] -pub struct ConnectionPaths { - /// client state unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// list of connection paths - #[prost(string, repeated, tag = "2")] - pub paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Version defines the versioning scheme used to negotiate the IBC verison in -/// the connection handshake. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.Version")] -pub struct Version { - /// unique version identifier - #[prost(string, tag = "1")] - pub identifier: ::prost::alloc::string::String, - /// list of features compatible with the specified identifier - #[prost(string, repeated, tag = "2")] - pub features: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Params defines the set of Connection parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.Params")] -pub struct Params { - /// maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the - /// largest amount of time that the chain might reasonably take to produce the next block under normal operating - /// conditions. A safe choice is 3-5x the expected time per block. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_expected_time_per_block: u64, -} -/// State defines if a connection is in one of the following states: -/// INIT, TRYOPEN, OPEN or UNINITIALIZED. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum State { - /// Default State - UninitializedUnspecified = 0, - /// A connection end has just started the opening handshake. - Init = 1, - /// A connection end has acknowledged the handshake step on the counterparty - /// chain. - Tryopen = 2, - /// A connection end has completed the handshake. - Open = 3, -} -impl State { - /// 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 { - State::UninitializedUnspecified => "STATE_UNINITIALIZED_UNSPECIFIED", - State::Init => "STATE_INIT", - State::Tryopen => "STATE_TRYOPEN", - State::Open => "STATE_OPEN", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "STATE_UNINITIALIZED_UNSPECIFIED" => Some(Self::UninitializedUnspecified), - "STATE_INIT" => Some(Self::Init), - "STATE_TRYOPEN" => Some(Self::Tryopen), - "STATE_OPEN" => Some(Self::Open), - _ => None, - } - } -} -/// GenesisState defines the ibc connection submodule's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, repeated, tag = "1")] - pub connections: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "2")] - pub client_connection_paths: ::prost::alloc::vec::Vec, - /// the sequence for the next generated connection identifier - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_connection_sequence: u64, - #[prost(message, optional, tag = "4")] - pub params: ::core::option::Option, -} -/// QueryConnectionRequest is the request type for the Query/Connection 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 = "/ibc.core.connection.v1.QueryConnectionRequest")] -#[proto_query( - path = "/ibc.core.connection.v1.Query/Connection", - response_type = QueryConnectionResponse -)] -pub struct QueryConnectionRequest { - /// connection unique identifier - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, -} -/// QueryConnectionResponse is the response type for the Query/Connection RPC -/// method. Besides the connection end, it includes a proof and the height from -/// which the proof was retrieved. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.QueryConnectionResponse")] -pub struct QueryConnectionResponse { - /// connection associated with the request identifier - #[prost(message, optional, tag = "1")] - pub connection: ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryConnectionsRequest is the request type for the Query/Connections 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 = "/ibc.core.connection.v1.QueryConnectionsRequest")] -#[proto_query( - path = "/ibc.core.connection.v1.Query/Connections", - response_type = QueryConnectionsResponse -)] -pub struct QueryConnectionsRequest { - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryConnectionsResponse is the response type for the Query/Connections 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 = "/ibc.core.connection.v1.QueryConnectionsResponse")] -pub struct QueryConnectionsResponse { - /// list of stored connections of the chain. - #[prost(message, repeated, tag = "1")] - pub connections: ::prost::alloc::vec::Vec, - /// pagination response - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, - /// query block height - #[prost(message, optional, tag = "3")] - pub height: ::core::option::Option, -} -/// QueryClientConnectionsRequest is the request type for the -/// Query/ClientConnections 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 = "/ibc.core.connection.v1.QueryClientConnectionsRequest")] -#[proto_query( - path = "/ibc.core.connection.v1.Query/ClientConnections", - response_type = QueryClientConnectionsResponse -)] -pub struct QueryClientConnectionsRequest { - /// client identifier associated with a connection - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, -} -/// QueryClientConnectionsResponse is the response type for the -/// Query/ClientConnections 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 = "/ibc.core.connection.v1.QueryClientConnectionsResponse")] -pub struct QueryClientConnectionsResponse { - /// slice of all the connection paths associated with a client. - #[prost(string, repeated, tag = "1")] - pub connection_paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was generated - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryConnectionClientStateRequest is the request type for the -/// Query/ConnectionClientState 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 = "/ibc.core.connection.v1.QueryConnectionClientStateRequest")] -#[proto_query( - path = "/ibc.core.connection.v1.Query/ConnectionClientState", - response_type = QueryConnectionClientStateResponse -)] -pub struct QueryConnectionClientStateRequest { - /// connection identifier - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, -} -/// QueryConnectionClientStateResponse is the response type for the -/// Query/ConnectionClientState 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 = "/ibc.core.connection.v1.QueryConnectionClientStateResponse")] -pub struct QueryConnectionClientStateResponse { - /// client state associated with the channel - #[prost(message, optional, tag = "1")] - pub identified_client_state: - ::core::option::Option, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, -} -/// QueryConnectionConsensusStateRequest is the request type for the -/// Query/ConnectionConsensusState 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 = "/ibc.core.connection.v1.QueryConnectionConsensusStateRequest")] -#[proto_query( - path = "/ibc.core.connection.v1.Query/ConnectionConsensusState", - response_type = QueryConnectionConsensusStateResponse -)] -pub struct QueryConnectionConsensusStateRequest { - /// connection identifier - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_number: u64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision_height: u64, -} -/// QueryConnectionConsensusStateResponse is the response type for the -/// Query/ConnectionConsensusState 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 = "/ibc.core.connection.v1.QueryConnectionConsensusStateResponse")] -pub struct QueryConnectionConsensusStateResponse { - /// consensus state associated with the channel - #[prost(message, optional, tag = "1")] - pub consensus_state: ::core::option::Option, - /// client ID associated with the consensus state - #[prost(string, tag = "2")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// merkle proof of existence - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof: ::prost::alloc::vec::Vec, - /// height at which the proof was retrieved - #[prost(message, optional, tag = "4")] - pub proof_height: ::core::option::Option, -} -/// QueryConnectionParamsRequest is the request type for the Query/ConnectionParams 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 = "/ibc.core.connection.v1.QueryConnectionParamsRequest")] -#[proto_query( - path = "/ibc.core.connection.v1.Query/ConnectionParams", - response_type = QueryConnectionParamsResponse -)] -pub struct QueryConnectionParamsRequest {} -/// QueryConnectionParamsResponse is the response type for the Query/ConnectionParams 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 = "/ibc.core.connection.v1.QueryConnectionParamsResponse")] -pub struct QueryConnectionParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgConnectionOpenInit defines the msg sent by an account on Chain A to -/// initialize a connection with Chain B. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.MsgConnectionOpenInit")] -pub struct MsgConnectionOpenInit { - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub counterparty: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub version: ::core::option::Option, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub delay_period: u64, - #[prost(string, tag = "5")] - pub signer: ::prost::alloc::string::String, -} -/// MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response -/// 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 = "/ibc.core.connection.v1.MsgConnectionOpenInitResponse")] -pub struct MsgConnectionOpenInitResponse {} -/// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a -/// connection on Chain B. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.MsgConnectionOpenTry")] -pub struct MsgConnectionOpenTry { - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. - #[deprecated] - #[prost(string, tag = "2")] - #[serde(alias = "previous_connectionID")] - pub previous_connection_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub client_state: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub counterparty: ::core::option::Option, - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub delay_period: u64, - #[prost(message, repeated, tag = "6")] - pub counterparty_versions: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "7")] - pub proof_height: ::core::option::Option, - /// proof of the initialization the connection on Chain A: `UNITIALIZED -> - /// INIT` - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_init: ::prost::alloc::vec::Vec, - /// proof of client state included in message - #[prost(bytes = "vec", tag = "9")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_client: ::prost::alloc::vec::Vec, - /// proof of client consensus state - #[prost(bytes = "vec", tag = "10")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_consensus: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "11")] - pub consensus_height: ::core::option::Option, - #[prost(string, tag = "12")] - pub signer: ::prost::alloc::string::String, - /// optional proof data for host state machines that are unable to introspect their own consensus state - #[prost(bytes = "vec", tag = "13")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub host_consensus_state_proof: ::prost::alloc::vec::Vec, -} -/// MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response 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 = "/ibc.core.connection.v1.MsgConnectionOpenTryResponse")] -pub struct MsgConnectionOpenTryResponse {} -/// MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to -/// acknowledge the change of connection state to TRYOPEN on Chain B. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.MsgConnectionOpenAck")] -pub struct MsgConnectionOpenAck { - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "counterparty_connectionID")] - pub counterparty_connection_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub version: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub client_state: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub proof_height: ::core::option::Option, - /// proof of the initialization the connection on Chain B: `UNITIALIZED -> - /// TRYOPEN` - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_try: ::prost::alloc::vec::Vec, - /// proof of client state included in message - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_client: ::prost::alloc::vec::Vec, - /// proof of client consensus state - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_consensus: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "9")] - pub consensus_height: ::core::option::Option, - #[prost(string, tag = "10")] - pub signer: ::prost::alloc::string::String, - /// optional proof data for host state machines that are unable to introspect their own consensus state - #[prost(bytes = "vec", tag = "11")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub host_consensus_state_proof: ::prost::alloc::vec::Vec, -} -/// MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response 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 = "/ibc.core.connection.v1.MsgConnectionOpenAckResponse")] -pub struct MsgConnectionOpenAckResponse {} -/// MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to -/// acknowledge the change of connection state to OPEN on Chain A. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.MsgConnectionOpenConfirm")] -pub struct MsgConnectionOpenConfirm { - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - /// proof for the change of the connection state on Chain A: `INIT -> OPEN` - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proof_ack: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub proof_height: ::core::option::Option, - #[prost(string, tag = "4")] - pub signer: ::prost::alloc::string::String, -} -/// MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm -/// response 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 = "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse")] -pub struct MsgConnectionOpenConfirmResponse {} -/// MsgUpdateParams defines the sdk.Msg type to update the connection parameters. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.connection.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// params defines the connection parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the MsgUpdateParams response 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 = "/ibc.core.connection.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct ConnectionQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ConnectionQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn connection( - &self, - connection_id: ::prost::alloc::string::String, - ) -> Result { - QueryConnectionRequest { connection_id }.query(self.querier) - } - pub fn connections( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryConnectionsRequest { pagination }.query(self.querier) - } - pub fn client_connections( - &self, - client_id: ::prost::alloc::string::String, - ) -> Result { - QueryClientConnectionsRequest { client_id }.query(self.querier) - } - pub fn connection_client_state( - &self, - connection_id: ::prost::alloc::string::String, - ) -> Result { - QueryConnectionClientStateRequest { connection_id }.query(self.querier) - } - pub fn connection_consensus_state( - &self, - connection_id: ::prost::alloc::string::String, - revision_number: u64, - revision_height: u64, - ) -> Result { - QueryConnectionConsensusStateRequest { - connection_id, - revision_number, - revision_height, - } - .query(self.querier) - } - pub fn connection_params( - &self, - ) -> Result { - QueryConnectionParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/core/mod.rs deleted file mode 100644 index 75c439f0..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod channel; -pub mod client; -pub mod commitment; -pub mod connection; -pub mod types; diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/types/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/core/types/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/types/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/types/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/core/types/v1.rs deleted file mode 100644 index 30fc4508..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/core/types/v1.rs +++ /dev/null @@ -1,25 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenesisState defines the ibc module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.core.types.v1.GenesisState")] -pub struct GenesisState { - /// ICS002 - Clients genesis state - #[prost(message, optional, tag = "1")] - pub client_genesis: ::core::option::Option, - /// ICS003 - Connections genesis state - #[prost(message, optional, tag = "2")] - pub connection_genesis: ::core::option::Option, - /// ICS004 - Channel genesis state - #[prost(message, optional, tag = "3")] - pub channel_genesis: ::core::option::Option, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/mod.rs deleted file mode 100644 index 7083bd82..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v2; diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/v2.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/v2.rs deleted file mode 100644 index bfba5dbf..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/localhost/v2.rs +++ /dev/null @@ -1,19 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ClientState defines the 09-localhost client state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.localhost.v2.ClientState")] -pub struct ClientState { - /// the latest block height - #[prost(message, optional, tag = "1")] - pub latest_height: ::core::option::Option, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/mod.rs deleted file mode 100644 index c8725b46..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod localhost; -pub mod solomachine; -pub mod tendermint; -pub mod wasm; diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/mod.rs deleted file mode 100644 index e55f7d1f..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod v2; -pub mod v3; diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v2.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v2.rs deleted file mode 100644 index ef99e51f..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v2.rs +++ /dev/null @@ -1,528 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ClientState defines a solo machine client that tracks the current consensus -/// state and if the client is frozen. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.ClientState")] -pub struct ClientState { - /// latest sequence of the client state - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// frozen sequence of the solo machine - #[prost(bool, tag = "2")] - pub is_frozen: bool, - #[prost(message, optional, tag = "3")] - pub consensus_state: ::core::option::Option, - /// when set to true, will allow governance to update a solo machine client. - /// The client will be unfrozen if it is frozen. - #[prost(bool, tag = "4")] - pub allow_update_after_proposal: bool, -} -/// ConsensusState defines a solo machine consensus state. The sequence of a -/// consensus state is contained in the "height" key used in storing the -/// consensus state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.ConsensusState")] -pub struct ConsensusState { - /// public key of the solo machine - #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option, - /// diversifier allows the same public key to be re-used across different solo - /// machine clients (potentially on different chains) without being considered - /// misbehaviour. - #[prost(string, tag = "2")] - pub diversifier: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// Header defines a solo machine consensus header -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.Header")] -pub struct Header { - /// sequence to update solo machine public key at - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub new_public_key: ::core::option::Option, - #[prost(string, tag = "5")] - pub new_diversifier: ::prost::alloc::string::String, -} -/// Misbehaviour defines misbehaviour for a solo machine which consists -/// of a sequence and two signatures over different messages at that sequence. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.Misbehaviour")] -pub struct Misbehaviour { - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - #[prost(message, optional, tag = "3")] - pub signature_one: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub signature_two: ::core::option::Option, -} -/// SignatureAndData contains a signature and the data signed over to create that -/// signature. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.SignatureAndData")] -pub struct SignatureAndData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - #[prost(enumeration = "DataType", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub data_type: i32, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// TimestampedSignatureData contains the signature data and the timestamp of the -/// signature. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.TimestampedSignatureData")] -pub struct TimestampedSignatureData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature_data: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// SignBytes defines the signed bytes used for signature verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.SignBytes")] -pub struct SignBytes { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, - #[prost(string, tag = "3")] - pub diversifier: ::prost::alloc::string::String, - /// type of the data used - #[prost(enumeration = "DataType", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub data_type: i32, - /// marshaled data - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// HeaderData returns the SignBytes data for update verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.HeaderData")] -pub struct HeaderData { - /// header public key - #[prost(message, optional, tag = "1")] - pub new_pub_key: ::core::option::Option, - /// header diversifier - #[prost(string, tag = "2")] - pub new_diversifier: ::prost::alloc::string::String, -} -/// ClientStateData returns the SignBytes data for client state verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.ClientStateData")] -pub struct ClientStateData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub client_state: ::core::option::Option, -} -/// ConsensusStateData returns the SignBytes data for consensus state -/// verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.ConsensusStateData")] -pub struct ConsensusStateData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub consensus_state: ::core::option::Option, -} -/// ConnectionStateData returns the SignBytes data for connection state -/// verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.ConnectionStateData")] -pub struct ConnectionStateData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub connection: - ::core::option::Option, -} -/// ChannelStateData returns the SignBytes data for channel state -/// verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.ChannelStateData")] -pub struct ChannelStateData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub channel: ::core::option::Option, -} -/// PacketCommitmentData returns the SignBytes data for packet commitment -/// verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.PacketCommitmentData")] -pub struct PacketCommitmentData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub commitment: ::prost::alloc::vec::Vec, -} -/// PacketAcknowledgementData returns the SignBytes data for acknowledgement -/// verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.PacketAcknowledgementData")] -pub struct PacketAcknowledgementData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub acknowledgement: ::prost::alloc::vec::Vec, -} -/// PacketReceiptAbsenceData returns the SignBytes data for -/// packet receipt absence verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.PacketReceiptAbsenceData")] -pub struct PacketReceiptAbsenceData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, -} -/// NextSequenceRecvData returns the SignBytes data for verification of the next -/// sequence to be received. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v2.NextSequenceRecvData")] -pub struct NextSequenceRecvData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_seq_recv: u64, -} -/// DataType defines the type of solo machine proof being created. This is done -/// to preserve uniqueness of different data sign byte encodings. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum DataType { - /// Default State - UninitializedUnspecified = 0, - /// Data type for client state verification - ClientState = 1, - /// Data type for consensus state verification - ConsensusState = 2, - /// Data type for connection state verification - ConnectionState = 3, - /// Data type for channel state verification - ChannelState = 4, - /// Data type for packet commitment verification - PacketCommitment = 5, - /// Data type for packet acknowledgement verification - PacketAcknowledgement = 6, - /// Data type for packet receipt absence verification - PacketReceiptAbsence = 7, - /// Data type for next sequence recv verification - NextSequenceRecv = 8, - /// Data type for header verification - Header = 9, -} -impl DataType { - /// 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 { - DataType::UninitializedUnspecified => "DATA_TYPE_UNINITIALIZED_UNSPECIFIED", - DataType::ClientState => "DATA_TYPE_CLIENT_STATE", - DataType::ConsensusState => "DATA_TYPE_CONSENSUS_STATE", - DataType::ConnectionState => "DATA_TYPE_CONNECTION_STATE", - DataType::ChannelState => "DATA_TYPE_CHANNEL_STATE", - DataType::PacketCommitment => "DATA_TYPE_PACKET_COMMITMENT", - DataType::PacketAcknowledgement => "DATA_TYPE_PACKET_ACKNOWLEDGEMENT", - DataType::PacketReceiptAbsence => "DATA_TYPE_PACKET_RECEIPT_ABSENCE", - DataType::NextSequenceRecv => "DATA_TYPE_NEXT_SEQUENCE_RECV", - DataType::Header => "DATA_TYPE_HEADER", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "DATA_TYPE_UNINITIALIZED_UNSPECIFIED" => Some(Self::UninitializedUnspecified), - "DATA_TYPE_CLIENT_STATE" => Some(Self::ClientState), - "DATA_TYPE_CONSENSUS_STATE" => Some(Self::ConsensusState), - "DATA_TYPE_CONNECTION_STATE" => Some(Self::ConnectionState), - "DATA_TYPE_CHANNEL_STATE" => Some(Self::ChannelState), - "DATA_TYPE_PACKET_COMMITMENT" => Some(Self::PacketCommitment), - "DATA_TYPE_PACKET_ACKNOWLEDGEMENT" => Some(Self::PacketAcknowledgement), - "DATA_TYPE_PACKET_RECEIPT_ABSENCE" => Some(Self::PacketReceiptAbsence), - "DATA_TYPE_NEXT_SEQUENCE_RECV" => Some(Self::NextSequenceRecv), - "DATA_TYPE_HEADER" => Some(Self::Header), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v3.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v3.rs deleted file mode 100644 index 63b6f467..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/solomachine/v3.rs +++ /dev/null @@ -1,252 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ClientState defines a solo machine client that tracks the current consensus -/// state and if the client is frozen. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.ClientState")] -pub struct ClientState { - /// latest sequence of the client state - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// frozen sequence of the solo machine - #[prost(bool, tag = "2")] - pub is_frozen: bool, - #[prost(message, optional, tag = "3")] - pub consensus_state: ::core::option::Option, -} -/// ConsensusState defines a solo machine consensus state. The sequence of a -/// consensus state is contained in the "height" key used in storing the -/// consensus state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.ConsensusState")] -pub struct ConsensusState { - /// public key of the solo machine - #[prost(message, optional, tag = "1")] - pub public_key: ::core::option::Option, - /// diversifier allows the same public key to be re-used across different solo - /// machine clients (potentially on different chains) without being considered - /// misbehaviour. - #[prost(string, tag = "2")] - pub diversifier: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// Header defines a solo machine consensus header -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.Header")] -pub struct Header { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub new_public_key: ::core::option::Option, - #[prost(string, tag = "4")] - pub new_diversifier: ::prost::alloc::string::String, -} -/// Misbehaviour defines misbehaviour for a solo machine which consists -/// of a sequence and two signatures over different messages at that sequence. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.Misbehaviour")] -pub struct Misbehaviour { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - #[prost(message, optional, tag = "2")] - pub signature_one: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub signature_two: ::core::option::Option, -} -/// SignatureAndData contains a signature and the data signed over to create that -/// signature. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.SignatureAndData")] -pub struct SignatureAndData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// TimestampedSignatureData contains the signature data and the timestamp of the -/// signature. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.TimestampedSignatureData")] -pub struct TimestampedSignatureData { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature_data: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, -} -/// SignBytes defines the signed bytes used for signature verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.SignBytes")] -pub struct SignBytes { - /// the sequence number - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, - /// the proof timestamp - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timestamp: u64, - /// the public key diversifier - #[prost(string, tag = "3")] - pub diversifier: ::prost::alloc::string::String, - /// the standardised path bytes - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub path: ::prost::alloc::vec::Vec, - /// the marshaled data bytes - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// HeaderData returns the SignBytes data for update verification. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.solomachine.v3.HeaderData")] -pub struct HeaderData { - /// header public key - #[prost(message, optional, tag = "1")] - pub new_pub_key: ::core::option::Option, - /// header diversifier - #[prost(string, tag = "2")] - pub new_diversifier: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/v1.rs deleted file mode 100644 index f42c3f3c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/tendermint/v1.rs +++ /dev/null @@ -1,177 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ClientState from Tendermint tracks the current validator set, latest height, -/// and a possible frozen height. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.tendermint.v1.ClientState")] -pub struct ClientState { - #[prost(string, tag = "1")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub trust_level: ::core::option::Option, - /// duration of the period since the LastestTimestamp during which the - /// submitted headers are valid for upgrade - #[prost(message, optional, tag = "3")] - pub trusting_period: ::core::option::Option, - /// duration of the staking unbonding period - #[prost(message, optional, tag = "4")] - pub unbonding_period: ::core::option::Option, - /// defines how much new (untrusted) header's Time can drift into the future. - #[prost(message, optional, tag = "5")] - pub max_clock_drift: ::core::option::Option, - /// Block height when the client was frozen due to a misbehaviour - #[prost(message, optional, tag = "6")] - pub frozen_height: ::core::option::Option, - /// Latest height the client was updated to - #[prost(message, optional, tag = "7")] - pub latest_height: ::core::option::Option, - /// Proof specifications used in verifying counterparty state - #[prost(message, repeated, tag = "8")] - pub proof_specs: - ::prost::alloc::vec::Vec, - /// Path at which next upgraded client will be committed. - /// Each element corresponds to the key for a single CommitmentProof in the - /// chained proof. NOTE: ClientState must stored under - /// `{upgradePath}/{upgradeHeight}/clientState` ConsensusState must be stored - /// under `{upgradepath}/{upgradeHeight}/consensusState` For SDK chains using - /// the default upgrade module, upgrade_path should be []string{"upgrade", - /// "upgradedIBCState"}` - #[prost(string, repeated, tag = "9")] - pub upgrade_path: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// allow_update_after_expiry is deprecated - #[deprecated] - #[prost(bool, tag = "10")] - pub allow_update_after_expiry: bool, - /// allow_update_after_misbehaviour is deprecated - #[deprecated] - #[prost(bool, tag = "11")] - pub allow_update_after_misbehaviour: bool, -} -/// ConsensusState defines the consensus state from Tendermint. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.tendermint.v1.ConsensusState")] -pub struct ConsensusState { - /// timestamp that corresponds to the block height in which the ConsensusState - /// was stored. - #[prost(message, optional, tag = "1")] - pub timestamp: ::core::option::Option, - /// commitment root (i.e app hash) - #[prost(message, optional, tag = "2")] - pub root: ::core::option::Option, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, -} -/// Misbehaviour is a wrapper over two conflicting Headers -/// that implements Misbehaviour interface expected by ICS-02 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.tendermint.v1.Misbehaviour")] -pub struct Misbehaviour { - /// ClientID is deprecated - #[deprecated] - #[prost(string, tag = "1")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub header_1: ::core::option::Option
, - #[prost(message, optional, tag = "3")] - pub header_2: ::core::option::Option
, -} -/// Header defines the Tendermint client consensus Header. -/// It encapsulates all the information necessary to update from a trusted -/// Tendermint ConsensusState. The inclusion of TrustedHeight and -/// TrustedValidators allows this update to process correctly, so long as the -/// ConsensusState for the TrustedHeight exists, this removes race conditions -/// among relayers The SignedHeader and ValidatorSet are the new untrusted update -/// fields for the client. The TrustedHeight is the height of a stored -/// ConsensusState on the client that will be used to verify the new untrusted -/// header. The Trusted ConsensusState must be within the unbonding period of -/// current time in order to correctly verify, and the TrustedValidators must -/// hash to TrustedConsensusState.NextValidatorsHash since that is the last -/// trusted validator set at the TrustedHeight. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.tendermint.v1.Header")] -pub struct Header { - #[prost(message, optional, tag = "1")] - pub signed_header: - ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub validator_set: - ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub trusted_height: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub trusted_validators: - ::core::option::Option, -} -/// Fraction defines the protobuf message type for tmmath.Fraction that only -/// supports positive values. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.tendermint.v1.Fraction")] -pub struct Fraction { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub numerator: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub denominator: u64, -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/v1.rs deleted file mode 100644 index f01d6915..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/lightclients/wasm/v1.rs +++ /dev/null @@ -1,385 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenesisState defines 08-wasm's keeper genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.GenesisState")] -pub struct GenesisState { - /// uploaded light client wasm contracts - #[prost(message, repeated, tag = "1")] - pub contracts: ::prost::alloc::vec::Vec, -} -/// Contract stores contract code -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.Contract")] -pub struct Contract { - /// contract byte code - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub code_bytes: ::prost::alloc::vec::Vec, -} -/// QueryChecksumsRequest is the request type for the Query/Checksums 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 = "/ibc.lightclients.wasm.v1.QueryChecksumsRequest")] -#[proto_query( - path = "/ibc.lightclients.wasm.v1.Query/Checksums", - response_type = QueryChecksumsResponse -)] -pub struct QueryChecksumsRequest { - /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, -} -/// QueryChecksumsResponse is the response type for the Query/Checksums 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 = "/ibc.lightclients.wasm.v1.QueryChecksumsResponse")] -pub struct QueryChecksumsResponse { - /// checksums is a list of the hex encoded checksums of all wasm codes stored. - #[prost(string, repeated, tag = "1")] - pub checksums: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageResponse, - >, -} -/// QueryCodeRequest is the request type for the Query/Code 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 = "/ibc.lightclients.wasm.v1.QueryCodeRequest")] -#[proto_query( - path = "/ibc.lightclients.wasm.v1.Query/Code", - response_type = QueryCodeResponse -)] -pub struct QueryCodeRequest { - /// checksum is a hex encoded string of the code stored. - #[prost(string, tag = "1")] - pub checksum: ::prost::alloc::string::String, -} -/// QueryCodeResponse is the response type for the Query/Code 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 = "/ibc.lightclients.wasm.v1.QueryCodeResponse")] -pub struct QueryCodeResponse { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// MsgStoreCode defines the request type for the StoreCode rpc. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.MsgStoreCode")] -pub struct MsgStoreCode { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// wasm byte code of light client contract. It can be raw or gzip compressed - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub wasm_byte_code: ::prost::alloc::vec::Vec, -} -/// MsgStoreCodeResponse defines the response type for the StoreCode rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.MsgStoreCodeResponse")] -pub struct MsgStoreCodeResponse { - /// checksum is the sha256 hash of the stored code - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub checksum: ::prost::alloc::vec::Vec, -} -/// MsgRemoveChecksum defines the request type for the MsgRemoveChecksum rpc. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.MsgRemoveChecksum")] -pub struct MsgRemoveChecksum { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// checksum is the sha256 hash to be removed from the store - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub checksum: ::prost::alloc::vec::Vec, -} -/// MsgStoreChecksumResponse defines the response type for the StoreCode rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.MsgRemoveChecksumResponse")] -pub struct MsgRemoveChecksumResponse {} -/// MsgMigrateContract defines the request type for the MigrateContract rpc. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.MsgMigrateContract")] -pub struct MsgMigrateContract { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// the client id of the contract - #[prost(string, tag = "2")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - /// checksum is the sha256 hash of the new wasm byte code for the contract - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub checksum: ::prost::alloc::vec::Vec, - /// the json encoded message to be passed to the contract on migration - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub msg: ::prost::alloc::vec::Vec, -} -/// MsgMigrateContractResponse defines the response type for the MigrateContract rpc -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.MsgMigrateContractResponse")] -pub struct MsgMigrateContractResponse {} -/// Wasm light client's Client state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.ClientState")] -pub struct ClientState { - /// bytes encoding the client state of the underlying light client - /// implemented as a Wasm contract. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub checksum: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub latest_height: ::core::option::Option, -} -/// Wasm light client's ConsensusState -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.ConsensusState")] -pub struct ConsensusState { - /// bytes encoding the consensus state of the underlying light client - /// implemented as a Wasm contract. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// Wasm light client message (either header(s) or misbehaviour) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.ClientMessage")] -pub struct ClientMessage { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// Checksums defines a list of all checksums that are stored -/// -/// Deprecated: This message is deprecated in favor of storing the checksums -/// using a Collections.KeySet. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/ibc.lightclients.wasm.v1.Checksums")] -#[deprecated] -pub struct Checksums { - #[prost(bytes = "vec", repeated, tag = "1")] - pub checksums: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -pub struct WasmQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> WasmQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn checksums( - &self, - pagination: ::core::option::Option< - super::super::super::super::cosmos::base::query::v1beta1::PageRequest, - >, - ) -> Result { - QueryChecksumsRequest { pagination }.query(self.querier) - } - pub fn code( - &self, - checksum: ::prost::alloc::string::String, - ) -> Result { - QueryCodeRequest { checksum }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/ibc/mod.rs b/packages/neutron-sdk/src/proto_types/ibc/mod.rs deleted file mode 100644 index c37ae57d..00000000 --- a/packages/neutron-sdk/src/proto_types/ibc/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod applications; -pub mod core; -pub mod lightclients; diff --git a/packages/neutron-sdk/src/proto_types/mod.rs b/packages/neutron-sdk/src/proto_types/mod.rs deleted file mode 100644 index 9f2df66c..00000000 --- a/packages/neutron-sdk/src/proto_types/mod.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub mod capability; -pub mod cosmos; -pub mod cosmwasm; -pub mod feemarket; -pub mod gaia; -pub mod ibc; -pub mod neutron; -pub mod osmosis; -pub mod slinky; -pub mod tendermint; diff --git a/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs deleted file mode 100644 index 19185a55..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs +++ /dev/null @@ -1,297 +0,0 @@ -pub mod v1; -use neutron_std_derive::CosmwasmExt; -/// Failure message contains information about ACK failures and can be used to -/// replay ACK in case of requirement. -/// Note that Failure means that sudo handler to cosmwasm contract failed for -/// some reason -#[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.Failure")] -pub struct Failure { - /// Address of the failed contract - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - /// Id of the failure under specific address - #[prost(uint64, tag = "2")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - /// Serialized MessageSudoCallback with Packet and Ack(if exists) - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub sudo_payload: ::prost::alloc::vec::Vec, - /// Redacted error response of the sudo call. Full error is emitted as an event - #[prost(string, tag = "4")] - pub error: ::prost::alloc::string::String, -} -/// Params defines the parameters for the module. -#[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.Params")] -pub struct Params { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sudo_call_gas_limit: u64, -} -/// GenesisState defines the contractmanager module's genesis state. -#[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.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// List of the contract failures - /// - /// this line is used by starport scaffolding # genesis/proto/state - #[prost(message, repeated, tag = "2")] - pub failures_list: ::prost::alloc::vec::Vec, -} -/// QueryParamsRequest is request type for the Query/Params 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.QueryParamsRequest")] -#[proto_query( - path = "/neutron.contractmanager.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryFailuresRequest 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.QueryFailuresRequest")] -#[proto_query( - 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, -} -/// 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, - /// ID of the failure for the given contract. - #[prost(uint64, tag = "2")] - #[serde(alias = "failureID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub failure_id: u64, -} -/// 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, -} -/// QueryFailuresResponse is response 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.QueryFailuresResponse")] -pub struct QueryFailuresResponse { - #[prost(message, repeated, tag = "1")] - pub failures: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[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.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/contractmanager parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct ContractmanagerQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> ContractmanagerQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn address_failure( - &self, - address: ::prost::alloc::string::String, - failure_id: u64, - ) -> Result { - QueryFailureRequest { - address, - failure_id, - } - .query(self.querier) - } - pub fn address_failures( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryFailuresRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn failures( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryFailuresRequest { - address, - pagination, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/contractmanager/v1.rs b/packages/neutron-sdk/src/proto_types/neutron/contractmanager/v1.rs deleted file mode 100644 index 96ad83a5..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/contractmanager/v1.rs +++ /dev/null @@ -1,42 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Deprecated. Used only for migration purposes. -#[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.v1.Failure")] -pub struct Failure { - /// ChannelId - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - /// Address of the failed contract - #[prost(string, tag = "2")] - pub address: ::prost::alloc::string::String, - /// id of the failure under specific address - #[prost(uint64, tag = "3")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - /// ACK id to restore - #[prost(uint64, tag = "4")] - #[serde(alias = "ackID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub ack_id: u64, - /// Acknowledgement type - #[prost(string, tag = "5")] - pub ack_type: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs deleted file mode 100644 index f22c6ab9..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/cron/mod.rs +++ /dev/null @@ -1,425 +0,0 @@ -pub mod v1; -use neutron_std_derive::CosmwasmExt; -/// Defines the parameters for the module. -#[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.Params")] -pub struct Params { - /// Security address that can remove schedules - #[prost(string, tag = "1")] - pub security_address: ::prost::alloc::string::String, - /// Limit of schedules executed in one block - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub limit: u64, -} -/// Defines the schedule for execution -#[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.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 certain number of blocks, specified in the `period` field - #[prost(message, repeated, tag = "3")] - pub msgs: ::prost::alloc::vec::Vec, - /// 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, - /// 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 execution_stage: i32, -} -/// Defines the contract and the message to pass -#[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.MsgExecuteContract")] -pub struct MsgExecuteContract { - /// The address of the smart contract - #[prost(string, tag = "1")] - pub contract: ::prost::alloc::string::String, - /// JSON encoded message to be passed to the contract - #[prost(string, tag = "2")] - pub msg: ::prost::alloc::string::String, -} -/// Defines the number of current schedules -#[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.ScheduleCount")] -pub struct ScheduleCount { - /// 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, -} -/// 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 ExecutionStage { - /// Execution at the end of the block - EndBlocker = 0, - /// Execution at the beginning of the block - BeginBlocker = 1, -} -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 { - ExecutionStage::EndBlocker => "EXECUTION_STAGE_END_BLOCKER", - ExecutionStage::BeginBlocker => "EXECUTION_STAGE_BEGIN_BLOCKER", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "EXECUTION_STAGE_END_BLOCKER" => Some(Self::EndBlocker), - "EXECUTION_STAGE_BEGIN_BLOCKER" => Some(Self::BeginBlocker), - _ => None, - } - } -} -/// Defines the cron module's genesis state. -#[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.GenesisState")] -pub struct GenesisState { - #[prost(message, repeated, tag = "2")] - pub schedule_list: ::prost::alloc::vec::Vec, - /// this line is used by starport scaffolding # genesis/proto/state - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// The request type for the Query/Params 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.cron.QueryParamsRequest")] -#[proto_query(path = "/neutron.cron.Query/Params", response_type = QueryParamsResponse)] -pub struct QueryParamsRequest {} -/// The response type for the Query/Params 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.cron.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// The request type for the Query/Schedule 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.cron.QueryGetScheduleRequest")] -#[proto_query( - path = "/neutron.cron.Query/Schedule", - response_type = QueryGetScheduleResponse -)] -pub struct QueryGetScheduleRequest { - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, -} -/// The response type for the Query/Params 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.cron.QueryGetScheduleResponse")] -pub struct QueryGetScheduleResponse { - #[prost(message, optional, tag = "1")] - pub schedule: ::core::option::Option, -} -/// The request type for the Query/Schedules 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.cron.QuerySchedulesRequest")] -#[proto_query( - path = "/neutron.cron.Query/Schedules", - response_type = QuerySchedulesResponse -)] -pub struct QuerySchedulesRequest { - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -/// The response type for the Query/Params 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.cron.QuerySchedulesResponse")] -pub struct QuerySchedulesResponse { - #[prost(message, repeated, tag = "1")] - pub schedules: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -/// 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 { - /// The address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// Name of the schedule - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, - /// Period in blocks - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub period: u64, - /// Msgs that will be executed every certain number of blocks, specified in the `period` field - #[prost(message, repeated, tag = "4")] - pub msgs: ::prost::alloc::vec::Vec, - /// 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 execution_stage: i32, -} -/// 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 {} -/// 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 { - /// The address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// Name of the schedule - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -/// 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 {} -/// The MsgUpdateParams request type. -/// -/// Since: 0.47 -#[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.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// The address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// Defines the x/cron parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// Defines the response structure for executing a MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct CronQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> CronQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn schedule( - &self, - name: ::prost::alloc::string::String, - ) -> Result { - QueryGetScheduleRequest { name }.query(self.querier) - } - pub fn schedules( - &self, - pagination: ::core::option::Option, - ) -> Result { - QuerySchedulesRequest { pagination }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs b/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs deleted file mode 100644 index 6776522a..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs +++ /dev/null @@ -1,79 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Defines the schedule for execution -#[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 certain number of blocks, specified in the `period` field - #[prost(message, repeated, tag = "3")] - pub msgs: ::prost::alloc::vec::Vec, - /// 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, -} -/// Defines the contract and the message to pass -#[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 { - /// The address of the smart contract - #[prost(string, tag = "1")] - pub contract: ::prost::alloc::string::String, - /// JSON encoded message to be passed to the contract - #[prost(string, tag = "2")] - pub msg: ::prost::alloc::string::String, -} -/// Defines the number of current schedules -#[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 { - /// 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, -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs deleted file mode 100644 index 007b04f2..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/dex/mod.rs +++ /dev/null @@ -1,2120 +0,0 @@ -pub mod v2; -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.dex.PairID")] -pub struct PairId { - #[prost(string, tag = "1")] - pub token0: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub token1: ::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.dex.TradePairID")] -pub struct TradePairId { - #[prost(string, tag = "2")] - pub maker_denom: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub taker_denom: ::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.dex.PoolReservesKey")] -pub struct PoolReservesKey { - #[prost(message, optional, tag = "1")] - #[serde(alias = "trade_pairID")] - pub trade_pair_id: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index_taker_to_maker: i64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub fee: 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.dex.PoolReserves")] -pub struct PoolReserves { - #[prost(message, optional, tag = "1")] - pub key: ::core::option::Option, - #[prost(string, tag = "2")] - pub reserves_maker_denom: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub price_taker_to_maker: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub price_opposite_taker_to_maker: ::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.dex.Pool")] -pub struct Pool { - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - #[prost(message, optional, tag = "2")] - pub lower_tick0: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub upper_tick1: ::core::option::Option, -} -#[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.dex.DepositRecord")] -pub struct DepositRecord { - #[prost(message, optional, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::core::option::Option, - #[prost(string, tag = "2")] - pub shares_owned: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub center_tick_index: i64, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub lower_tick_index: i64, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub upper_tick_index: i64, - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub fee: u64, - #[prost(string, tag = "7")] - pub total_shares: ::prost::alloc::string::String, - #[prost(message, optional, tag = "8")] - pub pool: ::core::option::Option, -} -#[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.dex.LimitOrderTrancheKey")] -pub struct LimitOrderTrancheKey { - #[prost(message, optional, tag = "1")] - #[serde(alias = "trade_pairID")] - pub trade_pair_id: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index_taker_to_maker: i64, - #[prost(string, tag = "3")] - pub tranche_key: ::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.dex.LimitOrderTranche")] -pub struct LimitOrderTranche { - #[prost(message, optional, tag = "1")] - pub key: ::core::option::Option, - #[prost(string, tag = "2")] - pub reserves_maker_denom: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub reserves_taker_denom: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub total_maker_denom: ::prost::alloc::string::String, - /// LimitOrders with expiration_time set are valid as long as blockTime <= expiration_time - #[prost(string, tag = "5")] - pub total_taker_denom: ::prost::alloc::string::String, - /// JIT orders also use expiration_time to handle deletion but represent a special case - /// All JIT orders have a expiration_time of 0 and an exception is made to still treat these orders as live - /// Order deletion still functions the same and the orders will be deleted at the end of the block - #[prost(message, optional, tag = "6")] - pub expiration_time: ::core::option::Option, - #[prost(string, tag = "7")] - pub price_taker_to_maker: ::prost::alloc::string::String, -} -/// Params defines the parameters for the module. -#[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.dex.Params")] -pub struct Params { - #[prost(uint64, repeated, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub fee_tiers: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "3")] - pub paused: bool, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_jits_per_block: u64, - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub good_til_purge_allowance: 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.dex.DepositOptions")] -pub struct DepositOptions { - #[prost(bool, tag = "1")] - pub disable_autoswap: bool, - #[prost(bool, tag = "2")] - pub fail_tx_on_bel: bool, -} -#[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.dex.MsgDeposit")] -pub struct MsgDeposit { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub token_a: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub token_b: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "5")] - pub amounts_a: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(string, repeated, tag = "6")] - pub amounts_b: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(int64, repeated, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub tick_indexes_a_to_b: ::prost::alloc::vec::Vec, - #[prost(uint64, repeated, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub fees: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "9")] - pub options: ::prost::alloc::vec::Vec, -} -#[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.dex.FailedDeposit")] -pub struct FailedDeposit { - #[prost(uint64, tag = "1")] - #[serde(alias = "depositIDx")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub deposit_idx: u64, - #[prost(string, tag = "2")] - pub error: ::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.dex.MsgDepositResponse")] -pub struct MsgDepositResponse { - #[prost(string, repeated, tag = "1")] - pub reserve0_deposited: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(string, repeated, tag = "2")] - pub reserve1_deposited: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(message, repeated, tag = "3")] - pub failed_deposits: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub shares_issued: ::prost::alloc::vec::Vec, -} -#[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.dex.MsgWithdrawal")] -pub struct MsgWithdrawal { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub token_a: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub token_b: ::prost::alloc::string::String, - #[prost(string, repeated, tag = "5")] - pub shares_to_remove: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(int64, repeated, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub tick_indexes_a_to_b: ::prost::alloc::vec::Vec, - #[prost(uint64, repeated, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub fees: ::prost::alloc::vec::Vec, -} -#[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.dex.MsgWithdrawalResponse")] -pub struct MsgWithdrawalResponse { - #[prost(string, tag = "1")] - pub reserve0_withdrawn: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub reserve1_withdrawn: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub shares_burned: ::prost::alloc::vec::Vec, -} -#[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.dex.MsgPlaceLimitOrder")] -pub struct MsgPlaceLimitOrder { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub token_in: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub token_out: ::prost::alloc::string::String, - /// DEPRECATED: tick_index_in_to_out will be removed in future release; limit_sell_price should be used instead. - #[deprecated] - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index_in_to_out: i64, - #[prost(string, tag = "7")] - pub amount_in: ::prost::alloc::string::String, - #[prost(enumeration = "LimitOrderType", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub order_type: i32, - /// expirationTime is only valid iff orderType == GOOD_TIL_TIME. - #[prost(message, optional, tag = "9")] - pub expiration_time: ::core::option::Option, - #[prost(string, tag = "10")] - pub max_amount_out: ::prost::alloc::string::String, - #[prost(string, tag = "11")] - pub limit_sell_price: ::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.dex.MsgPlaceLimitOrderResponse")] -pub struct MsgPlaceLimitOrderResponse { - #[prost(string, tag = "1")] - pub tranche_key: ::prost::alloc::string::String, - /// Total amount of coin used for the limit order - #[prost(message, optional, tag = "2")] - pub coin_in: ::core::option::Option, - /// Total amount of coin received from the taker portion of the limit order - /// This is the amount of coin immediately available in the users account after - /// executing the limit order. It does not include any future proceeds from the - /// maker portion which will have withdrawn in the future - #[prost(message, optional, tag = "3")] - pub taker_coin_out: ::core::option::Option, - /// Total amount of the token in that was immediately swapped for takerOutCoin - #[prost(message, optional, tag = "4")] - pub taker_coin_in: ::core::option::Option, -} -#[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.dex.MsgWithdrawFilledLimitOrder")] -pub struct MsgWithdrawFilledLimitOrder { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub tranche_key: ::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.dex.MsgWithdrawFilledLimitOrderResponse")] -pub struct MsgWithdrawFilledLimitOrderResponse { - /// Total amount of taker reserves that were withdrawn - #[prost(message, optional, tag = "1")] - pub taker_coin_out: ::core::option::Option, - /// Total amount of maker reserves that were withdrawn --only applies to inactive LimitOrders - #[prost(message, optional, tag = "2")] - pub maker_coin_out: ::core::option::Option, -} -#[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.dex.MsgCancelLimitOrder")] -pub struct MsgCancelLimitOrder { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub tranche_key: ::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.dex.MsgCancelLimitOrderResponse")] -pub struct MsgCancelLimitOrderResponse { - /// Total amount of taker reserves that were withdrawn - #[prost(message, optional, tag = "1")] - pub taker_coin_out: ::core::option::Option, - /// Total amount of maker reserves that were canceled - #[prost(message, optional, tag = "2")] - pub maker_coin_out: ::core::option::Option, -} -#[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.dex.MultiHopRoute")] -pub struct MultiHopRoute { - #[prost(string, repeated, tag = "1")] - pub hops: ::prost::alloc::vec::Vec<::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.dex.MsgMultiHopSwap")] -pub struct MsgMultiHopSwap { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub routes: ::prost::alloc::vec::Vec, - #[prost(string, tag = "4")] - pub amount_in: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub exit_limit_price: ::prost::alloc::string::String, - /// If pickBestRoute == true then all routes are run and the route with the - /// best price is chosen otherwise, the first succesful route is used. - #[prost(bool, tag = "6")] - pub pick_best_route: bool, -} -#[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.dex.MsgMultiHopSwapResponse")] -pub struct MsgMultiHopSwapResponse { - #[prost(message, optional, tag = "1")] - pub coin_out: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub route: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub dust: ::prost::alloc::vec::Vec, -} -#[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.dex.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.dex.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum LimitOrderType { - GoodTilCancelled = 0, - FillOrKill = 1, - ImmediateOrCancel = 2, - JustInTime = 3, - GoodTilTime = 4, -} -impl LimitOrderType { - /// 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 { - LimitOrderType::GoodTilCancelled => "GOOD_TIL_CANCELLED", - LimitOrderType::FillOrKill => "FILL_OR_KILL", - LimitOrderType::ImmediateOrCancel => "IMMEDIATE_OR_CANCEL", - LimitOrderType::JustInTime => "JUST_IN_TIME", - LimitOrderType::GoodTilTime => "GOOD_TIL_TIME", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "GOOD_TIL_CANCELLED" => Some(Self::GoodTilCancelled), - "FILL_OR_KILL" => Some(Self::FillOrKill), - "IMMEDIATE_OR_CANCEL" => Some(Self::ImmediateOrCancel), - "JUST_IN_TIME" => Some(Self::JustInTime), - "GOOD_TIL_TIME" => Some(Self::GoodTilTime), - _ => None, - } - } -} -#[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.dex.LimitOrderTrancheUser")] -pub struct LimitOrderTrancheUser { - #[prost(message, optional, tag = "1")] - #[serde(alias = "trade_pairID")] - pub trade_pair_id: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index_taker_to_maker: i64, - #[prost(string, tag = "3")] - pub tranche_key: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub address: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub shares_owned: ::prost::alloc::string::String, - #[prost(string, tag = "6")] - pub shares_withdrawn: ::prost::alloc::string::String, - /// TODO: remove this in next release. It is no longer used - #[prost(string, tag = "7")] - pub shares_cancelled: ::prost::alloc::string::String, - #[prost(enumeration = "LimitOrderType", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub order_type: i32, -} -#[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.dex.PoolMetadata")] -pub struct PoolMetadata { - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick: i64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub fee: u64, - #[prost(message, optional, tag = "4")] - #[serde(alias = "pairID")] - pub pair_id: ::core::option::Option, -} -#[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.dex.TickLiquidity")] -pub struct TickLiquidity { - #[prost(oneof = "tick_liquidity::Liquidity", tags = "1, 2")] - pub liquidity: ::core::option::Option, -} -/// Nested message and enum types in `TickLiquidity`. -pub mod tick_liquidity { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Liquidity { - #[prost(message, tag = "1")] - PoolReserves(super::PoolReserves), - #[prost(message, tag = "2")] - LimitOrderTranche(super::LimitOrderTranche), - } -} -/// GenesisState defines the dex module's genesis state. -#[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.dex.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub tick_liquidity_list: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "3")] - pub inactive_limit_order_tranche_list: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "4")] - pub limit_order_tranche_user_list: ::prost::alloc::vec::Vec, - #[prost(message, repeated, tag = "5")] - pub pool_metadata_list: ::prost::alloc::vec::Vec, - /// this line is used by starport scaffolding # genesis/proto/state - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub pool_count: 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.dex.LimitOrderExpiration")] -pub struct LimitOrderExpiration { - /// see limitOrderTranche.proto for details on expiration_time - #[prost(message, optional, tag = "1")] - pub expiration_time: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tranche_ref: ::prost::alloc::vec::Vec, -} -/// QueryParamsRequest is request type for the Query/Params 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.dex.QueryParamsRequest")] -#[proto_query(path = "/neutron.dex.Query/Params", response_type = QueryParamsResponse)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.dex.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -#[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.dex.QueryGetLimitOrderTrancheUserRequest")] -#[proto_query( - path = "/neutron.dex.Query/LimitOrderTrancheUser", - response_type = QueryGetLimitOrderTrancheUserResponse -)] -pub struct QueryGetLimitOrderTrancheUserRequest { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub tranche_key: ::prost::alloc::string::String, - #[prost(bool, tag = "3")] - pub calc_withdrawable_shares: bool, -} -#[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.dex.QueryGetLimitOrderTrancheUserResponse")] -pub struct QueryGetLimitOrderTrancheUserResponse { - #[prost(message, optional, tag = "1")] - pub limit_order_tranche_user: ::core::option::Option, - #[prost(string, tag = "2")] - pub withdrawable_shares: ::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.dex.QueryAllLimitOrderTrancheUserRequest")] -#[proto_query( - path = "/neutron.dex.Query/LimitOrderTrancheUserAll", - response_type = QueryAllLimitOrderTrancheUserResponse -)] -pub struct QueryAllLimitOrderTrancheUserRequest { - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllLimitOrderTrancheUserResponse")] -pub struct QueryAllLimitOrderTrancheUserResponse { - #[prost(message, repeated, tag = "1")] - pub limit_order_tranche_user: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryGetLimitOrderTrancheRequest")] -#[proto_query( - path = "/neutron.dex.Query/LimitOrderTranche", - response_type = QueryGetLimitOrderTrancheResponse -)] -pub struct QueryGetLimitOrderTrancheRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index: i64, - #[prost(string, tag = "3")] - pub token_in: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub tranche_key: ::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.dex.QueryGetLimitOrderTrancheResponse")] -pub struct QueryGetLimitOrderTrancheResponse { - #[prost(message, optional, tag = "1")] - pub limit_order_tranche: ::core::option::Option, -} -#[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.dex.QueryAllLimitOrderTrancheRequest")] -#[proto_query( - path = "/neutron.dex.Query/LimitOrderTrancheAll", - response_type = QueryAllLimitOrderTrancheResponse -)] -pub struct QueryAllLimitOrderTrancheRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub token_in: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllLimitOrderTrancheResponse")] -pub struct QueryAllLimitOrderTrancheResponse { - #[prost(message, repeated, tag = "1")] - pub limit_order_tranche: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryAllUserDepositsRequest")] -#[proto_query( - path = "/neutron.dex.Query/UserDepositsAll", - response_type = QueryAllUserDepositsResponse -)] -pub struct QueryAllUserDepositsRequest { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, - #[prost(bool, tag = "3")] - pub include_pool_data: bool, -} -#[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.dex.QueryAllUserDepositsResponse")] -pub struct QueryAllUserDepositsResponse { - #[prost(message, repeated, tag = "1")] - pub deposits: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryAllLimitOrderTrancheUserByAddressRequest")] -#[proto_query( - path = "/neutron.dex.Query/LimitOrderTrancheUserAllByAddress", - response_type = QueryAllLimitOrderTrancheUserByAddressResponse -)] -pub struct QueryAllLimitOrderTrancheUserByAddressRequest { - #[prost(string, tag = "1")] - pub address: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllLimitOrderTrancheUserByAddressResponse")] -pub struct QueryAllLimitOrderTrancheUserByAddressResponse { - #[prost(message, repeated, tag = "1")] - pub limit_orders: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryAllTickLiquidityRequest")] -#[proto_query( - path = "/neutron.dex.Query/TickLiquidityAll", - response_type = QueryAllTickLiquidityResponse -)] -pub struct QueryAllTickLiquidityRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub token_in: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllTickLiquidityResponse")] -pub struct QueryAllTickLiquidityResponse { - #[prost(message, repeated, tag = "1")] - pub tick_liquidity: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryGetInactiveLimitOrderTrancheRequest")] -#[proto_query( - path = "/neutron.dex.Query/InactiveLimitOrderTranche", - response_type = QueryGetInactiveLimitOrderTrancheResponse -)] -pub struct QueryGetInactiveLimitOrderTrancheRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub token_in: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index: i64, - #[prost(string, tag = "4")] - pub tranche_key: ::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.dex.QueryGetInactiveLimitOrderTrancheResponse")] -pub struct QueryGetInactiveLimitOrderTrancheResponse { - #[prost(message, optional, tag = "1")] - pub inactive_limit_order_tranche: ::core::option::Option, -} -#[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.dex.QueryAllInactiveLimitOrderTrancheRequest")] -#[proto_query( - path = "/neutron.dex.Query/InactiveLimitOrderTrancheAll", - response_type = QueryAllInactiveLimitOrderTrancheResponse -)] -pub struct QueryAllInactiveLimitOrderTrancheRequest { - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllInactiveLimitOrderTrancheResponse")] -pub struct QueryAllInactiveLimitOrderTrancheResponse { - #[prost(message, repeated, tag = "1")] - pub inactive_limit_order_tranche: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryAllPoolReservesRequest")] -#[proto_query( - path = "/neutron.dex.Query/PoolReservesAll", - response_type = QueryAllPoolReservesResponse -)] -pub struct QueryAllPoolReservesRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub token_in: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllPoolReservesResponse")] -pub struct QueryAllPoolReservesResponse { - #[prost(message, repeated, tag = "1")] - pub pool_reserves: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QueryGetPoolReservesRequest")] -#[proto_query( - path = "/neutron.dex.Query/PoolReserves", - response_type = QueryGetPoolReservesResponse -)] -pub struct QueryGetPoolReservesRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub token_in: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index: i64, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub fee: 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.dex.QueryGetPoolReservesResponse")] -pub struct QueryGetPoolReservesResponse { - #[prost(message, optional, tag = "1")] - pub pool_reserves: ::core::option::Option, -} -#[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.dex.QueryEstimateMultiHopSwapRequest")] -#[proto_query( - path = "/neutron.dex.Query/EstimateMultiHopSwap", - response_type = QueryEstimateMultiHopSwapResponse -)] -pub struct QueryEstimateMultiHopSwapRequest { - /// DEPRECATED: Use QuerySimulateMultiHopSwap - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "3")] - pub routes: ::prost::alloc::vec::Vec, - #[prost(string, tag = "4")] - pub amount_in: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub exit_limit_price: ::prost::alloc::string::String, - /// If pickBestRoute == true then all routes are run and the route with the - /// best price is chosen otherwise, the first succesful route is used. - #[prost(bool, tag = "6")] - pub pick_best_route: bool, -} -#[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.dex.QueryEstimateMultiHopSwapResponse")] -pub struct QueryEstimateMultiHopSwapResponse { - #[prost(message, optional, tag = "1")] - pub coin_out: ::core::option::Option, -} -#[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.dex.QueryEstimatePlaceLimitOrderRequest")] -#[proto_query( - path = "/neutron.dex.Query/EstimatePlaceLimitOrder", - response_type = QueryEstimatePlaceLimitOrderResponse -)] -pub struct QueryEstimatePlaceLimitOrderRequest { - /// DEPRECATED: Use QuerySimulatePlaceLimitOrder - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub token_in: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub token_out: ::prost::alloc::string::String, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index_in_to_out: i64, - #[prost(string, tag = "6")] - pub amount_in: ::prost::alloc::string::String, - #[prost(enumeration = "LimitOrderType", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub order_type: i32, - /// expirationTime is only valid iff orderType == GOOD_TIL_TIME. - #[prost(message, optional, tag = "8")] - pub expiration_time: ::core::option::Option, - #[prost(string, tag = "9")] - pub max_amount_out: ::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.dex.QueryEstimatePlaceLimitOrderResponse")] -pub struct QueryEstimatePlaceLimitOrderResponse { - /// Total amount of coin used for the limit order - /// You can derive makerLimitInCoin using the equation: totalInCoin = - /// swapInCoin + makerLimitInCoin - #[prost(message, optional, tag = "1")] - pub total_in_coin: ::core::option::Option, - /// Total amount of the token in that was immediately swapped for swapOutCoin - #[prost(message, optional, tag = "2")] - pub swap_in_coin: ::core::option::Option, - /// Total amount of coin received from the taker portion of the limit order - /// This is the amount of coin immediately available in the users account after - /// executing the limit order. It does not include any future proceeds from the - /// maker portion which will have withdrawn in the future - #[prost(message, optional, tag = "3")] - pub swap_out_coin: ::core::option::Option, -} -#[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.dex.QueryPoolRequest")] -#[proto_query(path = "/neutron.dex.Query/Pool", response_type = QueryPoolResponse)] -pub struct QueryPoolRequest { - #[prost(string, tag = "1")] - #[serde(alias = "pairID")] - pub pair_id: ::prost::alloc::string::String, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tick_index: i64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub fee: 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.dex.QueryPoolByIDRequest")] -#[proto_query(path = "/neutron.dex.Query/PoolByID", response_type = QueryPoolResponse)] -pub struct QueryPoolByIdRequest { - #[prost(uint64, tag = "1")] - #[serde(alias = "poolID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub pool_id: 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.dex.QueryPoolResponse")] -pub struct QueryPoolResponse { - #[prost(message, optional, tag = "1")] - pub pool: ::core::option::Option, -} -#[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.dex.QueryGetPoolMetadataRequest")] -#[proto_query( - path = "/neutron.dex.Query/PoolMetadata", - response_type = QueryGetPoolMetadataResponse -)] -pub struct QueryGetPoolMetadataRequest { - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: 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.dex.QueryGetPoolMetadataResponse")] -pub struct QueryGetPoolMetadataResponse { - #[prost(message, optional, tag = "1")] - pub pool_metadata: ::core::option::Option, -} -#[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.dex.QueryAllPoolMetadataRequest")] -#[proto_query( - path = "/neutron.dex.Query/PoolMetadataAll", - response_type = QueryAllPoolMetadataResponse -)] -pub struct QueryAllPoolMetadataRequest { - #[prost(message, optional, tag = "1")] - pub pagination: ::core::option::Option, -} -#[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.dex.QueryAllPoolMetadataResponse")] -pub struct QueryAllPoolMetadataResponse { - #[prost(message, repeated, tag = "1")] - pub pool_metadata: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.dex.QuerySimulateDepositRequest")] -#[proto_query( - path = "/neutron.dex.Query/SimulateDeposit", - response_type = QuerySimulateDepositResponse -)] -pub struct QuerySimulateDepositRequest { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, -} -#[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.dex.QuerySimulateDepositResponse")] -pub struct QuerySimulateDepositResponse { - #[prost(message, optional, tag = "1")] - pub resp: ::core::option::Option, -} -#[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.dex.QuerySimulateWithdrawalRequest")] -#[proto_query( - path = "/neutron.dex.Query/SimulateWithdrawal", - response_type = QuerySimulateWithdrawalResponse -)] -pub struct QuerySimulateWithdrawalRequest { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, -} -#[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.dex.QuerySimulateWithdrawalResponse")] -pub struct QuerySimulateWithdrawalResponse { - #[prost(message, optional, tag = "1")] - pub resp: ::core::option::Option, -} -#[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.dex.QuerySimulatePlaceLimitOrderRequest")] -#[proto_query( - path = "/neutron.dex.Query/SimulatePlaceLimitOrder", - response_type = QuerySimulatePlaceLimitOrderResponse -)] -pub struct QuerySimulatePlaceLimitOrderRequest { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, -} -#[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.dex.QuerySimulatePlaceLimitOrderResponse")] -pub struct QuerySimulatePlaceLimitOrderResponse { - #[prost(message, optional, tag = "1")] - pub resp: ::core::option::Option, -} -#[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.dex.QuerySimulateWithdrawFilledLimitOrderRequest")] -#[proto_query( - path = "/neutron.dex.Query/SimulateWithdrawFilledLimitOrder", - response_type = QuerySimulateWithdrawFilledLimitOrderResponse -)] -pub struct QuerySimulateWithdrawFilledLimitOrderRequest { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, -} -#[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.dex.QuerySimulateWithdrawFilledLimitOrderResponse")] -pub struct QuerySimulateWithdrawFilledLimitOrderResponse { - #[prost(message, optional, tag = "1")] - pub resp: ::core::option::Option, -} -#[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.dex.QuerySimulateCancelLimitOrderRequest")] -#[proto_query( - path = "/neutron.dex.Query/SimulateCancelLimitOrder", - response_type = QuerySimulateCancelLimitOrderResponse -)] -pub struct QuerySimulateCancelLimitOrderRequest { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, -} -#[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.dex.QuerySimulateCancelLimitOrderResponse")] -pub struct QuerySimulateCancelLimitOrderResponse { - #[prost(message, optional, tag = "1")] - pub resp: ::core::option::Option, -} -#[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.dex.QuerySimulateMultiHopSwapRequest")] -#[proto_query( - path = "/neutron.dex.Query/SimulateMultiHopSwap", - response_type = QuerySimulateMultiHopSwapResponse -)] -pub struct QuerySimulateMultiHopSwapRequest { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, -} -#[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.dex.QuerySimulateMultiHopSwapResponse")] -pub struct QuerySimulateMultiHopSwapResponse { - #[prost(message, optional, tag = "1")] - pub resp: ::core::option::Option, -} -pub struct DexQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> DexQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn limit_order_tranche_user( - &self, - address: ::prost::alloc::string::String, - tranche_key: ::prost::alloc::string::String, - calc_withdrawable_shares: bool, - ) -> Result { - QueryGetLimitOrderTrancheUserRequest { - address, - tranche_key, - calc_withdrawable_shares, - } - .query(self.querier) - } - pub fn limit_order_tranche_user_all( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryAllLimitOrderTrancheUserRequest { pagination }.query(self.querier) - } - pub fn limit_order_tranche_user_all_by_address( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryAllLimitOrderTrancheUserByAddressRequest { - address, - pagination, - } - .query(self.querier) - } - pub fn limit_order_tranche( - &self, - pair_id: ::prost::alloc::string::String, - tick_index: i64, - token_in: ::prost::alloc::string::String, - tranche_key: ::prost::alloc::string::String, - ) -> Result { - QueryGetLimitOrderTrancheRequest { - pair_id, - tick_index, - token_in, - tranche_key, - } - .query(self.querier) - } - pub fn limit_order_tranche_all( - &self, - pair_id: ::prost::alloc::string::String, - token_in: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryAllLimitOrderTrancheRequest { - pair_id, - token_in, - pagination, - } - .query(self.querier) - } - pub fn user_deposits_all( - &self, - address: ::prost::alloc::string::String, - pagination: ::core::option::Option, - include_pool_data: bool, - ) -> Result { - QueryAllUserDepositsRequest { - address, - pagination, - include_pool_data, - } - .query(self.querier) - } - pub fn tick_liquidity_all( - &self, - pair_id: ::prost::alloc::string::String, - token_in: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryAllTickLiquidityRequest { - pair_id, - token_in, - pagination, - } - .query(self.querier) - } - pub fn inactive_limit_order_tranche( - &self, - pair_id: ::prost::alloc::string::String, - token_in: ::prost::alloc::string::String, - tick_index: i64, - tranche_key: ::prost::alloc::string::String, - ) -> Result { - QueryGetInactiveLimitOrderTrancheRequest { - pair_id, - token_in, - tick_index, - tranche_key, - } - .query(self.querier) - } - pub fn inactive_limit_order_tranche_all( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryAllInactiveLimitOrderTrancheRequest { pagination }.query(self.querier) - } - pub fn pool_reserves_all( - &self, - pair_id: ::prost::alloc::string::String, - token_in: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryAllPoolReservesRequest { - pair_id, - token_in, - pagination, - } - .query(self.querier) - } - pub fn pool_reserves( - &self, - pair_id: ::prost::alloc::string::String, - token_in: ::prost::alloc::string::String, - tick_index: i64, - fee: u64, - ) -> Result { - QueryGetPoolReservesRequest { - pair_id, - token_in, - tick_index, - fee, - } - .query(self.querier) - } - #[deprecated] - pub fn estimate_multi_hop_swap( - &self, - creator: ::prost::alloc::string::String, - receiver: ::prost::alloc::string::String, - routes: ::prost::alloc::vec::Vec, - amount_in: ::prost::alloc::string::String, - exit_limit_price: ::prost::alloc::string::String, - pick_best_route: bool, - ) -> Result { - QueryEstimateMultiHopSwapRequest { - creator, - receiver, - routes, - amount_in, - exit_limit_price, - pick_best_route, - } - .query(self.querier) - } - #[deprecated] - #[allow(clippy::too_many_arguments)] - pub fn estimate_place_limit_order( - &self, - creator: ::prost::alloc::string::String, - receiver: ::prost::alloc::string::String, - token_in: ::prost::alloc::string::String, - token_out: ::prost::alloc::string::String, - tick_index_in_to_out: i64, - amount_in: ::prost::alloc::string::String, - order_type: i32, - expiration_time: ::core::option::Option, - max_amount_out: ::prost::alloc::string::String, - ) -> Result { - QueryEstimatePlaceLimitOrderRequest { - creator, - receiver, - token_in, - token_out, - tick_index_in_to_out, - amount_in, - order_type, - expiration_time, - max_amount_out, - } - .query(self.querier) - } - pub fn pool( - &self, - pair_id: ::prost::alloc::string::String, - tick_index: i64, - fee: u64, - ) -> Result { - QueryPoolRequest { - pair_id, - tick_index, - fee, - } - .query(self.querier) - } - pub fn pool_by_id(&self, pool_id: u64) -> Result { - QueryPoolByIdRequest { pool_id }.query(self.querier) - } - pub fn pool_metadata( - &self, - id: u64, - ) -> Result { - QueryGetPoolMetadataRequest { id }.query(self.querier) - } - pub fn pool_metadata_all( - &self, - pagination: ::core::option::Option, - ) -> Result { - QueryAllPoolMetadataRequest { pagination }.query(self.querier) - } - pub fn simulate_deposit( - &self, - msg: ::core::option::Option, - ) -> Result { - QuerySimulateDepositRequest { msg }.query(self.querier) - } - pub fn simulate_withdrawal( - &self, - msg: ::core::option::Option, - ) -> Result { - QuerySimulateWithdrawalRequest { msg }.query(self.querier) - } - pub fn simulate_place_limit_order( - &self, - msg: ::core::option::Option, - ) -> Result { - QuerySimulatePlaceLimitOrderRequest { msg }.query(self.querier) - } - pub fn simulate_withdraw_filled_limit_order( - &self, - msg: ::core::option::Option, - ) -> Result { - QuerySimulateWithdrawFilledLimitOrderRequest { msg }.query(self.querier) - } - pub fn simulate_cancel_limit_order( - &self, - msg: ::core::option::Option, - ) -> Result { - QuerySimulateCancelLimitOrderRequest { msg }.query(self.querier) - } - pub fn simulate_multi_hop_swap( - &self, - msg: ::core::option::Option, - ) -> Result { - QuerySimulateMultiHopSwapRequest { msg }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/dex/v2.rs b/packages/neutron-sdk/src/proto_types/neutron/dex/v2.rs deleted file mode 100644 index 9c2b53bd..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/dex/v2.rs +++ /dev/null @@ -1,24 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the parameters for the module. -#[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.dex.v2.Params")] -pub struct Params { - #[prost(uint64, repeated, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub fee_tiers: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub max_true_taker_spread: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/dynamicfees/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/dynamicfees/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/dynamicfees/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/neutron/dynamicfees/v1.rs b/packages/neutron-sdk/src/proto_types/neutron/dynamicfees/v1.rs deleted file mode 100644 index fa818b81..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/dynamicfees/v1.rs +++ /dev/null @@ -1,124 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the parameters for the module. -#[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.dynamicfees.v1.Params")] -pub struct Params { - /// List of asset prices by the NTRN - /// it's used in cooperation with feemarket module - /// ntrn_prices is a data source to convert gas_price from feemarket's base_denom (untrn) - /// into a given asset - #[prost(message, repeated, tag = "1")] - pub ntrn_prices: ::prost::alloc::vec::Vec, -} -/// GenesisState defines the dynamicfees module's genesis state. -#[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.dynamicfees.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryParamsRequest is request type for the Query/Params 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.dynamicfees.v1.QueryParamsRequest")] -#[proto_query( - path = "/neutron.dynamicfees.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.dynamicfees.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgUpdateParams is the MsgUpdateParams 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.dynamicfees.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/dynamicfees parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams 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.dynamicfees.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct DynamicfeesQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> DynamicfeesQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/feeburner.rs b/packages/neutron-sdk/src/proto_types/neutron/feeburner.rs deleted file mode 100644 index 54c92518..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/feeburner.rs +++ /dev/null @@ -1,194 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the parameters for the module. -#[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.feeburner.Params")] -pub struct Params { - /// Defines Neutron denom, which will be burned during fee processing, any - /// other denom will be sent to Treasury - #[prost(string, tag = "1")] - pub neutron_denom: ::prost::alloc::string::String, - /// Deprecated in v0.4.4. Is not used anymore - #[prost(string, tag = "2")] - pub reserve_address: ::prost::alloc::string::String, - /// Defines treasury address - #[prost(string, tag = "3")] - pub treasury_address: ::prost::alloc::string::String, -} -/// TotalBurnedNeutronsAmount defines total amount of burned neutron fees -#[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.feeburner.TotalBurnedNeutronsAmount")] -pub struct TotalBurnedNeutronsAmount { - #[prost(message, optional, tag = "1")] - pub coin: ::core::option::Option, -} -/// GenesisState defines the feeburner module's genesis state. -#[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.feeburner.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// this line is used by starport scaffolding # genesis/proto/state - #[prost(message, optional, tag = "2")] - pub total_burned_neutrons_amount: ::core::option::Option, -} -/// QueryParamsRequest is request type for the Query/Params 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.feeburner.QueryParamsRequest")] -#[proto_query( - path = "/neutron.feeburner.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.feeburner.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryTotalBurnedNeutronsAmountRequest is request type for the -/// Query/QueryTotalBurnedNeutronsAmount 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.feeburner.QueryTotalBurnedNeutronsAmountRequest")] -#[proto_query( - path = "/neutron.feeburner.Query/TotalBurnedNeutronsAmount", - response_type = QueryTotalBurnedNeutronsAmountResponse -)] -pub struct QueryTotalBurnedNeutronsAmountRequest {} -/// QueryTotalBurnedNeutronsAmountResponse is response type for the -/// Query/QueryTotalBurnedNeutronsAmount 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.feeburner.QueryTotalBurnedNeutronsAmountResponse")] -pub struct QueryTotalBurnedNeutronsAmountResponse { - #[prost(message, optional, tag = "1")] - pub total_burned_neutrons_amount: ::core::option::Option, -} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[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.feeburner.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/feeburner parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.feeburner.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct FeeburnerQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> FeeburnerQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn total_burned_neutrons_amount( - &self, - ) -> Result { - QueryTotalBurnedNeutronsAmountRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/feerefunder.rs b/packages/neutron-sdk/src/proto_types/neutron/feerefunder.rs deleted file mode 100644 index af86eedd..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/feerefunder.rs +++ /dev/null @@ -1,257 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Fee defines the ICS29 receive, acknowledgement and timeout fees -#[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.feerefunder.Fee")] -pub struct Fee { - /// the packet receive fee - #[prost(message, repeated, tag = "1")] - pub recv_fee: ::prost::alloc::vec::Vec, - /// the packet acknowledgement fee - #[prost(message, repeated, tag = "2")] - pub ack_fee: ::prost::alloc::vec::Vec, - /// the packet timeout fee - #[prost(message, repeated, tag = "3")] - pub timeout_fee: ::prost::alloc::vec::Vec, -} -#[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.feerefunder.PacketID")] -pub struct PacketId { - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: u64, -} -/// Params defines the parameters for the module. -#[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.feerefunder.Params")] -pub struct Params { - #[prost(message, optional, tag = "1")] - pub min_fee: ::core::option::Option, -} -/// GenesisState defines the fee module's genesis state. -#[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.feerefunder.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// this line is used by starport scaffolding # genesis/proto/state - #[prost(message, repeated, tag = "2")] - pub fee_infos: ::prost::alloc::vec::Vec, -} -#[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.feerefunder.FeeInfo")] -pub struct FeeInfo { - #[prost(string, tag = "1")] - pub payer: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - #[serde(alias = "packetID")] - pub packet_id: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub fee: ::core::option::Option, -} -/// QueryParamsRequest is request type for the Query/Params 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.feerefunder.QueryParamsRequest")] -#[proto_query( - path = "/neutron.feerefunder.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.feerefunder.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -#[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.feerefunder.FeeInfoRequest")] -#[proto_query( - path = "/neutron.feerefunder.Query/FeeInfo", - response_type = FeeInfoResponse -)] -pub struct FeeInfoRequest { - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence: 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.feerefunder.FeeInfoResponse")] -pub struct FeeInfoResponse { - #[prost(message, optional, tag = "1")] - pub fee_info: ::core::option::Option, -} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[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.feerefunder.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/feerefunder parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.feerefunder.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct FeerefunderQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> FeerefunderQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn fee_info( - &self, - channel_id: ::prost::alloc::string::String, - port_id: ::prost::alloc::string::String, - sequence: u64, - ) -> Result { - FeeInfoRequest { - channel_id, - port_id, - sequence, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs b/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs deleted file mode 100644 index bcd9487b..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/interchainqueries.rs +++ /dev/null @@ -1,798 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the parameters for the module. -#[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.interchainqueries.Params")] -pub struct Params { - /// Defines amount of blocks required before query becomes available for - /// removal by anybody - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_submit_timeout: u64, - /// Amount of coins deposited for the query. - #[prost(message, repeated, tag = "2")] - pub query_deposit: ::prost::alloc::vec::Vec, - /// Amount of tx hashes to be removed during a single EndBlock. Can vary to - /// balance between network cleaning speed and EndBlock duration. A zero value - /// means no limit. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub tx_query_removal_limit: u64, - /// Maximum amount of keys in a registered key value query - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_kv_query_keys_count: u64, - /// max_transactions_filters defines maximum allowed amount of tx filters in msgRegisterInterchainQuery - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_transactions_filters: 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.interchainqueries.RegisteredQuery")] -pub struct RegisteredQuery { - /// The unique id of the registered query. - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - /// The address that registered the query. - #[prost(string, tag = "2")] - pub owner: ::prost::alloc::string::String, - /// The query type identifier: `kv` or `tx` now - #[prost(string, tag = "3")] - pub query_type: ::prost::alloc::string::String, - /// The KV-storage keys for which we want to get values from remote chain - #[prost(message, repeated, tag = "4")] - pub keys: ::prost::alloc::vec::Vec, - /// The filter for transaction search ICQ - #[prost(string, tag = "5")] - pub transactions_filter: ::prost::alloc::string::String, - /// The IBC connection ID for getting ConsensusState to verify proofs - #[prost(string, tag = "6")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - /// Parameter that defines how often the query must be updated. - #[prost(uint64, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub update_period: u64, - /// The local chain last block height when the query result was updated. - #[prost(uint64, tag = "8")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_submitted_result_local_height: u64, - /// The remote chain last block height when the query result was updated. - #[prost(message, optional, tag = "9")] - pub last_submitted_result_remote_height: - ::core::option::Option, - /// Amount of coins deposited for the query. - #[prost(message, repeated, tag = "10")] - pub deposit: ::prost::alloc::vec::Vec, - /// Timeout before query becomes available for everybody to remove. - #[prost(uint64, tag = "11")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub submit_timeout: u64, - /// The local chain height when the query was registered. - #[prost(uint64, tag = "12")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub registered_at_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.interchainqueries.KVKey")] -pub struct KvKey { - /// Path (storage prefix) to the storage where you want to read value by key - /// (usually name of cosmos-sdk module: 'staking', 'bank', etc.) - #[prost(string, tag = "1")] - pub path: ::prost::alloc::string::String, - /// Key you want to read from the storage - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, -} -/// GenesisState defines the interchainqueries module's genesis state. -#[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.interchainqueries.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub registered_queries: ::prost::alloc::vec::Vec, -} -#[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.interchainqueries.MsgRegisterInterchainQuery")] -pub struct MsgRegisterInterchainQuery { - /// defines a query type: `kv` or `tx` now - #[prost(string, tag = "1")] - pub query_type: ::prost::alloc::string::String, - /// is used to define KV-storage keys for which we want to get values from - /// remote chain - #[prost(message, repeated, tag = "2")] - pub keys: ::prost::alloc::vec::Vec, - /// is used to define a filter for transaction search ICQ - #[prost(string, tag = "3")] - pub transactions_filter: ::prost::alloc::string::String, - /// is IBC connection ID for getting ConsensusState to verify proofs - #[prost(string, tag = "4")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - /// is used to specify how often (in neutron blocks) the query must be updated - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub update_period: u64, - /// is the signer of the message - #[prost(string, tag = "6")] - pub sender: ::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.interchainqueries.MsgRegisterInterchainQueryResponse")] -pub struct MsgRegisterInterchainQueryResponse { - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: 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.interchainqueries.MsgSubmitQueryResult")] -pub struct MsgSubmitQueryResult { - #[prost(uint64, tag = "1")] - #[serde(alias = "queryID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_id: u64, - #[prost(string, tag = "2")] - pub sender: ::prost::alloc::string::String, - /// is the IBC client ID for an IBC connection between Neutron chain and target - /// chain (where the result was obtained from) - /// Deprecated: populating this field does not make any affect - #[deprecated] - #[prost(string, tag = "3")] - #[serde(alias = "clientID")] - pub client_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "4")] - pub result: ::core::option::Option, -} -#[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.interchainqueries.QueryResult")] -pub struct QueryResult { - #[prost(message, repeated, tag = "1")] - pub kv_results: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub block: ::core::option::Option, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub revision: u64, - #[prost(bool, tag = "5")] - pub allow_kv_callbacks: bool, -} -#[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.interchainqueries.StorageValue")] -pub struct StorageValue { - /// is the substore name (acc, staking, etc.) - #[prost(string, tag = "1")] - pub storage_prefix: ::prost::alloc::string::String, - /// is the key in IAVL store - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - /// is the value in IAVL store - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, - /// is the Merkle Proof which proves existence of key-value pair in IAVL - /// storage - #[prost(message, optional, tag = "4")] - pub proof: ::core::option::Option, -} -#[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.interchainqueries.Block")] -pub struct Block { - /// We need to know block X+1 to verify response of transaction for block X - /// since LastResultsHash is root hash of all results from the txs from the - /// previous block - #[prost(message, optional, tag = "1")] - pub next_block_header: ::core::option::Option, - /// We need to know block X to verify inclusion of transaction for block X - #[prost(message, optional, tag = "2")] - pub header: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub tx: ::core::option::Option, -} -#[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.interchainqueries.TxValue")] -pub struct TxValue { - #[prost(message, optional, tag = "1")] - pub response: ::core::option::Option, - /// is the Merkle Proof which proves existence of response in block with height - /// next_block_header.Height - #[prost(message, optional, tag = "2")] - pub delivery_proof: ::core::option::Option, - /// is the Merkle Proof which proves existence of data in block with height - /// header.Height - #[prost(message, optional, tag = "3")] - pub inclusion_proof: ::core::option::Option, - /// is body of the transaction - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -#[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.interchainqueries.MsgSubmitQueryResultResponse")] -pub struct MsgSubmitQueryResultResponse {} -#[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.interchainqueries.MsgRemoveInterchainQueryRequest")] -pub struct MsgRemoveInterchainQueryRequest { - #[prost(uint64, tag = "1")] - #[serde(alias = "queryID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_id: u64, - /// is the signer of the message - #[prost(string, tag = "2")] - pub sender: ::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.interchainqueries.MsgRemoveInterchainQueryResponse")] -pub struct MsgRemoveInterchainQueryResponse {} -#[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.interchainqueries.MsgUpdateInterchainQueryRequest")] -pub struct MsgUpdateInterchainQueryRequest { - #[prost(uint64, tag = "1")] - #[serde(alias = "queryID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_id: u64, - #[prost(message, repeated, tag = "2")] - pub new_keys: ::prost::alloc::vec::Vec, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub new_update_period: u64, - #[prost(string, tag = "4")] - pub new_transactions_filter: ::prost::alloc::string::String, - /// is the signer of the message - #[prost(string, tag = "5")] - pub sender: ::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.interchainqueries.MsgUpdateInterchainQueryResponse")] -pub struct MsgUpdateInterchainQueryResponse {} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[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.interchainqueries.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/interchainqueries parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.interchainqueries.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -/// QueryParamsRequest is request type for the Query/Params 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.interchainqueries.QueryParamsRequest")] -#[proto_query( - path = "/neutron.interchainqueries.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.interchainqueries.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -#[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.interchainqueries.QueryRegisteredQueriesRequest")] -#[proto_query( - path = "/neutron.interchainqueries.Query/RegisteredQueries", - response_type = QueryRegisteredQueriesResponse -)] -pub struct QueryRegisteredQueriesRequest { - #[prost(string, repeated, tag = "1")] - pub owners: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - #[prost(string, tag = "2")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub pagination: ::core::option::Option, -} -#[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.interchainqueries.QueryRegisteredQueriesResponse")] -pub struct QueryRegisteredQueriesResponse { - #[prost(message, repeated, tag = "1")] - pub registered_queries: ::prost::alloc::vec::Vec, - /// pagination defines the pagination in the response. - #[prost(message, optional, tag = "2")] - pub pagination: - ::core::option::Option, -} -#[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.interchainqueries.QueryRegisteredQueryRequest")] -#[proto_query( - path = "/neutron.interchainqueries.Query/RegisteredQuery", - response_type = QueryRegisteredQueryResponse -)] -pub struct QueryRegisteredQueryRequest { - #[prost(uint64, tag = "1")] - #[serde(alias = "queryID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_id: 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.interchainqueries.QueryRegisteredQueryResponse")] -pub struct QueryRegisteredQueryResponse { - #[prost(message, optional, tag = "1")] - pub registered_query: ::core::option::Option, -} -#[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.interchainqueries.QueryRegisteredQueryResultRequest")] -#[proto_query( - path = "/neutron.interchainqueries.Query/QueryResult", - response_type = QueryRegisteredQueryResultResponse -)] -pub struct QueryRegisteredQueryResultRequest { - #[prost(uint64, tag = "1")] - #[serde(alias = "queryID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub query_id: 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.interchainqueries.QueryRegisteredQueryResultResponse")] -pub struct QueryRegisteredQueryResultResponse { - #[prost(message, optional, tag = "1")] - pub result: ::core::option::Option, -} -#[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.interchainqueries.Transaction")] -pub struct Transaction { - #[prost(uint64, tag = "1")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -#[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.interchainqueries.QueryLastRemoteHeight")] -#[proto_query( - path = "/neutron.interchainqueries.Query/LastRemoteHeight", - response_type = QueryLastRemoteHeightResponse -)] -pub struct QueryLastRemoteHeight { - #[prost(string, tag = "1")] - #[serde(alias = "connectionID")] - pub connection_id: ::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.interchainqueries.QueryLastRemoteHeightResponse")] -pub struct QueryLastRemoteHeightResponse { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, -} -pub struct InterchainqueriesQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> InterchainqueriesQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn registered_queries( - &self, - owners: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - connection_id: ::prost::alloc::string::String, - pagination: ::core::option::Option, - ) -> Result { - QueryRegisteredQueriesRequest { - owners, - connection_id, - pagination, - } - .query(self.querier) - } - pub fn registered_query( - &self, - query_id: u64, - ) -> Result { - QueryRegisteredQueryRequest { query_id }.query(self.querier) - } - pub fn query_result( - &self, - query_id: u64, - ) -> Result { - QueryRegisteredQueryResultRequest { query_id }.query(self.querier) - } - pub fn last_remote_height( - &self, - connection_id: ::prost::alloc::string::String, - ) -> Result { - QueryLastRemoteHeight { connection_id }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs b/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs deleted file mode 100644 index 63d5b3b3..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs +++ /dev/null @@ -1,317 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Params defines the parameters for the module. -#[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.interchaintxs.v1.Params")] -pub struct Params { - /// Defines maximum amount of messages to be passed in MsgSubmitTx - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub msg_submit_tx_max_messages: u64, - /// Defines a minimum fee required to register interchain account - #[prost(message, repeated, tag = "2")] - pub register_fee: ::prost::alloc::vec::Vec, -} -/// GenesisState defines the interchaintxs module's genesis state. -#[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.interchaintxs.v1.GenesisState")] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryParamsRequest is request type for the Query/Params 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.interchaintxs.v1.QueryParamsRequest")] -#[proto_query( - path = "/neutron.interchaintxs.v1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is response type for the Query/Params 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.interchaintxs.v1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params holds all the parameters of this module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -#[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.interchaintxs.v1.QueryInterchainAccountAddressRequest")] -#[proto_query( - path = "/neutron.interchaintxs.v1.Query/InterchainAccountAddress", - response_type = QueryInterchainAccountAddressResponse -)] -pub struct QueryInterchainAccountAddressRequest { - /// owner_address is the owner of the interchain account on the controller - /// chain - #[prost(string, tag = "1")] - pub owner_address: ::prost::alloc::string::String, - /// interchain_account_id is an identifier of your interchain account from - /// which you want to execute msgs - #[prost(string, tag = "2")] - #[serde(alias = "interchain_accountID")] - pub interchain_account_id: ::prost::alloc::string::String, - /// connection_id is an IBC connection identifier between Neutron and remote - /// chain - #[prost(string, tag = "3")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, -} -/// Query response for an interchain account address -#[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.interchaintxs.v1.QueryInterchainAccountAddressResponse")] -pub struct QueryInterchainAccountAddressResponse { - /// The corresponding interchain account address on the host chain - #[prost(string, tag = "1")] - pub interchain_account_address: ::prost::alloc::string::String, -} -/// MsgRegisterInterchainAccount is used to register an account on a remote zone. -#[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.interchaintxs.v1.MsgRegisterInterchainAccount")] -pub struct MsgRegisterInterchainAccount { - #[prost(string, tag = "1")] - pub from_address: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - #[serde(alias = "interchain_accountID")] - pub interchain_account_id: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "4")] - pub register_fee: ::prost::alloc::vec::Vec, - #[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. -#[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.interchaintxs.v1.MsgRegisterInterchainAccountResponse")] -pub struct MsgRegisterInterchainAccountResponse { - #[prost(string, tag = "1")] - #[serde(alias = "channelID")] - pub channel_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - #[serde(alias = "portID")] - pub port_id: ::prost::alloc::string::String, -} -/// MsgSubmitTx defines the payload for Msg/SubmitTx -#[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.interchaintxs.v1.MsgSubmitTx")] -pub struct MsgSubmitTx { - #[prost(string, tag = "1")] - pub from_address: ::prost::alloc::string::String, - /// interchain_account_id is supposed to be the unique identifier, e.g., - /// lido/kava. This allows contracts to have more than one interchain accounts - /// on remote zone This identifier will be a part of the portID that we'll - /// claim our capability for. - #[prost(string, tag = "2")] - #[serde(alias = "interchain_accountID")] - pub interchain_account_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - #[serde(alias = "connectionID")] - pub connection_id: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "4")] - pub msgs: ::prost::alloc::vec::Vec, - #[prost(string, tag = "5")] - pub memo: ::prost::alloc::string::String, - /// timeout in seconds after which the packet times out - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout: u64, - #[prost(message, optional, tag = "7")] - pub fee: ::core::option::Option, -} -/// MsgSubmitTxResponse defines the response for Msg/SubmitTx -#[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.interchaintxs.v1.MsgSubmitTxResponse")] -pub struct MsgSubmitTxResponse { - /// channel's sequence_id for outgoing ibc packet. Unique per a channel. - #[prost(uint64, tag = "1")] - #[serde(alias = "sequenceID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence_id: u64, - /// channel src channel on neutron side transaction was submitted from - #[prost(string, tag = "2")] - pub channel: ::prost::alloc::string::String, -} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[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.interchaintxs.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/interchaintxs parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[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.interchaintxs.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct InterchaintxsQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> InterchaintxsQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn interchain_account_address( - &self, - owner_address: ::prost::alloc::string::String, - interchain_account_id: ::prost::alloc::string::String, - connection_id: ::prost::alloc::string::String, - ) -> Result { - QueryInterchainAccountAddressRequest { - owner_address, - interchain_account_id, - connection_id, - } - .query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/neutron/mod.rs b/packages/neutron-sdk/src/proto_types/neutron/mod.rs deleted file mode 100644 index aa66dd62..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/mod.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub mod contractmanager; -pub mod cron; -pub mod dex; -pub mod dynamicfees; -pub mod feeburner; -pub mod feerefunder; -pub mod interchainqueries; -pub mod interchaintxs; -pub mod transfer; diff --git a/packages/neutron-sdk/src/proto_types/neutron/transfer.rs b/packages/neutron-sdk/src/proto_types/neutron/transfer.rs deleted file mode 100644 index 6d9272da..00000000 --- a/packages/neutron-sdk/src/proto_types/neutron/transfer.rs +++ /dev/null @@ -1,120 +0,0 @@ -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.transfer.MsgTransfer")] -pub struct MsgTransfer { - /// the port on which the packet will be sent - #[prost(string, tag = "1")] - pub source_port: ::prost::alloc::string::String, - /// the channel by which the packet will be sent - #[prost(string, tag = "2")] - pub source_channel: ::prost::alloc::string::String, - /// the tokens to be transferred - #[prost(message, optional, tag = "3")] - pub token: ::core::option::Option, - /// the sender address - #[prost(string, tag = "4")] - pub sender: ::prost::alloc::string::String, - /// the recipient address on the destination chain - #[prost(string, tag = "5")] - pub receiver: ::prost::alloc::string::String, - /// Timeout height relative to the current block height. - /// The timeout is disabled when set to 0. - #[prost(message, optional, tag = "6")] - pub timeout_height: ::core::option::Option, - /// Timeout timestamp in absolute nanoseconds since unix epoch. - /// The timeout is disabled when set to 0. - #[prost(uint64, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub timeout_timestamp: u64, - #[prost(string, tag = "8")] - pub memo: ::prost::alloc::string::String, - #[prost(message, optional, tag = "9")] - pub fee: ::core::option::Option, -} -/// MsgTransferResponse is the modified response type for -/// ibc-go MsgTransfer. -#[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.transfer.MsgTransferResponse")] -pub struct MsgTransferResponse { - /// channel's sequence_id for outgoing ibc packet. Unique per a channel. - #[prost(uint64, tag = "1")] - #[serde(alias = "sequenceID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub sequence_id: u64, - /// channel src channel on neutron side transaction was submitted from - #[prost(string, tag = "2")] - pub channel: ::prost::alloc::string::String, -} -/// MsgUpdateParams is the Msg/UpdateParams 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.transfer.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// signer address - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// params defines the transfer parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams 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.transfer.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -#[allow(dead_code)] -pub struct TransferQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> TransferQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } -} diff --git a/packages/neutron-sdk/src/proto_types/osmosis/mod.rs b/packages/neutron-sdk/src/proto_types/osmosis/mod.rs deleted file mode 100644 index 0996d45e..00000000 --- a/packages/neutron-sdk/src/proto_types/osmosis/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod tokenfactory; diff --git a/packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/mod.rs b/packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/mod.rs deleted file mode 100644 index 8a438a5f..00000000 --- a/packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/mod.rs +++ /dev/null @@ -1,65 +0,0 @@ -pub mod v1beta1; -use neutron_std_derive::CosmwasmExt; -/// WhitelistedHook describes a beforeSendHook which is allowed to be added and executed -/// SetBeforeSendHook can only be called on denoms where the denom creator and -/// code_id for the `contract_addr` match a WhitelistedHook -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.WhitelistedHook")] -pub struct WhitelistedHook { - #[prost(uint64, tag = "1")] - #[serde(alias = "codeID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code_id: u64, - #[prost(string, tag = "2")] - pub denom_creator: ::prost::alloc::string::String, -} -/// Params defines the parameters for the tokenfactory module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.Params")] -pub struct Params { - /// DenomCreationFee defines the fee to be charged on the creation of a new - /// denom. The fee is drawn from the MsgCreateDenom's sender account, and - /// transferred to the community pool. - #[prost(message, repeated, tag = "1")] - pub denom_creation_fee: ::prost::alloc::vec::Vec, - /// DenomCreationGasConsume defines the gas cost for creating a new denom. - /// This is intended as a spam deterrence mechanism. - /// - /// See: - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub denom_creation_gas_consume: u64, - /// FeeCollectorAddress is the address where fees collected from denom creation - /// are sent to - #[prost(string, tag = "3")] - pub fee_collector_address: ::prost::alloc::string::String, - /// whitelisted_hooks is the list of hooks which are allowed to be added and executed - #[prost(message, repeated, tag = "4")] - pub whitelisted_hooks: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/v1beta1.rs b/packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/v1beta1.rs deleted file mode 100644 index a4404833..00000000 --- a/packages/neutron-sdk/src/proto_types/osmosis/tokenfactory/v1beta1.rs +++ /dev/null @@ -1,590 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// DenomAuthorityMetadata specifies metadata for addresses that have specific -/// capabilities over a token factory denom. Right now there is only one Admin -/// permission, but is planned to be extended to the future. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata")] -pub struct DenomAuthorityMetadata { - /// Can be empty for no admin, or a valid osmosis address - #[prost(string, tag = "1")] - pub admin: ::prost::alloc::string::String, -} -/// GenesisState defines the tokenfactory module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.GenesisState")] -pub struct GenesisState { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub factory_denoms: ::prost::alloc::vec::Vec, -} -/// GenesisDenom defines a tokenfactory denom that is defined within genesis -/// state. The structure contains DenomAuthorityMetadata which defines the -/// denom's admin. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.GenesisDenom")] -pub struct GenesisDenom { - #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub authority_metadata: ::core::option::Option, - #[prost(string, tag = "3")] - pub hook_contract_address: ::prost::alloc::string::String, -} -/// Params defines the parameters for the tokenfactory module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.Params")] -pub struct Params { - /// DenomCreationFee defines the fee to be charged on the creation of a new - /// denom. The fee is drawn from the MsgCreateDenom's sender account, and - /// transferred to the community pool. - #[prost(message, repeated, tag = "1")] - pub denom_creation_fee: - ::prost::alloc::vec::Vec, - /// DenomCreationGasConsume defines the gas cost for creating a new denom. - /// This is intended as a spam deterrence mechanism. - /// - /// See: - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub denom_creation_gas_consume: u64, - /// FeeCollectorAddress is the address where fees collected from denom creation - /// are sent to - #[prost(string, tag = "3")] - pub fee_collector_address: ::prost::alloc::string::String, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/osmosis.tokenfactory.v1beta1.QueryParamsRequest")] -#[proto_query( - path = "/osmosis.tokenfactory.v1beta1.Query/Params", - response_type = QueryParamsResponse -)] -pub struct QueryParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/osmosis.tokenfactory.v1beta1.QueryParamsResponse")] -pub struct QueryParamsResponse { - /// params defines the parameters of the module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// QueryDenomAuthorityMetadataRequest defines the request structure for the -/// DenomAuthorityMetadata gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest")] -#[proto_query( - path = "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata", - response_type = QueryDenomAuthorityMetadataResponse -)] -pub struct QueryDenomAuthorityMetadataRequest { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub subdenom: ::prost::alloc::string::String, -} -/// QueryDenomAuthorityMetadataResponse defines the response structure for the -/// DenomAuthorityMetadata gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse")] -pub struct QueryDenomAuthorityMetadataResponse { - #[prost(message, optional, tag = "1")] - pub authority_metadata: ::core::option::Option, -} -/// QueryDenomsFromCreatorRequest defines the request structure for the -/// DenomsFromCreator gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest")] -#[proto_query( - path = "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator", - response_type = QueryDenomsFromCreatorResponse -)] -pub struct QueryDenomsFromCreatorRequest { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, -} -/// QueryDenomsFromCreatorRequest defines the response structure for the -/// DenomsFromCreator gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse")] -pub struct QueryDenomsFromCreatorResponse { - #[prost(string, repeated, tag = "1")] - pub denoms: ::prost::alloc::vec::Vec<::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 = "/osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressRequest")] -#[proto_query( - path = "/osmosis.tokenfactory.v1beta1.Query/BeforeSendHookAddress", - response_type = QueryBeforeSendHookAddressResponse -)] -pub struct QueryBeforeSendHookAddressRequest { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub subdenom: ::prost::alloc::string::String, -} -/// QueryBeforeSendHookAddressResponse defines the response structure for the -/// DenomBeforeSendHook gRPC query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse")] -pub struct QueryBeforeSendHookAddressResponse { - #[prost(string, tag = "1")] - pub contract_addr: ::prost::alloc::string::String, -} -/// MsgCreateDenom defines the message structure for the CreateDenom gRPC service -/// method. It allows an account to create a new denom. It requires a sender -/// address and a sub denomination. The (sender_address, sub_denomination) tuple -/// must be unique and cannot be re-used. -/// -/// The resulting denom created is defined as -/// . The resulting denom's admin is -/// originally set to be the creator, but this can be changed later. The token -/// denom does not indicate the current admin. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgCreateDenom")] -pub struct MsgCreateDenom { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// subdenom can be up to 44 "alphanumeric" characters long. - #[prost(string, tag = "2")] - pub subdenom: ::prost::alloc::string::String, -} -/// MsgCreateDenomResponse is the return value of MsgCreateDenom -/// It returns the full string of the newly created denom -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse")] -pub struct MsgCreateDenomResponse { - #[prost(string, tag = "1")] - pub new_token_denom: ::prost::alloc::string::String, -} -/// MsgMint is the sdk.Msg type for allowing an admin account to mint -/// more of a token. For now, we only support minting to the sender account -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgMint")] -pub struct MsgMint { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub amount: ::core::option::Option, - #[prost(string, tag = "3")] - pub mint_to_address: ::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 = "/osmosis.tokenfactory.v1beta1.MsgMintResponse")] -pub struct MsgMintResponse {} -/// MsgBurn is the sdk.Msg type for allowing an admin account to burn -/// a token. For now, we only support burning from the sender account. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgBurn")] -pub struct MsgBurn { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub amount: ::core::option::Option, - #[prost(string, tag = "3")] - pub burn_from_address: ::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 = "/osmosis.tokenfactory.v1beta1.MsgBurnResponse")] -pub struct MsgBurnResponse {} -/// MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign -/// adminship of a denom to a new account -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgChangeAdmin")] -pub struct MsgChangeAdmin { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub new_admin: ::prost::alloc::string::String, -} -/// MsgChangeAdminResponse defines the response structure for an executed -/// MsgChangeAdmin 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 = "/osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse")] -pub struct MsgChangeAdminResponse {} -/// MsgSetBeforeSendHook is the sdk.Msg type for allowing an admin account to -/// assign a CosmWasm contract to call with a BeforeSend hook -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook")] -pub struct MsgSetBeforeSendHook { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub contract_addr: ::prost::alloc::string::String, -} -/// MsgSetBeforeSendHookResponse defines the response structure for an executed -/// MsgSetBeforeSendHook 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 = "/osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHookResponse")] -pub struct MsgSetBeforeSendHookResponse {} -/// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set -/// the denom's bank metadata -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata")] -pub struct MsgSetDenomMetadata { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub metadata: ::core::option::Option, -} -/// MsgSetDenomMetadataResponse defines the response structure for an executed -/// MsgSetDenomMetadata 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 = "/osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse")] -pub struct MsgSetDenomMetadataResponse {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgForceTransfer")] -pub struct MsgForceTransfer { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - #[prost(message, optional, tag = "2")] - pub amount: ::core::option::Option, - #[prost(string, tag = "3")] - pub transfer_from_address: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub transfer_to_address: ::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 = "/osmosis.tokenfactory.v1beta1.MsgForceTransferResponse")] -pub struct MsgForceTransferResponse {} -/// MsgUpdateParams is the MsgUpdateParams request type. -/// -/// Since: 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// Authority is the address of the governance account. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params defines the x/tokenfactory parameters to update. - /// - /// NOTE: All parameters must be supplied. - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -/// MsgUpdateParamsResponse defines the response structure for executing a -/// MsgUpdateParams message. -/// -/// Since: 0.47 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct TokenfactoryQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> TokenfactoryQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn params(&self) -> Result { - QueryParamsRequest {}.query(self.querier) - } - pub fn denom_authority_metadata( - &self, - creator: ::prost::alloc::string::String, - subdenom: ::prost::alloc::string::String, - ) -> Result { - QueryDenomAuthorityMetadataRequest { creator, subdenom }.query(self.querier) - } - pub fn denoms_from_creator( - &self, - creator: ::prost::alloc::string::String, - ) -> Result { - QueryDenomsFromCreatorRequest { creator }.query(self.querier) - } - pub fn before_send_hook_address( - &self, - creator: ::prost::alloc::string::String, - subdenom: ::prost::alloc::string::String, - ) -> Result { - QueryBeforeSendHookAddressRequest { creator, subdenom }.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/abci/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/abci/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/abci/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/abci/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/abci/v1.rs deleted file mode 100644 index cdf80f5c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/abci/v1.rs +++ /dev/null @@ -1,21 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// OracleVoteExtension defines the vote extension structure for oracle prices. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.abci.v1.OracleVoteExtension")] -pub struct OracleVoteExtension { - /// Prices defines a map of id(CurrencyPair) -> price.Bytes() . i.e. 1 -> - /// 0x123.. (bytes). Notice the `id` function is determined by the - /// `CurrencyPairIDStrategy` used in the VoteExtensionHandler. - #[prost(map = "uint64, bytes", tag = "1")] - pub prices: ::std::collections::HashMap>, -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/alerts/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/alerts/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/alerts/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/alerts/module/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/alerts/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/alerts/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/alerts/module/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/alerts/module/v1.rs deleted file mode 100644 index cf7303a2..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/alerts/module/v1.rs +++ /dev/null @@ -1,21 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the alerts module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.module.v1.Module")] -pub struct Module { - /// Authority defines the custom module authority. The authority will default - /// to the governance module account if not set. If the authority is set, the - /// address provided must be a valid bech-32 address - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/alerts/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/alerts/v1.rs deleted file mode 100644 index 4a53cdac..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/alerts/v1.rs +++ /dev/null @@ -1,576 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Alert defines the basic meta-data necessary for the alerts module to resolve -/// a claim that the price of a CurrencyPair on-chain is deviating from the price -/// off-chain. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.Alert")] -pub struct Alert { - /// height represents the height for which the alert is filed. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - /// signer is the signer of this alert, this is the address that will receive - /// the reward in the case of a positive conclusion, or whose bond will get - /// slashed in the event of a negative conclusion. - #[prost(string, tag = "2")] - pub signer: ::prost::alloc::string::String, - /// currency_pair is the currency-pair that this claim asserts is deviating - /// from the price off-chain. - #[prost(message, optional, tag = "3")] - pub currency_pair: ::core::option::Option, -} -/// AlertStatus contains the module specific state for an alert: Has the alert -/// been concluded? What height was the alert submitted, what height should the -/// alert be purged? -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.AlertStatus")] -pub struct AlertStatus { - /// ConclusionStatus determines whether the alert has been concluded. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub conclusion_status: u64, - /// SubmissionHeight is the height that the alert was submitted in. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub submission_height: u64, - /// SubmissionTimestamp is the block-timestamp of the block that the alert was - /// submitted in (as a UTC value in Unix time). - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub submission_timestamp: u64, - /// PurgeHeight is the height at which the alert should be purged. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub purge_height: u64, -} -/// AlertWithStatus represents a wrapper around the Alert and AlertStatus -/// objects, this is so that the module specific information about Alerts can be -/// packaged together. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.AlertWithStatus")] -pub struct AlertWithStatus { - /// alert is the alert that this status corresponds to. - #[prost(message, optional, tag = "1")] - pub alert: ::core::option::Option, - /// status is the status of the alert. - #[prost(message, optional, tag = "2")] - pub status: ::core::option::Option, -} -/// Signature is a container for a signer address mapped to a signature. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.Signature")] -pub struct Signature { - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, -} -/// MultiSigConcluson defines a conclusion that is accompanied by a set of -/// signatures. The signature is defined over the alert UID, status, OracleData, -/// and PriceBound. The signatures are used to verify that the conclusion is -/// valid. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MultiSigConclusion")] -pub struct MultiSigConclusion { - /// alert is the alert that this conclusion corresponds to. - #[prost(message, optional, tag = "1")] - pub alert: ::core::option::Option, - /// oracle_data is the oracle data that this conclusion references. - #[prost(message, optional, tag = "2")] - pub extended_commit_info: - ::core::option::Option, - /// signatures is a map of signer -> signature. Where the signature is over - /// Alert.UID, PriceBound, the marshalled ExtendedCommitInfo, and status. - #[prost(message, repeated, tag = "3")] - pub signatures: ::prost::alloc::vec::Vec, - /// price-bound is the price bound of the currency-pair off-chain for the - /// designated time-range. - #[prost(message, optional, tag = "4")] - pub price_bound: ::core::option::Option, - /// status is the status of the conclusion. - #[prost(bool, tag = "5")] - pub status: bool, - /// CurrencyPairID is the ID of the currency-pair that this conclusion - /// corresponds to. - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub currency_pair_i_d: u64, -} -/// MultiSigConclusionVerificationParams defines the parameters necessary to -/// verify a MultiSigConclusion. It contains a map between signer and public key. -/// Notice, the public-key (value) are the base-64 encoded bytes of the public -/// key. And the signer (key) is the bech32 encoded address of the signer. -/// Notice, all public keys must be secp256 keys. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MultiSigConclusionVerificationParams")] -pub struct MultiSigConclusionVerificationParams { - /// signers is a map of signer -> public key. - #[prost(message, repeated, tag = "1")] - pub signers: ::prost::alloc::vec::Vec, -} -/// PriceBound represents the bounds of the price of a currency-pair off chain -/// for a designated time-range -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.PriceBound")] -pub struct PriceBound { - #[prost(string, tag = "1")] - pub high: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub low: ::prost::alloc::string::String, -} -/// AlertParams is the set of parameters for the x/Alerts module's Alerting. It -/// defines whether or not Alerts can be submitted, and if so, the minimum -/// bond amount required to submit an Alert. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.AlertParams")] -pub struct AlertParams { - /// Enabled is a boolean defining whether or not Alerts can be submitted - /// to the module - #[prost(bool, tag = "1")] - pub enabled: bool, - /// BondAmount is the minimum amount of bond required to submit an - /// Alert - #[prost(message, optional, tag = "2")] - pub bond_amount: ::core::option::Option, - /// MaxBlockAge defines the maximum age of an Alert before it is pruned, notice - /// this is defined wrt. the height that the Alert references, i.e Alerts are - /// only relevant until Alert.Height + MaxBlockAge is reached. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_block_age: u64, -} -/// PruningParams defines the criterion for pruning Alerts from the state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.PruningParams")] -pub struct PruningParams { - /// Enabled defines whether Alerts are to be pruned - #[prost(bool, tag = "1")] - pub enabled: bool, - /// BlocksToPrune defines the number of blocks until an Alert will be pruned - /// from state, notice this is defined wrt. the current block height, i.e - /// Alerts will be stored in state until current_height + BlocksToPrune is - /// reached. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub blocks_to_prune: u64, -} -/// Params is the set of parameters for the x/Alerts module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.Params")] -pub struct Params { - /// AlertParams is the set of parameters for the x/Alerts module's Alerting. - #[prost(message, optional, tag = "1")] - pub alert_params: ::core::option::Option, - /// ConclusionVerificationParams is the set of parameters for the x/Alerts - /// module's conclusion verification. - #[prost(message, optional, tag = "2")] - pub conclusion_verification_params: ::core::option::Option, - /// PruningParams is the set of parameters for the x/Alerts module's pruning. - #[prost(message, optional, tag = "3")] - pub pruning_params: ::core::option::Option, -} -/// GenesisState is the state that must be provided at genesis. It contains -/// params for the module, and the set initial Alerts. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.GenesisState")] -pub struct GenesisState { - /// Params is the set of x/Alerts parameters - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// Alerts is the set of Alerts that have been submitted to the module - #[prost(message, repeated, tag = "2")] - pub alerts: ::prost::alloc::vec::Vec, -} -/// AlertsRequest is the request type for the Query.Alerts RPC method, the status -/// field indicates whether the request should return only Unconcluded / -/// Concluded Alerts, or all Alerts. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.AlertsRequest")] -#[proto_query(path = "/slinky.alerts.v1.Query/Alerts", response_type = AlertsResponse)] -pub struct AlertsRequest { - #[prost(enumeration = "AlertStatusId", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, -} -/// AlertsResponse is the response type for the Query.Alerts RPC method, it -/// contains the list of Alerts that are being tracked by the alerts module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.AlertsResponse")] -pub struct AlertsResponse { - #[prost(message, repeated, tag = "1")] - pub alerts: ::prost::alloc::vec::Vec, -} -/// ParamsRequest is the request type for the Query.Params 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 = "/slinky.alerts.v1.ParamsRequest")] -#[proto_query(path = "/slinky.alerts.v1.Query/Params", response_type = ParamsResponse)] -pub struct ParamsRequest {} -/// ParamsResponse is the response type for the Query.Params RPC method, it -/// contains the Params of the module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.ParamsResponse")] -pub struct ParamsResponse { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// AlertStatus is the type for the status of an Alert, it can be Unconcluded or -/// Concluded. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum AlertStatusId { - ConclusionStatusUnspecified = 0, - ConclusionStatusUnconcluded = 1, - ConclusionStatusConcluded = 2, -} -impl AlertStatusId { - /// 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 { - AlertStatusId::ConclusionStatusUnspecified => "CONCLUSION_STATUS_UNSPECIFIED", - AlertStatusId::ConclusionStatusUnconcluded => "CONCLUSION_STATUS_UNCONCLUDED", - AlertStatusId::ConclusionStatusConcluded => "CONCLUSION_STATUS_CONCLUDED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "CONCLUSION_STATUS_UNSPECIFIED" => Some(Self::ConclusionStatusUnspecified), - "CONCLUSION_STATUS_UNCONCLUDED" => Some(Self::ConclusionStatusUnconcluded), - "CONCLUSION_STATUS_CONCLUDED" => Some(Self::ConclusionStatusConcluded), - _ => None, - } - } -} -/// ValidatorAlertIncentive defines the incentive strategy to be executed for a -/// validator that has been confirmed to have at fault for an x/alerts alert. -/// This strategy is expected to slash half of the validator's stake. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.ValidatorAlertIncentive")] -pub struct ValidatorAlertIncentive { - /// The validator that has been confirmed to have been at fault for an alert. - #[prost(message, optional, tag = "1")] - pub validator: ::core::option::Option, - /// AlertSigner is the signer of the alert referenced by the conclusion that - /// created this incentive. - #[prost(string, tag = "2")] - pub alert_signer: ::prost::alloc::string::String, - /// AlertHeight is the height at which the infraction occurred - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub alert_height: u64, -} -/// MsgAlert defines a message to create an alert. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MsgAlert")] -pub struct MsgAlert { - /// alert is the alert to be filed - #[prost(message, optional, tag = "1")] - pub alert: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MsgAlertResponse")] -pub struct MsgAlertResponse {} -/// MsgConclusion defines a message carrying a Conclusion made by the SecondTier, -/// which will be used to close an alert. And trigger any ramifications of the -/// conclusion. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MsgConclusion")] -pub struct MsgConclusion { - /// signer is the signer of this transaction (notice, this may not always be a - /// node from the SecondTier) - #[prost(string, tag = "1")] - pub signer: ::prost::alloc::string::String, - /// conclusion is the conclusion to be filed - #[prost(message, optional, tag = "2")] - pub conclusion: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MsgConclusionResponse")] -pub struct MsgConclusionResponse {} -/// MsgUpdateParams defines the message type expected by the UpdateParams rpc. It -/// contains an authority address, and the new Params for the x/alerts module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MsgUpdateParams")] -pub struct MsgUpdateParams { - /// authority is the address of the authority that is submitting the update - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// params is the new set of parameters for the x/alerts module - #[prost(message, optional, tag = "2")] - pub params: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.alerts.v1.MsgUpdateParamsResponse")] -pub struct MsgUpdateParamsResponse {} -pub struct AlertsQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> AlertsQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn alerts(&self, status: i32) -> Result { - AlertsRequest { status }.query(self.querier) - } - pub fn params(&self) -> Result { - ParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/incentives/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/incentives/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/incentives/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/incentives/module/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/incentives/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/incentives/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/incentives/module/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/incentives/module/v1.rs deleted file mode 100644 index 33edfda7..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/incentives/module/v1.rs +++ /dev/null @@ -1,15 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the incentives module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.incentives.module.v1.Module")] -pub struct Module {} diff --git a/packages/neutron-sdk/src/proto_types/slinky/incentives/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/incentives/v1.rs deleted file mode 100644 index 3753eb9c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/incentives/v1.rs +++ /dev/null @@ -1,192 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// BadPriceIncentive is a message that contains the information about a bad -/// price that was submitted by a validator. -/// -/// NOTE: This is an example of a bad price incentive. It is not used in -/// production. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.incentives.v1.BadPriceIncentive")] -pub struct BadPriceIncentive { - /// Validator is the address of the validator that submitted the bad price. - #[prost(string, tag = "1")] - pub validator: ::prost::alloc::string::String, - /// Amount is the amount to slash. - #[prost(string, tag = "2")] - pub amount: ::prost::alloc::string::String, -} -/// GoodPriceIncentive is a message that contains the information about a good -/// price that was submitted by a validator. -/// -/// NOTE: This is an example of a good price incentive. It is not used in -/// production. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.incentives.v1.GoodPriceIncentive")] -pub struct GoodPriceIncentive { - /// Validator is the address of the validator that submitted the good price. - #[prost(string, tag = "1")] - pub validator: ::prost::alloc::string::String, - /// Amount is the amount to reward. - #[prost(string, tag = "2")] - pub amount: ::prost::alloc::string::String, -} -/// GenesisState is the genesis-state for the x/incentives module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.incentives.v1.GenesisState")] -pub struct GenesisState { - /// Registry is a list of incentives by type. The registry defined here - /// should be a subset of the incentive types defined in the incentive - /// module (keeper). - #[prost(message, repeated, tag = "1")] - pub registry: ::prost::alloc::vec::Vec, -} -/// IncentivesByType encapsulates a list of incentives by type. Each of the -/// entries here must correspond to the same incentive type defined here. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.incentives.v1.IncentivesByType")] -pub struct IncentivesByType { - /// IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - /// GoodPriceIncentiveType). - #[prost(string, tag = "1")] - pub incentive_type: ::prost::alloc::string::String, - /// Entries is a list of incentive bytes. - #[prost(bytes = "vec", repeated, tag = "2")] - pub entries: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// GetIncentivesByTypeRequest is the request type for the -/// Query/GetIncentivesByType 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 = "/slinky.incentives.v1.GetIncentivesByTypeRequest")] -#[proto_query( - path = "/slinky.incentives.v1.Query/GetIncentivesByType", - response_type = GetIncentivesByTypeResponse -)] -pub struct GetIncentivesByTypeRequest { - /// IncentiveType is the incentive type i.e. (BadPriceIncentiveType, - /// GoodPriceIncentiveType). - #[prost(string, tag = "1")] - pub incentive_type: ::prost::alloc::string::String, -} -/// GetIncentivesByTypeResponse is the response type for the -/// Query/GetIncentivesByType 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 = "/slinky.incentives.v1.GetIncentivesByTypeResponse")] -pub struct GetIncentivesByTypeResponse { - /// Entries is the list of incentives of the given type. - #[prost(bytes = "vec", repeated, tag = "1")] - pub entries: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// GetAllIncentivesRequest is the request type for the Query/GetAllIncentives -/// 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 = "/slinky.incentives.v1.GetAllIncentivesRequest")] -#[proto_query( - path = "/slinky.incentives.v1.Query/GetAllIncentives", - response_type = GetAllIncentivesResponse -)] -pub struct GetAllIncentivesRequest {} -/// GetAllIncentivesResponse is the response type for the Query/GetAllIncentives -/// 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 = "/slinky.incentives.v1.GetAllIncentivesResponse")] -pub struct GetAllIncentivesResponse { - /// Registry is the list of all incentives, grouped by type. - #[prost(message, repeated, tag = "1")] - pub registry: ::prost::alloc::vec::Vec, -} -pub struct IncentivesQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> IncentivesQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn get_incentives_by_type( - &self, - incentive_type: ::prost::alloc::string::String, - ) -> Result { - GetIncentivesByTypeRequest { incentive_type }.query(self.querier) - } - pub fn get_all_incentives(&self) -> Result { - GetAllIncentivesRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/marketmap/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/marketmap/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/marketmap/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/marketmap/module/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/marketmap/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/marketmap/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/marketmap/module/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/marketmap/module/v1.rs deleted file mode 100644 index c6f0e95e..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/marketmap/module/v1.rs +++ /dev/null @@ -1,25 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the builder module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.module.v1.Module")] -pub struct Module { - /// Authority defines the custom module authority. If not set, defaults to the - /// governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// HooksOrder specifies the order of marketmap hooks and should be a list - /// of module names which provide a marketmap hooks instance. If no order is - /// provided, then hooks will be applied in alphabetical order of module names. - #[prost(string, repeated, tag = "2")] - pub hooks_order: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/marketmap/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/marketmap/v1.rs deleted file mode 100644 index 3664e92f..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/marketmap/v1.rs +++ /dev/null @@ -1,522 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Market encapsulates a Ticker and its provider-specific configuration. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.Market")] -pub struct Market { - /// Ticker represents a price feed for a given asset pair i.e. BTC/USD. The - /// price feed is scaled to a number of decimal places and has a minimum number - /// of providers required to consider the ticker valid. - #[prost(message, optional, tag = "1")] - pub ticker: ::core::option::Option, - /// ProviderConfigs is the list of provider-specific configs for this Market. - #[prost(message, repeated, tag = "2")] - pub provider_configs: ::prost::alloc::vec::Vec, -} -/// Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price -/// feed is scaled to a number of decimal places and has a minimum number of -/// providers required to consider the ticker valid. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.Ticker")] -pub struct Ticker { - /// CurrencyPair is the currency pair for this ticker. - #[prost(message, optional, tag = "1")] - pub currency_pair: ::core::option::Option, - /// Decimals is the number of decimal places for the ticker. The number of - /// decimal places is used to convert the price to a human-readable format. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub decimals: u64, - /// MinProviderCount is the minimum number of providers required to consider - /// the ticker valid. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub min_provider_count: u64, - /// Enabled is the flag that denotes if the Ticker is enabled for price - /// fetching by an oracle. - #[prost(bool, tag = "14")] - pub enabled: bool, - /// MetadataJSON is a string of JSON that encodes any extra configuration - /// for the given ticker. - #[prost(string, tag = "15")] - pub metadata_json: ::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 = "/slinky.marketmap.v1.ProviderConfig")] -pub struct ProviderConfig { - /// Name corresponds to the name of the provider for which the configuration is - /// being set. - #[prost(string, tag = "1")] - pub name: ::prost::alloc::string::String, - /// OffChainTicker is the off-chain representation of the ticker i.e. BTC/USD. - /// The off-chain ticker is unique to a given provider and is used to fetch the - /// price of the ticker from the provider. - #[prost(string, tag = "2")] - pub off_chain_ticker: ::prost::alloc::string::String, - /// NormalizeByPair is the currency pair for this ticker to be normalized by. - /// For example, if the desired Ticker is BTC/USD, this market could be reached - /// using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is - /// optional and nullable. - #[prost(message, optional, tag = "3")] - pub normalize_by_pair: ::core::option::Option, - /// Invert is a boolean indicating if the BASE and QUOTE of the market should - /// be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE - #[prost(bool, tag = "4")] - pub invert: bool, - /// MetadataJSON is a string of JSON that encodes any extra configuration - /// for the given provider config. - #[prost(string, tag = "15")] - pub metadata_json: ::prost::alloc::string::String, -} -/// MarketMap maps ticker strings to their Markets. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MarketMap")] -pub struct MarketMap { - /// Markets is the full list of tickers and their associated configurations - /// to be stored on-chain. - #[prost(map = "string, message", tag = "1")] - pub markets: ::std::collections::HashMap<::prost::alloc::string::String, Market>, -} -/// Params defines the parameters for the x/marketmap module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.Params")] -pub struct Params { - /// MarketAuthorities is the list of authority accounts that are able to - /// control updating the marketmap. - #[prost(string, repeated, tag = "1")] - pub market_authorities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Admin is an address that can remove addresses from the MarketAuthorities - /// list. Only governance can add to the MarketAuthorities or change the Admin. - #[prost(string, tag = "2")] - pub admin: ::prost::alloc::string::String, -} -/// GenesisState defines the x/marketmap module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.GenesisState")] -pub struct GenesisState { - /// MarketMap defines the global set of market configurations for all providers - /// and markets. - #[prost(message, optional, tag = "1")] - pub market_map: ::core::option::Option, - /// LastUpdated is the last block height that the market map was updated. - /// This field can be used as an optimization for clients checking if there - /// is a new update to the map. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_updated: u64, - /// Params are the parameters for the x/marketmap module. - #[prost(message, optional, tag = "3")] - pub params: ::core::option::Option, -} -/// MarketMapRequest is the query request for the MarketMap query. -/// It takes no arguments. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MarketMapRequest")] -#[proto_query( - path = "/slinky.marketmap.v1.Query/MarketMap", - response_type = MarketMapResponse -)] -pub struct MarketMapRequest {} -/// MarketMapResponse is the query response for the MarketMap query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MarketMapResponse")] -pub struct MarketMapResponse { - /// MarketMap defines the global set of market configurations for all providers - /// and markets. - #[prost(message, optional, tag = "1")] - pub market_map: ::core::option::Option, - /// LastUpdated is the last block height that the market map was updated. - /// This field can be used as an optimization for clients checking if there - /// is a new update to the map. - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_updated: u64, - /// ChainId is the chain identifier for the market map. - #[prost(string, tag = "3")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, -} -/// MarketRequest is the query request for the Market query. -/// It takes the currency pair of the market as an argument. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MarketRequest")] -#[proto_query( - path = "/slinky.marketmap.v1.Query/Market", - response_type = MarketResponse -)] -pub struct MarketRequest { - /// CurrencyPair is the currency pair associated with the market being - /// requested. - #[prost(message, optional, tag = "1")] - pub currency_pair: ::core::option::Option, -} -/// MarketResponse is the query response for the Market query. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MarketResponse")] -pub struct MarketResponse { - /// Market is the configuration of a single market to be price-fetched for. - #[prost(message, optional, tag = "1")] - pub market: ::core::option::Option, -} -/// ParamsRequest is the request type for the Query/Params 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 = "/slinky.marketmap.v1.ParamsRequest")] -#[proto_query( - path = "/slinky.marketmap.v1.Query/Params", - response_type = ParamsResponse -)] -pub struct ParamsRequest {} -/// ParamsResponse is the response type for the Query/Params 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 = "/slinky.marketmap.v1.ParamsResponse")] -pub struct ParamsResponse { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// LastUpdatedRequest is the request type for the Query/LastUpdated 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 = "/slinky.marketmap.v1.LastUpdatedRequest")] -#[proto_query( - path = "/slinky.marketmap.v1.Query/LastUpdated", - response_type = LastUpdatedResponse -)] -pub struct LastUpdatedRequest {} -/// LastUpdatedResponse is the response type for the Query/LastUpdated 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 = "/slinky.marketmap.v1.LastUpdatedResponse")] -pub struct LastUpdatedResponse { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_updated: u64, -} -/// MsgCreateMarkets defines a message carrying a payload for creating markets in -/// the x/marketmap module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MsgCreateMarkets")] -pub struct MsgCreateMarkets { - /// Authority is the signer of this transaction. This authority must be - /// authorized by the module to execute the message. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// CreateMarkets is the list of all markets to be created for the given - /// transaction. - #[prost(message, repeated, tag = "2")] - pub create_markets: ::prost::alloc::vec::Vec, -} -/// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MsgCreateMarketsResponse")] -pub struct MsgCreateMarketsResponse {} -/// MsgUpdateMarkets defines a message carrying a payload for updating the -/// x/marketmap module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MsgUpdateMarkets")] -pub struct MsgUpdateMarkets { - /// Authority is the signer of this transaction. This authority must be - /// authorized by the module to execute the message. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// UpdateMarkets is the list of all markets to be updated for the given - /// transaction. - #[prost(message, repeated, tag = "2")] - pub update_markets: ::prost::alloc::vec::Vec, -} -/// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MsgUpdateMarketsResponse")] -pub struct MsgUpdateMarketsResponse {} -/// MsgParams defines the Msg/Params request type. It contains the -/// new parameters for the x/marketmap module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MsgParams")] -pub struct MsgParams { - /// Params defines the new parameters for the x/marketmap module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// Authority defines the authority that is updating the x/marketmap module - /// parameters. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} -/// MsgParamsResponse defines the Msg/Params response 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 = "/slinky.marketmap.v1.MsgParamsResponse")] -pub struct MsgParamsResponse {} -/// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse -/// request type. It contains the new addresses to remove from the list of -/// authorities -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.marketmap.v1.MsgRemoveMarketAuthorities")] -pub struct MsgRemoveMarketAuthorities { - /// RemoveAddresses is the list of addresses to remove. - #[prost(string, repeated, tag = "1")] - pub remove_addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Admin defines the authority that is the x/marketmap - /// Admin account. This account is set in the module parameters. - #[prost(string, tag = "2")] - pub admin: ::prost::alloc::string::String, -} -/// MsgRemoveMarketAuthoritiesResponse defines the -/// Msg/RemoveMarketAuthoritiesResponse response 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 = "/slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")] -pub struct MsgRemoveMarketAuthoritiesResponse {} -pub struct MarketmapQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> MarketmapQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn market_map(&self) -> Result { - MarketMapRequest {}.query(self.querier) - } - pub fn market( - &self, - currency_pair: ::core::option::Option, - ) -> Result { - MarketRequest { currency_pair }.query(self.querier) - } - pub fn last_updated(&self) -> Result { - LastUpdatedRequest {}.query(self.querier) - } - pub fn params(&self) -> Result { - ParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/mod.rs deleted file mode 100644 index a4651eaf..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -pub mod abci; -pub mod alerts; -pub mod incentives; -pub mod marketmap; -pub mod oracle; -pub mod service; -pub mod sla; -pub mod types; diff --git a/packages/neutron-sdk/src/proto_types/slinky/oracle/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/oracle/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/oracle/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/oracle/module/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/oracle/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/oracle/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/oracle/module/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/oracle/module/v1.rs deleted file mode 100644 index 9c8d5f65..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/oracle/module/v1.rs +++ /dev/null @@ -1,20 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the builder module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.module.v1.Module")] -pub struct Module { - /// Authority defines the custom module authority. If not set, defaults to the - /// governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/oracle/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/oracle/v1.rs deleted file mode 100644 index c508ed44..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/oracle/v1.rs +++ /dev/null @@ -1,425 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// QuotePrice is the representation of the aggregated prices for a CurrencyPair, -/// where price represents the price of Base in terms of Quote -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.QuotePrice")] -pub struct QuotePrice { - #[prost(string, tag = "1")] - pub price: ::prost::alloc::string::String, - /// BlockTimestamp tracks the block height associated with this price update. - /// We include block timestamp alongside the price to ensure that smart - /// contracts and applications are not utilizing stale oracle prices - #[prost(message, optional, tag = "2")] - pub block_timestamp: ::core::option::Option, - /// BlockHeight is height of block mentioned above - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_height: u64, -} -/// CurrencyPairState represents the stateful information tracked by the x/oracle -/// module per-currency-pair. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.CurrencyPairState")] -pub struct CurrencyPairState { - /// QuotePrice is the latest price for a currency-pair, notice this value can - /// be null in the case that no price exists for the currency-pair - #[prost(message, optional, tag = "1")] - pub price: ::core::option::Option, - /// Nonce is the number of updates this currency-pair has received - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub nonce: u64, - /// ID is the ID of the CurrencyPair - #[prost(uint64, tag = "3")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, -} -/// CurrencyPairGenesis is the information necessary for initialization of a -/// CurrencyPair. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.CurrencyPairGenesis")] -pub struct CurrencyPairGenesis { - /// The CurrencyPair to be added to module state - #[prost(message, optional, tag = "1")] - pub currency_pair: ::core::option::Option, - /// A genesis price if one exists (note this will be empty, unless it results - /// from forking the state of this module) - #[prost(message, optional, tag = "2")] - pub currency_pair_price: ::core::option::Option, - /// nonce is the nonce (number of updates) for the CP (same case as above, - /// likely 0 unless it results from fork of module) - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub nonce: u64, - /// id is the ID of the CurrencyPair - #[prost(uint64, tag = "4")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, -} -/// GenesisState is the genesis-state for the x/oracle module, it takes a set of -/// predefined CurrencyPairGeneses -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.GenesisState")] -pub struct GenesisState { - /// CurrencyPairGenesis is the set of CurrencyPairGeneses for the module. I.e - /// the starting set of CurrencyPairs for the module + information regarding - /// their latest update. - #[prost(message, repeated, tag = "1")] - pub currency_pair_genesis: ::prost::alloc::vec::Vec, - /// NextID is the next ID to be used for a CurrencyPair - #[prost(uint64, tag = "2")] - #[serde(alias = "nextID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub next_id: 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 = "/slinky.oracle.v1.GetAllCurrencyPairsRequest")] -#[proto_query( - path = "/slinky.oracle.v1.Query/GetAllCurrencyPairs", - response_type = GetAllCurrencyPairsResponse -)] -pub struct GetAllCurrencyPairsRequest {} -/// GetAllCurrencyPairsResponse returns all CurrencyPairs that the module is -/// currently tracking. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.GetAllCurrencyPairsResponse")] -pub struct GetAllCurrencyPairsResponse { - #[prost(message, repeated, tag = "1")] - pub currency_pairs: ::prost::alloc::vec::Vec, -} -/// GetPriceRequest either takes a CurrencyPair, or an identifier for the -/// CurrencyPair in the format base/quote. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.GetPriceRequest")] -#[proto_query( - path = "/slinky.oracle.v1.Query/GetPrice", - response_type = GetPriceResponse -)] -pub struct GetPriceRequest { - /// CurrencyPair represents the pair that the user wishes to query. - #[prost(message, optional, tag = "1")] - pub currency_pair: ::core::option::Option, -} -/// GetPriceResponse is the response from the GetPrice grpc method exposed from -/// the x/oracle query service. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.GetPriceResponse")] -pub struct GetPriceResponse { - /// QuotePrice represents the quote-price for the CurrencyPair given in - /// GetPriceRequest (possibly nil if no update has been made) - #[prost(message, optional, tag = "1")] - pub price: ::core::option::Option, - /// nonce represents the nonce for the CurrencyPair if it exists in state - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub nonce: u64, - /// decimals represents the number of decimals that the quote-price is - /// represented in. For Pairs where ETHEREUM is the quote this will be 18, - /// otherwise it will be 8. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub decimals: u64, - /// ID represents the identifier for the CurrencyPair. - #[prost(uint64, tag = "4")] - #[serde(alias = "ID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub id: u64, -} -/// GetPricesRequest takes an identifier for the CurrencyPair -/// in the format base/quote. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.GetPricesRequest")] -#[proto_query( - path = "/slinky.oracle.v1.Query/GetPrices", - response_type = GetPricesResponse -)] -pub struct GetPricesRequest { - #[prost(string, repeated, tag = "1")] - #[serde(alias = "currency_pairIDs")] - pub currency_pair_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// GetPricesResponse is the response from the GetPrices grpc method exposed from -/// the x/oracle query service. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.GetPricesResponse")] -pub struct GetPricesResponse { - #[prost(message, repeated, tag = "1")] - pub prices: ::prost::alloc::vec::Vec, -} -/// GetCurrencyPairMappingRequest is the GetCurrencyPairMapping 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 = "/slinky.oracle.v1.GetCurrencyPairMappingRequest")] -#[proto_query( - path = "/slinky.oracle.v1.Query/GetCurrencyPairMapping", - response_type = GetCurrencyPairMappingResponse -)] -pub struct GetCurrencyPairMappingRequest {} -/// GetCurrencyPairMappingResponse is the GetCurrencyPairMapping response 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 = "/slinky.oracle.v1.GetCurrencyPairMappingResponse")] -pub struct GetCurrencyPairMappingResponse { - /// currency_pair_mapping is a mapping of the id representing the currency pair - /// to the currency pair itself. - #[prost(map = "uint64, message", tag = "1")] - pub currency_pair_mapping: - ::std::collections::HashMap, -} -/// Given an authority + a set of CurrencyPairs, the x/oracle module will -/// check to see that the authority has permissions to update the set of -/// CurrencyPairs tracked in the oracle, and add the given CurrencyPairs to be -/// tracked in each VoteExtension -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.MsgAddCurrencyPairs")] -pub struct MsgAddCurrencyPairs { - /// authority is the address of the account that is authorized to update the - /// x/oracle's CurrencyPairs - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// set of CurrencyPairs to be added to the module (+ prices if they are to be - /// set) - #[prost(message, repeated, tag = "2")] - pub currency_pairs: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.MsgAddCurrencyPairsResponse")] -pub struct MsgAddCurrencyPairsResponse {} -/// Given an authority + a set of CurrencyPairIDs, the x/oracle module's message -/// service will remove all of the CurrencyPairs identified by each -/// CurrencyPairID in the request from state. Notice, if a given currency-pair -/// does not exist in state, the module ignores that currency-pair and continues -/// removing the rest. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.oracle.v1.MsgRemoveCurrencyPairs")] -pub struct MsgRemoveCurrencyPairs { - /// authority is the address of the account that is authorized to update the - /// x/oracle's CurrencyPairs - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, - /// currency_pair_ids are the stringified representation of a currency-pairs - /// (base/quote) to be removed from the module's state - #[prost(string, repeated, tag = "2")] - #[serde(alias = "currency_pairIDs")] - pub currency_pair_ids: ::prost::alloc::vec::Vec<::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 = "/slinky.oracle.v1.MsgRemoveCurrencyPairsResponse")] -pub struct MsgRemoveCurrencyPairsResponse {} -pub struct OracleQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> OracleQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn get_all_currency_pairs( - &self, - ) -> Result { - GetAllCurrencyPairsRequest {}.query(self.querier) - } - pub fn get_price( - &self, - currency_pair: ::core::option::Option, - ) -> Result { - GetPriceRequest { currency_pair }.query(self.querier) - } - pub fn get_prices( - &self, - currency_pair_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - ) -> Result { - GetPricesRequest { currency_pair_ids }.query(self.querier) - } - pub fn get_currency_pair_mapping( - &self, - ) -> Result { - GetCurrencyPairMappingRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/service/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/service/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/service/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/service/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/service/v1.rs deleted file mode 100644 index 8088343d..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/service/v1.rs +++ /dev/null @@ -1,68 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// QueryPricesRequest defines the request type for the the Prices 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 = "/slinky.service.v1.QueryPricesRequest")] -pub struct QueryPricesRequest {} -/// QueryPricesResponse defines the response type for the Prices 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 = "/slinky.service.v1.QueryPricesResponse")] -pub struct QueryPricesResponse { - /// prices defines the list of prices. - #[prost(map = "string, string", tag = "1")] - pub prices: - ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, - #[prost(message, optional, tag = "2")] - pub timestamp: ::core::option::Option, -} -/// QueryMarketMapRequest defines the request type for the MarketMap 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 = "/slinky.service.v1.QueryMarketMapRequest")] -pub struct QueryMarketMapRequest {} -/// QueryMarketMapResponse defines the response type for the MarketMap 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 = "/slinky.service.v1.QueryMarketMapResponse")] -pub struct QueryMarketMapResponse { - /// market_map defines the current market map configuration. - #[prost(message, optional, tag = "1")] - pub market_map: ::core::option::Option, -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/sla/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/sla/mod.rs deleted file mode 100644 index a8429e39..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/sla/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod module; -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/sla/module/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/sla/module/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/sla/module/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/sla/module/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/sla/module/v1.rs deleted file mode 100644 index 084d0dcd..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/sla/module/v1.rs +++ /dev/null @@ -1,20 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// Module is the config object of the builder module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.module.v1.Module")] -pub struct Module { - /// Authority defines the custom module authority. If not set, defaults to the - /// governance module. - #[prost(string, tag = "1")] - pub authority: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/sla/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/sla/v1.rs deleted file mode 100644 index c6f261f1..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/sla/v1.rs +++ /dev/null @@ -1,396 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// GenesisState defines the sla module's genesis state. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.GenesisState")] -pub struct GenesisState { - /// SLAs are the SLAs that are currently active. - #[prost(message, repeated, tag = "1")] - pub slas: ::prost::alloc::vec::Vec, - /// PrceFeeds are the price feeds that are currently active. - #[prost(message, repeated, tag = "2")] - pub price_feeds: ::prost::alloc::vec::Vec, - /// Params are the parameters for the sla module. - #[prost(message, optional, tag = "3")] - pub params: ::core::option::Option, -} -/// Params defines the parameters for the sla module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.Params")] -pub struct Params { - /// Enabled is a flag to enable or disable the sla module. - #[prost(bool, tag = "1")] - pub enabled: bool, -} -/// PriceFeedSLA defines the the desired SLA for a given set of price feeds. A -/// price feed is defined to be a set of price prices for the same (currency -/// pair, validator). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.PriceFeedSLA")] -pub struct PriceFeedSla { - /// MaximumViableWindow is the maximum time window that we are interested - /// for the SLA. This is used to determine the moving window of blocks that - /// we are interested in. - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub maximum_viable_window: u64, - /// ExpectedUptime is the expected uptime for the given validator and price - /// feed. - #[prost(string, tag = "2")] - pub expected_uptime: ::prost::alloc::string::String, - /// SlashConstant is the constant by which we will multiply the deviation from - /// the expected uptime. - #[prost(string, tag = "3")] - pub slash_constant: ::prost::alloc::string::String, - /// MinimumBlockUpdates is the minimum number of blocks that the - /// validator had to have voted on in the maximum viable window - /// in order to be considered for the SLA. - #[prost(uint64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub minimum_block_updates: u64, - /// Frequency is the frequency at which we will check the SLA. - #[prost(uint64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub frequency: u64, - /// ID is the unique identifier for the SLA. - #[prost(string, tag = "6")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, -} -/// PriceFeed defines the object type that will be utilized to monitor how -/// frequently validators are voting with price updates across the network. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.PriceFeed")] -pub struct PriceFeed { - /// UpdateMap represents the relevant moving window of price feed updates. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub update_map: ::prost::alloc::vec::Vec, - /// InclusionMap represents the relevant moving window of blocks that the - /// validator has voted on. - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub inclusion_map: ::prost::alloc::vec::Vec, - /// Index corresponds to the current index into the bitmap. - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u64, - /// Validator represents the validator that this SLA corresponds to. - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validator: ::prost::alloc::vec::Vec, - /// CurrencyPair represents the currency pair that this SLA corresponds to. - #[prost(message, optional, tag = "5")] - pub currency_pair: ::core::option::Option, - /// MaximumViableWindow represents the maximum number of blocks that can be - /// represented by the bit map. - #[prost(uint64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub maximum_viable_window: u64, - /// ID corresponds to the SLA ID that this price feed corresponds to. - #[prost(string, tag = "7")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, -} -/// QueryAllSLAsRequest is the request type for the Query/GetAllSLAs 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 = "/slinky.sla.v1.GetAllSLAsRequest")] -#[proto_query( - path = "/slinky.sla.v1.Query/GetAllSLAs", - response_type = GetAllSlAsResponse -)] -pub struct GetAllSlAsRequest {} -/// QueryAllSLAsResponse is the response type for the Query/GetAllSLAs 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 = "/slinky.sla.v1.GetAllSLAsResponse")] -pub struct GetAllSlAsResponse { - #[prost(message, repeated, tag = "1")] - pub slas: ::prost::alloc::vec::Vec, -} -/// QueryGetPriceFeedsRequest is the request type for the Query/GetPriceFeeds 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 = "/slinky.sla.v1.GetPriceFeedsRequest")] -#[proto_query( - path = "/slinky.sla.v1.Query/GetPriceFeeds", - response_type = GetPriceFeedsResponse -)] -pub struct GetPriceFeedsRequest { - /// ID defines the SLA to query price feeds for. - #[prost(string, tag = "1")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, -} -/// QueryGetPriceFeedsResponse is the response type for the Query/GetPriceFeeds -/// 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 = "/slinky.sla.v1.GetPriceFeedsResponse")] -pub struct GetPriceFeedsResponse { - /// PriceFeeds defines the price feeds for the given SLA. - #[prost(message, repeated, tag = "1")] - pub price_feeds: ::prost::alloc::vec::Vec, -} -/// QueryParamsRequest is the request type for the Query/Params 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 = "/slinky.sla.v1.ParamsRequest")] -#[proto_query(path = "/slinky.sla.v1.Query/Params", response_type = ParamsResponse)] -pub struct ParamsRequest {} -/// QueryParamsResponse is the response type for the Query/Params 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 = "/slinky.sla.v1.ParamsResponse")] -pub struct ParamsResponse { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, -} -/// MsgAddSLAs defines the Msg/AddSLAs request type. It contains the -/// SLAs to be added to the store. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.MsgAddSLAs")] -pub struct MsgAddSlAs { - /// SLAs defines the SLAs to be added to the store. - #[prost(message, repeated, tag = "1")] - pub slas: ::prost::alloc::vec::Vec, - /// Authority defines the authority that is adding the SLAs. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} -/// MsgAddSLAsResponse defines the Msg/AddSLAs response 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 = "/slinky.sla.v1.MsgAddSLAsResponse")] -pub struct MsgAddSlAsResponse {} -/// MsgRemoveSLAs defines the Msg/RemoveSLAs request type. It contains the -/// IDs of the SLAs to be removed from the store. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.MsgRemoveSLAs")] -pub struct MsgRemoveSlAs { - /// IDs defines the IDs of the SLAs to be removed from the store. - #[prost(string, repeated, tag = "1")] - pub ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Authority defines the authority that is removing the SLAs. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} -/// MsgRemoveSLAsResponse defines the Msg/RemoveSLAs response 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 = "/slinky.sla.v1.MsgRemoveSLAsResponse")] -pub struct MsgRemoveSlAsResponse {} -/// MsgParams defines the Msg/Params request type. It contains the -/// new parameters for the SLA module. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.sla.v1.MsgParams")] -pub struct MsgParams { - /// Params defines the new parameters for the SLA module. - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// Authority defines the authority that is updating the SLA module parameters. - #[prost(string, tag = "2")] - pub authority: ::prost::alloc::string::String, -} -/// MsgParamsResponse defines the Msg/Params response 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 = "/slinky.sla.v1.MsgParamsResponse")] -pub struct MsgParamsResponse {} -pub struct SlaQuerier<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, -} -impl<'a, Q: cosmwasm_std::CustomQuery> SlaQuerier<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - pub fn get_all_sl_as(&self) -> Result { - GetAllSlAsRequest {}.query(self.querier) - } - pub fn get_price_feeds( - &self, - id: ::prost::alloc::string::String, - ) -> Result { - GetPriceFeedsRequest { id }.query(self.querier) - } - pub fn params(&self) -> Result { - ParamsRequest {}.query(self.querier) - } -} diff --git a/packages/neutron-sdk/src/proto_types/slinky/types/mod.rs b/packages/neutron-sdk/src/proto_types/slinky/types/mod.rs deleted file mode 100644 index a3a6d96c..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/types/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod v1; diff --git a/packages/neutron-sdk/src/proto_types/slinky/types/v1.rs b/packages/neutron-sdk/src/proto_types/slinky/types/v1.rs deleted file mode 100644 index 3dbc8f75..00000000 --- a/packages/neutron-sdk/src/proto_types/slinky/types/v1.rs +++ /dev/null @@ -1,21 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// CurrencyPair is the standard representation of a pair of assets, where one -/// (Base) is priced in terms of the other (Quote) -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/slinky.types.v1.CurrencyPair")] -pub struct CurrencyPair { - #[prost(string, tag = "1")] - pub base: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub quote: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/abci.rs b/packages/neutron-sdk/src/proto_types/tendermint/abci.rs deleted file mode 100644 index 10e87795..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/abci.rs +++ /dev/null @@ -1,1677 +0,0 @@ -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 = "/tendermint.abci.Request")] -pub struct Request { - #[prost( - oneof = "request::Value", - tags = "1, 2, 3, 5, 6, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20" - )] - pub value: ::core::option::Option, -} -/// Nested message and enum types in `Request`. -pub mod request { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Value { - #[prost(message, tag = "1")] - Echo(super::RequestEcho), - #[prost(message, tag = "2")] - Flush(super::RequestFlush), - #[prost(message, tag = "3")] - Info(super::RequestInfo), - #[prost(message, tag = "5")] - InitChain(super::RequestInitChain), - #[prost(message, tag = "6")] - Query(super::RequestQuery), - #[prost(message, tag = "8")] - CheckTx(super::RequestCheckTx), - #[prost(message, tag = "11")] - Commit(super::RequestCommit), - #[prost(message, tag = "12")] - ListSnapshots(super::RequestListSnapshots), - #[prost(message, tag = "13")] - OfferSnapshot(super::RequestOfferSnapshot), - #[prost(message, tag = "14")] - LoadSnapshotChunk(super::RequestLoadSnapshotChunk), - #[prost(message, tag = "15")] - ApplySnapshotChunk(super::RequestApplySnapshotChunk), - #[prost(message, tag = "16")] - PrepareProposal(super::RequestPrepareProposal), - #[prost(message, tag = "17")] - ProcessProposal(super::RequestProcessProposal), - #[prost(message, tag = "18")] - ExtendVote(super::RequestExtendVote), - #[prost(message, tag = "19")] - VerifyVoteExtension(super::RequestVerifyVoteExtension), - #[prost(message, tag = "20")] - FinalizeBlock(super::RequestFinalizeBlock), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestEcho")] -pub struct RequestEcho { - #[prost(string, tag = "1")] - pub message: ::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 = "/tendermint.abci.RequestFlush")] -pub struct RequestFlush {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestInfo")] -pub struct RequestInfo { - #[prost(string, tag = "1")] - pub version: ::prost::alloc::string::String, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_version: u64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub p2p_version: u64, - #[prost(string, tag = "4")] - pub abci_version: ::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 = "/tendermint.abci.RequestInitChain")] -pub struct RequestInitChain { - #[prost(message, optional, tag = "1")] - pub time: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub consensus_params: ::core::option::Option, - #[prost(message, repeated, tag = "4")] - pub validators: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_state_bytes: ::prost::alloc::vec::Vec, - #[prost(int64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub initial_height: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestQuery")] -pub struct RequestQuery { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(string, tag = "2")] - pub path: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(bool, tag = "4")] - pub prove: bool, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestCheckTx")] -pub struct RequestCheckTx { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx: ::prost::alloc::vec::Vec, - #[prost(enumeration = "CheckTxType", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestCommit")] -pub struct RequestCommit {} -/// lists available snapshots -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestListSnapshots")] -pub struct RequestListSnapshots {} -/// offers a snapshot to the application -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestOfferSnapshot")] -pub struct RequestOfferSnapshot { - /// snapshot offered by peers - #[prost(message, optional, tag = "1")] - pub snapshot: ::core::option::Option, - /// light client-verified app hash for snapshot height - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, -} -/// loads a snapshot chunk -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestLoadSnapshotChunk")] -pub struct RequestLoadSnapshotChunk { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub chunk: u32, -} -/// Applies a snapshot chunk -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestApplySnapshotChunk")] -pub struct RequestApplySnapshotChunk { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub chunk: ::prost::alloc::vec::Vec, - #[prost(string, tag = "3")] - pub sender: ::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 = "/tendermint.abci.RequestPrepareProposal")] -pub struct RequestPrepareProposal { - /// the modified transactions cannot exceed this size. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_tx_bytes: i64, - /// txs is an array of transactions that will be included in a block, - /// sent to the app for possible modifications. - #[prost(bytes = "vec", repeated, tag = "2")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(message, optional, tag = "3")] - pub local_last_commit: ::core::option::Option, - #[prost(message, repeated, tag = "4")] - pub misbehavior: ::prost::alloc::vec::Vec, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(message, optional, tag = "6")] - pub time: ::core::option::Option, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, - /// address of the public key of the validator proposing the block. - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proposer_address: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestProcessProposal")] -pub struct RequestProcessProposal { - #[prost(bytes = "vec", repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(message, optional, tag = "2")] - pub proposed_last_commit: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub misbehavior: ::prost::alloc::vec::Vec, - /// hash is the merkle root hash of the fields of the proposed block. - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(message, optional, tag = "6")] - pub time: ::core::option::Option, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, - /// address of the public key of the original proposer of the block. - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proposer_address: ::prost::alloc::vec::Vec, -} -/// Extends a vote with application-injected data -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestExtendVote")] -pub struct RequestExtendVote { - /// the hash of the block that this vote may be referring to - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - /// the height of the extended vote - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// info of the block that this vote may be referring to - #[prost(message, optional, tag = "3")] - pub time: ::core::option::Option, - #[prost(bytes = "vec", repeated, tag = "4")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(message, optional, tag = "5")] - pub proposed_last_commit: ::core::option::Option, - #[prost(message, repeated, tag = "6")] - pub misbehavior: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, - /// address of the public key of the original proposer of the block. - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proposer_address: ::prost::alloc::vec::Vec, -} -/// Verify the vote extension -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestVerifyVoteExtension")] -pub struct RequestVerifyVoteExtension { - /// the hash of the block that this received vote corresponds to - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - /// the validator that signed the vote extension - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validator_address: ::prost::alloc::vec::Vec, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub vote_extension: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.RequestFinalizeBlock")] -pub struct RequestFinalizeBlock { - #[prost(bytes = "vec", repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, - #[prost(message, optional, tag = "2")] - pub decided_last_commit: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub misbehavior: ::prost::alloc::vec::Vec, - /// hash is the merkle root hash of the fields of the decided block. - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(message, optional, tag = "6")] - pub time: ::core::option::Option, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, - /// proposer_address is the address of the public key of the original proposer of the block. - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proposer_address: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.Response")] -pub struct Response { - #[prost( - oneof = "response::Value", - tags = "1, 2, 3, 4, 6, 7, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21" - )] - pub value: ::core::option::Option, -} -/// Nested message and enum types in `Response`. -pub mod response { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Value { - #[prost(message, tag = "1")] - Exception(super::ResponseException), - #[prost(message, tag = "2")] - Echo(super::ResponseEcho), - #[prost(message, tag = "3")] - Flush(super::ResponseFlush), - #[prost(message, tag = "4")] - Info(super::ResponseInfo), - #[prost(message, tag = "6")] - InitChain(super::ResponseInitChain), - #[prost(message, tag = "7")] - Query(super::ResponseQuery), - #[prost(message, tag = "9")] - CheckTx(super::ResponseCheckTx), - #[prost(message, tag = "12")] - Commit(super::ResponseCommit), - #[prost(message, tag = "13")] - ListSnapshots(super::ResponseListSnapshots), - #[prost(message, tag = "14")] - OfferSnapshot(super::ResponseOfferSnapshot), - #[prost(message, tag = "15")] - LoadSnapshotChunk(super::ResponseLoadSnapshotChunk), - #[prost(message, tag = "16")] - ApplySnapshotChunk(super::ResponseApplySnapshotChunk), - #[prost(message, tag = "17")] - PrepareProposal(super::ResponsePrepareProposal), - #[prost(message, tag = "18")] - ProcessProposal(super::ResponseProcessProposal), - #[prost(message, tag = "19")] - ExtendVote(super::ResponseExtendVote), - #[prost(message, tag = "20")] - VerifyVoteExtension(super::ResponseVerifyVoteExtension), - #[prost(message, tag = "21")] - FinalizeBlock(super::ResponseFinalizeBlock), - } -} -/// nondeterministic -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseException")] -pub struct ResponseException { - #[prost(string, tag = "1")] - pub error: ::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 = "/tendermint.abci.ResponseEcho")] -pub struct ResponseEcho { - #[prost(string, tag = "1")] - pub message: ::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 = "/tendermint.abci.ResponseFlush")] -pub struct ResponseFlush {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseInfo")] -pub struct ResponseInfo { - #[prost(string, tag = "1")] - pub data: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub version: ::prost::alloc::string::String, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub app_version: u64, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_block_height: i64, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_block_app_hash: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseInitChain")] -pub struct ResponseInitChain { - #[prost(message, optional, tag = "1")] - pub consensus_params: ::core::option::Option, - #[prost(message, repeated, tag = "2")] - pub validators: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseQuery")] -pub struct ResponseQuery { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code: u32, - /// bytes data = 2; // use "value" instead. - /// - /// nondeterministic - #[prost(string, tag = "3")] - pub log: ::prost::alloc::string::String, - /// nondeterministic - #[prost(string, tag = "4")] - pub info: ::prost::alloc::string::String, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: i64, - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub value: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "8")] - pub proof_ops: ::core::option::Option, - #[prost(int64, tag = "9")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(string, tag = "10")] - pub codespace: ::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 = "/tendermint.abci.ResponseCheckTx")] -pub struct ResponseCheckTx { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - /// nondeterministic - #[prost(string, tag = "3")] - pub log: ::prost::alloc::string::String, - /// nondeterministic - #[prost(string, tag = "4")] - pub info: ::prost::alloc::string::String, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_wanted: i64, - #[prost(int64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_used: i64, - #[prost(message, repeated, tag = "7")] - pub events: ::prost::alloc::vec::Vec, - #[prost(string, tag = "8")] - pub codespace: ::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 = "/tendermint.abci.ResponseCommit")] -pub struct ResponseCommit { - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub retain_height: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseListSnapshots")] -pub struct ResponseListSnapshots { - #[prost(message, repeated, tag = "1")] - pub snapshots: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseOfferSnapshot")] -pub struct ResponseOfferSnapshot { - #[prost(enumeration = "response_offer_snapshot::Result", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, -} -/// Nested message and enum types in `ResponseOfferSnapshot`. -pub mod response_offer_snapshot { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] - pub enum Result { - /// Unknown result, abort all snapshot restoration - Unknown = 0, - /// Snapshot accepted, apply chunks - Accept = 1, - /// Abort all snapshot restoration - Abort = 2, - /// Reject this specific snapshot, try others - Reject = 3, - /// Reject all snapshots of this format, try others - RejectFormat = 4, - /// Reject all snapshots from the sender(s), try others - RejectSender = 5, - } - impl Result { - /// 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 { - Result::Unknown => "UNKNOWN", - Result::Accept => "ACCEPT", - Result::Abort => "ABORT", - Result::Reject => "REJECT", - Result::RejectFormat => "REJECT_FORMAT", - Result::RejectSender => "REJECT_SENDER", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "ACCEPT" => Some(Self::Accept), - "ABORT" => Some(Self::Abort), - "REJECT" => Some(Self::Reject), - "REJECT_FORMAT" => Some(Self::RejectFormat), - "REJECT_SENDER" => Some(Self::RejectSender), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseLoadSnapshotChunk")] -pub struct ResponseLoadSnapshotChunk { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub chunk: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseApplySnapshotChunk")] -pub struct ResponseApplySnapshotChunk { - #[prost(enumeration = "response_apply_snapshot_chunk::Result", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub result: i32, - /// Chunks to refetch and reapply - #[prost(uint32, repeated, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub refetch_chunks: ::prost::alloc::vec::Vec, - /// Chunk senders to reject and ban - #[prost(string, repeated, tag = "3")] - pub reject_senders: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// Nested message and enum types in `ResponseApplySnapshotChunk`. -pub mod response_apply_snapshot_chunk { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] - pub enum Result { - /// Unknown result, abort all snapshot restoration - Unknown = 0, - /// Chunk successfully accepted - Accept = 1, - /// Abort all snapshot restoration - Abort = 2, - /// Retry chunk (combine with refetch and reject) - Retry = 3, - /// Retry snapshot (combine with refetch and reject) - RetrySnapshot = 4, - /// Reject this snapshot, try others - RejectSnapshot = 5, - } - impl Result { - /// 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 { - Result::Unknown => "UNKNOWN", - Result::Accept => "ACCEPT", - Result::Abort => "ABORT", - Result::Retry => "RETRY", - Result::RetrySnapshot => "RETRY_SNAPSHOT", - Result::RejectSnapshot => "REJECT_SNAPSHOT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "ACCEPT" => Some(Self::Accept), - "ABORT" => Some(Self::Abort), - "RETRY" => Some(Self::Retry), - "RETRY_SNAPSHOT" => Some(Self::RetrySnapshot), - "REJECT_SNAPSHOT" => Some(Self::RejectSnapshot), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponsePrepareProposal")] -pub struct ResponsePrepareProposal { - #[prost(bytes = "vec", repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseProcessProposal")] -pub struct ResponseProcessProposal { - #[prost(enumeration = "response_process_proposal::ProposalStatus", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, -} -/// Nested message and enum types in `ResponseProcessProposal`. -pub mod response_process_proposal { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] - pub enum ProposalStatus { - Unknown = 0, - Accept = 1, - Reject = 2, - } - impl ProposalStatus { - /// 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 { - ProposalStatus::Unknown => "UNKNOWN", - ProposalStatus::Accept => "ACCEPT", - ProposalStatus::Reject => "REJECT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "ACCEPT" => Some(Self::Accept), - "REJECT" => Some(Self::Reject), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseExtendVote")] -pub struct ResponseExtendVote { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub vote_extension: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseVerifyVoteExtension")] -pub struct ResponseVerifyVoteExtension { - #[prost( - enumeration = "response_verify_vote_extension::VerifyStatus", - tag = "1" - )] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub status: i32, -} -/// Nested message and enum types in `ResponseVerifyVoteExtension`. -pub mod response_verify_vote_extension { - #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] - #[repr(i32)] - #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] - pub enum VerifyStatus { - Unknown = 0, - Accept = 1, - /// Rejecting the vote extension will reject the entire precommit by the sender. - /// Incorrectly implementing this thus has liveness implications as it may affect - /// CometBFT's ability to receive 2/3+ valid votes to finalize the block. - /// Honest nodes should never be rejected. - Reject = 2, - } - impl VerifyStatus { - /// 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 { - VerifyStatus::Unknown => "UNKNOWN", - VerifyStatus::Accept => "ACCEPT", - VerifyStatus::Reject => "REJECT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "ACCEPT" => Some(Self::Accept), - "REJECT" => Some(Self::Reject), - _ => None, - } - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ResponseFinalizeBlock")] -pub struct ResponseFinalizeBlock { - /// set of block events emmitted as part of executing the block - #[prost(message, repeated, tag = "1")] - pub events: ::prost::alloc::vec::Vec, - /// the result of executing each transaction including the events - /// the particular transction emitted. This should match the order - /// of the transactions delivered in the block itself - #[prost(message, repeated, tag = "2")] - pub tx_results: ::prost::alloc::vec::Vec, - /// a list of updates to the validator set. These will reflect the validator set at current height + 2. - #[prost(message, repeated, tag = "3")] - pub validator_updates: ::prost::alloc::vec::Vec, - /// updates to the consensus params, if any. - #[prost(message, optional, tag = "4")] - pub consensus_param_updates: ::core::option::Option, - /// app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was deterministic. It is up to the application to decide which algorithm to use. - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.CommitInfo")] -pub struct CommitInfo { - #[prost(int32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(message, repeated, tag = "2")] - pub votes: ::prost::alloc::vec::Vec, -} -/// ExtendedCommitInfo is similar to CommitInfo except that it is only used in -/// the PrepareProposal request such that CometBFT can provide vote extensions -/// to the application. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ExtendedCommitInfo")] -pub struct ExtendedCommitInfo { - /// The round at which the block proposer decided in the previous height. - #[prost(int32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - /// List of validators' addresses in the last validator set with their voting - /// information, including vote extensions. - #[prost(message, repeated, tag = "2")] - pub votes: ::prost::alloc::vec::Vec, -} -/// Event allows application developers to attach additional information to -/// ResponseFinalizeBlock and ResponseCheckTx. -/// Later, transactions may be queried using these events. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.Event")] -pub struct Event { - #[prost(string, tag = "1")] - pub r#type: ::prost::alloc::string::String, - #[prost(message, repeated, tag = "2")] - pub attributes: ::prost::alloc::vec::Vec, -} -/// EventAttribute is a single key-value pair, associated with an event. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.EventAttribute")] -pub struct EventAttribute { - #[prost(string, tag = "1")] - pub key: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub value: ::prost::alloc::string::String, - /// nondeterministic - #[prost(bool, tag = "3")] - pub index: bool, -} -/// ExecTxResult contains results of executing one individual transaction. -/// -/// * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ExecTxResult")] -pub struct ExecTxResult { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - /// nondeterministic - #[prost(string, tag = "3")] - pub log: ::prost::alloc::string::String, - /// nondeterministic - #[prost(string, tag = "4")] - pub info: ::prost::alloc::string::String, - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_wanted: i64, - #[prost(int64, tag = "6")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub gas_used: i64, - /// nondeterministic - #[prost(message, repeated, tag = "7")] - pub events: ::prost::alloc::vec::Vec, - #[prost(string, tag = "8")] - pub codespace: ::prost::alloc::string::String, -} -/// TxResult contains results of executing the transaction. -/// -/// One usage is indexing transaction results. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.TxResult")] -pub struct TxResult { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u32, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "4")] - pub result: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.Validator")] -pub struct Validator { - /// The first 20 bytes of SHA256(public key) - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub address: ::prost::alloc::vec::Vec, - /// PubKey pub_key = 2 \[(gogoproto.nullable)=false\]; - /// - /// The voting power - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub power: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ValidatorUpdate")] -pub struct ValidatorUpdate { - #[prost(message, optional, tag = "1")] - pub pub_key: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub power: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.VoteInfo")] -pub struct VoteInfo { - #[prost(message, optional, tag = "1")] - pub validator: ::core::option::Option, - #[prost(enumeration = "super::types::BlockIdFlag", tag = "3")] - #[serde(alias = "blockID_flag")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_id_flag: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.ExtendedVoteInfo")] -pub struct ExtendedVoteInfo { - /// The validator that sent the vote. - #[prost(message, optional, tag = "1")] - pub validator: ::core::option::Option, - /// Non-deterministic extension provided by the sending validator's application. - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub vote_extension: ::prost::alloc::vec::Vec, - /// Vote extension signature created by CometBFT - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub extension_signature: ::prost::alloc::vec::Vec, - /// block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all - #[prost(enumeration = "super::types::BlockIdFlag", tag = "5")] - #[serde(alias = "blockID_flag")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_id_flag: i32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.Misbehavior")] -pub struct Misbehavior { - #[prost(enumeration = "MisbehaviorType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - /// The offending validator - #[prost(message, optional, tag = "2")] - pub validator: ::core::option::Option, - /// The height when the offense occurred - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// The corresponding time where the offense occurred - #[prost(message, optional, tag = "4")] - pub time: ::core::option::Option, - /// Total voting power of the validator set in case the ABCI application does - /// not store historical validators. - /// - #[prost(int64, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_voting_power: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.abci.Snapshot")] -pub struct Snapshot { - /// The height at which the snapshot was taken - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - /// The application-specific snapshot format - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, - /// Number of chunks in the snapshot - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub chunks: u32, - /// Arbitrary snapshot hash, equal only if identical - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - /// Arbitrary application metadata - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub metadata: ::prost::alloc::vec::Vec, -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum CheckTxType { - New = 0, - Recheck = 1, -} -impl CheckTxType { - /// 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 { - CheckTxType::New => "NEW", - CheckTxType::Recheck => "RECHECK", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "NEW" => Some(Self::New), - "RECHECK" => Some(Self::Recheck), - _ => None, - } - } -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum MisbehaviorType { - Unknown = 0, - DuplicateVote = 1, - LightClientAttack = 2, -} -impl MisbehaviorType { - /// 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 { - MisbehaviorType::Unknown => "UNKNOWN", - MisbehaviorType::DuplicateVote => "DUPLICATE_VOTE", - MisbehaviorType::LightClientAttack => "LIGHT_CLIENT_ATTACK", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNKNOWN" => Some(Self::Unknown), - "DUPLICATE_VOTE" => Some(Self::DuplicateVote), - "LIGHT_CLIENT_ATTACK" => Some(Self::LightClientAttack), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/blocksync.rs b/packages/neutron-sdk/src/proto_types/tendermint/blocksync.rs deleted file mode 100644 index f782f17f..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/blocksync.rs +++ /dev/null @@ -1,144 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// BlockRequest requests a block for a specific height -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.blocksync.BlockRequest")] -pub struct BlockRequest { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} -/// NoBlockResponse informs the node that the peer does not have block at the requested height -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.blocksync.NoBlockResponse")] -pub struct NoBlockResponse { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} -/// BlockResponse returns block to the requested -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.blocksync.BlockResponse")] -pub struct BlockResponse { - #[prost(message, optional, tag = "1")] - pub block: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub ext_commit: ::core::option::Option, -} -/// StatusRequest requests the status of a peer. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.blocksync.StatusRequest")] -pub struct StatusRequest {} -/// StatusResponse is a peer response to inform their status. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.blocksync.StatusResponse")] -pub struct StatusResponse { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub base: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.blocksync.Message")] -pub struct Message { - #[prost(oneof = "message::Sum", tags = "1, 2, 3, 4, 5")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Message`. -pub mod message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - BlockRequest(super::BlockRequest), - #[prost(message, tag = "2")] - NoBlockResponse(super::NoBlockResponse), - #[prost(message, tag = "3")] - BlockResponse(Box), - #[prost(message, tag = "4")] - StatusRequest(super::StatusRequest), - #[prost(message, tag = "5")] - StatusResponse(super::StatusResponse), - } -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/consensus.rs b/packages/neutron-sdk/src/proto_types/tendermint/consensus.rs deleted file mode 100644 index 5af6d6ff..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/consensus.rs +++ /dev/null @@ -1,471 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// NewRoundStep is sent for every step taken in the ConsensusState. -/// For every height/round/step transition -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.NewRoundStep")] -pub struct NewRoundStep { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub step: u32, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub seconds_since_start_time: i64, - #[prost(int32, tag = "5")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_commit_round: i32, -} -/// NewValidBlock is sent when a validator observes a valid block B in some round r, -/// i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. -/// In case the block is also committed, then IsCommit flag is set to true. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.NewValidBlock")] -pub struct NewValidBlock { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(message, optional, tag = "3")] - pub block_part_set_header: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub block_parts: ::core::option::Option, - #[prost(bool, tag = "5")] - pub is_commit: bool, -} -/// Proposal is sent when a new block is proposed. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.Proposal")] -pub struct Proposal { - #[prost(message, optional, tag = "1")] - pub proposal: ::core::option::Option, -} -/// ProposalPOL is sent when a previous proposal is re-proposed. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.ProposalPOL")] -pub struct ProposalPol { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposal_pol_round: i32, - #[prost(message, optional, tag = "3")] - pub proposal_pol: ::core::option::Option, -} -/// BlockPart is sent when gossipping a piece of the proposed block. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.BlockPart")] -pub struct BlockPart { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(message, optional, tag = "3")] - pub part: ::core::option::Option, -} -/// Vote is sent when voting for a proposal (or lack thereof). -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.Vote")] -pub struct Vote { - #[prost(message, optional, tag = "1")] - pub vote: ::core::option::Option, -} -/// HasVote is sent to indicate that a particular vote has been received. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.HasVote")] -pub struct HasVote { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(enumeration = "super::types::SignedMsgType", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - #[prost(int32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: i32, -} -/// VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.VoteSetMaj23")] -pub struct VoteSetMaj23 { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(enumeration = "super::types::SignedMsgType", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - #[prost(message, optional, tag = "4")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, -} -/// VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.VoteSetBits")] -pub struct VoteSetBits { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(enumeration = "super::types::SignedMsgType", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - #[prost(message, optional, tag = "4")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub votes: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.Message")] -pub struct Message { - #[prost(oneof = "message::Sum", tags = "1, 2, 3, 4, 5, 6, 7, 8, 9")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Message`. -pub mod message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - NewRoundStep(super::NewRoundStep), - #[prost(message, tag = "2")] - NewValidBlock(super::NewValidBlock), - #[prost(message, tag = "3")] - Proposal(super::Proposal), - #[prost(message, tag = "4")] - ProposalPol(super::ProposalPol), - #[prost(message, tag = "5")] - BlockPart(super::BlockPart), - #[prost(message, tag = "6")] - Vote(super::Vote), - #[prost(message, tag = "7")] - HasVote(super::HasVote), - #[prost(message, tag = "8")] - VoteSetMaj23(super::VoteSetMaj23), - #[prost(message, tag = "9")] - VoteSetBits(super::VoteSetBits), - } -} -/// MsgInfo are msgs from the reactor which may update the state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.MsgInfo")] -pub struct MsgInfo { - #[prost(message, optional, tag = "1")] - pub msg: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "peerID")] - pub peer_id: ::prost::alloc::string::String, -} -/// TimeoutInfo internally generated messages which may update the state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.TimeoutInfo")] -pub struct TimeoutInfo { - #[prost(message, optional, tag = "1")] - pub duration: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(uint32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub step: u32, -} -/// EndHeight marks the end of the given height inside WAL. -/// @internal used by scripts/wal2json util. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.EndHeight")] -pub struct EndHeight { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.WALMessage")] -pub struct WalMessage { - #[prost(oneof = "wal_message::Sum", tags = "1, 2, 3, 4")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `WALMessage`. -pub mod wal_message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - EventDataRoundState(super::super::types::EventDataRoundState), - #[prost(message, tag = "2")] - MsgInfo(super::MsgInfo), - #[prost(message, tag = "3")] - TimeoutInfo(super::TimeoutInfo), - #[prost(message, tag = "4")] - EndHeight(super::EndHeight), - } -} -/// TimedWALMessage wraps WALMessage and adds Time for debugging purposes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.consensus.TimedWALMessage")] -pub struct TimedWalMessage { - #[prost(message, optional, tag = "1")] - pub time: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub msg: ::core::option::Option, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/crypto.rs b/packages/neutron-sdk/src/proto_types/tendermint/crypto.rs deleted file mode 100644 index 8ace81a7..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/crypto.rs +++ /dev/null @@ -1,163 +0,0 @@ -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 = "/tendermint.crypto.Proof")] -pub struct Proof { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total: i64, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: i64, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub leaf_hash: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", repeated, tag = "4")] - pub aunts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.crypto.ValueOp")] -pub struct ValueOp { - /// Encoded in ProofOp.Key. - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - /// To encode in ProofOp.Data - #[prost(message, optional, tag = "2")] - pub proof: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.crypto.DominoOp")] -pub struct DominoOp { - #[prost(string, tag = "1")] - pub key: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub input: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub output: ::prost::alloc::string::String, -} -/// ProofOp defines an operation used for calculating Merkle root -/// The data could be arbitrary format, providing nessecary data -/// for example neighbouring node hash -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.crypto.ProofOp")] -pub struct ProofOp { - #[prost(string, tag = "1")] - pub r#type: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub key: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -/// ProofOps is Merkle proof defined by the list of ProofOps -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.crypto.ProofOps")] -pub struct ProofOps { - #[prost(message, repeated, tag = "1")] - pub ops: ::prost::alloc::vec::Vec, -} -/// PublicKey defines the keys available for use with Validators -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.crypto.PublicKey")] -pub struct PublicKey { - #[prost(oneof = "public_key::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `PublicKey`. -pub mod public_key { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(bytes, tag = "1")] - Ed25519(::prost::alloc::vec::Vec), - #[prost(bytes, tag = "2")] - Secp256k1(::prost::alloc::vec::Vec), - } -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/libs/bits.rs b/packages/neutron-sdk/src/proto_types/tendermint/libs/bits.rs deleted file mode 100644 index 31177d2b..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/libs/bits.rs +++ /dev/null @@ -1,27 +0,0 @@ -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 = "/tendermint.libs.bits.BitArray")] -pub struct BitArray { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub bits: i64, - #[prost(uint64, repeated, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - pub elems: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/libs/mod.rs b/packages/neutron-sdk/src/proto_types/tendermint/libs/mod.rs deleted file mode 100644 index e79b623c..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/libs/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod bits; diff --git a/packages/neutron-sdk/src/proto_types/tendermint/mempool.rs b/packages/neutron-sdk/src/proto_types/tendermint/mempool.rs deleted file mode 100644 index 6f2f29bf..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/mempool.rs +++ /dev/null @@ -1,50 +0,0 @@ -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 = "/tendermint.mempool.Txs")] -pub struct Txs { - #[prost(bytes = "vec", repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.mempool.Message")] -pub struct Message { - #[prost(oneof = "message::Sum", tags = "1")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Message`. -pub mod message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - Txs(super::Txs), - } -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/mod.rs b/packages/neutron-sdk/src/proto_types/tendermint/mod.rs deleted file mode 100644 index 09b25428..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub mod abci; -pub mod blocksync; -pub mod consensus; -pub mod crypto; -pub mod libs; -pub mod mempool; -pub mod p2p; -pub mod privval; -pub mod rpc; -pub mod state; -pub mod statesync; -pub mod store; -pub mod types; -pub mod version; diff --git a/packages/neutron-sdk/src/proto_types/tendermint/p2p.rs b/packages/neutron-sdk/src/proto_types/tendermint/p2p.rs deleted file mode 100644 index 0371bcba..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/p2p.rs +++ /dev/null @@ -1,289 +0,0 @@ -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 = "/tendermint.p2p.PacketPing")] -pub struct PacketPing {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.PacketPong")] -pub struct PacketPong {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.PacketMsg")] -pub struct PacketMsg { - #[prost(int32, tag = "1")] - #[serde(alias = "channelID")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub channel_id: i32, - #[prost(bool, tag = "2")] - pub eof: bool, - #[prost(bytes = "vec", tag = "3")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.Packet")] -pub struct Packet { - #[prost(oneof = "packet::Sum", tags = "1, 2, 3")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Packet`. -pub mod packet { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - PacketPing(super::PacketPing), - #[prost(message, tag = "2")] - PacketPong(super::PacketPong), - #[prost(message, tag = "3")] - PacketMsg(super::PacketMsg), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.AuthSigMessage")] -pub struct AuthSigMessage { - #[prost(message, optional, tag = "1")] - pub pub_key: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub sig: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.NetAddress")] -pub struct NetAddress { - #[prost(string, tag = "1")] - #[serde(alias = "ID")] - pub id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub ip: ::prost::alloc::string::String, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub port: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.ProtocolVersion")] -pub struct ProtocolVersion { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub p2p: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block: u64, - #[prost(uint64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub app: 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 = "/tendermint.p2p.DefaultNodeInfo")] -pub struct DefaultNodeInfo { - #[prost(message, optional, tag = "1")] - pub protocol_version: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "default_nodeID")] - pub default_node_id: ::prost::alloc::string::String, - #[prost(string, tag = "3")] - pub listen_addr: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub network: ::prost::alloc::string::String, - #[prost(string, tag = "5")] - pub version: ::prost::alloc::string::String, - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub channels: ::prost::alloc::vec::Vec, - #[prost(string, tag = "7")] - pub moniker: ::prost::alloc::string::String, - #[prost(message, optional, tag = "8")] - pub other: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.DefaultNodeInfoOther")] -pub struct DefaultNodeInfoOther { - #[prost(string, tag = "1")] - pub tx_index: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub rpc_address: ::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 = "/tendermint.p2p.PexRequest")] -pub struct PexRequest {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.PexAddrs")] -pub struct PexAddrs { - #[prost(message, repeated, tag = "1")] - pub addrs: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.p2p.Message")] -pub struct Message { - #[prost(oneof = "message::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Message`. -pub mod message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - PexRequest(super::PexRequest), - #[prost(message, tag = "2")] - PexAddrs(super::PexAddrs), - } -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/privval.rs b/packages/neutron-sdk/src/proto_types/tendermint/privval.rs deleted file mode 100644 index cf5984ea..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/privval.rs +++ /dev/null @@ -1,252 +0,0 @@ -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 = "/tendermint.privval.RemoteSignerError")] -pub struct RemoteSignerError { - #[prost(int32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub code: i32, - #[prost(string, tag = "2")] - pub description: ::prost::alloc::string::String, -} -/// PubKeyRequest requests the consensus public key from the remote signer. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.PubKeyRequest")] -pub struct PubKeyRequest { - #[prost(string, tag = "1")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, -} -/// PubKeyResponse is a response message containing the public key. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.PubKeyResponse")] -pub struct PubKeyResponse { - #[prost(message, optional, tag = "1")] - pub pub_key: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub error: ::core::option::Option, -} -/// SignVoteRequest is a request to sign a vote -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.SignVoteRequest")] -pub struct SignVoteRequest { - #[prost(message, optional, tag = "1")] - pub vote: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, -} -/// SignedVoteResponse is a response containing a signed vote or an error -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.SignedVoteResponse")] -pub struct SignedVoteResponse { - #[prost(message, optional, tag = "1")] - pub vote: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub error: ::core::option::Option, -} -/// SignProposalRequest is a request to sign a proposal -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.SignProposalRequest")] -pub struct SignProposalRequest { - #[prost(message, optional, tag = "1")] - pub proposal: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, -} -/// SignedProposalResponse is response containing a signed proposal or an error -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.SignedProposalResponse")] -pub struct SignedProposalResponse { - #[prost(message, optional, tag = "1")] - pub proposal: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub error: ::core::option::Option, -} -/// PingRequest is a request to confirm that the connection is alive. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.PingRequest")] -pub struct PingRequest {} -/// PingResponse is a response to confirm that the connection is alive. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.PingResponse")] -pub struct PingResponse {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.privval.Message")] -pub struct Message { - #[prost(oneof = "message::Sum", tags = "1, 2, 3, 4, 5, 6, 7, 8")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Message`. -pub mod message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - PubKeyRequest(super::PubKeyRequest), - #[prost(message, tag = "2")] - PubKeyResponse(super::PubKeyResponse), - #[prost(message, tag = "3")] - SignVoteRequest(super::SignVoteRequest), - #[prost(message, tag = "4")] - SignedVoteResponse(super::SignedVoteResponse), - #[prost(message, tag = "5")] - SignProposalRequest(super::SignProposalRequest), - #[prost(message, tag = "6")] - SignedProposalResponse(super::SignedProposalResponse), - #[prost(message, tag = "7")] - PingRequest(super::PingRequest), - #[prost(message, tag = "8")] - PingResponse(super::PingResponse), - } -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum Errors { - Unknown = 0, - UnexpectedResponse = 1, - NoConnection = 2, - ConnectionTimeout = 3, - ReadTimeout = 4, - WriteTimeout = 5, -} -impl Errors { - /// 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 { - Errors::Unknown => "ERRORS_UNKNOWN", - Errors::UnexpectedResponse => "ERRORS_UNEXPECTED_RESPONSE", - Errors::NoConnection => "ERRORS_NO_CONNECTION", - Errors::ConnectionTimeout => "ERRORS_CONNECTION_TIMEOUT", - Errors::ReadTimeout => "ERRORS_READ_TIMEOUT", - Errors::WriteTimeout => "ERRORS_WRITE_TIMEOUT", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ERRORS_UNKNOWN" => Some(Self::Unknown), - "ERRORS_UNEXPECTED_RESPONSE" => Some(Self::UnexpectedResponse), - "ERRORS_NO_CONNECTION" => Some(Self::NoConnection), - "ERRORS_CONNECTION_TIMEOUT" => Some(Self::ConnectionTimeout), - "ERRORS_READ_TIMEOUT" => Some(Self::ReadTimeout), - "ERRORS_WRITE_TIMEOUT" => Some(Self::WriteTimeout), - _ => None, - } - } -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/rpc/grpc.rs b/packages/neutron-sdk/src/proto_types/tendermint/rpc/grpc.rs deleted file mode 100644 index dd8e0b8a..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/rpc/grpc.rs +++ /dev/null @@ -1,65 +0,0 @@ -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 = "/tendermint.rpc.grpc.RequestPing")] -pub struct RequestPing {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.rpc.grpc.RequestBroadcastTx")] -pub struct RequestBroadcastTx { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub tx: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.rpc.grpc.ResponsePing")] -pub struct ResponsePing {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.rpc.grpc.ResponseBroadcastTx")] -pub struct ResponseBroadcastTx { - #[prost(message, optional, tag = "1")] - pub check_tx: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub tx_result: ::core::option::Option, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/rpc/mod.rs b/packages/neutron-sdk/src/proto_types/tendermint/rpc/mod.rs deleted file mode 100644 index 773d491c..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/rpc/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod grpc; diff --git a/packages/neutron-sdk/src/proto_types/tendermint/state.rs b/packages/neutron-sdk/src/proto_types/tendermint/state.rs deleted file mode 100644 index 0b192828..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/state.rs +++ /dev/null @@ -1,231 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// LegacyABCIResponses retains the responses -/// of the legacy ABCI calls during block processing. -/// Note ReponseDeliverTx is renamed to ExecTxResult but they are semantically the same -/// Kept for backwards compatibility for versions prior to v0.38 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.LegacyABCIResponses")] -pub struct LegacyAbciResponses { - #[prost(message, repeated, tag = "1")] - pub deliver_txs: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub end_block: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub begin_block: ::core::option::Option, -} -/// ResponseBeginBlock is kept for backwards compatibility for versions prior to v0.38 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.ResponseBeginBlock")] -pub struct ResponseBeginBlock { - #[prost(message, repeated, tag = "1")] - pub events: ::prost::alloc::vec::Vec, -} -/// ResponseEndBlock is kept for backwards compatibility for versions prior to v0.38 -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.ResponseEndBlock")] -pub struct ResponseEndBlock { - #[prost(message, repeated, tag = "1")] - pub validator_updates: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub consensus_param_updates: ::core::option::Option, - #[prost(message, repeated, tag = "3")] - pub events: ::prost::alloc::vec::Vec, -} -/// ValidatorsInfo represents the latest validator set, or the last height it changed -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.ValidatorsInfo")] -pub struct ValidatorsInfo { - #[prost(message, optional, tag = "1")] - pub validator_set: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_height_changed: i64, -} -/// ConsensusParamsInfo represents the latest consensus params, or the last height it changed -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.ConsensusParamsInfo")] -pub struct ConsensusParamsInfo { - #[prost(message, optional, tag = "1")] - pub consensus_params: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_height_changed: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.ABCIResponsesInfo")] -pub struct AbciResponsesInfo { - #[prost(message, optional, tag = "1")] - pub legacy_abci_responses: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(message, optional, tag = "3")] - pub response_finalize_block: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.state.Version")] -pub struct Version { - #[prost(message, optional, tag = "1")] - pub consensus: ::core::option::Option, - #[prost(string, tag = "2")] - pub software: ::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 = "/tendermint.state.State")] -pub struct State { - #[prost(message, optional, tag = "1")] - pub version: ::core::option::Option, - /// immutable - #[prost(string, tag = "2")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - #[prost(int64, tag = "14")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub initial_height: i64, - /// LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_block_height: i64, - #[prost(message, optional, tag = "4")] - #[serde(alias = "last_blockID")] - pub last_block_id: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub last_block_time: ::core::option::Option, - /// LastValidators is used to validate block.LastCommit. - /// Validators are persisted to the database separately every time they change, - /// so we can query for historical validator sets. - /// Note that if s.LastBlockHeight causes a valset change, - /// we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 - /// Extra +1 due to nextValSet delay. - #[prost(message, optional, tag = "6")] - pub next_validators: ::core::option::Option, - #[prost(message, optional, tag = "7")] - pub validators: ::core::option::Option, - #[prost(message, optional, tag = "8")] - pub last_validators: ::core::option::Option, - #[prost(int64, tag = "9")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_height_validators_changed: i64, - /// Consensus parameters used for validating blocks. - /// Changes returned by EndBlock and updated after Commit. - #[prost(message, optional, tag = "10")] - pub consensus_params: ::core::option::Option, - #[prost(int64, tag = "11")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub last_height_consensus_params_changed: i64, - /// Merkle root of the results from executing prev block - #[prost(bytes = "vec", tag = "12")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_results_hash: ::prost::alloc::vec::Vec, - /// the latest AppHash we've received from calling abci.Commit() - #[prost(bytes = "vec", tag = "13")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/statesync.rs b/packages/neutron-sdk/src/proto_types/tendermint/statesync.rs deleted file mode 100644 index 22335fa1..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/statesync.rs +++ /dev/null @@ -1,169 +0,0 @@ -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 = "/tendermint.statesync.Message")] -pub struct Message { - #[prost(oneof = "message::Sum", tags = "1, 2, 3, 4")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Message`. -pub mod message { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - SnapshotsRequest(super::SnapshotsRequest), - #[prost(message, tag = "2")] - SnapshotsResponse(super::SnapshotsResponse), - #[prost(message, tag = "3")] - ChunkRequest(super::ChunkRequest), - #[prost(message, tag = "4")] - ChunkResponse(super::ChunkResponse), - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.statesync.SnapshotsRequest")] -pub struct SnapshotsRequest {} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.statesync.SnapshotsResponse")] -pub struct SnapshotsResponse { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub chunks: u32, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub metadata: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.statesync.ChunkRequest")] -pub struct ChunkRequest { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u32, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.statesync.ChunkResponse")] -pub struct ChunkResponse { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: u64, - #[prost(uint32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub format: u32, - #[prost(uint32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u32, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub chunk: ::prost::alloc::vec::Vec, - #[prost(bool, tag = "5")] - pub missing: bool, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/store.rs b/packages/neutron-sdk/src/proto_types/tendermint/store.rs deleted file mode 100644 index 57dd918b..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/store.rs +++ /dev/null @@ -1,27 +0,0 @@ -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 = "/tendermint.store.BlockStoreState")] -pub struct BlockStoreState { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub base: i64, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/types.rs b/packages/neutron-sdk/src/proto_types/tendermint/types.rs deleted file mode 100644 index 30a2a344..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/types.rs +++ /dev/null @@ -1,1268 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// ConsensusParams contains consensus critical parameters that determine the -/// validity of blocks. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.ConsensusParams")] -pub struct ConsensusParams { - #[prost(message, optional, tag = "1")] - pub block: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub evidence: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub validator: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub version: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub abci: ::core::option::Option, -} -/// BlockParams contains limits on the block size. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.BlockParams")] -pub struct BlockParams { - /// Max block size, in bytes. - /// Note: must be greater than 0 - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_bytes: i64, - /// Max gas per block. - /// Note: must be greater or equal to -1 - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_gas: i64, -} -/// EvidenceParams determine how we handle evidence of malfeasance. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.EvidenceParams")] -pub struct EvidenceParams { - /// Max age of evidence, in blocks. - /// - /// The basic formula for calculating this is: MaxAgeDuration / {average block - /// time}. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_age_num_blocks: i64, - /// Max age of evidence, in time. - /// - /// It should correspond with an app's "unbonding period" or other similar - /// mechanism for handling [Nothing-At-Stake - /// attacks](). - #[prost(message, optional, tag = "2")] - pub max_age_duration: ::core::option::Option, - /// This sets the maximum size of total evidence in bytes that can be committed in a single block. - /// and should fall comfortably under the max block bytes. - /// Default is 1048576 or 1MB - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub max_bytes: i64, -} -/// ValidatorParams restrict the public key types validators can use. -/// NOTE: uses ABCI pubkey naming, not Amino names. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.ValidatorParams")] -pub struct ValidatorParams { - #[prost(string, repeated, tag = "1")] - pub pub_key_types: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// VersionParams contains the ABCI application version. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.VersionParams")] -pub struct VersionParams { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub app: u64, -} -/// HashedParams is a subset of ConsensusParams. -/// -/// It is hashed into the Header.ConsensusHash. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.HashedParams")] -pub struct HashedParams { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_max_bytes: i64, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_max_gas: i64, -} -/// ABCIParams configure functionality specific to the Application Blockchain Interface. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.ABCIParams")] -pub struct AbciParams { - /// vote_extensions_enable_height configures the first height during which - /// vote extensions will be enabled. During this specified height, and for all - /// subsequent heights, precommit messages that do not contain valid extension data - /// will be considered invalid. Prior to this height, vote extensions will not - /// be used or accepted by validators on the network. - /// - /// Once enabled, vote extensions will be created by the application in ExtendVote, - /// passed to the application for validation in VerifyVoteExtension and given - /// to the application to use when proposing a block during PrepareProposal. - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub vote_extensions_enable_height: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.ValidatorSet")] -pub struct ValidatorSet { - #[prost(message, repeated, tag = "1")] - pub validators: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub proposer: ::core::option::Option, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_voting_power: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Validator")] -pub struct Validator { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub pub_key: ::core::option::Option, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub voting_power: i64, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub proposer_priority: i64, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.SimpleValidator")] -pub struct SimpleValidator { - #[prost(message, optional, tag = "1")] - pub pub_key: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub voting_power: i64, -} -/// BlockIdFlag indicates which BlockID the signature is for -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum BlockIdFlag { - /// indicates an error condition - Unknown = 0, - /// the vote was not received - Absent = 1, - /// voted for the block that received the majority - Commit = 2, - /// voted for nil - Nil = 3, -} -impl BlockIdFlag { - /// 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 { - BlockIdFlag::Unknown => "BLOCK_ID_FLAG_UNKNOWN", - BlockIdFlag::Absent => "BLOCK_ID_FLAG_ABSENT", - BlockIdFlag::Commit => "BLOCK_ID_FLAG_COMMIT", - BlockIdFlag::Nil => "BLOCK_ID_FLAG_NIL", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "BLOCK_ID_FLAG_UNKNOWN" => Some(Self::Unknown), - "BLOCK_ID_FLAG_ABSENT" => Some(Self::Absent), - "BLOCK_ID_FLAG_COMMIT" => Some(Self::Commit), - "BLOCK_ID_FLAG_NIL" => Some(Self::Nil), - _ => None, - } - } -} -/// PartsetHeader -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.PartSetHeader")] -pub struct PartSetHeader { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Part")] -pub struct Part { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub index: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub bytes: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub proof: ::core::option::Option, -} -/// BlockID -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.BlockID")] -pub struct BlockId { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub part_set_header: ::core::option::Option, -} -/// Header defines the structure of a block header. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Header")] -pub struct Header { - /// basic block info - #[prost(message, optional, tag = "1")] - pub version: ::core::option::Option, - #[prost(string, tag = "2")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(message, optional, tag = "4")] - pub time: ::core::option::Option, - /// prev block info - #[prost(message, optional, tag = "5")] - #[serde(alias = "last_blockID")] - pub last_block_id: ::core::option::Option, - /// hashes of block data - /// - /// commit from validators from the last block - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_commit_hash: ::prost::alloc::vec::Vec, - /// transactions - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data_hash: ::prost::alloc::vec::Vec, - /// hashes from the app output from the prev block - /// - /// validators for the current block - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validators_hash: ::prost::alloc::vec::Vec, - /// validators for the next block - #[prost(bytes = "vec", tag = "9")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub next_validators_hash: ::prost::alloc::vec::Vec, - /// consensus params for current block - #[prost(bytes = "vec", tag = "10")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub consensus_hash: ::prost::alloc::vec::Vec, - /// state after txs from the previous block - #[prost(bytes = "vec", tag = "11")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub app_hash: ::prost::alloc::vec::Vec, - /// root hash of all results from the txs from the previous block - #[prost(bytes = "vec", tag = "12")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub last_results_hash: ::prost::alloc::vec::Vec, - /// consensus info - /// - /// evidence included in the block - #[prost(bytes = "vec", tag = "13")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub evidence_hash: ::prost::alloc::vec::Vec, - /// original proposer of the block - #[prost(bytes = "vec", tag = "14")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub proposer_address: ::prost::alloc::vec::Vec, -} -/// Data contains the set of transactions included in the block -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Data")] -pub struct Data { - /// Txs that will be applied by state @ block.Height+1. - /// NOTE: not all txs here are valid. We're just agreeing on the order first. - /// This means that block.AppHash does not include these txs. - #[prost(bytes = "vec", repeated, tag = "1")] - pub txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, -} -/// Vote represents a prevote or precommit vote from validators for -/// consensus. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Vote")] -pub struct Vote { - #[prost(enumeration = "SignedMsgType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - /// zero if vote is nil. - #[prost(message, optional, tag = "4")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub timestamp: ::core::option::Option, - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validator_address: ::prost::alloc::vec::Vec, - #[prost(int32, tag = "7")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub validator_index: i32, - /// Vote signature by the validator if they participated in consensus for the - /// associated block. - #[prost(bytes = "vec", tag = "8")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - /// Vote extension provided by the application. Only valid for precommit - /// messages. - #[prost(bytes = "vec", tag = "9")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub extension: ::prost::alloc::vec::Vec, - /// Vote extension signature by the validator if they participated in - /// consensus for the associated block. - /// Only valid for precommit messages. - #[prost(bytes = "vec", tag = "10")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub extension_signature: ::prost::alloc::vec::Vec, -} -/// Commit contains the evidence that a block was committed by a set of validators. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Commit")] -pub struct Commit { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(message, optional, tag = "3")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, repeated, tag = "4")] - pub signatures: ::prost::alloc::vec::Vec, -} -/// CommitSig is a part of the Vote included in a Commit. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.CommitSig")] -pub struct CommitSig { - #[prost(enumeration = "BlockIdFlag", tag = "1")] - #[serde(alias = "blockID_flag")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_id_flag: i32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validator_address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub timestamp: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.ExtendedCommit")] -pub struct ExtendedCommit { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(message, optional, tag = "3")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, repeated, tag = "4")] - pub extended_signatures: ::prost::alloc::vec::Vec, -} -/// ExtendedCommitSig retains all the same fields as CommitSig but adds vote -/// extension-related fields. We use two signatures to ensure backwards compatibility. -/// That is the digest of the original signature is still the same in prior versions -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.ExtendedCommitSig")] -pub struct ExtendedCommitSig { - #[prost(enumeration = "BlockIdFlag", tag = "1")] - #[serde(alias = "blockID_flag")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_id_flag: i32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub validator_address: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub timestamp: ::core::option::Option, - #[prost(bytes = "vec", tag = "4")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, - /// Vote extension data - #[prost(bytes = "vec", tag = "5")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub extension: ::prost::alloc::vec::Vec, - /// Vote extension signature - #[prost(bytes = "vec", tag = "6")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub extension_signature: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Proposal")] -pub struct Proposal { - #[prost(enumeration = "SignedMsgType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(int32, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub pol_round: i32, - #[prost(message, optional, tag = "5")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, optional, tag = "6")] - pub timestamp: ::core::option::Option, - #[prost(bytes = "vec", tag = "7")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub signature: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.SignedHeader")] -pub struct SignedHeader { - #[prost(message, optional, tag = "1")] - pub header: ::core::option::Option
, - #[prost(message, optional, tag = "2")] - pub commit: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.LightBlock")] -pub struct LightBlock { - #[prost(message, optional, tag = "1")] - pub signed_header: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub validator_set: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.BlockMeta")] -pub struct BlockMeta { - #[prost(message, optional, tag = "1")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block_size: i64, - #[prost(message, optional, tag = "3")] - pub header: ::core::option::Option
, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub num_txs: i64, -} -/// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.TxProof")] -pub struct TxProof { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub root_hash: ::prost::alloc::vec::Vec, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub data: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "3")] - pub proof: ::core::option::Option, -} -/// SignedMsgType is a type of signed message in the consensus. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] -pub enum SignedMsgType { - Unknown = 0, - /// Votes - Prevote = 1, - Precommit = 2, - /// Proposals - Proposal = 32, -} -impl SignedMsgType { - /// 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 { - SignedMsgType::Unknown => "SIGNED_MSG_TYPE_UNKNOWN", - SignedMsgType::Prevote => "SIGNED_MSG_TYPE_PREVOTE", - SignedMsgType::Precommit => "SIGNED_MSG_TYPE_PRECOMMIT", - SignedMsgType::Proposal => "SIGNED_MSG_TYPE_PROPOSAL", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SIGNED_MSG_TYPE_UNKNOWN" => Some(Self::Unknown), - "SIGNED_MSG_TYPE_PREVOTE" => Some(Self::Prevote), - "SIGNED_MSG_TYPE_PRECOMMIT" => Some(Self::Precommit), - "SIGNED_MSG_TYPE_PROPOSAL" => Some(Self::Proposal), - _ => None, - } - } -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Evidence")] -pub struct Evidence { - #[prost(oneof = "evidence::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Evidence`. -pub mod evidence { - #[allow(clippy::derive_partial_eq_without_eq)] - #[derive( - Clone, - PartialEq, - Eq, - ::prost::Oneof, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - )] - pub enum Sum { - #[prost(message, tag = "1")] - DuplicateVoteEvidence(super::DuplicateVoteEvidence), - #[prost(message, tag = "2")] - LightClientAttackEvidence(super::LightClientAttackEvidence), - } -} -/// DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.DuplicateVoteEvidence")] -pub struct DuplicateVoteEvidence { - #[prost(message, optional, tag = "1")] - pub vote_a: ::core::option::Option, - #[prost(message, optional, tag = "2")] - pub vote_b: ::core::option::Option, - #[prost(int64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_voting_power: i64, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub validator_power: i64, - #[prost(message, optional, tag = "5")] - pub timestamp: ::core::option::Option, -} -/// LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.LightClientAttackEvidence")] -pub struct LightClientAttackEvidence { - #[prost(message, optional, tag = "1")] - pub conflicting_block: ::core::option::Option, - #[prost(int64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub common_height: i64, - #[prost(message, repeated, tag = "3")] - pub byzantine_validators: ::prost::alloc::vec::Vec, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total_voting_power: i64, - #[prost(message, optional, tag = "5")] - pub timestamp: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.EvidenceList")] -pub struct EvidenceList { - #[prost(message, repeated, tag = "1")] - pub evidence: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.Block")] -pub struct Block { - #[prost(message, optional, tag = "1")] - pub header: ::core::option::Option
, - #[prost(message, optional, tag = "2")] - pub data: ::core::option::Option, - #[prost(message, optional, tag = "3")] - pub evidence: ::core::option::Option, - #[prost(message, optional, tag = "4")] - pub last_commit: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.EventDataRoundState")] -pub struct EventDataRoundState { - #[prost(int64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(int32, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i32, - #[prost(string, tag = "3")] - pub step: ::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 = "/tendermint.types.CanonicalBlockID")] -pub struct CanonicalBlockId { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, - #[prost(message, optional, tag = "2")] - pub part_set_header: ::core::option::Option, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.CanonicalPartSetHeader")] -pub struct CanonicalPartSetHeader { - #[prost(uint32, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub total: u32, - #[prost(bytes = "vec", tag = "2")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub hash: ::prost::alloc::vec::Vec, -} -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.CanonicalProposal")] -pub struct CanonicalProposal { - /// type alias for byte - #[prost(enumeration = "SignedMsgType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - /// canonicalization requires fixed size encoding here - #[prost(sfixed64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// canonicalization requires fixed size encoding here - #[prost(sfixed64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i64, - #[prost(int64, tag = "4")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub pol_round: i64, - #[prost(message, optional, tag = "5")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, optional, tag = "6")] - pub timestamp: ::core::option::Option, - #[prost(string, tag = "7")] - #[serde(alias = "chainID")] - pub chain_id: ::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 = "/tendermint.types.CanonicalVote")] -pub struct CanonicalVote { - /// type alias for byte - #[prost(enumeration = "SignedMsgType", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub r#type: i32, - /// canonicalization requires fixed size encoding here - #[prost(sfixed64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - /// canonicalization requires fixed size encoding here - #[prost(sfixed64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i64, - #[prost(message, optional, tag = "4")] - #[serde(alias = "blockID")] - pub block_id: ::core::option::Option, - #[prost(message, optional, tag = "5")] - pub timestamp: ::core::option::Option, - #[prost(string, tag = "6")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, -} -/// CanonicalVoteExtension provides us a way to serialize a vote extension from -/// a particular validator such that we can sign over those serialized bytes. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.types.CanonicalVoteExtension")] -pub struct CanonicalVoteExtension { - #[prost(bytes = "vec", tag = "1")] - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - pub extension: ::prost::alloc::vec::Vec, - #[prost(sfixed64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub height: i64, - #[prost(sfixed64, tag = "3")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub round: i64, - #[prost(string, tag = "4")] - #[serde(alias = "chainID")] - pub chain_id: ::prost::alloc::string::String, -} diff --git a/packages/neutron-sdk/src/proto_types/tendermint/version.rs b/packages/neutron-sdk/src/proto_types/tendermint/version.rs deleted file mode 100644 index f4e8d455..00000000 --- a/packages/neutron-sdk/src/proto_types/tendermint/version.rs +++ /dev/null @@ -1,55 +0,0 @@ -use neutron_std_derive::CosmwasmExt; -/// App includes the protocol and software version for the application. -/// This information is included in ResponseInfo. The App.Protocol can be -/// updated in ResponseEndBlock. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.version.App")] -pub struct App { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub protocol: u64, - #[prost(string, tag = "2")] - pub software: ::prost::alloc::string::String, -} -/// Consensus captures the consensus rules for processing a block in the blockchain, -/// including all blockchain data structures and the rules of the application's -/// state transition machine. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive( - Clone, - PartialEq, - Eq, - ::prost::Message, - ::serde::Serialize, - ::serde::Deserialize, - ::schemars::JsonSchema, - CosmwasmExt, -)] -#[proto_message(type_url = "/tendermint.version.Consensus")] -pub struct Consensus { - #[prost(uint64, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub block: u64, - #[prost(uint64, tag = "2")] - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - pub app: u64, -} diff --git a/packages/neutron-sdk/src/shim.rs b/packages/neutron-sdk/src/shim.rs deleted file mode 100644 index 28e4e85e..00000000 --- a/packages/neutron-sdk/src/shim.rs +++ /dev/null @@ -1,375 +0,0 @@ -use ::serde::{Deserialize, Deserializer, Serialize, Serializer}; -use chrono::{DateTime, Utc}; -use cosmwasm_std::StdResult; -use serde::de; -use serde::de::Visitor; - -use std::fmt; -use std::str::FromStr; - -#[derive(Clone, PartialEq, Eq, ::prost::Message, schemars::JsonSchema)] -pub struct Timestamp { - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. - #[prost(int64, tag = "1")] - pub seconds: i64, - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. - #[prost(int32, tag = "2")] - pub nanos: i32, -} - -impl Serialize for Timestamp { - fn serialize(&self, serializer: S) -> Result<::Ok, ::Error> - where - S: Serializer, - { - let mut ts = prost_types::Timestamp { - seconds: self.seconds, - nanos: self.nanos, - }; - ts.normalize(); - let dt = DateTime::from_timestamp(ts.seconds, ts.nanos as u32) - .expect("invalid or out-of-range datetime"); - serializer.serialize_str(format!("{:?}", dt).as_str()) - } -} - -impl<'de> Deserialize<'de> for Timestamp { - fn deserialize(deserializer: D) -> Result>::Error> - where - D: Deserializer<'de>, - { - struct TimestampVisitor; - - impl<'de> Visitor<'de> for TimestampVisitor { - type Value = Timestamp; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Timestamp in RFC3339 format") - } - - fn visit_str(self, value: &str) -> Result - where - E: de::Error, - { - let utc: DateTime = chrono::DateTime::from_str(value).map_err(|err| { - serde::de::Error::custom(format!( - "Failed to parse {} as datetime: {:?}", - value, err - )) - })?; - let ts = Timestamp::from(utc); - Ok(ts) - } - } - deserializer.deserialize_str(TimestampVisitor) - } -} - -impl From> for Timestamp { - fn from(dt: DateTime) -> Self { - Timestamp { - seconds: dt.timestamp(), - nanos: dt.timestamp_subsec_nanos() as i32, - } - } -} -#[derive(Clone, PartialEq, Eq, ::prost::Message, schemars::JsonSchema)] -pub struct Duration { - /// Signed seconds of the span of time. Must be from -315,576,000,000 - /// to +315,576,000,000 inclusive. Note: these bounds are computed from: - /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - #[prost(int64, tag = "1")] - pub seconds: i64, - /// Signed fractions of a second at nanosecond resolution of the span - /// of time. Durations less than one second are represented with a 0 - /// `seconds` field and a positive or negative `nanos` field. For durations - /// of one second or more, a non-zero value for the `nanos` field must be - /// of the same sign as the `seconds` field. Must be from -999,999,999 - /// to +999,999,999 inclusive. - #[prost(int32, tag = "2")] - pub nanos: i32, -} - -impl Serialize for Duration { - fn serialize(&self, serializer: S) -> Result<::Ok, ::Error> - where - S: Serializer, - { - let mut d = prost_types::Duration::from(self.to_owned()); - d.normalize(); - - serializer.serialize_str(d.to_string().as_str()) - } -} - -impl<'de> Deserialize<'de> for Duration { - fn deserialize(deserializer: D) -> Result>::Error> - where - D: Deserializer<'de>, - { - struct DurationVisitor; - - impl<'de> Visitor<'de> for DurationVisitor { - type Value = Duration; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("Timestamp in RFC3339 format") - } - - fn visit_str(self, value: &str) -> Result - where - E: de::Error, - { - value - .parse::() - .map(Into::into) - .map_err(de::Error::custom) - } - } - deserializer.deserialize_str(DurationVisitor) - } -} - -#[derive(Clone, PartialEq, Eq, ::prost::Message, schemars::JsonSchema)] -pub struct Any { - /// A URL/resource name that uniquely identifies the type of the serialized - /// protocol buffer message. This string must contain at least - /// one "/" character. The last segment of the URL's path must represent - /// the fully qualified name of the type (as in - /// `path/google.protobuf.Duration`). The name should be in a canonical form - /// (e.g., leading "." is not accepted). - /// - /// In practice, teams usually precompile into the binary all types that they - /// expect it to use in the context of Any. However, for URLs which use the - /// scheme `http`, `https`, or no scheme, one can optionally set up a type - /// server that maps type URLs to message definitions as follows: - /// - /// * If no scheme is provided, `https` is assumed. - /// * An HTTP GET on the URL must yield a \[google.protobuf.Type][\] - /// value in binary format, or produce an error. - /// * Applications are allowed to cache lookup results based on the - /// URL, or have them precompiled into a binary to avoid any - /// lookup. Therefore, binary compatibility needs to be preserved - /// on changes to types. (Use versioned type names to manage - /// breaking changes.) - /// - /// Note: this functionality is not currently available in the official - /// protobuf release, and it is not used for type URLs beginning with - /// type.googleapis.com. - /// - /// Schemes other than `http`, `https` (or the empty scheme) might be - /// used with implementation specific semantics. - /// - #[prost(string, tag = "1")] - pub type_url: ::prost::alloc::string::String, - /// Must be a valid serialized protocol buffer of the above specified type. - #[prost(bytes = "vec", tag = "2")] - pub value: ::prost::alloc::vec::Vec, -} - -macro_rules! expand_as_any { - ($($ty:path,)*) => { - - // TODO: make serialized data contains `@type` (https://github.com/osmosis-labs/osmosis-rust/issues/43) - impl Serialize for Any { - fn serialize( - &self, - _serializer: S, - ) -> Result<::Ok, ::Error> - where - S: ::serde::Serializer, - { - $( - if self.type_url == <$ty>::TYPE_URL { - let value: Result<$ty, ::Error> = - prost::Message::decode(self.value.as_slice()).map_err(ser::Error::custom); - - if let Ok(value) = value { - return value.serialize(serializer); - } - } - )* - - Err(serde::ser::Error::custom( - "data did not match any type that supports serialization as `Any`", - )) - } - } - - impl<'de> Deserialize<'de> for Any { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let value = match serde_cw_value::Value::deserialize(deserializer) { - Ok(value) => value, - Err(err) => { - return Err(err); - } - }; - - // must be map er else error - let type_url = if let serde_cw_value::Value::Map(m) = value.clone() { - m.get(&serde_cw_value::Value::String("@type".to_string())) - .map(|t| match t.to_owned() { - serde_cw_value::Value::String(s) => Ok(s), - _ => Err(serde::de::Error::custom("type_url must be String")), - }) - .transpose() - } else { - Err(serde::de::Error::custom("data must have map structure")) - }?; - - match type_url { - // @type found - Some(_) => { - $( - if t == <$ty>::TYPE_URL { - return <$ty>::deserialize( - serde_cw_value::ValueDeserializer::::new( - value.clone(), - ), - ) - .map(|v| Any { - type_url: <$ty>::TYPE_URL.to_string(), - value: v.encode_to_vec(), - }) - .map_err(serde::de::Error::custom); - } - )* - } - // @type not found, try match the type structure - None => { - $( - if let Ok(v) = <$ty>::deserialize( - serde_cw_value::ValueDeserializer::::new( - value.clone(), - ), - ) { - return Ok(Any { - type_url: <$ty>::TYPE_URL.to_string(), - value: v.encode_to_vec(), - }); - } - )* - } - }; - - Err(serde::de::Error::custom( - "data did not match any type that supports deserialization as `Any`", - )) - } - } - - $( - impl TryFrom for $ty { - type Error = prost::DecodeError; - - fn try_from(value: Any) -> Result { - prost::Message::decode(value.value.as_slice()) - } - } - )* - }; -} - -// [HACK] Register all types that can serde as Any manually for now. -// must order by type that has more information for Any deserialization to -// work correctly. Since after serialization, it currently loses @type tag. -// And deserialization works by trying to iteratively match the structure. -expand_as_any!(); - -macro_rules! impl_prost_types_exact_conversion { - ($t:ident | $($arg:ident),*) => { - impl From<$t> for prost_types::$t { - fn from(src: $t) -> Self { - prost_types::$t { - $( - $arg: src.$arg, - )* - } - } - } - - impl From for $t { - fn from(src: prost_types::$t) -> Self { - $t { - $( - $arg: src.$arg, - )* - } - } - } - }; -} - -impl_prost_types_exact_conversion! { Timestamp | seconds, nanos } -impl_prost_types_exact_conversion! { Duration | seconds, nanos } -impl_prost_types_exact_conversion! { Any | type_url, value } - -impl From for crate::proto_types::cosmos::base::v1beta1::Coin { - fn from(cosmwasm_std::Coin { denom, amount }: cosmwasm_std::Coin) -> Self { - crate::proto_types::cosmos::base::v1beta1::Coin { - denom, - amount: amount.into(), - } - } -} - -impl TryFrom for cosmwasm_std::Coin { - type Error = cosmwasm_std::StdError; - - fn try_from( - crate::proto_types::cosmos::base::v1beta1::Coin { denom, amount }: crate::proto_types::cosmos::base::v1beta1::Coin, - ) -> cosmwasm_std::StdResult { - Ok(cosmwasm_std::Coin { - denom, - amount: amount.parse()?, - }) - } -} - -/// Convert a list of `Coin` from generated proto `Coin` type to cosmwasm `Coin` type -pub fn try_proto_to_cosmwasm_coins( - coins: impl IntoIterator, -) -> StdResult> { - coins.into_iter().map(|c| c.try_into()).collect() -} - -/// Convert a list of `Coin` from cosmwasm `Coin` type to generated proto `Coin` type -pub fn cosmwasm_to_proto_coins( - coins: impl IntoIterator, -) -> Vec { - coins.into_iter().map(|c| c.into()).collect() -} - -#[cfg(test)] -mod tests { - use cosmwasm_std::Uint128; - - use super::*; - - #[test] - fn test_coins_conversion() { - let coins = vec![ - cosmwasm_std::Coin { - denom: "uatom".to_string(), - amount: Uint128::new(100), - }, - cosmwasm_std::Coin { - denom: "uosmo".to_string(), - amount: Uint128::new(200), - }, - ]; - - let proto_coins = cosmwasm_to_proto_coins(coins.clone()); - let cosmwasm_coins = try_proto_to_cosmwasm_coins(proto_coins).unwrap(); - - assert_eq!(coins, cosmwasm_coins); - } -} diff --git a/proto-build/Cargo.toml b/proto-build/Cargo.toml deleted file mode 100644 index 184ed276..00000000 --- a/proto-build/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -description = "This package is a modified copy of the osmosis package - https://github.com/osmosis-labs/osmosis-rust/tree/main/packages/proto-build" -authors = ["Supanat Potiwarakorn ", "Justin Kilpatrick ", "Tony Arcieri "] -edition = "2021" -name = "proto-build" -publish = false -version = "0.1.0" - -[dependencies] -heck = "0.4.0" -itertools = "0.10.3" -log = "0.4.17" -pretty_env_logger = "0.4.0" -prettyplease = "0.1.16" -proc-macro2 = "1.0.52" -prost = "0.12" -prost-build = "0.12" -prost-types = { workspace = true } -quote = "1.0.26" -regex = "1" -syn = {version = "1.0.98", features = ["full", "parsing", "extra-traits"]} -tonic = "0.10" -tonic-build = "0.10" -walkdir = "2" diff --git a/proto-build/buf.gen.yaml b/proto-build/buf.gen.yaml deleted file mode 100644 index d0f2f350..00000000 --- a/proto-build/buf.gen.yaml +++ /dev/null @@ -1,9 +0,0 @@ -version: v1 -plugins: - # - remote: buf.build/prost/plugins/prost:v0.2.1-1 - - plugin: buf.build/community/neoeinstein-prost:v0.2.3 - out: . - opt: - - extern_path=.google.protobuf.Timestamp=crate::shim::Timestamp - - extern_path=.google.protobuf.Duration=crate::shim::Duration - - extern_path=.google.protobuf.Any=crate::shim::Any diff --git a/proto-build/buf.lock b/proto-build/buf.lock deleted file mode 100644 index 958ce7c0..00000000 --- a/proto-build/buf.lock +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: cosmos - repository: cosmos-proto - commit: 1935555c206d4afb9e94615dfd0fad31 - - remote: buf.build - owner: cosmos - repository: cosmos-sdk - commit: 4074ba39c09e4b4799271a56a053227c - - remote: buf.build - owner: cosmos - repository: gogo-proto - commit: 34d970b699f84aa382f3c29773a60836 - - remote: buf.build - owner: googleapis - repository: googleapis - commit: 75b4300737fb4efca0831636be94e517 diff --git a/proto-build/buf.yaml b/proto-build/buf.yaml deleted file mode 100644 index d49b53e6..00000000 --- a/proto-build/buf.yaml +++ /dev/null @@ -1,23 +0,0 @@ -version: v1 -name: buf.build/neutron-org/neutron-sdk -deps: - - buf.build/cosmos/cosmos-sdk - - buf.build/cosmos/cosmos-proto - - buf.build/cosmos/gogo-proto - - buf.build/googleapis/googleapis -breaking: - use: - - FILE -lint: - use: - - DEFAULT - - COMMENTS - - FILE_LOWER_SNAKE_CASE - except: - - UNARY_RPC - - COMMENT_FIELD - - SERVICE_SUFFIX - - PACKAGE_VERSION_SUFFIX - - RPC_REQUEST_STANDARD_NAME - ignore: - - tendermint diff --git a/proto-build/src/code_generator.rs b/proto-build/src/code_generator.rs deleted file mode 100644 index c91d529a..00000000 --- a/proto-build/src/code_generator.rs +++ /dev/null @@ -1,256 +0,0 @@ -use std::fs::{create_dir_all, remove_dir_all}; -use std::path::{Path, PathBuf}; -use std::process::Command; -use std::{env, fs, io}; - -use log::{debug, info}; -use prost::Message; -use prost_types::FileDescriptorSet; -use walkdir::WalkDir; - -use crate::{mod_gen, transform}; - -#[derive(Clone, Debug)] -pub struct CosmosProject { - pub name: String, - pub version: String, - pub project_dir: String, - - /// determines which modules to exclude from the project - pub exclude_mods: Vec, -} - -pub struct CodeGenerator { - project: CosmosProject, - root: PathBuf, - out_dir: PathBuf, - tmp_build_dir: PathBuf, - deps: Vec, -} - -impl CodeGenerator { - pub fn new( - out_dir: PathBuf, - // TODO: remove tmp_build_dir from constructor in favor of generated tmp dir - tmp_build_dir: PathBuf, - project: CosmosProject, - deps: Vec, - ) -> Self { - Self { - project, - root: PathBuf::from(env!("CARGO_MANIFEST_DIR")), - out_dir, - tmp_build_dir, - deps, - } - } - - pub fn generate(&self) { - self.prepare_dir(); - self.compile_proto(); - - info!( - "🧪 [{}] Embellishing modules to expose nice API for library user...", - self.project.name - ); - - self.transform(); - self.generate_mod_file(); - self.fmt(); - - info!( - "✨ [{}] Library is successfully generated!", - self.project.name - ); - } - - fn prepare_dir(&self) { - if self.tmp_build_dir.exists() { - remove_dir_all(self.tmp_build_dir.clone()).unwrap(); - } - create_dir_all(self.tmp_namespaced_dir()).unwrap(); - output_version_file( - &self.project.name, - &self.project.version, - &self.tmp_namespaced_dir(), - ); - } - - fn generate_mod_file(&self) { - mod_gen::generate_mod_file(&self.absolute_out_dir()); - } - - fn transform(&self) { - transform::copy_and_transform_all( - &self.tmp_namespaced_dir(), - &self.absolute_out_dir(), - &self.file_descriptor_set(), - ); - } - - fn absolute_out_dir(&self) -> PathBuf { - self.root.join(&self.out_dir) - } - - fn fmt(&self) { - let manifest_path = find_cargo_toml(&self.absolute_out_dir()); - let exit_status = Command::new("cargo") - .arg("fmt") - .arg("--manifest-path") - .arg(manifest_path.to_string_lossy().to_string()) - .spawn() - .unwrap() - .wait() - .unwrap(); - - if !exit_status.success() { - panic!( - "unable to format with: cargo fmt --manifest-path {}", - manifest_path.to_string_lossy() - ); - } - } - - fn compile_proto(&self) { - let mut all_related_projects = self.deps.clone(); - all_related_projects.push(self.project.clone()); - - let buf_gen_template = self.root.join("buf.gen.yaml"); - - info!( - "🧪 [{}] Compiling types from protobuf definitions...", - self.project.name - ); - - // Compile proto files for each file in `protos` variable - // `buf generate —template {` - for project in all_related_projects { - let buf_root = if project.name == "cosmos" || project.name == "ics23" { - self.root.join(&project.project_dir).join("proto") - } else { - WalkDir::new(&self.root.join(&project.project_dir)) - .into_iter() - .filter_map(|e| e.ok()) - .find(|e| { - e.file_name() - .to_str() - .map(|s| s == "buf.yaml" || s == "buf.yml") - .unwrap_or(false) - }) - .map(|e| e.path().parent().unwrap().to_path_buf()) - .unwrap() - }; - - debug!("buf_root for project {:?}: {:?}", project.name, buf_root); - - let proto_path = &self.root.join(&project.project_dir).join("proto"); - - let mut cmd = Command::new("buf"); - cmd.arg("generate") - .arg(buf_root.to_string_lossy().to_string()) - .arg("--template") - .arg(buf_gen_template.to_string_lossy().to_string()) - .arg("--output") - .arg(self.tmp_namespaced_dir().to_string_lossy().to_string()); - - if !project.exclude_mods.is_empty() { - for excluded_mod in project.exclude_mods.clone() { - cmd.arg("--exclude-path") - .arg(proto_path.join(project.name.clone()).join(excluded_mod)); - } - } - - let exit_status = cmd.spawn().unwrap().wait().unwrap(); - - if !exit_status.success() { - panic!( - "unable to generate with: {:?}", - cmd.get_args().collect::>() - ); - } - - let descriptor_file = self - .tmp_namespaced_dir() - .join(format!("descriptor_{}.bin", project.name)); - - // generate descriptor file with `buf build buf.yaml --as-file-descriptor-set -o {descriptor_file}` - let mut cmd = Command::new("buf"); - cmd.arg("build") - .arg(buf_root.to_string_lossy().to_string()) - .arg("--as-file-descriptor-set") - .arg("-o") - .arg(descriptor_file.to_string_lossy().to_string()); - - if !project.exclude_mods.is_empty() { - for include_mod in project.exclude_mods { - cmd.arg("--exclude-path") - .arg(proto_path.join(project.name.clone()).join(include_mod)); - } - } - - let exit_status = cmd.spawn().unwrap().wait().unwrap(); - - if !exit_status.success() { - panic!( - "unable to build with: {:?}", - cmd.get_args().collect::>() - ); - } - } - - info!( - "✨ [{}] Types from protobuf definitions is compiled successfully!", - self.project.name - ); - } - - pub fn file_descriptor_set(&self) -> FileDescriptorSet { - // list all files in self.tmp_namespaced_dir() - let files = fs::read_dir(self.tmp_namespaced_dir()) - .unwrap() - .map(|res| res.map(|e| e.path())) - .collect::, io::Error>>() - .unwrap(); - - // filter only files that match "descriptor_*.bin" - let descriptor_files = files - .iter() - .filter(|f| { - f.file_name() - .unwrap() - .to_str() - .unwrap() - .starts_with("descriptor_") - }) - .collect::>(); - - // read all files and merge them into one FileDescriptorSet - let mut file_descriptor_set = FileDescriptorSet { file: vec![] }; - for descriptor_file in descriptor_files { - let descriptor_bytes = &fs::read(descriptor_file).unwrap()[..]; - let mut file_descriptor_set_tmp = FileDescriptorSet::decode(descriptor_bytes).unwrap(); - file_descriptor_set - .file - .append(&mut file_descriptor_set_tmp.file); - } - - file_descriptor_set - } - - fn tmp_namespaced_dir(&self) -> PathBuf { - self.tmp_build_dir.join(&self.project.name) - } -} - -fn output_version_file(project_name: &str, versions: &str, out_dir: &Path) { - let path = out_dir.join(format!("{}_COMMIT", project_name.to_uppercase())); - fs::write(path, versions).unwrap(); -} - -fn find_cargo_toml(path: &Path) -> PathBuf { - if path.join("Cargo.toml").exists() { - path.to_path_buf().join("Cargo.toml") - } else { - find_cargo_toml(path.parent().expect("Cargo.toml not found")) - } -} diff --git a/proto-build/src/git.rs b/proto-build/src/git.rs deleted file mode 100644 index 9583b203..00000000 --- a/proto-build/src/git.rs +++ /dev/null @@ -1,32 +0,0 @@ -use log::info; -use std::ffi::OsStr; -use std::path::PathBuf; -use std::process::{Command, Stdio}; - -fn run_git(args: impl IntoIterator>) -> Result<(), String> { - let stdout = Stdio::inherit(); - - let exit_status = Command::new("git") - .args(args) - .stdout(stdout) - .status() - .expect("git exit status missing"); - - if !exit_status.success() { - return Err(format!( - "git exited with error code: {:?}", - exit_status.code() - )); - } - - Ok(()) -} - -pub fn clone_repo(repo: &str, dir: &str, rev: &str) { - let full_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(dir); - - info!("Cloning {} repo...", dir.split('/').nth(2).unwrap()); - - run_git(["clone", repo, full_path.to_str().unwrap()]).expect("failed to clone"); - run_git(["-C", full_path.to_str().unwrap(), "checkout", rev]).expect("failed to checkout"); -} diff --git a/proto-build/src/lib.rs b/proto-build/src/lib.rs deleted file mode 100644 index ab8e7460..00000000 --- a/proto-build/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod code_generator; -pub mod git; -pub mod mod_gen; -pub mod transform; -pub mod transformers; diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs deleted file mode 100644 index 1308432c..00000000 --- a/proto-build/src/main.rs +++ /dev/null @@ -1,168 +0,0 @@ -//! Build Neutron proto files. This build script clones the CosmosSDK and Neutron version -//! specified in the COSMOS_SDK_REV and NEUTRON_REV constant respectively and then -//! uses that to build the required proto files for further compilation. -//! This is based on the proto-compiler code in github.com/informalsystems/ibc-rs - -use std::{fs, path::PathBuf}; - -use proto_build::{ - code_generator::{CodeGenerator, CosmosProject}, - git, -}; - -const COSMOS_SDK_REPO: &str = "https://github.com/neutron-org/cosmos-sdk.git"; -const NEUTRON_REPO: &str = "https://github.com/neutron-org/neutron.git"; -const WASMD_REPO: &str = "https://github.com/neutron-org/wasmd.git"; -const COMETBFT_REPO: &str = "https://github.com/cometbft/cometbft.git"; -const IBC_GO_REPO: &str = "https://github.com/cosmos/ibc-go.git"; -const ICS23_REPO: &str = "https://github.com/cosmos/ics23.git"; -const FEEMARKET_REPO: &str = "https://github.com/skip-mev/feemarket.git"; -const SLINKY_REPO: &str = "https://github.com/skip-mev/slinky.git"; - -/// The Cosmos SDK commit or tag to be cloned and used to build the proto files -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 = "6bef62c6d9182b51fd5facc41088689c809b96d5"; - -/// The wasmd commit or tag to be cloned and used to build the proto files -const WASMD_REV: &str = "v0.51.0"; - -/// The cometbft commit or tag to be cloned and used to build the proto files -const COMETBFT_REV: &str = "v0.38.10"; - -/// The ibc-go commit or tag to be cloned and used to build the proto files -const IBC_GO_REV: &str = "v8.2.1"; - -/// The ics23 commit or tag to be cloned and used to build the proto files -const ICS23_REV: &str = "go/v0.10.0"; - -const FEEMARKET_REV: &str = "v1.0.3"; - -const SLINKY_REV: &str = "v1.0.3"; - -// All paths must end with a / and either be absolute or include a ./ to reference the current -// working directory. - -/// Directory where the cosmos-sdk repo is located -const COSMOS_SDK_DIR: &str = "../dependencies/cosmos-sdk/"; -/// Directory where the neutron repo is located -const NEUTRON_DIR: &str = "../dependencies/neutron/"; -/// Directory where the wasmd repo is located -const WASMD_DIR: &str = "../dependencies/wasmd/"; -/// Directory where the cometbft repo is located -const COMETBFT_DIR: &str = "../dependencies/cometbft/"; -/// Directory where the ibc-go repo is located -const IBC_GO_DIR: &str = "../dependencies/ibc-go/"; -/// Directory where the ics23 repo is located -const ICS23_DIR: &str = "../dependencies/ics23/"; -/// Directory where the feemarket repo is located -const FEEMARKET_DIR: &str = "../dependencies/feemarket/"; -/// Directory where the slinky repo is located -const SLINKY_DIR: &str = "../dependencies/slinky/"; - -/// A temporary directory for repos storing -const TMP_REPOS_DIR: &str = "./dependencies/"; -/// A temporary directory for proto building -const TMP_BUILD_DIR: &str = "/tmp/tmp-protobuf/"; -/// The directory generated cosmos-sdk proto files go into in this repo -const OUT_DIR: &str = "../packages/neutron-sdk/src/proto_types/"; - -pub fn generate() { - let tmp_repos_dir: PathBuf = TMP_REPOS_DIR.parse().unwrap(); - if tmp_repos_dir.exists() { - fs::remove_dir_all(tmp_repos_dir.clone()).unwrap(); - } - - git::clone_repo(COSMOS_SDK_REPO, COSMOS_SDK_DIR, COSMOS_SDK_REV); - git::clone_repo(NEUTRON_REPO, NEUTRON_DIR, NEUTRON_REV); - git::clone_repo(WASMD_REPO, WASMD_DIR, WASMD_REV); - git::clone_repo(COMETBFT_REPO, COMETBFT_DIR, COMETBFT_REV); - git::clone_repo(IBC_GO_REPO, IBC_GO_DIR, IBC_GO_REV); - git::clone_repo(ICS23_REPO, ICS23_DIR, ICS23_REV); - git::clone_repo(FEEMARKET_REPO, FEEMARKET_DIR, FEEMARKET_REV); - git::clone_repo(SLINKY_REPO, SLINKY_DIR, SLINKY_REV); - - let tmp_build_dir: PathBuf = TMP_BUILD_DIR.parse().unwrap(); - let out_dir: PathBuf = OUT_DIR.parse().unwrap(); - - let cosmos_project = CosmosProject { - name: "cosmos".to_string(), - version: COSMOS_SDK_REV.to_string(), - project_dir: COSMOS_SDK_DIR.to_string(), - exclude_mods: vec!["reflection".to_string(), "autocli".to_string()], - }; - - let neutron_project = CosmosProject { - name: "neutron".to_string(), - version: NEUTRON_REV.to_string(), - project_dir: NEUTRON_DIR.to_string(), - exclude_mods: vec![], - }; - - let wasmd_project = CosmosProject { - name: "wasmd".to_string(), - version: WASMD_REV.to_string(), - project_dir: WASMD_DIR.to_string(), - exclude_mods: vec![], - }; - - let cometbft_project = CosmosProject { - name: "tendermint".to_string(), - version: COMETBFT_REV.to_string(), - project_dir: COMETBFT_DIR.to_string(), - exclude_mods: vec![], - }; - - let ibc_project = CosmosProject { - name: "ibc".to_string(), - version: IBC_GO_REV.to_string(), - project_dir: IBC_GO_DIR.to_string(), - exclude_mods: vec![], - }; - - let ics23_project = CosmosProject { - name: "ics23".to_string(), - version: ICS23_REV.to_string(), - project_dir: ICS23_DIR.to_string(), - exclude_mods: vec![], - }; - - let feemarket_project = CosmosProject { - name: "feemarket".to_string(), - version: FEEMARKET_REV.to_string(), - project_dir: FEEMARKET_DIR.to_string(), - exclude_mods: vec![], - }; - - let slinky_project = CosmosProject { - name: "slinky".to_string(), - version: SLINKY_REV.to_string(), - project_dir: SLINKY_DIR.to_string(), - exclude_mods: vec![], - }; - - let neutron_code_generator = CodeGenerator::new( - out_dir, - tmp_build_dir, - neutron_project, - vec![ - cosmos_project, - wasmd_project, - cometbft_project, - ibc_project, - ics23_project, - feemarket_project, - slinky_project, - ], - ); - - neutron_code_generator.generate(); - - fs::remove_dir_all(tmp_repos_dir.clone()).unwrap(); -} - -fn main() { - pretty_env_logger::init(); - generate(); -} diff --git a/proto-build/src/mod_gen.rs b/proto-build/src/mod_gen.rs deleted file mode 100644 index 9297fb47..00000000 --- a/proto-build/src/mod_gen.rs +++ /dev/null @@ -1,115 +0,0 @@ -use itertools::Itertools; -use proc_macro2::TokenStream as TokenStream2; -use quote::{format_ident, quote}; -use std::ffi::OsStr; -use std::fs; -use std::fs::create_dir_all; -use std::path::{Path, PathBuf}; - -pub fn generate_mod_file(for_dir: &Path) { - let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let types_dir = root.join(for_dir); - - let paths = fs::read_dir(&types_dir) - .expect("[error] Unable to read dir") - .filter_map(|d| { - let f = d.expect("[error] Unable to get dir entry"); - if f.path().extension() == Some(OsStr::new("rs")) { - f.path() - .file_stem() - .and_then(|s| s.to_str()) - .map(|s| s.to_string()) - } else { - None - } - }) - .map(|s| s.split('.').map(|s| s.to_string()).collect::>()) - .collect::>>(); - - paths - .iter() - .for_each(|p| create_dir_all(for_dir.join(p[..(p.len() - 1)].join("/"))).unwrap()); - - recur_gen_mod(&types_dir, &types_dir, paths, ""); -} - -fn recur_gen_mod(for_dir: &Path, start_dir: &Path, paths: Vec>, include_file: &str) { - let uniq_keys = paths - .iter() - .filter_map(|p| (*p).first()) - .map(|s| s.to_owned()) - .unique() - .sorted() - .collect::>(); - - // base case - if uniq_keys.is_empty() { - let from = start_dir.join(format!("{}.rs", include_file.replace('/', "."))); - let to = for_dir - .parent() - .unwrap() - .join(format!("{}.rs", include_file.split('.').last().unwrap())); - fs::rename(from, to).unwrap(); - } else { - let ts = uniq_keys.iter().map(|k| { - let module = format_ident!("{}", k); - quote! { pub mod #module; } - }); - - let additional_mod_content = if paths.iter().any(|p| p.is_empty()) && paths.len() > 1 { - let src_file = start_dir.join(format!("{}.rs", include_file)); - let tk = fs::read_to_string(src_file.clone()) - .unwrap() - .parse::() - .unwrap(); - - fs::remove_file(src_file).unwrap(); - - tk - } else { - quote!() - }; - - create_mod_rs( - quote! { - #(#ts)* - - #additional_mod_content - }, - for_dir, - ); - - for k in uniq_keys { - let paths: Vec> = paths - .iter() - // only if head = k - .filter(|p| (**p).first() == Some(&k)) - // get tail - .map(|p| p.split_at(1).1.to_vec()) - .collect(); - let include_file = if include_file.is_empty() { - k.clone() - } else { - format!("{include_file}.{k}") - }; - - recur_gen_mod( - &for_dir.join(k.clone()), - start_dir, - paths.clone(), - &include_file, - ); - } - } -} - -fn create_mod_rs(ts: TokenStream2, path: &Path) { - let file = syn::parse_file(ts.to_string().as_str()) - .expect("[error] Unable to parse generated content as file while genrating mod.rs"); - - let write = fs::write(path.join("mod.rs"), prettyplease::unparse(&file)); - - if let Err(e) = write { - panic!("[error] Error while generating mod.rs: {}", e); - } -} diff --git a/proto-build/src/transform.rs b/proto-build/src/transform.rs deleted file mode 100644 index 810fd38b..00000000 --- a/proto-build/src/transform.rs +++ /dev/null @@ -1,204 +0,0 @@ -use heck::ToUpperCamelCase; -use log::debug; -use prost_types::FileDescriptorSet; - -use regex::Regex; -use std::ffi::OsStr; -use std::fs::{create_dir_all, remove_dir_all}; -use std::path::{Path, PathBuf}; -use std::{fs, io}; -use syn::{File, Item, ItemMod}; -use walkdir::WalkDir; - -use crate::transformers; - -/// Protos belonging to these Protobuf packages will be excluded -/// (i.e. because they are sourced from `tendermint-proto`) -const EXCLUDED_PROTO_PACKAGES: &[&str] = &["cosmos_proto", "gogoproto", "google"]; - -pub fn copy_and_transform_all(from_dir: &Path, to_dir: &Path, descriptor: &FileDescriptorSet) { - let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let to_dir = root.join(to_dir); - debug!("Copying generated files into '{}'...", to_dir.display()); - - // Remove old compiled files - remove_dir_all(&to_dir).unwrap_or_default(); - create_dir_all(&to_dir).unwrap(); - - let mut filenames = Vec::new(); - - // Copy new compiled files (prost does not use folder structures) - let errors = WalkDir::new(from_dir) - .into_iter() - .filter_map(|e| e.ok()) - .filter(|e| e.file_type().is_file()) - .map(|e| { - let filename = e.file_name().to_os_string().to_str().unwrap().to_string(); - filenames.push(filename.clone()); - copy_and_transform( - e.path(), - format!("{}{}", to_dir.display(), &filename), - descriptor, - ) - }) - .filter_map(|e| e.err()) - .collect::>(); - - if !errors.is_empty() { - for e in errors { - eprintln!("[error] Error while copying compiled file: {}", e); - } - - panic!("[error] Aborted."); - } -} - -fn copy_and_transform( - src: &Path, - dest: impl AsRef, - descriptor: &FileDescriptorSet, -) -> io::Result<()> { - debug!("copy_and_transform: {:?} -> {:?}", src, dest.as_ref()); - // Skip proto files belonging to `EXCLUDED_PROTO_PACKAGES` - for package in EXCLUDED_PROTO_PACKAGES { - if let Some(filename) = src.file_name().and_then(OsStr::to_str) { - if filename.starts_with(&format!("{}.", package)) { - return Ok(()); - } - } - } - - let mut contents = match fs::read_to_string(src) { - Ok(c) => c, - Err(e) => { - debug!("{:?} – {}, copy_and_transform skipped", src, e); - return Ok(()); - } - }; - - for &(filename, regex, replacement) in transformers::LARGE_SIZE_ENUM_REPLACEMENTS { - if src.file_name().and_then(OsStr::to_str).unwrap() == filename { - contents = Regex::new(regex) - .unwrap_or_else(|_| panic!("invalid regex: {}", regex)) - .replace_all(&contents, replacement) - .to_string(); - } - } - - for &(regex, replacement) in transformers::REPLACEMENTS { - contents = Regex::new(regex) - .unwrap_or_else(|_| panic!("invalid regex: {}", regex)) - .replace_all(&contents, replacement) - .to_string(); - } - - let file = syn::parse_file(&contents); - if let Ok(file) = file { - // only transform rust file (skipping `*_COMMIT` file) - let items = transform_module(file.items, src, &[], descriptor, false); - contents = prettyplease::unparse(&File { items, ..file }); - } - - fs::write(dest, &*contents) -} - -fn transform_module( - items: Vec, - src: &Path, - ancestors: &[String], - descriptor: &FileDescriptorSet, - nested_mod: bool, -) -> Vec { - let mut items = transform_items(items, src, ancestors, descriptor); - - if items.iter().any(|i| matches!(i, Item::Struct(_))) { - items = prepend(items); - } - - append(items, src, descriptor, nested_mod) -} - -fn prepend(items: Vec) -> Vec { - let mut items = items; - - let mut prepending_items = vec![syn::parse_quote! { - use neutron_std_derive::CosmwasmExt; - }]; - - items.splice(0..0, prepending_items.drain(..)); - items -} - -fn append( - items: Vec, - src: &Path, - descriptor: &FileDescriptorSet, - nested_mod: bool, -) -> Vec { - transformers::append_querier(items, src, nested_mod, descriptor) -} - -fn transform_items( - items: Vec, - src: &Path, - ancestors: &[String], - descriptor: &FileDescriptorSet, -) -> Vec { - items - .into_iter() - .map(|i| match i { - Item::Struct(s) => Item::Struct({ - let s = transformers::add_derive_eq_struct(&s); - let s = transformers::append_attrs_struct(src, &s, descriptor); - let s = transformers::serde_alias_id_with_uppercased(s); - // A hack to make Pagination::next_key optional. - // Remove if [this PR](https://github.com/cosmos/cosmos-sdk/pull/20246) is merged and released - let s = transformers::make_next_key_optional(s); - let s = transformers::allow_serde_option_vec_u8_as_base64_encoded_string(s); - let s = transformers::allow_serde_vec_u8_as_base64_encoded_string(s); - let s = transformers::allow_serde_int_as_str(s); - - transformers::allow_serde_vec_int_as_vec_str(s) - }), - - Item::Enum(e) => Item::Enum({ - let e = transformers::add_derive_eq_enum(&e); - transformers::append_attrs_enum(src, &e, descriptor) - }), - - // This is a temporary hack to fix the issue with clashing stake authorization validators - Item::Mod(m) => Item::Mod(transformers::fix_clashing_stake_authorization_validators(m)), - - i => i, - }) - .map(|i: Item| transform_nested_mod(i, src, ancestors, descriptor)) - .collect::>() -} - -fn transform_nested_mod( - i: Item, - src: &Path, - ancestors: &[String], - descriptor: &FileDescriptorSet, -) -> Item { - match i.clone() { - Item::Mod(m) => { - let parent = &m.ident.to_string().to_upper_camel_case(); - let content = m.content.map(|(brace, items)| { - ( - brace, - transform_module( - items, - src, - &[ancestors, &[parent.to_string()]].concat(), - descriptor, - true, - ), - ) - }); - - Item::Mod(ItemMod { content, ..m }) - } - _ => i, - } -} diff --git a/proto-build/src/transformers.rs b/proto-build/src/transformers.rs deleted file mode 100644 index 157d063e..00000000 --- a/proto-build/src/transformers.rs +++ /dev/null @@ -1,873 +0,0 @@ -use std::collections::HashMap; -use std::path::Path; - -use heck::ToSnakeCase; -use heck::ToUpperCamelCase; -use proc_macro2::{Group, TokenStream as TokenStream2, TokenTree}; -use prost_types::{ - DescriptorProto, EnumDescriptorProto, FileDescriptorSet, ServiceDescriptorProto, -}; -use quote::{format_ident, quote}; -use regex::Regex; -use syn::ItemEnum; -use syn::ItemMod; -use syn::{parse_quote, Attribute, Fields, Ident, Item, ItemStruct, Type}; - -const TOO_MANY_ARGUMENTS_FUNCS: &[&str] = &["estimate_place_limit_order"]; - -pub const LARGE_SIZE_ENUM_REPLACEMENTS: &[(&str, &str, &str)] = &[( - "tendermint.blocksync.rs", - "super::BlockResponse", - "Box", -)]; - -/// Regex substitutions to apply to the prost-generated output -pub const REPLACEMENTS: &[(&str, &str)] = &[ - // Feature-gate gRPC client modules - ( - "/// Generated client implementations.", - "/// Generated client implementations.\n\ - #[cfg(feature = \"grpc\")]\n\ - #[cfg_attr(docsrs, doc(cfg(feature = \"grpc\")))]", - ), - // Feature-gate gRPC client impls which use `tonic::transport` - ( - "impl (.+)Client", - "#[cfg(feature = \"grpc-transport\")]\n \ - #[cfg_attr(docsrs, doc(cfg(feature = \"grpc-transport\")))]\n \ - impl ${1}Client", - ), -]; - -pub fn add_derive_eq(mut attr: Attribute) -> Attribute { - // find derive attribute - if attr.path.is_ident("derive") { - attr.tokens = attr - .tokens - .into_iter() - .map(|token_tree| { - match token_tree { - // with group token stream, which is `#[derive( ... )]` - TokenTree::Group(group) => { - let has_ident = |ident_str: &str| { - group.stream().into_iter().any(|token| match token { - TokenTree::Ident(ident) => ident == format_ident!("{}", ident_str), - _ => false, - }) - }; - - // if does not have both PartialEq and Eq - let stream = if !(has_ident("PartialEq") && has_ident("Eq")) { - // construct new token stream - group - .stream() - .into_iter() - .flat_map(|token| { - match token { - // if there exist `PartialEq` in derive attr - TokenTree::Ident(ident) => { - if ident == format_ident!("PartialEq") { - // expand token stream in group with `#[derive( ..., PartialEq, ... )]` to ``#[derive( ..., PartialEq, Eq, ... )]`` - let expanded_token_stream: TokenStream2 = - syn::parse_quote!(PartialEq, Eq); - expanded_token_stream.into_iter().collect() - } else { - vec![TokenTree::Ident(ident)] - } - } - tt => vec![tt], - } - }) - .collect() - } else { - group.stream() - }; - - TokenTree::Group(Group::new(group.delimiter(), stream)) - } - _ => token_tree, - } - }) - .collect(); - attr - } else { - attr - } -} - -pub fn add_derive_eq_struct(s: &ItemStruct) -> ItemStruct { - let mut item_struct = s.clone(); - item_struct.attrs = item_struct.attrs.into_iter().map(add_derive_eq).collect(); - - item_struct -} - -pub fn add_derive_eq_enum(s: &ItemEnum) -> ItemEnum { - let mut item_enum = s.clone(); - item_enum.attrs = item_enum.attrs.into_iter().map(add_derive_eq).collect(); - - item_enum -} - -pub fn append_attrs_struct( - src: &Path, - s: &ItemStruct, - descriptor: &FileDescriptorSet, -) -> ItemStruct { - let mut s = s.clone(); - let query_services = extract_query_services(descriptor); - let type_url = get_type_url(src, &s.ident, descriptor); - - let deprecated = get_deprecation(src, &s.ident, descriptor); - - s.attrs.append(&mut vec![ - syn::parse_quote! { #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)] }, - syn::parse_quote! { #[proto_message(type_url = #type_url)] }, - ]); - - if let Some(attr) = get_query_attr(src, &s.ident, &query_services) { - s.attrs.append(&mut vec![attr]) - } - - if deprecated { - s.attrs - .append(&mut vec![syn::parse_quote! { #[deprecated] }]); - } - - s -} - -pub fn append_attrs_enum(src: &Path, e: &ItemEnum, descriptor: &FileDescriptorSet) -> ItemEnum { - let mut e = e.clone(); - let deprecated = get_deprecation(src, &e.ident, descriptor); - - e.attrs.append(&mut vec![ - syn::parse_quote! { #[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)] }, - ]); - - if deprecated { - e.attrs - .append(&mut vec![syn::parse_quote! { #[deprecated] }]); - } - - e -} - -pub fn allow_serde_int_as_str(s: ItemStruct) -> ItemStruct { - let fields_vec = s - .fields - .clone() - .into_iter() - .map(|mut field| { - let int_types = vec![ - parse_quote!(i8), - parse_quote!(i16), - parse_quote!(i32), - parse_quote!(i64), - parse_quote!(i128), - parse_quote!(isize), - parse_quote!(u8), - parse_quote!(u16), - parse_quote!(u32), - parse_quote!(u64), - parse_quote!(u128), - parse_quote!(usize), - ]; - - if int_types.contains(&field.ty) { - let from_str: syn::Attribute = parse_quote! { - #[serde( - serialize_with = "crate::serde::as_str::serialize", - deserialize_with = "crate::serde::as_str::deserialize" - )] - }; - field.attrs.append(&mut vec![from_str]); - field - } else { - field - } - }) - .collect::>(); - - let fields_named: syn::FieldsNamed = parse_quote! { - { #(#fields_vec,)* } - }; - let fields = syn::Fields::Named(fields_named); - - syn::ItemStruct { fields, ..s } -} - -pub fn allow_serde_vec_int_as_vec_str(s: ItemStruct) -> ItemStruct { - let fields_vec = s - .fields - .clone() - .into_iter() - .map(|mut field| { - let vec_int_types = vec![ - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - // parse_quote!(::prost::alloc::vec::Vec), -- this is not included because it is used for bytes and has it's own rule - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - parse_quote!(::prost::alloc::vec::Vec), - ]; - - if vec_int_types.contains(&field.ty) { - let from_str: syn::Attribute = parse_quote! { - #[serde( - serialize_with = "crate::serde::as_str_vec::serialize", - deserialize_with = "crate::serde::as_str_vec::deserialize" - )] - }; - field.attrs.append(&mut vec![from_str]); - field - } else { - field - } - }) - .collect::>(); - - let fields_named: syn::FieldsNamed = parse_quote! { - { #(#fields_vec,)* } - }; - let fields = syn::Fields::Named(fields_named); - - syn::ItemStruct { fields, ..s } -} - -pub fn allow_serde_vec_u8_as_base64_encoded_string(s: ItemStruct) -> ItemStruct { - let fields_vec = s - .fields - .clone() - .into_iter() - .map(|mut field| { - if field.ty == parse_quote!(::prost::alloc::vec::Vec) { - let from_str: syn::Attribute = parse_quote! { - #[serde( - serialize_with = "crate::serde::as_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_base64_encoded_string::deserialize" - )] - }; - field.attrs.append(&mut vec![from_str]); - field - } else { - field - } - }) - .collect::>(); - - let fields_named: syn::FieldsNamed = parse_quote! { - { #(#fields_vec,)* } - }; - let fields = syn::Fields::Named(fields_named); - - syn::ItemStruct { fields, ..s } -} - -/// some of proto's fields in osmosis' modules are named `ID` but prost generates `id` field -/// this function adds `#[serde(alias = "ID")]` to the `id` field -/// so that serde can deserialize `ID` field to `id` field. -/// This is required because the `ID` field is used in the query response and is serialized as json. -pub fn serde_alias_id_with_uppercased(s: ItemStruct) -> ItemStruct { - let fields_vec = s - .fields - .clone() - .into_iter() - .map(|mut field| { - if let Some(ident) = &field.ident { - let ident_str = ident.to_string(); - if ident_str == "id" { - let serde_alias_id: syn::Attribute = parse_quote! { - #[serde(alias = "ID")] - }; - field.attrs.append(&mut vec![serde_alias_id]); - field - } else if ident_str.contains("_id") { - let ident_str = ident_str.replace("_id", "ID"); - let serde_alias_id: syn::Attribute = parse_quote! { - #[serde(alias = #ident_str)] - }; - field.attrs.append(&mut vec![serde_alias_id]); - field - } else { - field - } - } else { - field - } - }) - .collect::>(); - - let fields_named: syn::FieldsNamed = parse_quote! { - { #(#fields_vec,)* } - }; - let fields = syn::Fields::Named(fields_named); - - syn::ItemStruct { fields, ..s } -} - -pub fn make_next_key_optional(mut s: ItemStruct) -> ItemStruct { - if s.ident == "PageResponse" { - if let Fields::Named(ref mut fields_named) = s.fields { - for field in fields_named.named.iter_mut() { - if let Some(ident) = &field.ident { - if ident == "next_key" { - field.ty = - parse_quote!(::core::option::Option<::prost::alloc::vec::Vec>); - for attr in field.attrs.iter_mut() { - if attr.path.is_ident("prost") { - *attr = parse_quote! { - #[prost(bytes = "vec", optional, tag = "1")] - }; - } - } - } - } - } - } - } - - s -} - -pub fn allow_serde_option_vec_u8_as_base64_encoded_string(s: syn::ItemStruct) -> syn::ItemStruct { - let fields_vec = s.fields - .clone() - .into_iter() - .map(|mut field| { - if let syn::Type::Path(type_path) = &field.ty { - if let Some(segment) = type_path.path.segments.last() { - if segment.ident == "Option" { - if let syn::PathArguments::AngleBracketed(args) = &segment.arguments { - if let Some(syn::GenericArgument::Type(syn::Type::Path(inner_path))) = args.args.first() { - if let Some(inner_segment) = inner_path.path.segments.last() { - if inner_segment.ident == "Vec" { - let from_str: syn::Attribute = parse_quote! { - #[serde( - serialize_with = "crate::serde::as_option_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_option_base64_encoded_string::deserialize" - )] - }; - field.attrs.push(from_str); - } - } - } - } - } - } - } - field - }) - .collect::>(); - - let fields_named: syn::FieldsNamed = parse_quote! { - { #(#fields_vec,)* } - }; - let fields = syn::Fields::Named(fields_named); - - syn::ItemStruct { fields, ..s } -} - -// ====== helpers ====== - -fn get_query_attr( - src: &Path, - ident: &Ident, - query_services: &HashMap, -) -> Option { - let package = src.file_stem().unwrap().to_str().unwrap(); - let service = query_services.get(package); - - let method = service?.method.iter().find(|m| { - let input_type = m.input_type.clone().unwrap(); - let input_type = input_type.split('.').last().unwrap(); - *ident == input_type.to_upper_camel_case() - }); - - let method_name = method?.name.clone().unwrap(); - let response_type = method?.output_type.clone().unwrap(); - let response_type = response_type.split('.').last().unwrap(); - let response_type = format_ident!("{}", response_type.to_upper_camel_case()); - - let path = format!("/{}.Query/{}", package, method_name); - Some(syn::parse_quote! { #[proto_query(path = #path, response_type = #response_type)] }) -} - -fn get_type_url(src: &Path, ident: &Ident, descriptor: &FileDescriptorSet) -> String { - let type_path = src.file_stem().unwrap().to_str().unwrap(); - let init_path = ""; - - let name: Option = descriptor - .file - .clone() - .into_iter() - .filter(|f| f.package.to_owned().unwrap() == type_path) - .flat_map(|f| { - let target = ident.to_string(); - vec![ - extract_type_path_from_enum(&target, &f.enum_type, init_path), - extract_type_path_from_descriptor(&target, &f.message_type, init_path), - ] - }) - .filter(|r| r.is_some()) - .take(1) - .collect(); - - format!("/{}.{}", type_path, name.unwrap()) -} - -fn get_deprecation(src: &Path, ident: &Ident, descriptor: &FileDescriptorSet) -> bool { - let type_path = src.file_stem().unwrap().to_str().unwrap(); - - let deprecation: Option = descriptor - .file - .clone() - .into_iter() - .filter(|f| f.package.to_owned().unwrap() == type_path) - .flat_map(|f| { - let target = ident.to_string(); - vec![ - extract_deprecation_from_enum(&target, &f.enum_type), - extract_deprecation_from_descriptor(&target, &f.message_type), - ] - }) - .find(|r| r.is_some()) - .flatten(); - - deprecation.unwrap_or(false) -} - -fn extract_deprecation_from_descriptor( - target: &str, - message_type: &[DescriptorProto], -) -> Option { - message_type.iter().find_map(|descriptor| { - let message_name = descriptor.name.to_owned().unwrap(); - - if message_name.to_upper_camel_case() == target { - descriptor.clone().options?.deprecated - } else if let Some(deprecated) = - extract_deprecation_from_descriptor(target, &descriptor.nested_type) - { - Some(deprecated) - } else { - extract_deprecation_from_enum(target, &descriptor.enum_type) - } - }) -} - -fn extract_deprecation_from_enum(target: &str, enum_type: &[EnumDescriptorProto]) -> Option { - enum_type - .iter() - .find(|e| e.name.to_owned().unwrap().to_upper_camel_case() == target) - .and_then(|e| e.clone().options?.deprecated) -} - -fn extract_type_path_from_descriptor( - target: &str, - message_type: &[DescriptorProto], - path: &str, -) -> Option { - message_type.iter().find_map(|descriptor| { - let message_name = descriptor.name.to_owned().unwrap(); - - if message_name.to_upper_camel_case() == target { - Some(append_type_path(path, &message_name)) - } else if let Some(message_name) = extract_type_path_from_descriptor( - target, - &descriptor.nested_type, - &append_type_path(path, &message_name), - ) { - Some(message_name) - } else { - extract_type_path_from_enum( - target, - &descriptor.enum_type, - &append_type_path(path, &message_name), - ) - } - }) -} - -pub fn extract_type_path_from_service_str(s: &str) -> String { - let mut parts: Vec<_> = s.trim_start_matches('.').split('.').collect(); - parts.pop(); - parts.join(".") -} - -fn extract_type_path_from_enum( - target: &str, - enum_type: &[EnumDescriptorProto], - path: &str, -) -> Option { - enum_type - .iter() - .find(|e| e.name.to_owned().unwrap().to_upper_camel_case() == target) - .map(|e| append_type_path(path, &e.name.to_owned().unwrap())) -} - -pub fn extract_query_services( - descriptor: &FileDescriptorSet, -) -> HashMap { - descriptor - .clone() - .file - .into_iter() - .filter_map(|f| { - let service = f - .service - .into_iter() - .find(|s| s.name == Some("Query".to_string())); - - if let Some(service) = service { - Some(( - f.package.expect("Missing package name in file descriptor"), - service, - )) - } else { - None - } - }) - .collect() -} - -fn append_type_path(path: &str, name: &str) -> String { - if path.is_empty() { - name.to_string() - } else { - format!("{}.{}", path, name) - } -} - -pub fn append_querier( - items: Vec, - src: &Path, - nested_mod: bool, - descriptor: &FileDescriptorSet, -) -> Vec { - let package = src.file_stem().unwrap().to_str().unwrap(); - let re = Regex::new(r"([^.]*)(\.v\d+(beta\d+)?)?$").unwrap(); - - let package_stem = re.captures(package).unwrap().get(1).unwrap().as_str(); - - let querier_wrapper_ident = format_ident!("{}Querier", &package_stem.to_upper_camel_case()); - - let query_services = extract_query_services(descriptor); - let query_fns = query_services.get(package).map(|service| service.method.iter().map(|method_desc| { - if nested_mod { - return quote! {}; - } - - let deprecated = method_desc.clone().options.map(|opt| opt.deprecated.unwrap_or(false)).unwrap_or(false); - let deprecated_attr = if deprecated { - quote!(#[deprecated]) - } else { - quote!() - }; - - let method_desc = method_desc.clone(); - - // Some requests are defined in other packages and imported, but end up in the - // ServiceDescriptorProto anyway, so we need to filter them out - let req_package = extract_type_path_from_service_str(method_desc.input_type.as_ref().unwrap()); - if req_package != package { - return quote! {}; - } - - let name = format_ident!("{}", method_desc.name.unwrap().as_str().to_snake_case()); - let req_type = format_ident!("{}", method_desc.input_type.unwrap().split('.').last().unwrap().to_string().to_upper_camel_case()); - let res_type = format_ident!("{}", method_desc.output_type.unwrap().split('.').last().unwrap().to_string().to_upper_camel_case()); - - let allow_too_many_arguments_attr = if TOO_MANY_ARGUMENTS_FUNCS.iter().any(|&i| name == i) { - quote!(#[allow(clippy::too_many_arguments)]) - } else { - quote!() - }; - - let req_args = items.clone().into_iter() - .find_map(|item| match item { - Item::Struct(s) => { - if s.ident == req_type { - match s.fields { - Fields::Named(fields_named) => { - Some(fields_named.named) - } - _ => None - } - } else { - None - } - } - _ => None - }); - - let arg_idents = req_args.clone().unwrap().into_iter().map(|arg| arg.ident.unwrap()).collect::>(); - let arg_ty = req_args.unwrap().into_iter().map(|arg| arg.ty).collect::>(); - - quote! { - #deprecated_attr - #allow_too_many_arguments_attr - pub fn #name( &self, #(#arg_idents : #arg_ty),* ) -> Result<#res_type, cosmwasm_std::StdError> { - #req_type { #(#arg_idents),* }.query(self.querier) - } - } - }).collect::>()); - - let querier = if let Some(query_fns) = query_fns { - if !nested_mod { - let allow_dead_code_attr = if query_fns.iter().any(|i| !i.is_empty()) { - quote!() - } else { - quote!(#[allow(dead_code)]) - }; - - vec![ - parse_quote! { - #allow_dead_code_attr - pub struct #querier_wrapper_ident<'a, Q: cosmwasm_std::CustomQuery> { - querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, - } - }, - parse_quote! { - impl<'a, Q: cosmwasm_std::CustomQuery> #querier_wrapper_ident<'a, Q> { - pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { - Self { querier } - } - #(#query_fns)* - } - }, - ] - } else { - vec![] - } - } else { - vec![] - }; - - [items, querier].concat() -} - -/// This is a hack to fix a clashing name in the stake_authorization module -pub fn fix_clashing_stake_authorization_validators(input: ItemMod) -> ItemMod { - // do this only if the module is named "stake_authorization" - if input.ident != "stake_authorization" { - return input; - } - let new_name = Ident::new("Validators_", input.ident.span()); - let mut validators = None; - let items = input.content.clone().unwrap().1; - - // Iterate over the items in the module and look for the Validators struct then rename it - let items = items.into_iter().map(|mut item| { - if let Item::Struct(ref mut s) = item { - if s.ident == "Validators" { - s.ident = new_name.clone(); - validators = Some(s.clone()); - } - } - item - }); - - // Update any references to the struct - let items = items.into_iter().map(|mut item| { - if let Item::Enum(ref mut e) = item { - if e.ident == "Validators" { - for v in e.variants.iter_mut() { - if let Fields::Unnamed(ref mut f) = v.fields { - if let Type::Path(ref mut p) = f.unnamed.first_mut().unwrap().ty { - if p.path.segments.first().unwrap().ident == "Validators" { - p.path.segments.first_mut().unwrap().ident = new_name.clone(); - } - } - } - } - } - } - item - }); - - ItemMod { - content: Some((input.content.unwrap().0, items.collect())), - ..input - } -} - -#[cfg(test)] -mod tests { - use super::*; - use syn::ItemStruct; - - macro_rules! assert_ast_eq { - ($left:ident, $right:ident) => { - let left_fmt = - prettyplease::unparse(&syn::parse_file("e! { #$left }.to_string()).unwrap()); - let right_fmt = - prettyplease::unparse(&syn::parse_file("e! { #$right}.to_string()).unwrap()); - - assert!( - $left == $right, - "Left is: \n\n{} \n\n but right is: \n\n{} \n\n", - left_fmt, - right_fmt - ); - }; - } - - #[test] - fn test_add_derive_eq_if_there_is_partial_eq() { - let item_struct: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Debug)] - struct Hello { - name: String - } - }; - - let result = add_derive_eq_struct(&item_struct); - let expected: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - struct Hello { - name: String - } - }; - - assert_ast_eq!(result, expected); - } - - #[test] - fn test_add_derive_eq_does_not_add_if_there_is_no_partial_eq() { - let item_struct: ItemStruct = syn::parse_quote! { - #[derive(Debug)] - struct Hello { - name: String - } - }; - - let result = add_derive_eq_struct(&item_struct); - - assert_ast_eq!(item_struct, result); - } - - #[test] - fn test_add_derive_eq_does_not_add_if_there_is_partial_eq_and_eq() { - let item_struct: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - struct Hello { - name: String - } - }; - - let result = add_derive_eq_struct(&item_struct); - - let expected: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - struct Hello { - name: String - } - }; - - assert_ast_eq!(result, expected); - } - - #[test] - #[allow(non_snake_case)] - fn test_alias_id_with_ID_if_there_id_a_field_named_id() { - let item_struct: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - struct PeriodLock { - id: u64, - duration: Duration, - } - }; - - let result = serde_alias_id_with_uppercased(item_struct); - - let expected: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - struct PeriodLock { - #[serde(alias = "ID")] - id: u64, - duration: Duration, - } - }; - - assert_ast_eq!(result, expected); - } - - #[test] - #[allow(non_snake_case)] - fn test_alias_partial_id_with_ID() { - let item_struct: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - pub struct FeeToken { - pub denom: ::prost::alloc::string::String, - - pub pool_id: u64, - } - }; - - let result = serde_alias_id_with_uppercased(item_struct); - - let expected: ItemStruct = syn::parse_quote! { - #[derive(PartialEq, Eq, Debug)] - pub struct FeeToken { - pub denom: ::prost::alloc::string::String, - #[serde(alias = "poolID")] - pub pool_id: u64, - } - }; - - assert_ast_eq!(result, expected); - } - - #[test] - fn test_make_next_key_optional() { - let input: ItemStruct = parse_quote! { - pub struct PageResponse { - #[prost(bytes = "vec", tag = "1")] - pub next_key: ::prost::alloc::vec::Vec, - } - }; - - let result = make_next_key_optional(input); - - let expected: ItemStruct = parse_quote! { - pub struct PageResponse { - #[prost(bytes = "vec", optional, tag = "1")] - pub next_key: ::core::option::Option<::prost::alloc::vec::Vec>, - } - }; - - assert_ast_eq!(result, expected); - } - - #[test] - fn test_allow_serde_option_vec_u8_as_base64_encoded_string() { - let input: ItemStruct = parse_quote! { - pub struct PageResponse { - #[prost(bytes = "vec", optional, tag = "1")] - pub next_key: ::core::option::Option<::prost::alloc::vec::Vec>, - } - }; - - let result = allow_serde_option_vec_u8_as_base64_encoded_string(input); - - let expected: ItemStruct = parse_quote! { - pub struct PageResponse { - #[prost(bytes = "vec", optional, tag = "1")] - #[serde( - serialize_with = "crate::serde::as_option_base64_encoded_string::serialize", - deserialize_with = "crate::serde::as_option_base64_encoded_string::deserialize" - )] - pub next_key: ::core::option::Option<::prost::alloc::vec::Vec>, - } - }; - - assert_ast_eq!(result, expected); - } -} From fc7041b0af341058c3cfd7dafda6ae6b077a9aa4 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:03:02 +0400 Subject: [PATCH 06/35] fix proto types --- contracts/ibc_transfer/Cargo.toml | 2 +- contracts/ibc_transfer/src/contract.rs | 8 +- .../neutron_interchain_queries/Cargo.toml | 2 +- .../src/contract.rs | 6 +- .../neutron_interchain_queries/src/msg.rs | 1 - contracts/neutron_interchain_txs/Cargo.toml | 2 + .../neutron_interchain_txs/src/contract.rs | 77 +++++++++++-------- contracts/neutron_interchain_txs/src/msg.rs | 2 +- packages/neutron-sdk/Cargo.toml | 2 +- packages/neutron-sdk/src/bindings/msg.rs | 15 +++- .../src/interchain_queries/queries.rs | 9 ++- .../src/interchain_queries/types.rs | 4 +- .../src/interchain_queries/v045/helpers.rs | 6 +- .../v045/register_queries.rs | 64 +++++++++------ .../src/interchain_queries/v045/types.rs | 3 +- .../v047/register_queries.rs | 14 ++-- .../src/interchain_queries/v047/types.rs | 3 +- packages/neutron-sdk/src/lib.rs | 6 +- 18 files changed, 127 insertions(+), 99 deletions(-) diff --git a/contracts/ibc_transfer/Cargo.toml b/contracts/ibc_transfer/Cargo.toml index c253a0d7..d75daf42 100644 --- a/contracts/ibc_transfer/Cargo.toml +++ b/contracts/ibc_transfer/Cargo.toml @@ -26,7 +26,7 @@ serde-json-wasm = { workspace = true } cw-storage-plus = { workspace = true, features = ["iterator"]} cosmwasm-schema = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } -neutron-std = "4.2.2-rc" +neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } [dev-dependencies] cosmwasm-schema = { workspace = true } diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 187c06c6..e470711a 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -3,17 +3,17 @@ use cosmwasm_std::{ StdError, StdResult, SubMsg, }; use cw2::set_contract_version; -use neutron_std::types::neutron::transfer::MsgTransfer; +use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; use neutron_sdk::interchain_txs::helpers::decode_message_response; -use neutron_sdk::proto_types::neutron::transfer::{MsgTransferResponse}; use neutron_sdk::{ sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg}, NeutronResult, }; -use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; // TODO: rename +use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; +use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; +// TODO: rename use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use neutron_sdk::proto_types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, state::{ diff --git a/contracts/neutron_interchain_queries/Cargo.toml b/contracts/neutron_interchain_queries/Cargo.toml index 5fed4a16..25d9fd5b 100644 --- a/contracts/neutron_interchain_queries/Cargo.toml +++ b/contracts/neutron_interchain_queries/Cargo.toml @@ -28,7 +28,7 @@ serde-json-wasm = { workspace = true } prost-types = { workspace = true } cosmwasm-schema = { workspace = true } # TODO: use workspace everywhere? -neutron-std = "4.2.2-rc" +neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } [dev-dependencies] base64 = { workspace = true } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 6ed83501..98513f23 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -150,7 +150,7 @@ pub fn register_balances_query( denoms: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?; + let msg: CosmosMsg = new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?.into(); Ok(Response::new().add_message(msg)) } @@ -289,7 +289,7 @@ pub fn update_interchain_query( new_keys: Vec, new_update_period: u64, new_recipient: Option, -) -> NeutronResult> { +) -> NeutronResult { let new_filter = new_recipient.map(|recipient| { vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), @@ -303,7 +303,7 @@ pub fn update_interchain_query( Ok(Response::new().add_message(update_msg)) } -pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult> { +pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult { let remove_msg = helpers_remove_interchain_query(contract, query_id); Ok(Response::new().add_message(remove_msg)) } diff --git a/contracts/neutron_interchain_queries/src/msg.rs b/contracts/neutron_interchain_queries/src/msg.rs index 86eb7041..e3e910bf 100644 --- a/contracts/neutron_interchain_queries/src/msg.rs +++ b/contracts/neutron_interchain_queries/src/msg.rs @@ -1,7 +1,6 @@ use crate::state::Transfer; use cosmwasm_std::Uint128; use neutron_std::types::neutron::interchainqueries::KvKey; -use neutron_sdk::bindings::types::KVKey; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/contracts/neutron_interchain_txs/Cargo.toml b/contracts/neutron_interchain_txs/Cargo.toml index 9c320018..54c4358f 100644 --- a/contracts/neutron_interchain_txs/Cargo.toml +++ b/contracts/neutron_interchain_txs/Cargo.toml @@ -27,3 +27,5 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } prost-types = { workspace = true } cosmwasm-schema = { workspace = true } +# TODO: fixme +neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index cddab948..12a850fe 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -1,16 +1,15 @@ -use cosmos_sdk_proto::cosmos::base::v1beta1::Coin; -use cosmos_sdk_proto::cosmos::staking::v1beta1::{ - MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, -}; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ to_json_binary, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; +use neutron_std::shim::Timestamp; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; - +use neutron_std::types::cosmos::base::v1beta1::Coin; +use neutron_std::types::cosmos::staking::v1beta1::{MsgDelegate, MsgDelegateResponse, MsgUndelegateResponse}; +use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use crate::storage::{ add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload, @@ -18,10 +17,8 @@ use crate::storage::{ ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; use neutron_sdk::bindings::msg::{ChannelOrdering, IbcFee}; -use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse; use neutron_sdk::{ bindings::{ - msg::NeutronMsg, types::ProtobufAny, }, interchain_txs::helpers::{decode_message_response, get_port_id}, @@ -29,6 +26,8 @@ use neutron_sdk::{ sudo::msg::{RequestPacket, SudoMsg}, NeutronError, NeutronResult, }; +use neutron_sdk::interchain_queries::v045::register_queries::register_interchain_account; +use neutron_std::types::neutron::interchaintxs::v1::{InterchaintxsQuerier, MsgSubmitTxResponse}; // Default timeout for SubmitTX is two weeks const DEFAULT_TIMEOUT_SECONDS: u64 = 60 * 60 * 24 * 7 * 2; @@ -54,7 +53,7 @@ pub fn instantiate( _env: Env, _info: MessageInfo, _msg: InstantiateMsg, -) -> NeutronResult> { +) -> NeutronResult { deps.api.debug("WASMDEBUG: instantiate"); set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?; Ok(Response::default()) @@ -62,11 +61,11 @@ pub fn instantiate( #[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] pub fn execute( - deps: DepsMut, + deps: DepsMut, env: Env, _: MessageInfo, msg: ExecuteMsg, -) -> NeutronResult> { +) -> NeutronResult{ deps.api .debug(format!("WASMDEBUG: execute: received msg: {:?}", msg).as_str()); match msg { @@ -117,7 +116,7 @@ pub fn execute( } #[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] -pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult { match msg { QueryMsg::InterchainAccountAddress { interchain_account_id, @@ -136,24 +135,24 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult // returns ICA address from Neutron ICA SDK module pub fn query_interchain_address( - deps: Deps, + deps: Deps, env: Env, interchain_account_id: String, connection_id: String, ) -> NeutronResult { - let query = NeutronQuery::InterchainAccountAddress { - owner_address: env.contract.address.to_string(), + let querier = InterchaintxsQuerier::new(&deps.querier); + let res = querier.interchain_account_address( + env.contract.address.to_string(), interchain_account_id, connection_id, - }; + )?; - let res: QueryInterchainAccountAddressResponse = deps.querier.query(&query.into())?; Ok(to_json_binary(&res)?) } // returns ICA address from the contract storage. The address was saved in sudo_open_ack method pub fn query_interchain_address_contract( - deps: Deps, + deps: Deps, env: Env, interchain_account_id: String, ) -> NeutronResult { @@ -166,7 +165,7 @@ pub fn query_interchain_address_contract( // returns the result pub fn query_acknowledgement_result( - deps: Deps, + deps: Deps, env: Env, interchain_account_id: String, sequence_id: u64, @@ -176,14 +175,14 @@ pub fn query_acknowledgement_result( Ok(to_json_binary(&res)?) } -pub fn query_errors_queue(deps: Deps) -> NeutronResult { +pub fn query_errors_queue(deps: Deps) -> NeutronResult { let res = read_errors_from_queue(deps.storage)?; Ok(to_json_binary(&res)?) } // saves payload to process later to the storage and returns a SubmitTX Cosmos SubMsg with necessary reply id fn msg_with_sudo_callback>, T>( - deps: DepsMut, + deps: DepsMut, msg: C, payload: SudoPayload, ) -> StdResult> { @@ -192,37 +191,38 @@ fn msg_with_sudo_callback>, T>( } fn execute_register_ica( - deps: DepsMut, + deps: DepsMut, env: Env, connection_id: String, interchain_account_id: String, - register_fee: Vec, + register_fee: Vec, ordering: Option, -) -> NeutronResult> { - let register = NeutronMsg::register_interchain_account( +) -> NeutronResult { + let register = register_interchain_account( + env.contract.address.clone(), connection_id, interchain_account_id.clone(), - Some(register_fee), + register_fee, ordering, ); - let key = get_port_id(env.contract.address.as_str(), &interchain_account_id); + let key = get_port_id(&env.contract.address.to_string(), &interchain_account_id); // we are saving empty data here because we handle response of registering ICA in sudo_open_ack method INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?; Ok(Response::new().add_message(register)) } fn execute_delegate( - mut deps: DepsMut, + mut deps: DepsMut, env: Env, interchain_account_id: String, validator: String, amount: u128, denom: String, timeout: Option, -) -> NeutronResult> { +) -> NeutronResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_ibc_fee(deps.as_ref())?.min_fee); + let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?.min_fee); let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgDelegate { delegator_address: delegator, @@ -246,7 +246,7 @@ fn execute_delegate( value: Binary::from(buf), }; - let cosmos_msg = NeutronMsg::submit_tx( + let cosmos_msg = submit_tx( connection_id, interchain_account_id.clone(), vec![any_msg], @@ -270,14 +270,14 @@ fn execute_delegate( } fn execute_undelegate( - mut deps: DepsMut, + mut deps: DepsMut, env: Env, interchain_account_id: String, validator: String, amount: u128, denom: String, timeout: Option, -) -> NeutronResult> { +) -> NeutronResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview let fee = min_ntrn_ibc_fee(query_min_ibc_fee(deps.as_ref())?.min_fee); @@ -304,7 +304,7 @@ fn execute_undelegate( value: Binary::from(buf), }; - let cosmos_msg = NeutronMsg::submit_tx( + let cosmos_msg = submit_tx( connection_id, interchain_account_id.clone(), vec![any_msg], @@ -454,7 +454,7 @@ fn sudo_response(deps: DepsMut, request: RequestPacket, data: Binary) -> StdResu deps.api .debug(error_msg); add_error_to_queue(deps.storage, error_msg.to_string()); - Some(prost_types::Timestamp::default()) + Some(Timestamp::default()) }); deps.api .debug(format!("Undelegation completion time: {:?}", completion_time).as_str()); @@ -643,3 +643,12 @@ fn min_ntrn_ibc_fee(fee: IbcFee) -> IbcFee { .collect(), } } + +fn query_min_fee(deps: Deps) -> StdResult { + let querier = FeerefunderQuerier::new(&deps.querier); + let params = querier.params()?; + let params_inner = params.params.ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; + let min_fee = params_inner.min_fee.ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; + + Ok(min_fee) +} \ No newline at end of file diff --git a/contracts/neutron_interchain_txs/src/msg.rs b/contracts/neutron_interchain_txs/src/msg.rs index d4f44823..d27ca561 100644 --- a/contracts/neutron_interchain_txs/src/msg.rs +++ b/contracts/neutron_interchain_txs/src/msg.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::Coin; +use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_sdk::bindings::msg::ChannelOrdering; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/packages/neutron-sdk/Cargo.toml b/packages/neutron-sdk/Cargo.toml index 5d710d23..62ff3095 100644 --- a/packages/neutron-sdk/Cargo.toml +++ b/packages/neutron-sdk/Cargo.toml @@ -25,7 +25,7 @@ prost-types = { workspace = true } tendermint-proto = { workspace = true } speedate = { workspace = true } chrono = { version = "0.4.22", default-features = false } -neutron-std = { version = "4.2.2-rc" } +neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } neutron-std-derive = { version = "0.20.1", path = "../neutron-std-derive" } [dev-dependencies] diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index a8292044..ddec2207 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,7 +1,6 @@ use crate::{ - bindings::types::{KVKey, ProtobufAny}, + bindings::types::ProtobufAny, interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem}, - proto_types::neutron::cron::ExecutionStage, sudo::msg::RequestPacketTimeoutHeight, NeutronResult, }; @@ -27,10 +26,18 @@ pub struct IbcFee { } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] pub enum ChannelOrdering { + OrderUnordered , OrderOrdered, - OrderUnordered, +} + +impl Into for ChannelOrdering { + fn into(self) -> i32 { + match self { + ChannelOrdering::OrderUnordered => 1, + ChannelOrdering::OrderOrdered => 2 + } + } } #[deprecated(note = "Please use neutron-std autogenerated messages instead of wasmbindings", since = "0.12.0")] diff --git a/packages/neutron-sdk/src/interchain_queries/queries.rs b/packages/neutron-sdk/src/interchain_queries/queries.rs index 12843210..fdde90e7 100644 --- a/packages/neutron-sdk/src/interchain_queries/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/queries.rs @@ -6,7 +6,8 @@ use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, R /// Checks **actual** query type is **expected** query type pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<()> { - if actual != expected.to_string() { + let expected_str: String = expected.into(); + if actual != expected_str { return Err(NeutronError::InvalidQueryType { query_type: actual.into(), }); @@ -31,7 +32,7 @@ pub fn query_kv_result( query_id: u64, ) -> NeutronResult { let registered_query_result = get_raw_interchain_query_result(deps, query_id)?; - KVReconstruct::reconstruct(registered_query_result.clone().kv_results.into()) + KVReconstruct::reconstruct(registered_query_result.kv_results.as_slice()) } /// Queries raw interchain query result (raw KV storage values or transactions) from Interchain Queries Module. @@ -41,10 +42,10 @@ pub fn query_kv_result( pub fn get_raw_interchain_query_result( deps: Deps, interchain_query_id: u64, -) -> NeutronResult<&QueryResult> { +) -> NeutronResult { let querier = InterchainqueriesQuerier::new(&deps.querier); let query_res = querier.query_result(interchain_query_id.into())?; - let res = &query_res.result.ok_or_else(|| StdError::generic_err("no result in registered query"))?; + let res = query_res.result.ok_or_else(|| StdError::generic_err("no result in registered query"))?; Ok(res) } diff --git a/packages/neutron-sdk/src/interchain_queries/types.rs b/packages/neutron-sdk/src/interchain_queries/types.rs index 5e854d82..ddc53a78 100644 --- a/packages/neutron-sdk/src/interchain_queries/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/types.rs @@ -1,9 +1,9 @@ use crate::{ - bindings::types::{StorageValue}, + // bindings::types::{StorageValue}, errors::error::NeutronResult, }; use cosmwasm_std::{from_json, StdError, Uint128}; -use neutron_std::types::neutron::interchainqueries::KvKey; +use neutron_std::types::neutron::interchainqueries::{KvKey, StorageValue}; use schemars::{JsonSchema, _serde_json::Value}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; diff --git a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs index e4c8cc92..e9b33560 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs @@ -324,7 +324,7 @@ pub fn get_update_time(commission: &Option) -> Option } /// Returns denom for total supply from StorageValue key -pub fn get_total_supply_denom(denom: &Binary) -> Option { +pub fn get_total_supply_denom(denom: &Vec) -> Option { if denom.len() < 2 { return None; } @@ -337,6 +337,6 @@ pub fn get_total_supply_denom(denom: &Binary) -> Option { } /// Returns total supply amount from StorageValue key -pub fn get_total_supply_amount(amount: &Binary) -> Option { - from_utf8(amount).ok().map(|a| Uint128::from_str(a).ok())? +pub fn get_total_supply_amount(amount: &Vec) -> Option { + from_utf8(amount.as_slice()).ok().map(|a| Uint128::from_str(a).ok())? } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs index 2a184e6a..33ebdcfc 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs @@ -13,9 +13,12 @@ use crate::{ create_validator_signing_info_key, create_wasm_contract_store_key, }, }; -use cosmwasm_std::{Addr, Binary, CosmosMsg, StdError}; +use cosmwasm_std::{Addr, CosmosMsg, StdError}; use neutron_std::types::neutron::interchainqueries::{KvKey, MsgRegisterInterchainQuery, MsgRemoveInterchainQueryRequest, MsgUpdateInterchainQueryRequest}; +use neutron_std::types::neutron::interchaintxs::v1::MsgRegisterInterchainAccount; use serde_json_wasm::to_string; +use crate::bindings::msg::ChannelOrdering; +use neutron_std::types::cosmos::base::v1beta1::Coin; /// Creates a message to register an Interchain Query to get balance of account on remote chain for list of denoms /// @@ -29,7 +32,7 @@ pub fn new_register_balances_query_msg( addr: String, denoms: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let kv_keys = create_balances_query_keys(addr, denoms)?; register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) } @@ -47,7 +50,7 @@ pub fn new_register_balance_query_msg( addr: String, denom: String, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { new_register_balances_query_msg(contract, connection_id, addr, vec![denom], update_period) } @@ -61,7 +64,7 @@ pub fn new_register_bank_total_supply_query_msg( connection_id: String, denoms: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let mut kv_keys: Vec = Vec::with_capacity(denoms.len()); for denom in denoms { @@ -86,7 +89,7 @@ pub fn new_register_distribution_fee_pool_query_msg( contract: Addr, connection_id: String, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let kv_key = KvKey { path: DISTRIBUTION_STORE_KEY.to_string(), key: create_fee_pool_key()?, @@ -110,7 +113,7 @@ pub fn new_register_gov_proposals_query_msg( connection_id: String, proposals_ids: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let kv_keys = create_gov_proposal_keys(proposals_ids)?; register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) @@ -126,7 +129,7 @@ pub fn update_gov_proposals_query_msg( query_id: u64, proposals_ids: Vec, new_update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let kv_keys = create_gov_proposal_keys(proposals_ids)?; update_interchain_query(contract, query_id, kv_keys, new_update_period, None) @@ -144,7 +147,7 @@ pub fn new_register_gov_proposals_voters_votes_query_msg( proposals_ids: Vec, voters: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let kv_keys = create_gov_proposals_voters_votes_keys(proposals_ids, voters)?; register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) @@ -162,7 +165,7 @@ pub fn update_gov_proposals_votes_query_msg( proposals_ids: Vec, voters: Vec, new_update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let kv_keys = create_gov_proposals_voters_votes_keys(proposals_ids, voters)?; update_interchain_query(contract, query_id, kv_keys, new_update_period, None) @@ -178,7 +181,7 @@ pub fn new_register_staking_validators_query_msg( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let mut kv_keys: Vec = Vec::with_capacity(validators.len()); for validator in validators { @@ -205,7 +208,7 @@ pub fn new_register_validators_signing_infos_query_msg( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let mut kv_keys: Vec = Vec::with_capacity(validators.len()); for validator in validators { @@ -234,7 +237,7 @@ pub fn new_register_delegator_delegations_query_msg( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory for such KV keys as: @@ -280,7 +283,7 @@ pub fn new_register_delegator_unbonding_delegations_query_msg( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory, one KV key per validator @@ -318,7 +321,7 @@ pub fn new_register_wasm_contract_store_query_msg( contract_address: String, key: impl AsRef<[u8]>, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let converted_addr_bytes = decode_and_convert(contract_address.as_str())?; let wasm_key = create_wasm_contract_store_key(converted_addr_bytes, key.as_ref())?; @@ -347,7 +350,7 @@ pub fn new_register_transfers_query_msg( recipient: String, update_period: u64, min_height: Option, -) -> NeutronResult> { +) -> NeutronResult>> { let mut query_data = vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), op: TransactionFilterOp::Eq, @@ -377,11 +380,11 @@ pub fn new_register_transfers_query_msg( /// maximum allowed number of filters is 32. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **update_period** is used to say how often (in neutron blocks) the query must be updated. -fn register_interchain_query(contract: Addr, query: QueryPayload, connection_id: String, update_period: u64) -> NeutronResult> { - Ok(match query { +fn register_interchain_query(contract: Addr, query: QueryPayload, connection_id: String, update_period: u64) -> NeutronResult>> { + Ok(Box::new(match query { QueryPayload::KV(keys) => MsgRegisterInterchainQuery{ sender: contract.to_string(), - query_type: QueryType::KV.to_string(), + query_type: QueryType::KV.into(), keys, transactions_filter: String::new(), connection_id, @@ -396,7 +399,7 @@ fn register_interchain_query(contract: Addr, query: QueryPayload, connection_id: connection_id, update_period, }, - }) + })) } /// Basic helper to define a update interchain query message: @@ -409,8 +412,8 @@ pub fn update_interchain_query( new_keys: Vec, new_update_period: u64, new_transactions_filter: Option>, -) -> NeutronResult> { - Ok(MsgUpdateInterchainQueryRequest { +) -> NeutronResult>> { + Ok(Box::new(MsgUpdateInterchainQueryRequest { sender: contract.to_string(), query_id, new_keys, @@ -422,14 +425,25 @@ pub fn update_interchain_query( // TODO: check if passing empty string is correct None => "".to_string(), }, - }) + })) } /// Basic helper to define a remove interchain query message: /// * **query_id** is ID of the query we want to remove. -pub fn remove_interchain_query(contract: Addr, query_id: u64)-> NeutronResult> { - Ok(MsgRemoveInterchainQueryRequest { +pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult>> { + Ok(Box::new(MsgRemoveInterchainQueryRequest { sender: contract.to_string(), query_id, - }) + })) +} + +// TODO: comment +pub fn register_interchain_account(contract: Addr, connection_id: String, interchain_account_id: String, register_fee: Vec, ordering: Option) -> NeutronResult>> { + Ok(Box::new(MsgRegisterInterchainAccount{ + from_address: contract.to_string(), + connection_id, + interchain_account_id, + register_fee, + ordering: ordering.unwrap_or_else(|| ChannelOrdering::OrderOrdered).into(), + })) } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/types.rs b/packages/neutron-sdk/src/interchain_queries/v045/types.rs index 68e29be8..0588598c 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/types.rs @@ -2,7 +2,6 @@ use crate::interchain_queries::helpers::uint256_to_u128; use crate::interchain_queries::types::KVReconstruct; use crate::interchain_queries::v045::helpers::deconstruct_account_denom_balance_key; use crate::{ - bindings::types::StorageValue, errors::error::{NeutronError, NeutronResult}, }; use cosmos_sdk_proto::cosmos::gov::v1beta1::Vote; @@ -18,7 +17,7 @@ use cosmwasm_std::{from_json, Addr, Coin, Decimal, Decimal256, Timestamp, Uint12 use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::{ops::Div, str::FromStr}; - +use neutron_std::types::neutron::interchainqueries::StorageValue; use super::helpers::{ get_max_change_rate, get_max_rate, get_rate, get_total_supply_amount, get_total_supply_denom, get_update_time, diff --git a/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs index 24f58bc2..6889d560 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs @@ -2,15 +2,13 @@ // to make it available from v047 package (kinda proxy) since they work with Cosmos SDK 0.47 as usual pub use crate::interchain_queries::v045::register_queries::*; -use crate::bindings::msg::NeutronMsg; -use crate::bindings::types::KVKey; use crate::interchain_queries::helpers::decode_and_convert; -use crate::interchain_queries::types::{QueryPayload, QueryType}; +use crate::interchain_queries::types::QueryType; use crate::interchain_queries::v045::helpers::{create_delegation_key, create_validator_key}; use crate::interchain_queries::v045::types::STAKING_STORE_KEY; use crate::interchain_queries::v047::types::STAKING_PARAMS_KEY; use crate::NeutronResult; -use cosmwasm_std::{Addr, Binary, CosmosMsg}; +use cosmwasm_std::{Addr, CosmosMsg}; use neutron_std::types::neutron::interchainqueries::{MsgRegisterInterchainQuery, KvKey}; /// Creates a message to register an Interchain Query to get delegations of particular delegator on remote chain. @@ -25,7 +23,7 @@ pub fn new_register_delegator_delegations_query_msg( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult> { +) -> NeutronResult>> { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory for such KV keys as: @@ -56,12 +54,12 @@ pub fn new_register_delegator_delegations_query_msg( }) } - Ok(MsgRegisterInterchainQuery{ - query_type: QueryType::KV.to_string(), + Ok(Box::new(MsgRegisterInterchainQuery{ + query_type: QueryType::KV.into(), keys, transactions_filter: "".to_string(), connection_id, update_period, sender: contract.to_string(), - }) + })) } diff --git a/packages/neutron-sdk/src/interchain_queries/v047/types.rs b/packages/neutron-sdk/src/interchain_queries/v047/types.rs index 38e3a00a..9cfa4f4d 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/types.rs @@ -7,7 +7,7 @@ pub use crate::interchain_queries::v045::types::*; // compatible with Cosmos SDK 0.47 use crate::interchain_queries::types::KVReconstruct; -use crate::{bindings::types::StorageValue, errors::error::NeutronResult, NeutronError}; +use crate::{errors::error::NeutronResult, NeutronError}; use crate::interchain_queries::helpers::uint256_to_u128; use crate::interchain_queries::v047::helpers::deconstruct_account_denom_balance_key; @@ -19,6 +19,7 @@ use cosmwasm_std::{Addr, Coin, Decimal256, Uint128, Uint256}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::str::FromStr; +use neutron_std::types::neutron::interchainqueries::StorageValue; /// Key for Staking Params in the **staking** module's storage /// diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index b419643d..aae2f460 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -3,6 +3,8 @@ // #![forbid(unsafe_code)] #![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)] +// TODO: can we get it from other place? or move NEUTRON_COMMIT to other place +// TODO: do we need NEUTROND_VERSION? /// The version (commit hash) of the Cosmos SDK used when generating this library. pub const NEUTROND_VERSION: &str = include_str!("proto_types/NEUTRON_COMMIT"); @@ -10,14 +12,10 @@ pub mod bindings; mod errors; pub mod interchain_queries; pub mod interchain_txs; -#[allow(deprecated, clippy::module_inception)] -pub mod proto_types; mod serde; -pub mod shim; pub mod sudo; pub use errors::error::{NeutronError, NeutronResult}; -pub use shim::{cosmwasm_to_proto_coins, try_proto_to_cosmwasm_coins}; // This is a signal, such that any contract that imports these helpers will only run on the // neutron blockchain From 7bacf6a8af957e4701d97df2708a4c803048071b Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:21:10 +0400 Subject: [PATCH 07/35] comment tests --- .../src/testing/mock_querier.rs | 241 +- .../src/testing/tests.rs | 2266 ++++++------- .../src/testing/tests.rs | 4 +- .../src/interchain_queries/v045/testing.rs | 2900 ++++++++--------- .../src/interchain_queries/v047/testing.rs | 2648 +++++++-------- 5 files changed, 4028 insertions(+), 4031 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs index 4d19d376..0477543e 100644 --- a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs +++ b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs @@ -1,121 +1,120 @@ -use std::collections::HashMap; -use std::marker::PhantomData; - -use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; -use cosmwasm_std::{ - from_json, Binary, Coin, ContractResult, CustomQuery, FullDelegation, OwnedDeps, Querier, - QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, Validator, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -use neutron_sdk::bindings::query::NeutronQuery; - -pub const MOCK_CONTRACT_ADDR: &str = "cosmos2contract"; - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct CustomQueryWrapper {} - -// implement custom query -impl CustomQuery for CustomQueryWrapper {} - -pub fn mock_dependencies( - contract_balance: &[Coin], -) -> OwnedDeps { - let contract_addr = MOCK_CONTRACT_ADDR; - let custom_querier: WasmMockQuerier = - WasmMockQuerier::new(MockQuerier::new(&[(contract_addr, contract_balance)])); - - OwnedDeps { - storage: MockStorage::default(), - api: MockApi::default(), - querier: custom_querier, - custom_query_type: PhantomData, - } -} - -pub struct WasmMockQuerier { - base: MockQuerier, - query_responses: HashMap, - registered_queries: HashMap, -} - -impl Querier for WasmMockQuerier { - fn raw_query(&self, bin_request: &[u8]) -> QuerierResult { - let request: QueryRequest = match from_json(bin_request) { - Ok(v) => v, - Err(e) => { - return QuerierResult::Err(SystemError::InvalidRequest { - error: format!("Parsing query request: {}", e), - request: bin_request.into(), - }); - } - }; - self.handle_query(&request) - } -} - -impl WasmMockQuerier { - pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { - match &request { - QueryRequest::Custom(NeutronQuery::InterchainQueryResult { query_id }) => { - SystemResult::Ok(ContractResult::Ok( - (*self.query_responses.get(query_id).unwrap()).clone(), - )) - } - QueryRequest::Custom(NeutronQuery::RegisteredInterchainQuery { query_id }) => { - SystemResult::Ok(ContractResult::Ok( - (*self.registered_queries.get(query_id).unwrap()).clone(), - )) - } - QueryRequest::Custom(NeutronQuery::RegisteredInterchainQueries { - owners: _owners, - connection_id: _connection_id, - pagination: _pagination, - }) => { - todo!() - } - QueryRequest::Custom(NeutronQuery::InterchainAccountAddress { .. }) => { - todo!() - } - _ => self.base.handle_query(request), - } - } - - pub fn _update_staking( - &mut self, - denom: &str, - validators: &[Validator], - delegations: &[FullDelegation], - ) { - self.base.staking.update(denom, validators, delegations); - } - - pub fn add_query_response(&mut self, query_id: u64, response: Binary) { - self.query_responses.insert(query_id, response); - } - pub fn add_registered_queries(&mut self, query_id: u64, response: Binary) { - self.registered_queries.insert(query_id, response); - } -} - -#[derive(Clone, Default)] -pub struct BalanceQuerier { - _balances: HashMap, -} - -#[derive(Clone, Default)] -pub struct TokenQuerier { - _balances: HashMap>, -} - -impl WasmMockQuerier { - pub fn new(base: MockQuerier) -> Self { - WasmMockQuerier { - base, - query_responses: HashMap::new(), - registered_queries: HashMap::new(), - } - } -} +// use std::collections::HashMap; +// use std::marker::PhantomData; +// +// use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; +// use cosmwasm_std::{ +// from_json, Binary, Coin, ContractResult, CustomQuery, FullDelegation, OwnedDeps, Querier, +// QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, Validator, +// }; +// use schemars::JsonSchema; +// use serde::{Deserialize, Serialize}; +// +// pub const MOCK_CONTRACT_ADDR: &str = "cosmos2contract"; +// +// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +// #[serde(rename_all = "snake_case")] +// pub struct CustomQueryWrapper {} +// +// // implement custom query +// impl CustomQuery for CustomQueryWrapper {} +// +// pub fn mock_dependencies( +// contract_balance: &[Coin], +// ) -> OwnedDeps { +// let contract_addr = MOCK_CONTRACT_ADDR; +// let custom_querier: WasmMockQuerier = +// WasmMockQuerier::new(MockQuerier::new(&[(contract_addr, contract_balance)])); +// +// OwnedDeps { +// storage: MockStorage::default(), +// api: MockApi::default(), +// querier: custom_querier, +// custom_query_type: PhantomData, +// } +// } +// +// pub struct WasmMockQuerier { +// base: MockQuerier, +// query_responses: HashMap, +// registered_queries: HashMap, +// } +// +// impl Querier for WasmMockQuerier { +// fn raw_query(&self, bin_request: &[u8]) -> QuerierResult { +// let request: QueryRequest = match from_json(bin_request) { +// Ok(v) => v, +// Err(e) => { +// return QuerierResult::Err(SystemError::InvalidRequest { +// error: format!("Parsing query request: {}", e), +// request: bin_request.into(), +// }); +// } +// }; +// self.handle_query(&request) +// } +// } +// +// // TODO: fix +// impl WasmMockQuerier { +// pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { +// match &request { +// QueryRequest::Custom(NeutronQuery::InterchainQueryResult { query_id }) => { +// SystemResult::Ok(ContractResult::Ok( +// (*self.query_responses.get(query_id).unwrap()).clone(), +// )) +// } +// QueryRequest::Custom(NeutronQuery::RegisteredInterchainQuery { query_id }) => { +// SystemResult::Ok(ContractResult::Ok( +// (*self.registered_queries.get(query_id).unwrap()).clone(), +// )) +// } +// QueryRequest::Custom(NeutronQuery::RegisteredInterchainQueries { +// owners: _owners, +// connection_id: _connection_id, +// pagination: _pagination, +// }) => { +// todo!() +// } +// QueryRequest::Custom(NeutronQuery::InterchainAccountAddress { .. }) => { +// todo!() +// } +// _ => self.base.handle_query(request), +// } +// } +// +// pub fn _update_staking( +// &mut self, +// denom: &str, +// validators: &[Validator], +// delegations: &[FullDelegation], +// ) { +// self.base.staking.update(denom, validators, delegations); +// } +// +// pub fn add_query_response(&mut self, query_id: u64, response: Binary) { +// self.query_responses.insert(query_id, response); +// } +// pub fn add_registered_queries(&mut self, query_id: u64, response: Binary) { +// self.registered_queries.insert(query_id, response); +// } +// } +// +// #[derive(Clone, Default)] +// pub struct BalanceQuerier { +// _balances: HashMap, +// } +// +// #[derive(Clone, Default)] +// pub struct TokenQuerier { +// _balances: HashMap>, +// } +// +// impl WasmMockQuerier { +// pub fn new(base: MockQuerier) -> Self { +// WasmMockQuerier { +// base, +// query_responses: HashMap::new(), +// registered_queries: HashMap::new(), +// } +// } +// } diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 1dbda130..36eab253 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -1,1133 +1,1133 @@ -use base64::{prelude::*, Engine}; -use std::str::FromStr; - -use super::mock_querier::mock_dependencies as dependencies; -use crate::contract::{execute, query, sudo_tx_query_result}; -use crate::msg::{ExecuteMsg, QueryMsg}; -use crate::state::{Transfer, RECIPIENT_TXS}; -use crate::testing::mock_querier::WasmMockQuerier; -use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin as CosmosCoin, DecCoin as CosmosDecCoin}; -use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; -use cosmos_sdk_proto::cosmos::gov::v1beta1::{ - Proposal as CosmosProposal, TallyResult as CosmosTallyResult, -}; -use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; -use cosmos_sdk_proto::cosmos::staking::v1beta1::Validator as CosmosValidator; -use cosmos_sdk_proto::traits::Message; -use cosmos_sdk_proto::Any; -use cosmwasm_std::testing::{message_info, mock_env, MockApi, MockStorage}; -use cosmwasm_std::{ - from_json, to_json_binary, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, - Uint128, -}; -use neutron_sdk::bindings::query::{ - NeutronQuery, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse, -}; -use neutron_sdk::bindings::types::{ - decode_hex, Height, InterchainQueryResult, KVKey, KVKeys, RegisteredQuery, StorageValue, -}; -use neutron_sdk::interchain_queries::helpers::decode_and_convert; -use neutron_sdk::interchain_queries::types::{ - QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, -}; -use neutron_sdk::interchain_queries::v047::helpers::{ - create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, - create_total_denom_key, create_validator_key, -}; -use neutron_sdk::interchain_queries::v047::types::{ - Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, - TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, -}; - -use neutron_sdk::interchain_queries::v047::queries::{ - BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse, - TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, -}; -use neutron_sdk::NeutronError; -use schemars::_serde_json::to_string; - -enum QueryParam { - Keys(Vec), - TransactionsFilter(String), -} - -fn build_registered_query_response( - id: u64, - param: QueryParam, - query_type: QueryType, - last_submitted_result_local_height: u64, -) -> Binary { - let mut resp = QueryRegisteredQueryResponse { - registered_query: RegisteredQuery { - id, - owner: "".to_string(), - keys: vec![], - query_type, - transactions_filter: "".to_string(), - connection_id: "".to_string(), - update_period: 0, - last_submitted_result_local_height, - last_submitted_result_remote_height: Height { - revision_number: 0, - revision_height: 0, - }, - deposit: Vec::from([Coin { - denom: "stake".to_string(), - amount: Uint128::from_str("100").unwrap(), - }]), - submit_timeout: 0, - registered_at_height: 0, - }, - }; - match param { - QueryParam::Keys(keys) => resp.registered_query.keys = keys, - QueryParam::TransactionsFilter(transactions_filter) => { - resp.registered_query.transactions_filter = transactions_filter - } - } - - Binary::from(to_string(&resp).unwrap().as_bytes()) -} - -fn build_interchain_query_bank_total_denom_value(denom: String, amount: String) -> StorageValue { - let bank_total_key = create_total_denom_key(denom).unwrap(); - - let amount = amount.as_bytes().to_vec(); - - StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(bank_total_key), - value: Binary::new(amount), - } -} - -fn build_interchain_query_distribution_fee_pool_response(denom: String, amount: String) -> Binary { - let fee_pool_key = create_fee_pool_key().unwrap(); - - let community_pool_amount = CosmosDecCoin { denom, amount }; - - let fee_pool = CosmosFeePool { - community_pool: vec![community_pool_amount], - }; - - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(fee_pool_key), - value: Binary::new(fee_pool.encode_to_vec()), - }; - Binary::from( - to_string(&QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - kv_results: vec![s], - height: 123456, - revision: 2, - }, - }) - .unwrap() - .as_bytes(), - ) -} - -fn build_interchain_query_staking_validator_value(validator: String) -> StorageValue { - let operator_address = decode_and_convert(validator.as_str()).unwrap(); - let validator_key = create_validator_key(operator_address).unwrap(); - - let validator = CosmosValidator { - operator_address: validator, - consensus_pubkey: Some(Any { - type_url: "".to_string(), - value: vec![], - }), - status: 1, - tokens: "1".to_string(), - jailed: false, - delegator_shares: "1".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "1".to_string(), - }; - - StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(validator_key), - value: Binary::new(validator.encode_to_vec()), - } -} - -fn build_interchain_query_validator_signing_info_value( - validator: String, - jailed_until: Option, -) -> StorageValue { - let operator_address = decode_and_convert(validator.as_str()).unwrap(); - let validator_key = create_validator_key(operator_address).unwrap(); - - let validator = CosmosValidatorSigningInfo { - address: validator, - start_height: 1, - index_offset: 20, - jailed_until, - tombstoned: false, - missed_blocks_counter: 13, - }; - - StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(validator_key), - value: Binary::new(validator.encode_to_vec()), - } -} - -fn build_interchain_query_gov_proposal_value(proposal_id: u64) -> StorageValue { - let proposal_key = create_gov_proposal_key(proposal_id).unwrap(); - - let proposal = CosmosProposal { - proposal_id, - content: Some(Any { - type_url: "/cosmos.gov.v1beta1.TextProposal".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: Some(CosmosTallyResult { - abstain: "0".to_string(), - yes: "0".to_string(), - no: "0".to_string(), - no_with_veto: "0".to_string(), - }), - deposit_end_time: None, - submit_time: None, - total_deposit: Vec::from([CosmosCoin { - denom: "stake".to_string(), - amount: "100".to_string(), - }]), - voting_start_time: None, - voting_end_time: None, - }; - - StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(proposal_key), - value: Binary::new(proposal.encode_to_vec()), - } -} - -fn build_interchain_query_balances_response(addr: Addr, balances: Vec) -> Binary { - let converted_addr_bytes = decode_and_convert(addr.as_str()).unwrap(); - - let s: Vec = balances - .iter() - .map(|c| { - let balance_key = - create_account_denom_balance_key(converted_addr_bytes.clone(), c.denom.clone()) - .unwrap(); - StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(balance_key), - value: Binary::new(c.amount.to_string().into_bytes()), - } - }) - .collect(); - - Binary::from( - to_string(&QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - kv_results: s, - height: 123456, - revision: 2, - }, - }) - .unwrap() - .as_bytes(), - ) -} - -// registers an interchain query -fn register_query( - deps: &mut OwnedDeps, - env: Env, - info: MessageInfo, - msg: ExecuteMsg, -) -> KVKeys { - let reg_msgs = execute(deps.as_mut(), env, info, msg).unwrap(); - for attr in reg_msgs.attributes { - if attr.key == "kv_keys" && !attr.value.is_empty() { - return KVKeys::from_string(attr.value).unwrap(); - } - } - - KVKeys(vec![]) -} - -#[test] -fn test_query_balance() { - let mut deps = dependencies(&[]); - - let msg = ExecuteMsg::RegisterBalancesQuery { - connection_id: "connection".to_string(), - update_period: 10, - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - denoms: vec!["uosmo".to_string()], - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - deps.querier.add_registered_queries(1, registered_query); - deps.querier.add_query_response( - 1, - build_interchain_query_balances_response( - Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - vec![Coin::new(8278104u128, "uosmo")], - ), - ); - let query_balance = QueryMsg::Balance { query_id: 1 }; - let resp: BalanceResponse = - from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); - assert_eq!( - resp, - BalanceResponse { - last_submitted_local_height: 987, - balances: Balances { - coins: vec![Coin::new(8278104u128, "uosmo")] - }, - } - ) -} - -#[test] -fn test_query_balances() { - let mut deps = dependencies(&[]); - - let msg = ExecuteMsg::RegisterBalancesQuery { - connection_id: "connection".to_string(), - update_period: 10, - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - denoms: vec!["uosmo".to_string(), "uatom".to_string()], - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - deps.querier.add_registered_queries(1, registered_query); - deps.querier.add_query_response( - 1, - build_interchain_query_balances_response( - Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - vec![ - Coin::new(8278104u128, "uosmo"), - Coin::new(1234567u128, "uatom"), - ], - ), - ); - let query_balance = QueryMsg::Balance { query_id: 1 }; - let resp: BalanceResponse = - from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); - assert_eq!( - resp, - BalanceResponse { - last_submitted_local_height: 987, - balances: Balances { - coins: vec![ - Coin::new(8278104u128, "uosmo"), - Coin::new(1234567u128, "uatom") - ] - }, - } - ) -} - -#[test] -fn test_bank_total_supply_query() { - let mut deps = dependencies(&[]); - - let denoms = vec!["uosmo".to_string(), "uatom".to_string()]; - - let msg = ExecuteMsg::RegisterBankTotalSupplyQuery { - connection_id: "connection".to_string(), - update_period: 10, - denoms: denoms.clone(), - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - let mut kv_results: Vec = vec![]; - - for denom in denoms { - let value = - build_interchain_query_bank_total_denom_value(denom.to_string(), "8278104".to_string()); - kv_results.push(value); - } - - let total_supply_response = QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - kv_results, - height: 0, - revision: 0, - }, - }; - - deps.querier.add_registered_queries(1, registered_query); - deps.querier - .add_query_response(1, to_json_binary(&total_supply_response).unwrap()); - let bank_total_balance = QueryMsg::BankTotalSupply { query_id: 1 }; - - let resp: TotalSupplyResponse = - from_json(query(deps.as_ref(), mock_env(), bank_total_balance).unwrap()).unwrap(); - assert_eq!( - resp, - TotalSupplyResponse { - last_submitted_local_height: 987, - supply: TotalSupply { - coins: vec![ - Coin::new(8278104u128, "uosmo"), - Coin::new(8278104u128, "uatom"), - ] - }, - } - ); -} - -#[test] -fn test_distribution_fee_pool_query() { - let mut deps = dependencies(&[]); - - let msg = ExecuteMsg::RegisterDistributionFeePoolQuery { - connection_id: "connection".to_string(), - update_period: 10, - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - deps.querier.add_registered_queries(1, registered_query); - deps.querier.add_query_response( - 1, - build_interchain_query_distribution_fee_pool_response( - "uosmo".to_string(), - "8278104000000000000000000".to_string(), // 8278104 + 18 zeros - ), - ); - let fee_pool_balance = QueryMsg::DistributionFeePool { query_id: 1 }; - let resp: FeePoolResponse = - from_json(query(deps.as_ref(), mock_env(), fee_pool_balance).unwrap()).unwrap(); - assert_eq!( - resp, - FeePoolResponse { - last_submitted_local_height: 987, - pool: FeePool { - coins: vec![Coin::new(8278104u128, "uosmo")] - }, - } - ) -} - -#[test] -fn test_gov_proposals_query() { - let mut deps = dependencies(&[]); - - let proposals_ids = vec![1, 2, 3]; - - let msg = ExecuteMsg::RegisterGovernmentProposalsQuery { - connection_id: "connection".to_string(), - proposals_ids: proposals_ids.clone(), - update_period: 10, - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - let mut kv_results: Vec = vec![]; - - for id in proposals_ids { - let value = build_interchain_query_gov_proposal_value(id); - kv_results.push(value); - } - - let proposals_response = QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - kv_results, - height: 0, - revision: 0, - }, - }; - - deps.querier.add_registered_queries(1, registered_query); - deps.querier - .add_query_response(1, to_json_binary(&proposals_response).unwrap()); - - let government_proposal = QueryMsg::GovernmentProposals { query_id: 1 }; - let resp: ProposalResponse = - from_json(query(deps.as_ref(), mock_env(), government_proposal).unwrap()).unwrap(); - assert_eq!( - resp, - ProposalResponse { - last_submitted_local_height: 987, - proposals: GovernmentProposal { - proposals: vec![ - Proposal { - proposal_id: 1, - proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), - total_deposit: Vec::from([Coin { - denom: "stake".to_string(), - amount: Uint128::from_str("100").unwrap(), - }]), - status: 1, - submit_time: None, - deposit_end_time: None, - voting_end_time: None, - voting_start_time: None, - final_tally_result: Some(TallyResult { - abstain: Uint128::zero(), - yes: Uint128::zero(), - no: Uint128::zero(), - no_with_veto: Uint128::zero(), - }), - }, - Proposal { - proposal_id: 2, - proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), - total_deposit: Vec::from([Coin { - denom: "stake".to_string(), - amount: Uint128::from_str("100").unwrap(), - }]), - status: 1, - submit_time: None, - deposit_end_time: None, - voting_end_time: None, - voting_start_time: None, - final_tally_result: Some(TallyResult { - abstain: Uint128::zero(), - yes: Uint128::zero(), - no: Uint128::zero(), - no_with_veto: Uint128::zero(), - }), - }, - Proposal { - proposal_id: 3, - proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), - total_deposit: Vec::from([Coin { - denom: "stake".to_string(), - amount: Uint128::from_str("100").unwrap(), - }]), - status: 1, - submit_time: None, - deposit_end_time: None, - voting_end_time: None, - voting_start_time: None, - final_tally_result: Some(TallyResult { - abstain: Uint128::zero(), - yes: Uint128::zero(), - no: Uint128::zero(), - no_with_veto: Uint128::zero(), - }), - }, - ] - }, - } - ) -} - -#[test] -fn test_staking_validators_query() { - let mut deps = dependencies(&[]); - let validators = vec![ - "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), - "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), - ]; - - let msg = ExecuteMsg::RegisterStakingValidatorsQuery { - connection_id: "connection".to_string(), - update_period: 10, - validators: validators.clone(), - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - let mut kv_results: Vec = vec![]; - - for validator in validators { - let value = build_interchain_query_staking_validator_value(validator); - kv_results.push(value); - } - - let validators_response = QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - kv_results, - height: 0, - revision: 0, - }, - }; - - deps.querier.add_registered_queries(1, registered_query); - deps.querier - .add_query_response(1, to_json_binary(&validators_response).unwrap()); - let staking_validators = QueryMsg::StakingValidators { query_id: 1 }; - let resp: ValidatorResponse = - from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); - assert_eq!( - resp, - ValidatorResponse { - last_submitted_local_height: 987, - validator: StakingValidator { - validators: vec![ - Validator { - operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" - .to_string(), - status: 1, - consensus_pubkey: Some(vec!()), - tokens: "1".to_string(), - jailed: false, - delegator_shares: "1".to_string(), - unbonding_height: 0, - unbonding_time: None, - min_self_delegation: Decimal::from_str("1").unwrap(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - }, - Validator { - operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" - .to_string(), - status: 1, - consensus_pubkey: Some(vec!()), - tokens: "1".to_string(), - jailed: false, - delegator_shares: "1".to_string(), - unbonding_height: 0, - unbonding_time: None, - min_self_delegation: Decimal::from_str("1").unwrap(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - }, - ] - }, - } - ) -} - -#[test] -fn test_validators_signing_infos_query() { - let mut deps = dependencies(&[]); - let validators = vec![ - ( - "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), - None, - ), - ( - "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), - Some(prost_types::Timestamp { - seconds: 1203981203, - nanos: 123123, - }), - ), - ]; - - let msg = ExecuteMsg::RegisterValidatorsSigningInfosQuery { - connection_id: "connection".to_string(), - update_period: 10, - validators: validators.clone().into_iter().map(|(v, _)| v).collect(), - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - let mut kv_results: Vec = vec![]; - - for validator in validators { - let value = build_interchain_query_validator_signing_info_value(validator.0, validator.1); - kv_results.push(value); - } - - let validators_response = QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - kv_results, - height: 0, - revision: 0, - }, - }; - - deps.querier.add_registered_queries(1, registered_query); - deps.querier - .add_query_response(1, to_json_binary(&validators_response).unwrap()); - let staking_validators = QueryMsg::ValidatorsSigningInfos { query_id: 1 }; - let resp: ValidatorSigningInfoResponse = - from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); - assert_eq!( - resp, - ValidatorSigningInfoResponse { - last_submitted_local_height: 987, - signing_infos: SigningInfo { - signing_infos: vec![ - ValidatorSigningInfo { - address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), - start_height: 1, - index_offset: 20, - jailed_until: None, - tombstoned: false, - missed_blocks_counter: 13, - }, - ValidatorSigningInfo { - address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), - start_height: 1, - index_offset: 20, - jailed_until: Some(1203981203), - tombstoned: false, - missed_blocks_counter: 13, - }, - ] - }, - } - ) -} - -#[test] -fn test_query_delegator_delegations() { - let mut deps = dependencies(&[]); - - let msg = ExecuteMsg::RegisterDelegatorDelegationsQuery { - connection_id: "connection".to_string(), - update_period: 10, - delegator: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validators: vec![ - "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), - "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), - ], - }; - - let keys = register_query( - &mut deps, - mock_env(), - message_info(&Addr::unchecked(""), &[]), - msg, - ); - - let delegations_response = QueryRegisteredQueryResultResponse { - result: InterchainQueryResult { - // response for `RegisterDelegatorDelegationsQuery` with necessary KV values to test reconstruction logic. - // The values are taken from osmosis network - kv_results: vec![ - // params value of staking module for key 'staking/params' - // value: Params - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from([STAKING_PARAMS_KEY]), - value: Binary::from(BASE64_STANDARD.decode("CgQIgN9uEGQYByCQTioFdWF0b20yATA6FC0xMDAwMDAwMDAwMDAwMDAwMDAwQhMxMDAwMDAwMDAwMDAwMDAwMDAwShMxMDAwMDAwMDAwMDAwMDAwMDAw").unwrap()), - }, - // delegation - // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs - // to: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 - // delegation_shares: "5177628000000000000000000" - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b8141ab940697a73dd080edafeb538ad408b5cae0264").unwrap()), - value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxoZNTE3NzYyODAwMDAwMDAwMDAwMDAwMDAwMA==").unwrap()), - }, - // validator: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 - // delegator_shares: "2845862840643000000000000000000" - // total tokens: "2845862840643" - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from(decode_hex("21141ab940697a73dd080edafeb538ad408b5cae0264").unwrap()), - value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiCaZhCbacCetQorko3LfUUJX2UEyX38qBGVri8GyH8lcCADKg0yODQ1ODYyODQwNjQzMh8yODQ1ODYyODQwNjQzMDAwMDAwMDAwMDAwMDAwMDAwOqQCChRzdHJhbmdlbG92ZS12ZW50dXJlcxIQRDBEOEI4MEYxQzVDNzBCNRocaHR0cHM6Ly9zdHJhbmdlbG92ZS52ZW50dXJlcyrbAScuLi5iZWNhdXNlIG9mIHRoZSBhdXRvbWF0ZWQgYW5kIGlycmV2b2NhYmxlIGRlY2lzaW9uLW1ha2luZyBwcm9jZXNzIHdoaWNoIHJ1bGVzIG91dCBodW1hbiBtZWRkbGluZywgdGhlIERvb21zZGF5IG1hY2hpbmUgaXMgdGVycmlmeWluZyBhbmQgc2ltcGxlIHRvIHVuZGVyc3RhbmQgYW5kIGNvbXBsZXRlbHkgY3JlZGlibGUgYW5kIGNvbnZpbmNpbmcuJyAtIERyLiBTdHJhbmdlbG92ZUoAUkwKPAoRNTAwMDAwMDAwMDAwMDAwMDASEzEwMDAwMDAwMDAwMDAwMDAwMDAaEjUwMDAwMDAwMDAwMDAwMDAwMBIMCPetyYYGEKPoosUCWgEx").unwrap()), - }, - // delegation - // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs - // to: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t - // delegation_shares: "29620221000000000000000000" - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814cc9598513212c12c36a1775e2233b962e4d5128e").unwrap()), - value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBoaMjk2MjAyMjEwMDAwMDAwMDAwMDAwMDAwMDA=").unwrap()), - }, - // validator: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t - // delegator_shares: "3054477259038000000000000000000" - // total tokens: "3054477259038" - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from(decode_hex("2114cc9598513212c12c36a1775e2233b962e4d5128e").unwrap()), - value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiA27dgAuZV/uS9FdsILGWLBw8eYPy+ZEyv1Df2VsrjXDiADKg0zMDU0NDc3MjU5MDM4Mh8zMDU0NDc3MjU5MDM4MDAwMDAwMDAwMDAwMDAwMDAwOoEBChFGcmVucyAo8J+knSzwn6SdKRIQQzQ3ODQ1MjI2NjYyQUY0NxoSaHR0cHM6Ly9mcmVucy5hcm15IhtzZWN1cml0eUBraWRzb250aGVibG9jay54eXoqKVlvdXIgZnJpZW5kbHkgdmFsaWRhdG9yIGZvciBjb3Ntb3MgY2hhaW5zQP3HpQFKCwj3zq6PBhCfrO86UkoKOgoRNTAwMDAwMDAwMDAwMDAwMDASEjUwMDAwMDAwMDAwMDAwMDAwMBoRNTAwMDAwMDAwMDAwMDAwMDASDAjg1rSQBhDkudCDAVoDNTAw").unwrap()), - }, - // delegation - // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs - // to: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we - // delegation_shares: "219920000000000000000000" - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap()), - value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRoYMjE5OTIwMDAwMDAwMDAwMDAwMDAwMDAw").unwrap()), - }, - // validator: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we - // delegator_shares: "3201438898476000000000000000000" - // total tokens: "3201438898476" - StorageValue { - storage_prefix: "staking".to_string(), - key: Binary::from(decode_hex("2114f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap()), - value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiBPXCnkQvO+pU6oGbp4ZiJBBZ7RNoLYtXYFOEdpXGH+uSADKg0zMjAxNDM4ODk4NDc2Mh8zMjAxNDM4ODk4NDc2MDAwMDAwMDAwMDAwMDAwMDAwOp8CCgtDaXRhZGVsLm9uZRIQRUJCMDNFQjRCQjRDRkNBNxoTaHR0cHM6Ly9jaXRhZGVsLm9uZSroAUNpdGFkZWwub25lIGlzIGEgbXVsdGktYXNzZXQgbm9uLWN1c3RvZGlhbCBzdGFraW5nIHBsYXRmb3JtIHRoYXQgbGV0cyBhbnlvbmUgYmVjb21lIGEgcGFydCBvZiBkZWNlbnRyYWxpemVkIGluZnJhc3RydWN0dXJlIGFuZCBlYXJuIHBhc3NpdmUgaW5jb21lLiBTdGFrZSB3aXRoIG91ciBub2RlcyBvciBhbnkgb3RoZXIgdmFsaWRhdG9yIGFjcm9zcyBtdWx0aXBsZSBuZXR3b3JrcyBpbiBhIGZldyBjbGlja3NKAFJECjoKETUwMDAwMDAwMDAwMDAwMDAwEhIyMDAwMDAwMDAwMDAwMDAwMDAaETMwMDAwMDAwMDAwMDAwMDAwEgYIkKKzhgZaATE=").unwrap()), - }, - ], - height: 0, - revision: 0, - }, - }; - - let registered_query = - build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); - - deps.querier - .add_query_response(1, to_json_binary(&delegations_response).unwrap()); - deps.querier.add_registered_queries(1, registered_query); - - let query_delegations = QueryMsg::GetDelegations { query_id: 1 }; - let resp: DelegatorDelegationsResponse = - from_json(query(deps.as_ref(), mock_env(), query_delegations).unwrap()).unwrap(); - - assert_eq!( - resp, - DelegatorDelegationsResponse { - last_submitted_local_height: 987, - delegations: vec![ - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: Coin::new(5177628u128, "uatom".to_string()), - }, - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), - amount: Coin::new(29620221u128, "uatom".to_string()), - }, - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), - amount: Coin::new(219920u128, "uatom".to_string()), - }, - ], - } - ) -} - -#[test] -fn test_sudo_tx_query_result_callback() { - let mut deps = dependencies(&[]); - let env = mock_env(); - let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); - let query_id: u64 = 1u64; - let height: u64 = 1u64; - let msg = ExecuteMsg::RegisterTransfersQuery { - connection_id: "connection".to_string(), - update_period: 1u64, - recipient: watched_addr.clone(), - min_height: None, - }; - execute( - deps.as_mut(), - env.clone(), - message_info(&Addr::unchecked(""), &[]), - msg, - ) - .unwrap(); - let registered_query = build_registered_query_response( - 1, - QueryParam::TransactionsFilter( - to_string(&vec![&TransactionFilterItem { - field: RECIPIENT_FIELD.to_string(), - op: TransactionFilterOp::Eq, - value: TransactionFilterValue::String(watched_addr.clone()), - }]) - .unwrap(), - ), - QueryType::TX, - 0, - ); - deps.querier.add_registered_queries(1, registered_query); - - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake - let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); - sudo_tx_query_result( - deps.as_mut(), - env.clone(), - query_id, - Height { - revision_number: 0, - revision_height: height, - }, - data, - ) - .unwrap(); - - // ensure the callback has worked and contract's state has changed - let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); - assert_eq!( - txs, - Vec::from([Transfer { - recipient: watched_addr.clone(), - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - }]) - ); - - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake - let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); - let res = sudo_tx_query_result( - deps.as_mut(), - env.clone(), - query_id, - Height { - revision_number: 0, - revision_height: height, - }, - data, - ); - - // ensure the callback has returned an error and contract's state hasn't changed - assert_eq!( - res.unwrap_err(), - NeutronError::Std(StdError::generic_err( - "failed to find a matching transaction message", - )) - ); - let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); - assert_eq!( - txs, - Vec::from([Transfer { - recipient: watched_addr.clone(), - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - }]) - ); - - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake - let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); - sudo_tx_query_result( - deps.as_mut(), - env, - query_id, - Height { - revision_number: 0, - revision_height: height, - }, - data, - ) - .unwrap(); - - // ensure the callback has worked and contract's state has changed again - let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); - assert_eq!( - txs, - Vec::from([ - Transfer { - recipient: watched_addr.clone(), - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - }, - Transfer { - recipient: watched_addr, - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - } - ]) - ); -} - -#[test] -fn test_sudo_tx_query_result_min_height_callback() { - let mut deps = dependencies(&[]); - let env = mock_env(); - let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); - let query_id: u64 = 1u64; - let height: u64 = 1u64; - let msg = ExecuteMsg::RegisterTransfersQuery { - connection_id: "connection".to_string(), - update_period: 1u64, - recipient: watched_addr.clone(), - min_height: Some(100000), - }; - execute( - deps.as_mut(), - env.clone(), - message_info(&Addr::unchecked(""), &[]), - msg, - ) - .unwrap(); - let registered_query = build_registered_query_response( - 1, - QueryParam::TransactionsFilter( - to_string(&vec![&TransactionFilterItem { - field: RECIPIENT_FIELD.to_string(), - op: TransactionFilterOp::Eq, - value: TransactionFilterValue::String(watched_addr.clone()), - }]) - .unwrap(), - ), - QueryType::TX, - 0, - ); - deps.querier.add_registered_queries(1, registered_query); - - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake - let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); - sudo_tx_query_result( - deps.as_mut(), - env.clone(), - query_id, - Height { - revision_number: 0, - revision_height: height, - }, - data, - ) - .unwrap(); - - // ensure the callback has worked and contract's state has changed - let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); - assert_eq!( - txs, - Vec::from([Transfer { - recipient: watched_addr.clone(), - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - }]) - ); - - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake - let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); - let res = sudo_tx_query_result( - deps.as_mut(), - env.clone(), - query_id, - Height { - revision_number: 0, - revision_height: height, - }, - data, - ); - - // ensure the callback has returned an error and contract's state hasn't changed - assert_eq!( - res.unwrap_err(), - NeutronError::Std(StdError::generic_err( - "failed to find a matching transaction message", - )) - ); - let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); - assert_eq!( - txs, - Vec::from([Transfer { - recipient: watched_addr.clone(), - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - }]) - ); - - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake - let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); - sudo_tx_query_result( - deps.as_mut(), - env, - query_id, - Height { - revision_number: 0, - revision_height: height, - }, - data, - ) - .unwrap(); - - // ensure the callback has worked and contract's state has changed again - let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); - assert_eq!( - txs, - Vec::from([ - Transfer { - recipient: watched_addr.clone(), - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - }, - Transfer { - recipient: watched_addr, - sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), - denom: "stake".to_string(), - amount: "10000".to_string(), - } - ]) - ); -} +// use base64::{prelude::*, Engine}; +// use std::str::FromStr; +// +// use super::mock_querier::mock_dependencies as dependencies; +// use crate::contract::{execute, query, sudo_tx_query_result}; +// use crate::msg::{ExecuteMsg, QueryMsg}; +// use crate::state::{Transfer, RECIPIENT_TXS}; +// use crate::testing::mock_querier::WasmMockQuerier; +// use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin as CosmosCoin, DecCoin as CosmosDecCoin}; +// use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; +// use cosmos_sdk_proto::cosmos::gov::v1beta1::{ +// Proposal as CosmosProposal, TallyResult as CosmosTallyResult, +// }; +// use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; +// use cosmos_sdk_proto::cosmos::staking::v1beta1::Validator as CosmosValidator; +// use cosmos_sdk_proto::traits::Message; +// use cosmos_sdk_proto::Any; +// use cosmwasm_std::testing::{message_info, mock_env, MockApi, MockStorage}; +// use cosmwasm_std::{ +// from_json, to_json_binary, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, +// Uint128, +// }; +// use neutron_sdk::bindings::query::{ +// NeutronQuery, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse, +// }; +// use neutron_sdk::bindings::types::{ +// decode_hex, Height, InterchainQueryResult, KVKey, KVKeys, RegisteredQuery, StorageValue, +// }; +// use neutron_sdk::interchain_queries::helpers::decode_and_convert; +// use neutron_sdk::interchain_queries::types::{ +// QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, +// }; +// use neutron_sdk::interchain_queries::v047::helpers::{ +// create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, +// create_total_denom_key, create_validator_key, +// }; +// use neutron_sdk::interchain_queries::v047::types::{ +// Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, +// TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, +// }; +// +// use neutron_sdk::interchain_queries::v047::queries::{ +// BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse, +// TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, +// }; +// use neutron_sdk::NeutronError; +// use schemars::_serde_json::to_string; +// +// enum QueryParam { +// Keys(Vec), +// TransactionsFilter(String), +// } +// +// fn build_registered_query_response( +// id: u64, +// param: QueryParam, +// query_type: QueryType, +// last_submitted_result_local_height: u64, +// ) -> Binary { +// let mut resp = QueryRegisteredQueryResponse { +// registered_query: RegisteredQuery { +// id, +// owner: "".to_string(), +// keys: vec![], +// query_type, +// transactions_filter: "".to_string(), +// connection_id: "".to_string(), +// update_period: 0, +// last_submitted_result_local_height, +// last_submitted_result_remote_height: Height { +// revision_number: 0, +// revision_height: 0, +// }, +// deposit: Vec::from([Coin { +// denom: "stake".to_string(), +// amount: Uint128::from_str("100").unwrap(), +// }]), +// submit_timeout: 0, +// registered_at_height: 0, +// }, +// }; +// match param { +// QueryParam::Keys(keys) => resp.registered_query.keys = keys, +// QueryParam::TransactionsFilter(transactions_filter) => { +// resp.registered_query.transactions_filter = transactions_filter +// } +// } +// +// Binary::from(to_string(&resp).unwrap().as_bytes()) +// } +// +// fn build_interchain_query_bank_total_denom_value(denom: String, amount: String) -> StorageValue { +// let bank_total_key = create_total_denom_key(denom).unwrap(); +// +// let amount = amount.as_bytes().to_vec(); +// +// StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(bank_total_key), +// value: Binary::new(amount), +// } +// } +// +// fn build_interchain_query_distribution_fee_pool_response(denom: String, amount: String) -> Binary { +// let fee_pool_key = create_fee_pool_key().unwrap(); +// +// let community_pool_amount = CosmosDecCoin { denom, amount }; +// +// let fee_pool = CosmosFeePool { +// community_pool: vec![community_pool_amount], +// }; +// +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(fee_pool_key), +// value: Binary::new(fee_pool.encode_to_vec()), +// }; +// Binary::from( +// to_string(&QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// kv_results: vec![s], +// height: 123456, +// revision: 2, +// }, +// }) +// .unwrap() +// .as_bytes(), +// ) +// } +// +// fn build_interchain_query_staking_validator_value(validator: String) -> StorageValue { +// let operator_address = decode_and_convert(validator.as_str()).unwrap(); +// let validator_key = create_validator_key(operator_address).unwrap(); +// +// let validator = CosmosValidator { +// operator_address: validator, +// consensus_pubkey: Some(Any { +// type_url: "".to_string(), +// value: vec![], +// }), +// status: 1, +// tokens: "1".to_string(), +// jailed: false, +// delegator_shares: "1".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "1".to_string(), +// }; +// +// StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(validator_key), +// value: Binary::new(validator.encode_to_vec()), +// } +// } +// +// fn build_interchain_query_validator_signing_info_value( +// validator: String, +// jailed_until: Option, +// ) -> StorageValue { +// let operator_address = decode_and_convert(validator.as_str()).unwrap(); +// let validator_key = create_validator_key(operator_address).unwrap(); +// +// let validator = CosmosValidatorSigningInfo { +// address: validator, +// start_height: 1, +// index_offset: 20, +// jailed_until, +// tombstoned: false, +// missed_blocks_counter: 13, +// }; +// +// StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(validator_key), +// value: Binary::new(validator.encode_to_vec()), +// } +// } +// +// fn build_interchain_query_gov_proposal_value(proposal_id: u64) -> StorageValue { +// let proposal_key = create_gov_proposal_key(proposal_id).unwrap(); +// +// let proposal = CosmosProposal { +// proposal_id, +// content: Some(Any { +// type_url: "/cosmos.gov.v1beta1.TextProposal".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: Some(CosmosTallyResult { +// abstain: "0".to_string(), +// yes: "0".to_string(), +// no: "0".to_string(), +// no_with_veto: "0".to_string(), +// }), +// deposit_end_time: None, +// submit_time: None, +// total_deposit: Vec::from([CosmosCoin { +// denom: "stake".to_string(), +// amount: "100".to_string(), +// }]), +// voting_start_time: None, +// voting_end_time: None, +// }; +// +// StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(proposal_key), +// value: Binary::new(proposal.encode_to_vec()), +// } +// } +// +// fn build_interchain_query_balances_response(addr: Addr, balances: Vec) -> Binary { +// let converted_addr_bytes = decode_and_convert(addr.as_str()).unwrap(); +// +// let s: Vec = balances +// .iter() +// .map(|c| { +// let balance_key = +// create_account_denom_balance_key(converted_addr_bytes.clone(), c.denom.clone()) +// .unwrap(); +// StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(balance_key), +// value: Binary::new(c.amount.to_string().into_bytes()), +// } +// }) +// .collect(); +// +// Binary::from( +// to_string(&QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// kv_results: s, +// height: 123456, +// revision: 2, +// }, +// }) +// .unwrap() +// .as_bytes(), +// ) +// } +// +// // registers an interchain query +// fn register_query( +// deps: &mut OwnedDeps, +// env: Env, +// info: MessageInfo, +// msg: ExecuteMsg, +// ) -> KVKeys { +// let reg_msgs = execute(deps.as_mut(), env, info, msg).unwrap(); +// for attr in reg_msgs.attributes { +// if attr.key == "kv_keys" && !attr.value.is_empty() { +// return KVKeys::from_string(attr.value).unwrap(); +// } +// } +// +// KVKeys(vec![]) +// } +// +// #[test] +// fn test_query_balance() { +// let mut deps = dependencies(&[]); +// +// let msg = ExecuteMsg::RegisterBalancesQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// denoms: vec!["uosmo".to_string()], +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier.add_query_response( +// 1, +// build_interchain_query_balances_response( +// Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// vec![Coin::new(8278104u128, "uosmo")], +// ), +// ); +// let query_balance = QueryMsg::Balance { query_id: 1 }; +// let resp: BalanceResponse = +// from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); +// assert_eq!( +// resp, +// BalanceResponse { +// last_submitted_local_height: 987, +// balances: Balances { +// coins: vec![Coin::new(8278104u128, "uosmo")] +// }, +// } +// ) +// } +// +// #[test] +// fn test_query_balances() { +// let mut deps = dependencies(&[]); +// +// let msg = ExecuteMsg::RegisterBalancesQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// denoms: vec!["uosmo".to_string(), "uatom".to_string()], +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier.add_query_response( +// 1, +// build_interchain_query_balances_response( +// Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// vec![ +// Coin::new(8278104u128, "uosmo"), +// Coin::new(1234567u128, "uatom"), +// ], +// ), +// ); +// let query_balance = QueryMsg::Balance { query_id: 1 }; +// let resp: BalanceResponse = +// from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); +// assert_eq!( +// resp, +// BalanceResponse { +// last_submitted_local_height: 987, +// balances: Balances { +// coins: vec![ +// Coin::new(8278104u128, "uosmo"), +// Coin::new(1234567u128, "uatom") +// ] +// }, +// } +// ) +// } +// +// #[test] +// fn test_bank_total_supply_query() { +// let mut deps = dependencies(&[]); +// +// let denoms = vec!["uosmo".to_string(), "uatom".to_string()]; +// +// let msg = ExecuteMsg::RegisterBankTotalSupplyQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// denoms: denoms.clone(), +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// let mut kv_results: Vec = vec![]; +// +// for denom in denoms { +// let value = +// build_interchain_query_bank_total_denom_value(denom.to_string(), "8278104".to_string()); +// kv_results.push(value); +// } +// +// let total_supply_response = QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// kv_results, +// height: 0, +// revision: 0, +// }, +// }; +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier +// .add_query_response(1, to_json_binary(&total_supply_response).unwrap()); +// let bank_total_balance = QueryMsg::BankTotalSupply { query_id: 1 }; +// +// let resp: TotalSupplyResponse = +// from_json(query(deps.as_ref(), mock_env(), bank_total_balance).unwrap()).unwrap(); +// assert_eq!( +// resp, +// TotalSupplyResponse { +// last_submitted_local_height: 987, +// supply: TotalSupply { +// coins: vec![ +// Coin::new(8278104u128, "uosmo"), +// Coin::new(8278104u128, "uatom"), +// ] +// }, +// } +// ); +// } +// +// #[test] +// fn test_distribution_fee_pool_query() { +// let mut deps = dependencies(&[]); +// +// let msg = ExecuteMsg::RegisterDistributionFeePoolQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier.add_query_response( +// 1, +// build_interchain_query_distribution_fee_pool_response( +// "uosmo".to_string(), +// "8278104000000000000000000".to_string(), // 8278104 + 18 zeros +// ), +// ); +// let fee_pool_balance = QueryMsg::DistributionFeePool { query_id: 1 }; +// let resp: FeePoolResponse = +// from_json(query(deps.as_ref(), mock_env(), fee_pool_balance).unwrap()).unwrap(); +// assert_eq!( +// resp, +// FeePoolResponse { +// last_submitted_local_height: 987, +// pool: FeePool { +// coins: vec![Coin::new(8278104u128, "uosmo")] +// }, +// } +// ) +// } +// +// #[test] +// fn test_gov_proposals_query() { +// let mut deps = dependencies(&[]); +// +// let proposals_ids = vec![1, 2, 3]; +// +// let msg = ExecuteMsg::RegisterGovernmentProposalsQuery { +// connection_id: "connection".to_string(), +// proposals_ids: proposals_ids.clone(), +// update_period: 10, +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// let mut kv_results: Vec = vec![]; +// +// for id in proposals_ids { +// let value = build_interchain_query_gov_proposal_value(id); +// kv_results.push(value); +// } +// +// let proposals_response = QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// kv_results, +// height: 0, +// revision: 0, +// }, +// }; +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier +// .add_query_response(1, to_json_binary(&proposals_response).unwrap()); +// +// let government_proposal = QueryMsg::GovernmentProposals { query_id: 1 }; +// let resp: ProposalResponse = +// from_json(query(deps.as_ref(), mock_env(), government_proposal).unwrap()).unwrap(); +// assert_eq!( +// resp, +// ProposalResponse { +// last_submitted_local_height: 987, +// proposals: GovernmentProposal { +// proposals: vec![ +// Proposal { +// proposal_id: 1, +// proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), +// total_deposit: Vec::from([Coin { +// denom: "stake".to_string(), +// amount: Uint128::from_str("100").unwrap(), +// }]), +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_end_time: None, +// voting_start_time: None, +// final_tally_result: Some(TallyResult { +// abstain: Uint128::zero(), +// yes: Uint128::zero(), +// no: Uint128::zero(), +// no_with_veto: Uint128::zero(), +// }), +// }, +// Proposal { +// proposal_id: 2, +// proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), +// total_deposit: Vec::from([Coin { +// denom: "stake".to_string(), +// amount: Uint128::from_str("100").unwrap(), +// }]), +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_end_time: None, +// voting_start_time: None, +// final_tally_result: Some(TallyResult { +// abstain: Uint128::zero(), +// yes: Uint128::zero(), +// no: Uint128::zero(), +// no_with_veto: Uint128::zero(), +// }), +// }, +// Proposal { +// proposal_id: 3, +// proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), +// total_deposit: Vec::from([Coin { +// denom: "stake".to_string(), +// amount: Uint128::from_str("100").unwrap(), +// }]), +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_end_time: None, +// voting_start_time: None, +// final_tally_result: Some(TallyResult { +// abstain: Uint128::zero(), +// yes: Uint128::zero(), +// no: Uint128::zero(), +// no_with_veto: Uint128::zero(), +// }), +// }, +// ] +// }, +// } +// ) +// } +// +// #[test] +// fn test_staking_validators_query() { +// let mut deps = dependencies(&[]); +// let validators = vec![ +// "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), +// "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), +// ]; +// +// let msg = ExecuteMsg::RegisterStakingValidatorsQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// validators: validators.clone(), +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// let mut kv_results: Vec = vec![]; +// +// for validator in validators { +// let value = build_interchain_query_staking_validator_value(validator); +// kv_results.push(value); +// } +// +// let validators_response = QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// kv_results, +// height: 0, +// revision: 0, +// }, +// }; +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier +// .add_query_response(1, to_json_binary(&validators_response).unwrap()); +// let staking_validators = QueryMsg::StakingValidators { query_id: 1 }; +// let resp: ValidatorResponse = +// from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); +// assert_eq!( +// resp, +// ValidatorResponse { +// last_submitted_local_height: 987, +// validator: StakingValidator { +// validators: vec![ +// Validator { +// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" +// .to_string(), +// status: 1, +// consensus_pubkey: Some(vec!()), +// tokens: "1".to_string(), +// jailed: false, +// delegator_shares: "1".to_string(), +// unbonding_height: 0, +// unbonding_time: None, +// min_self_delegation: Decimal::from_str("1").unwrap(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// }, +// Validator { +// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" +// .to_string(), +// status: 1, +// consensus_pubkey: Some(vec!()), +// tokens: "1".to_string(), +// jailed: false, +// delegator_shares: "1".to_string(), +// unbonding_height: 0, +// unbonding_time: None, +// min_self_delegation: Decimal::from_str("1").unwrap(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// }, +// ] +// }, +// } +// ) +// } +// +// #[test] +// fn test_validators_signing_infos_query() { +// let mut deps = dependencies(&[]); +// let validators = vec![ +// ( +// "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), +// None, +// ), +// ( +// "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), +// Some(prost_types::Timestamp { +// seconds: 1203981203, +// nanos: 123123, +// }), +// ), +// ]; +// +// let msg = ExecuteMsg::RegisterValidatorsSigningInfosQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// validators: validators.clone().into_iter().map(|(v, _)| v).collect(), +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// let mut kv_results: Vec = vec![]; +// +// for validator in validators { +// let value = build_interchain_query_validator_signing_info_value(validator.0, validator.1); +// kv_results.push(value); +// } +// +// let validators_response = QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// kv_results, +// height: 0, +// revision: 0, +// }, +// }; +// +// deps.querier.add_registered_queries(1, registered_query); +// deps.querier +// .add_query_response(1, to_json_binary(&validators_response).unwrap()); +// let staking_validators = QueryMsg::ValidatorsSigningInfos { query_id: 1 }; +// let resp: ValidatorSigningInfoResponse = +// from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); +// assert_eq!( +// resp, +// ValidatorSigningInfoResponse { +// last_submitted_local_height: 987, +// signing_infos: SigningInfo { +// signing_infos: vec![ +// ValidatorSigningInfo { +// address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), +// start_height: 1, +// index_offset: 20, +// jailed_until: None, +// tombstoned: false, +// missed_blocks_counter: 13, +// }, +// ValidatorSigningInfo { +// address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), +// start_height: 1, +// index_offset: 20, +// jailed_until: Some(1203981203), +// tombstoned: false, +// missed_blocks_counter: 13, +// }, +// ] +// }, +// } +// ) +// } +// +// #[test] +// fn test_query_delegator_delegations() { +// let mut deps = dependencies(&[]); +// +// let msg = ExecuteMsg::RegisterDelegatorDelegationsQuery { +// connection_id: "connection".to_string(), +// update_period: 10, +// delegator: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validators: vec![ +// "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), +// "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), +// ], +// }; +// +// let keys = register_query( +// &mut deps, +// mock_env(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ); +// +// let delegations_response = QueryRegisteredQueryResultResponse { +// result: InterchainQueryResult { +// // response for `RegisterDelegatorDelegationsQuery` with necessary KV values to test reconstruction logic. +// // The values are taken from osmosis network +// kv_results: vec![ +// // params value of staking module for key 'staking/params' +// // value: Params +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from([STAKING_PARAMS_KEY]), +// value: Binary::from(BASE64_STANDARD.decode("CgQIgN9uEGQYByCQTioFdWF0b20yATA6FC0xMDAwMDAwMDAwMDAwMDAwMDAwQhMxMDAwMDAwMDAwMDAwMDAwMDAwShMxMDAwMDAwMDAwMDAwMDAwMDAw").unwrap()), +// }, +// // delegation +// // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs +// // to: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 +// // delegation_shares: "5177628000000000000000000" +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b8141ab940697a73dd080edafeb538ad408b5cae0264").unwrap()), +// value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxoZNTE3NzYyODAwMDAwMDAwMDAwMDAwMDAwMA==").unwrap()), +// }, +// // validator: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 +// // delegator_shares: "2845862840643000000000000000000" +// // total tokens: "2845862840643" +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from(decode_hex("21141ab940697a73dd080edafeb538ad408b5cae0264").unwrap()), +// value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiCaZhCbacCetQorko3LfUUJX2UEyX38qBGVri8GyH8lcCADKg0yODQ1ODYyODQwNjQzMh8yODQ1ODYyODQwNjQzMDAwMDAwMDAwMDAwMDAwMDAwOqQCChRzdHJhbmdlbG92ZS12ZW50dXJlcxIQRDBEOEI4MEYxQzVDNzBCNRocaHR0cHM6Ly9zdHJhbmdlbG92ZS52ZW50dXJlcyrbAScuLi5iZWNhdXNlIG9mIHRoZSBhdXRvbWF0ZWQgYW5kIGlycmV2b2NhYmxlIGRlY2lzaW9uLW1ha2luZyBwcm9jZXNzIHdoaWNoIHJ1bGVzIG91dCBodW1hbiBtZWRkbGluZywgdGhlIERvb21zZGF5IG1hY2hpbmUgaXMgdGVycmlmeWluZyBhbmQgc2ltcGxlIHRvIHVuZGVyc3RhbmQgYW5kIGNvbXBsZXRlbHkgY3JlZGlibGUgYW5kIGNvbnZpbmNpbmcuJyAtIERyLiBTdHJhbmdlbG92ZUoAUkwKPAoRNTAwMDAwMDAwMDAwMDAwMDASEzEwMDAwMDAwMDAwMDAwMDAwMDAaEjUwMDAwMDAwMDAwMDAwMDAwMBIMCPetyYYGEKPoosUCWgEx").unwrap()), +// }, +// // delegation +// // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs +// // to: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t +// // delegation_shares: "29620221000000000000000000" +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814cc9598513212c12c36a1775e2233b962e4d5128e").unwrap()), +// value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBoaMjk2MjAyMjEwMDAwMDAwMDAwMDAwMDAwMDA=").unwrap()), +// }, +// // validator: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t +// // delegator_shares: "3054477259038000000000000000000" +// // total tokens: "3054477259038" +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from(decode_hex("2114cc9598513212c12c36a1775e2233b962e4d5128e").unwrap()), +// value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiA27dgAuZV/uS9FdsILGWLBw8eYPy+ZEyv1Df2VsrjXDiADKg0zMDU0NDc3MjU5MDM4Mh8zMDU0NDc3MjU5MDM4MDAwMDAwMDAwMDAwMDAwMDAwOoEBChFGcmVucyAo8J+knSzwn6SdKRIQQzQ3ODQ1MjI2NjYyQUY0NxoSaHR0cHM6Ly9mcmVucy5hcm15IhtzZWN1cml0eUBraWRzb250aGVibG9jay54eXoqKVlvdXIgZnJpZW5kbHkgdmFsaWRhdG9yIGZvciBjb3Ntb3MgY2hhaW5zQP3HpQFKCwj3zq6PBhCfrO86UkoKOgoRNTAwMDAwMDAwMDAwMDAwMDASEjUwMDAwMDAwMDAwMDAwMDAwMBoRNTAwMDAwMDAwMDAwMDAwMDASDAjg1rSQBhDkudCDAVoDNTAw").unwrap()), +// }, +// // delegation +// // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs +// // to: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we +// // delegation_shares: "219920000000000000000000" +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap()), +// value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRoYMjE5OTIwMDAwMDAwMDAwMDAwMDAwMDAw").unwrap()), +// }, +// // validator: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we +// // delegator_shares: "3201438898476000000000000000000" +// // total tokens: "3201438898476" +// StorageValue { +// storage_prefix: "staking".to_string(), +// key: Binary::from(decode_hex("2114f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap()), +// value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiBPXCnkQvO+pU6oGbp4ZiJBBZ7RNoLYtXYFOEdpXGH+uSADKg0zMjAxNDM4ODk4NDc2Mh8zMjAxNDM4ODk4NDc2MDAwMDAwMDAwMDAwMDAwMDAwOp8CCgtDaXRhZGVsLm9uZRIQRUJCMDNFQjRCQjRDRkNBNxoTaHR0cHM6Ly9jaXRhZGVsLm9uZSroAUNpdGFkZWwub25lIGlzIGEgbXVsdGktYXNzZXQgbm9uLWN1c3RvZGlhbCBzdGFraW5nIHBsYXRmb3JtIHRoYXQgbGV0cyBhbnlvbmUgYmVjb21lIGEgcGFydCBvZiBkZWNlbnRyYWxpemVkIGluZnJhc3RydWN0dXJlIGFuZCBlYXJuIHBhc3NpdmUgaW5jb21lLiBTdGFrZSB3aXRoIG91ciBub2RlcyBvciBhbnkgb3RoZXIgdmFsaWRhdG9yIGFjcm9zcyBtdWx0aXBsZSBuZXR3b3JrcyBpbiBhIGZldyBjbGlja3NKAFJECjoKETUwMDAwMDAwMDAwMDAwMDAwEhIyMDAwMDAwMDAwMDAwMDAwMDAaETMwMDAwMDAwMDAwMDAwMDAwEgYIkKKzhgZaATE=").unwrap()), +// }, +// ], +// height: 0, +// revision: 0, +// }, +// }; +// +// let registered_query = +// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); +// +// deps.querier +// .add_query_response(1, to_json_binary(&delegations_response).unwrap()); +// deps.querier.add_registered_queries(1, registered_query); +// +// let query_delegations = QueryMsg::GetDelegations { query_id: 1 }; +// let resp: DelegatorDelegationsResponse = +// from_json(query(deps.as_ref(), mock_env(), query_delegations).unwrap()).unwrap(); +// +// assert_eq!( +// resp, +// DelegatorDelegationsResponse { +// last_submitted_local_height: 987, +// delegations: vec![ +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: Coin::new(5177628u128, "uatom".to_string()), +// }, +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), +// amount: Coin::new(29620221u128, "uatom".to_string()), +// }, +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), +// amount: Coin::new(219920u128, "uatom".to_string()), +// }, +// ], +// } +// ) +// } +// +// #[test] +// fn test_sudo_tx_query_result_callback() { +// let mut deps = dependencies(&[]); +// let env = mock_env(); +// let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); +// let query_id: u64 = 1u64; +// let height: u64 = 1u64; +// let msg = ExecuteMsg::RegisterTransfersQuery { +// connection_id: "connection".to_string(), +// update_period: 1u64, +// recipient: watched_addr.clone(), +// min_height: None, +// }; +// execute( +// deps.as_mut(), +// env.clone(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ) +// .unwrap(); +// let registered_query = build_registered_query_response( +// 1, +// QueryParam::TransactionsFilter( +// to_string(&vec![&TransactionFilterItem { +// field: RECIPIENT_FIELD.to_string(), +// op: TransactionFilterOp::Eq, +// value: TransactionFilterValue::String(watched_addr.clone()), +// }]) +// .unwrap(), +// ), +// QueryType::TX, +// 0, +// ); +// deps.querier.add_registered_queries(1, registered_query); +// +// // simulate neutron's SudoTxQueryResult call with the following payload: +// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake +// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); +// sudo_tx_query_result( +// deps.as_mut(), +// env.clone(), +// query_id, +// Height { +// revision_number: 0, +// revision_height: height, +// }, +// data, +// ) +// .unwrap(); +// +// // ensure the callback has worked and contract's state has changed +// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); +// assert_eq!( +// txs, +// Vec::from([Transfer { +// recipient: watched_addr.clone(), +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// }]) +// ); +// +// // simulate neutron's SudoTxQueryResult call with the following payload: +// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake +// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); +// let res = sudo_tx_query_result( +// deps.as_mut(), +// env.clone(), +// query_id, +// Height { +// revision_number: 0, +// revision_height: height, +// }, +// data, +// ); +// +// // ensure the callback has returned an error and contract's state hasn't changed +// assert_eq!( +// res.unwrap_err(), +// NeutronError::Std(StdError::generic_err( +// "failed to find a matching transaction message", +// )) +// ); +// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); +// assert_eq!( +// txs, +// Vec::from([Transfer { +// recipient: watched_addr.clone(), +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// }]) +// ); +// +// // simulate neutron's SudoTxQueryResult call with the following payload: +// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake +// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); +// sudo_tx_query_result( +// deps.as_mut(), +// env, +// query_id, +// Height { +// revision_number: 0, +// revision_height: height, +// }, +// data, +// ) +// .unwrap(); +// +// // ensure the callback has worked and contract's state has changed again +// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); +// assert_eq!( +// txs, +// Vec::from([ +// Transfer { +// recipient: watched_addr.clone(), +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// }, +// Transfer { +// recipient: watched_addr, +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// } +// ]) +// ); +// } +// +// #[test] +// fn test_sudo_tx_query_result_min_height_callback() { +// let mut deps = dependencies(&[]); +// let env = mock_env(); +// let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); +// let query_id: u64 = 1u64; +// let height: u64 = 1u64; +// let msg = ExecuteMsg::RegisterTransfersQuery { +// connection_id: "connection".to_string(), +// update_period: 1u64, +// recipient: watched_addr.clone(), +// min_height: Some(100000), +// }; +// execute( +// deps.as_mut(), +// env.clone(), +// message_info(&Addr::unchecked(""), &[]), +// msg, +// ) +// .unwrap(); +// let registered_query = build_registered_query_response( +// 1, +// QueryParam::TransactionsFilter( +// to_string(&vec![&TransactionFilterItem { +// field: RECIPIENT_FIELD.to_string(), +// op: TransactionFilterOp::Eq, +// value: TransactionFilterValue::String(watched_addr.clone()), +// }]) +// .unwrap(), +// ), +// QueryType::TX, +// 0, +// ); +// deps.querier.add_registered_queries(1, registered_query); +// +// // simulate neutron's SudoTxQueryResult call with the following payload: +// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake +// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); +// sudo_tx_query_result( +// deps.as_mut(), +// env.clone(), +// query_id, +// Height { +// revision_number: 0, +// revision_height: height, +// }, +// data, +// ) +// .unwrap(); +// +// // ensure the callback has worked and contract's state has changed +// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); +// assert_eq!( +// txs, +// Vec::from([Transfer { +// recipient: watched_addr.clone(), +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// }]) +// ); +// +// // simulate neutron's SudoTxQueryResult call with the following payload: +// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake +// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); +// let res = sudo_tx_query_result( +// deps.as_mut(), +// env.clone(), +// query_id, +// Height { +// revision_number: 0, +// revision_height: height, +// }, +// data, +// ); +// +// // ensure the callback has returned an error and contract's state hasn't changed +// assert_eq!( +// res.unwrap_err(), +// NeutronError::Std(StdError::generic_err( +// "failed to find a matching transaction message", +// )) +// ); +// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); +// assert_eq!( +// txs, +// Vec::from([Transfer { +// recipient: watched_addr.clone(), +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// }]) +// ); +// +// // simulate neutron's SudoTxQueryResult call with the following payload: +// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake +// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); +// sudo_tx_query_result( +// deps.as_mut(), +// env, +// query_id, +// Height { +// revision_number: 0, +// revision_height: height, +// }, +// data, +// ) +// .unwrap(); +// +// // ensure the callback has worked and contract's state has changed again +// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); +// assert_eq!( +// txs, +// Vec::from([ +// Transfer { +// recipient: watched_addr.clone(), +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// }, +// Transfer { +// recipient: watched_addr, +// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), +// denom: "stake".to_string(), +// amount: "10000".to_string(), +// } +// ]) +// ); +// } diff --git a/contracts/neutron_interchain_txs/src/testing/tests.rs b/contracts/neutron_interchain_txs/src/testing/tests.rs index de11aad6..b572a421 100644 --- a/contracts/neutron_interchain_txs/src/testing/tests.rs +++ b/contracts/neutron_interchain_txs/src/testing/tests.rs @@ -11,9 +11,7 @@ use cosmwasm_std::{ OwnedDeps, }; -use neutron_sdk::bindings::query::NeutronQuery; - -pub fn mock_dependencies() -> OwnedDeps { +pub fn mock_dependencies() -> OwnedDeps { OwnedDeps { storage: MockStorage::default(), api: MockApi::default(), diff --git a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs index 96b2dd93..53493b9a 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs @@ -1,1450 +1,1450 @@ -use crate::bindings::types::StorageValue; -use crate::interchain_queries::helpers::decode_and_convert; -use crate::interchain_queries::types::{AddressBytes, KVReconstruct}; -use crate::interchain_queries::v045::helpers::{ - create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, - create_gov_proposal_key, create_gov_proposal_votes_key, create_params_store_key, - create_total_denom_key, create_validator_key, create_validator_signing_info_key, - deconstruct_account_denom_balance_key, -}; -use crate::interchain_queries::v045::types::BALANCES_PREFIX; -use crate::interchain_queries::v045::types::{ - Balances, Delegations, FeePool, GovernmentProposal, GovernmentProposalVotes, Proposal, - ProposalVote, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, - UnbondingDelegations, UnbondingEntry, UnbondingResponse, Validator as ContractValidator, - ValidatorSigningInfo, WeightedVoteOption, DECIMAL_PLACES, KEY_BOND_DENOM, STAKING_STORE_KEY, -}; -use crate::{NeutronError, NeutronResult}; -use base64::prelude::*; -use base64::Engine; -use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; -use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; -use cosmos_sdk_proto::cosmos::gov::v1beta1::{ - Proposal as CosmosProposal, TallyResult as CosmosTallyResult, Vote, - WeightedVoteOption as CosmosWeightedVoteOption, -}; -use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; -use cosmos_sdk_proto::cosmos::staking::v1beta1::{ - Commission, CommissionRates, Delegation, Description, Validator, -}; -use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{to_json_binary, Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; -use hex; -use std::ops::Mul; -use std::str::FromStr; - -// raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. -pub const BALANCES_HEX_RESPONSE: &str = "0a057374616b6512083939393939303030"; -pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "333030303031303938"; -pub const FEE_POOL_HEX_RESPONSE: &str = - "0a1d0a057374616b6512143231393630303030303030303030303030303030"; -pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "0801129f010a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c127b0a11416464204e65772056616c696461746f721266546869732070726f706f73616c20726571756573747320616464696e672061206e65772076616c696461746f7220746f20746865206e6574776f726b20746f20696d70726f766520646563656e7472616c697a6174696f6e20616e642073656375726974792e1801220c0a01301201301a01302201302a0c08c9fdd3a20610988990d103320c08c9c3dea20610988990d1033a0d0a057374616b65120431303030420b088092b8c398feffffff014a0b088092b8c398feffffff01"; -pub const GOV_PROPOSAL_VOTES_HEX_RESPONSE: &str = "0804122d636f736d6f73313068397374633576366e7467657967663578663934356e6a717135683332723533757175767722170801121331303030303030303030303030303030303030"; -pub const STAKING_DENOM_HEX_RESPONSE: &str = "227374616b6522"; -pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d747112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20b20c07b3eb900df72b48c24e9a2e06ff4fe73bbd255e433af8eae3b1988e698820032a09313030303030303030321b3130303030303030303030303030303030303030303030303030303a080a066d796e6f64654a00524a0a3b0a1231303030303030303030303030303030303012123230303030303030303030303030303030301a113130303030303030303030303030303030120b089cfcd3a20610e0dc890b5a0131"; -pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73313566716a706a39307275686a353771336c366135686461307274373767366d63757a3777386e1234636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d74711a1b313030303030303030303030303030303030303030303030303030"; -pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; -pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; - -#[test] -fn test_balance_reconstruct() { - struct TestCase { - addr: String, - coins: Vec<(String, Uint128)>, - } - let test_cases: Vec = vec![ - TestCase { - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - coins: vec![("uosmo".to_string(), Uint128::from(100u128))], - }, - TestCase { - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - coins: vec![ - ("uosmo".to_string(), Uint128::from(100u128)), - ("uatom".to_string(), Uint128::from(500u128)), - ("uluna".to_string(), Uint128::from(80u128)), - ], - }, - TestCase { - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - coins: vec![], - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); - for coin in &ts.coins { - let balance_key = - create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); - - let balance_amount = Coin { - denom: coin.0.clone(), - amount: coin.1.to_string(), - }; - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(balance_key), - value: Binary::new(balance_amount.encode_to_vec()), - }; - st_values.push(s); - } - - let balances = Balances::reconstruct(&st_values).unwrap(); - assert_eq!(balances.coins.len(), ts.coins.len()); - for (i, coin) in balances.coins.iter().enumerate() { - assert_eq!(coin.denom, ts.coins[i].0); - assert_eq!(coin.amount, ts.coins[i].1) - } - } -} - -#[test] -fn test_bank_total_supply_reconstruct() { - struct TestValue { - denom: String, - amount: String, - } - struct TestCase { - values: Vec, - } - - let test_cases: Vec = vec![ - TestCase { - values: vec![TestValue { - denom: "uatom".to_string(), - amount: "100".to_string(), - }], - }, - TestCase { - values: vec![ - TestValue { - denom: "uatom".to_string(), - amount: "100".to_string(), - }, - TestValue { - denom: "uosmo".to_string(), - amount: "200".to_string(), - }, - ], - }, - TestCase { values: vec![] }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for case in &ts.values { - let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(denom_key), - value: Binary::new(case.amount.as_bytes().to_vec()), - }; - st_values.push(s); - } - - let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); - assert_eq!(total_supply.coins.len(), ts.values.len()); - for (i, coin) in total_supply.coins.iter().enumerate() { - assert_eq!(coin.denom, ts.values[i].denom); - assert_eq!( - coin.amount, - Uint128::from_str(ts.values[i].amount.as_str()).unwrap() - ) - } - } -} - -#[test] -fn test_staking_validators_reconstruct() { - struct TestCase { - validators: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }], - expected_result: Ok(StakingValidator { - validators: vec![ContractValidator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - status: 0, - consensus_pubkey: None, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - unbonding_height: 0, - unbonding_time: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }], - }), - }, - TestCase { - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: Some(prost_types::Any { - type_url: "consensus_pubkey".to_string(), - value: vec![], - }), - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: Some(Description { - moniker: "Test validator".to_string(), - identity: "JHFDHHFHF".to_string(), - website: "https://neutron.org".to_string(), - security_contact: "".to_string(), - details: "Validator details".to_string(), - }), - unbonding_height: 0, - unbonding_time: Some(prost_types::Timestamp { - seconds: 1203981203, - nanos: 123123, - }), - commission: Some(Commission { - commission_rates: Some(CommissionRates { - rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros - max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros - max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros - }), - update_time: Some(prost_types::Timestamp { - seconds: 56324234, - nanos: 1343, - }), - }), - min_self_delegation: "".to_string(), - }], - expected_result: Ok(StakingValidator { - validators: vec![ContractValidator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - status: 0, - consensus_pubkey: Some(vec![]), - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - moniker: Some("Test validator".to_string()), - identity: Some("JHFDHHFHF".to_string()), - website: Some("https://neutron.org".to_string()), - security_contact: Some("".to_string()), - details: Some("Validator details".to_string()), - unbonding_height: 0, - unbonding_time: Some(1203981203), - rate: Some(Decimal::from_str("5").unwrap()), - max_rate: Some(Decimal::from_str("20").unwrap()), - max_change_rate: Some(Decimal::from_str("1").unwrap()), - update_time: Some(56324234), - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }], - }), - }, - TestCase { - validators: vec![ - Validator { - operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" - .to_string(), - consensus_pubkey: Some(prost_types::Any { - type_url: "consensus_pubkey".to_string(), - value: vec![1u8, 2u8, 3u8, 4u8], - }), - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - Validator { - operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" - .to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "2000000000000000000".to_string(), - delegator_shares: "3000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - ], - expected_result: Ok(StakingValidator { - validators: vec![ - ContractValidator { - operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" - .to_string(), - status: 0, - consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - unbonding_height: 0, - unbonding_time: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }, - ContractValidator { - operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" - .to_string(), - status: 0, - consensus_pubkey: None, - tokens: "2000000000000000000".to_string(), - delegator_shares: "3000000000000000000".to_string(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - unbonding_height: 0, - unbonding_time: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }, - ], - }), - }, - TestCase { - validators: vec![], - expected_result: Ok(StakingValidator { validators: vec![] }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for validator in &ts.validators { - let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); - - let validator_key = create_validator_key(&val_addr).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(validator_key), - value: Binary::new(validator.encode_to_vec()), - }; - st_values.push(s); - } - - let stakin_validator = StakingValidator::reconstruct(&st_values); - - assert_eq!(stakin_validator, ts.expected_result) - } -} - -#[test] -fn test_validators_signing_infos_reconstruct() { - struct TestCase { - signing_infos: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - signing_infos: vec![CosmosValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: false, - missed_blocks_counter: 987675, - }], - expected_result: Ok(SigningInfo { - signing_infos: vec![ValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: false, - missed_blocks_counter: 987675, - }], - }), - }, - TestCase { - signing_infos: vec![CosmosValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(prost_types::Timestamp { - seconds: 321654, - nanos: 123123, - }), - tombstoned: false, - missed_blocks_counter: 987675, - }], - expected_result: Ok(SigningInfo { - signing_infos: vec![ValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(321654), - tombstoned: false, - missed_blocks_counter: 987675, - }], - }), - }, - TestCase { - signing_infos: vec![ - CosmosValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: true, - missed_blocks_counter: 987675, - }, - CosmosValidatorSigningInfo { - address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(prost_types::Timestamp { - seconds: 321654, - nanos: 123123, - }), - tombstoned: false, - missed_blocks_counter: 345012, - }, - ], - expected_result: Ok(SigningInfo { - signing_infos: vec![ - ValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: true, - missed_blocks_counter: 987675, - }, - ValidatorSigningInfo { - address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(321654), - tombstoned: false, - missed_blocks_counter: 345012, - }, - ], - }), - }, - TestCase { - signing_infos: vec![], - expected_result: Ok(SigningInfo { - signing_infos: vec![], - }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for info in &ts.signing_infos { - let val_addr = decode_and_convert(info.address.as_str()).unwrap(); - - let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(signing_info_key), - value: Binary::new(info.encode_to_vec()), - }; - st_values.push(s); - } - - let signing_infos = SigningInfo::reconstruct(&st_values); - - assert_eq!(signing_infos, ts.expected_result) - } -} - -#[test] -fn test_government_proposals_reconstruct() { - struct TestCase { - proposals: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - proposals: vec![CosmosProposal { - proposal_id: 1, - content: Some(prost_types::Any { - type_url: "proposal_type".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: None, - submit_time: None, - deposit_end_time: None, - total_deposit: vec![Coin { - amount: "100000".to_string(), - denom: "stake".to_string(), - }], - voting_start_time: None, - voting_end_time: None, - }], - expected_result: Ok(GovernmentProposal { - proposals: vec![Proposal { - proposal_id: 1, - proposal_type: Some("proposal_type".to_string()), - total_deposit: vec![StdCoin::new(100000u128, "stake")], - status: 1, - submit_time: None, - deposit_end_time: None, - voting_start_time: None, - voting_end_time: None, - final_tally_result: None, - }], - }), - }, - TestCase { - proposals: vec![CosmosProposal { - proposal_id: 1, - content: Some(prost_types::Any { - type_url: "proposal_type".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: Some(CosmosTallyResult { - abstain: "1".to_string(), - no: "2".to_string(), - no_with_veto: "3".to_string(), - yes: "4".to_string(), - }), - submit_time: Some(prost_types::Timestamp { - seconds: 2222222, - nanos: 123123, - }), - deposit_end_time: Some(prost_types::Timestamp { - seconds: 3333333, - nanos: 123123, - }), - total_deposit: vec![Coin { - amount: "100000".to_string(), - denom: "stake".to_string(), - }], - voting_start_time: Some(prost_types::Timestamp { - seconds: 4444444, - nanos: 123123, - }), - voting_end_time: Some(prost_types::Timestamp { - seconds: 555555555, - nanos: 123123, - }), - }], - expected_result: Ok(GovernmentProposal { - proposals: vec![Proposal { - proposal_id: 1, - proposal_type: Some("proposal_type".to_string()), - total_deposit: vec![StdCoin::new(100000u128, "stake")], - status: 1, - submit_time: Some(2222222), - deposit_end_time: Some(3333333), - voting_start_time: Some(4444444), - voting_end_time: Some(555555555), - final_tally_result: Some(TallyResult { - abstain: Uint128::from(1u64), - no: Uint128::from(2u64), - no_with_veto: Uint128::from(3u64), - yes: Uint128::from(4u64), - }), - }], - }), - }, - TestCase { - proposals: vec![ - CosmosProposal { - proposal_id: 1, - content: Some(prost_types::Any { - type_url: "proposal_type1".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: None, - submit_time: None, - deposit_end_time: None, - total_deposit: vec![Coin { - amount: "100000".to_string(), - denom: "stake".to_string(), - }], - voting_start_time: None, - voting_end_time: None, - }, - CosmosProposal { - proposal_id: 2, - content: Some(prost_types::Any { - type_url: "proposal_type2".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: None, - submit_time: None, - deposit_end_time: None, - total_deposit: vec![Coin { - amount: "200000".to_string(), - denom: "osmo".to_string(), - }], - voting_start_time: None, - voting_end_time: None, - }, - ], - expected_result: Ok(GovernmentProposal { - proposals: vec![ - Proposal { - proposal_id: 1, - proposal_type: Some("proposal_type1".to_string()), - total_deposit: vec![StdCoin::new(100000u128, "stake")], - status: 1, - submit_time: None, - deposit_end_time: None, - voting_start_time: None, - voting_end_time: None, - final_tally_result: None, - }, - Proposal { - proposal_id: 2, - proposal_type: Some("proposal_type2".to_string()), - total_deposit: vec![StdCoin::new(200000u128, "osmo")], - status: 1, - submit_time: None, - deposit_end_time: None, - voting_start_time: None, - voting_end_time: None, - final_tally_result: None, - }, - ], - }), - }, - TestCase { - proposals: vec![], - expected_result: Ok(GovernmentProposal { proposals: vec![] }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for proposal in &ts.proposals { - let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(proposal_key), - value: Binary::new(proposal.encode_to_vec()), - }; - st_values.push(s); - } - - let gov_proposal = GovernmentProposal::reconstruct(&st_values); - - assert_eq!(gov_proposal, ts.expected_result) - } -} - -#[allow(deprecated)] -#[test] -fn test_proposal_votes_reconstruct() { - struct TestCase { - proposal_votes: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - proposal_votes: vec![Vote { - proposal_id: 1, - voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - option: 0, - options: vec![CosmosWeightedVoteOption { - weight: "1000000000000000000".to_string(), - option: 1, - }], - }], - expected_result: Ok(GovernmentProposalVotes { - proposal_votes: vec![ProposalVote { - proposal_id: 1, - voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - options: vec![WeightedVoteOption { - weight: "1000000000000000000".to_string(), - option: 1, - }], - }], - }), - }, - TestCase { - proposal_votes: vec![ - Vote { - proposal_id: 1, - voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - option: 0, - options: vec![CosmosWeightedVoteOption { - weight: "1000000000000000000".to_string(), - option: 1, - }], - }, - Vote { - proposal_id: 2, - voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - option: 0, - options: vec![CosmosWeightedVoteOption { - weight: "567890".to_string(), - option: 2, - }], - }, - ], - expected_result: Ok(GovernmentProposalVotes { - proposal_votes: vec![ - ProposalVote { - proposal_id: 1, - voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - options: vec![WeightedVoteOption { - weight: "1000000000000000000".to_string(), - option: 1, - }], - }, - ProposalVote { - proposal_id: 2, - voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - options: vec![WeightedVoteOption { - weight: "567890".to_string(), - option: 2, - }], - }, - ], - }), - }, - TestCase { - proposal_votes: vec![], - expected_result: Ok(GovernmentProposalVotes { - proposal_votes: vec![], - }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for votes in &ts.proposal_votes { - let proposal_key = create_gov_proposal_votes_key(votes.proposal_id).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(proposal_key), - value: Binary::new(votes.encode_to_vec()), - }; - st_values.push(s); - } - - let gov_proposals_votes = GovernmentProposalVotes::reconstruct(&st_values); - - assert_eq!(gov_proposals_votes, ts.expected_result) - } -} - -#[test] -fn test_fee_pool_reconstruct() { - struct TestCase { - coins: Vec<(String, Uint128)>, - } - let test_cases: Vec = vec![ - TestCase { - coins: vec![("uosmo".to_string(), Uint128::from(100u128))], - }, - TestCase { - coins: vec![ - ("uosmo".to_string(), Uint128::from(100u128)), - ("uatom".to_string(), Uint128::from(500u128)), - ("uluna".to_string(), Uint128::from(80u128)), - ], - }, - TestCase { coins: vec![] }, - ]; - - for ts in test_cases { - let mut coins: Vec = vec![]; - - for coin in &ts.coins { - let balance_amount = DecCoin { - denom: coin.0.clone(), - amount: coin - .1 - .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format - .to_string(), - }; - - coins.push(balance_amount); - } - - let fee_pool = CosmosFeePool { - community_pool: coins, - }; - - let fee_pool_key = create_fee_pool_key().unwrap(); - - let st_value = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(fee_pool_key), - value: Binary::new(fee_pool.encode_to_vec()), - }; - - let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); - assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); - for (i, coin) in fee_pool_coins.coins.iter().enumerate() { - assert_eq!(coin.denom, ts.coins[i].0); - assert_eq!(coin.amount, ts.coins[i].1) - } - } -} - -#[test] -fn test_delegations_reconstruct() { - struct TestCase { - stake_denom: String, - delegations: Vec, - validators: Vec, - expected_result: NeutronResult, - } - let test_cases: Vec = vec![ - TestCase { - stake_denom: "stake".to_string(), - delegations: vec![Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - shares: "1000000000000000000".to_string(), - }], - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }], - expected_result: Ok(Delegations { - delegations: vec![StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: StdCoin::new(1000000000000000000u128, "stake"), - }], - }), - }, - TestCase { - stake_denom: "stake".to_string(), - delegations: vec![ - Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - shares: "1000000000000000000".to_string(), - }, - Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" - .to_string(), - shares: "1000000000000000000".to_string(), - }, - ], - validators: vec![ - Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - Validator { - operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" - .to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - ], - expected_result: Ok(Delegations { - delegations: vec![ - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: StdCoin::new(1000000000000000000u128, "stake"), - }, - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), - amount: StdCoin::new(1000000000000000000u128, "stake"), - }, - ], - }), - }, - TestCase { - stake_denom: "stake".to_string(), - delegations: vec![], - validators: vec![], - expected_result: Ok(Delegations { - delegations: vec![], - }), - }, - TestCase { - stake_denom: Default::default(), - delegations: vec![], - validators: vec![], - expected_result: Err(NeutronError::InvalidQueryResultFormat( - "denom is empty".into(), - )), - }, - TestCase { - stake_denom: "stake".to_string(), - delegations: vec![Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - shares: "1000000000000000000".to_string(), - }], - validators: vec![], - expected_result: Err(NeutronError::InvalidQueryResultFormat( - "validator is empty".into(), - )), - }, - ]; - - for ts in &test_cases { - // prepare storage values - let mut st_values: Vec = vec![StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), - value: { - if ts.stake_denom.is_empty() { - return Default::default(); - } - to_json_binary(&ts.stake_denom).unwrap() - }, - }]; - - for (i, d) in ts.delegations.iter().enumerate() { - let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); - let val_addr = decode_and_convert(&d.validator_address).unwrap(); - - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), - value: Binary::from(d.encode_to_vec()), - }); - - if let Some(v) = ts.validators.get(i) { - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr).unwrap()), - value: Binary::from(v.encode_to_vec()), - }); - } - } - - // test reconstruction - let delegations = Delegations::reconstruct(&st_values); - - assert_eq!(delegations, ts.expected_result) - } -} - -#[test] -fn test_balance_reconstruct_from_hex() { - let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - let balance_key = create_account_denom_balance_key( - decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), - "uosmo", - ) - .unwrap(); - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::from(balance_key), - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let bank_balances = Balances::reconstruct(&[s]).unwrap(); - assert_eq!( - bank_balances, - Balances { - coins: vec![StdCoin { - denom: String::from("uosmo"), - amount: Uint128::from(99999000u64), - }] - } - ); -} - -#[test] -fn test_balance_reconstruct_from_empty_value() { - let balance_key = create_account_denom_balance_key( - decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), - "uosmo", - ) - .unwrap(); - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::from(balance_key), - value: Binary::from(vec![]), - }; - let bank_balances = Balances::reconstruct(&[s]).unwrap(); - assert_eq!( - bank_balances, - Balances { - coins: vec![StdCoin::new(0u128, "uosmo")] - } - ); -} - -#[test] -fn test_bank_total_supply_reconstruct_from_hex() { - let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::new(create_total_denom_key("stake").unwrap()), - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); - assert_eq!( - total_supply, - TotalSupply { - coins: vec![StdCoin { - denom: String::from("stake"), - amount: Uint128::from(300001098u64), // mutating - }] - } - ); -} - -#[test] -fn test_staking_validators_reconstruct_from_hex() { - let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); - assert_eq!( - staking_validator, - StakingValidator { - validators: vec![ContractValidator { - operator_address: String::from( - "cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq" // mutating - ), - consensus_pubkey: Some(vec![ - 10, 32, 178, 12, 7, 179, 235, 144, 13, 247, 43, 72, 194, 78, 154, 46, 6, 255, - 79, 231, 59, 189, 37, 94, 67, 58, 248, 234, 227, 177, 152, 142, 105, 136, - ]), - jailed: false, - status: 3, - tokens: String::from("100000000"), - delegator_shares: String::from("100000000000000000000000000"), - moniker: Some(String::from("mynode")), - identity: Some(String::from("")), - website: Some(String::from("")), - security_contact: Some(String::from("")), - details: Some(String::from("")), - unbonding_height: 0u64, - unbonding_time: Some(0u64), - rate: Some(Decimal::from_str("0.100000000000000000").unwrap()), - max_rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), - max_change_rate: Some(Decimal::from_str("0.010000000000000000").unwrap()), - update_time: Some(1683291676u64), // mutating - min_self_delegation: Decimal::one(), - }] - } - ); -} - -#[test] -fn test_validators_signing_infos_reconstruct_from_hex() { - let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); - assert_eq!( - signing_info, - SigningInfo { - signing_infos: vec![ValidatorSigningInfo { - address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), - start_height: 0, - index_offset: 16, - jailed_until: Some(0), - tombstoned: false, - missed_blocks_counter: 0, - }] - } - ); -} - -#[test] -fn test_government_proposals_reconstruct_from_hex() { - let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); - assert_eq!( - proposals, - GovernmentProposal { - proposals: vec![Proposal { - proposal_id: 1u64, - proposal_type: Some(String::from("/cosmos.gov.v1beta1.TextProposal")), - total_deposit: vec![StdCoin { - denom: String::from("stake"), - amount: Uint128::from(1000u64), - }], - status: 1i32, - submit_time: Some(1683291849u64), // mutating - deposit_end_time: Some(1683464649u64), // mutating - voting_start_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z - voting_end_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z - final_tally_result: Some(TallyResult { - yes: Uint128::zero(), - no: Uint128::zero(), - abstain: Uint128::zero(), - no_with_veto: Uint128::zero(), - }), - }] - } - ); -} - -#[test] -fn test_proposal_votes_reconstruct_from_hex() { - let bytes = hex::decode(GOV_PROPOSAL_VOTES_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let votes = GovernmentProposalVotes::reconstruct(&[s]).unwrap(); - assert_eq!( - votes, - GovernmentProposalVotes { - proposal_votes: vec![ProposalVote { - proposal_id: 4, - voter: "cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw".to_string(), - options: vec![WeightedVoteOption { - weight: "1000000000000000000".to_string(), - option: 1, - }], - }], - } - ); -} - -#[test] -fn test_fee_pool_reconstruct_from_hex() { - let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let fee_pool = FeePool::reconstruct(&[s]).unwrap(); - assert_eq!( - fee_pool, - FeePool { - coins: vec![StdCoin { - denom: String::from("stake"), - amount: Uint128::from(21u64), // mutating - }] - } - ); -} - -#[test] -fn test_delegations_reconstruct_from_hex() { - let staking_denom_bytes = hex::decode(STAKING_DENOM_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let staking_denom_base64_input = BASE64_STANDARD.encode(staking_denom_bytes); // encode bytes to base64 string - let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string - let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string - - let mut st_values: Vec = vec![StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(staking_denom_base64_input.as_str()).unwrap(), - }]; - st_values.push(StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(delegation_base64_input.as_str()).unwrap(), - }); - st_values.push(StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap(), - }); - - let delegations = Delegations::reconstruct(&st_values).unwrap(); - assert_eq!( - delegations, - Delegations { - delegations: vec![StdDelegation { - delegator: Addr::unchecked("cosmos15fqjpj90ruhj57q3l6a5hda0rt77g6mcuz7w8n"), // mutating - validator: String::from("cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq"), // mutating - amount: StdCoin { - denom: String::from("stake"), - amount: Uint128::from(100000000u64), - }, - }], - } - ); -} - -#[test] -fn test_unbonding_delegations_reconstruct_from_hex() { - let unbonding_delegations_bytes = - hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string - - let st_values: Vec = vec![StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap(), - }]; - - let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); - assert_eq!( - unbonding_delegations, - UnbondingDelegations { - unbonding_responses: vec![UnbondingResponse { - delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), - validator_address: String::from( - "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" - ), - entries: vec![ - UnbondingEntry { - balance: Uint128::new(10_000), - completion_time: Some(Timestamp::from_nanos(1704872890570185206)), - creation_height: 365, - initial_balance: Uint128::new(10_000), - }, - UnbondingEntry { - balance: Uint128::new(20_000), - completion_time: Some(Timestamp::from_nanos(1704872903002248037)), - creation_height: 377, - initial_balance: Uint128::new(20_000), - }, - ], - }] - } - ); -} - -#[test] -fn test_deconstruct_account_denom_balance_key() { - struct TestCase { - key: Vec, - expected_result: NeutronResult<(AddressBytes, String)>, - } - - let testcases = vec![ - TestCase { - // valid key - key: create_account_denom_balance_key("addr1", "uatom").unwrap(), - expected_result: Ok(( - "addr1".bytes().collect::(), - "uatom".to_string(), - )), - }, - TestCase { - // empty key - key: vec![], - expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( - "invalid key length".to_string(), - )), - }, - TestCase { - // first element in the key is not BALANCES_PREFIX - key: vec![81], - expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( - "first element in key does not equal to BALANCES_PREFIX: 81 != 2".to_string(), - )), - }, - TestCase { - // first element in the key is BALANCES_PREFIX but key length is invalid - key: vec![BALANCES_PREFIX], - expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( - "invalid key length".to_string(), - )), - }, - TestCase { - // invalid address length in key - // second element must define addr length, but here we say that length is 10, - // but actually it's 1 which is wrong - key: vec![BALANCES_PREFIX, 10, 1], - expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( - "address length in key is invalid".to_string(), - )), - }, - TestCase { - // first element is correct, addr length is good, but there is no denom in the key - key: vec![BALANCES_PREFIX, 2, 1, 2], - expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( - "denom in key can't be empty".to_string(), - )), - }, - TestCase { - // must fail since [0, 159, 146, 150] are invalid UTF-8 bytes - key: vec![BALANCES_PREFIX, 2, 1, 2, 0, 159, 146, 150], - expected_result: Err(NeutronError::FromUTF8Error( - String::from_utf8(vec![0, 159, 146, 150]).unwrap_err(), - )), - }, - ]; - - for tc in testcases { - assert_eq!( - deconstruct_account_denom_balance_key(tc.key), - tc.expected_result - ); - } -} - -#[test] -fn test_delegations_reconstruct_overflow() { - struct TestCase { - stake_denom: String, - delegations: Vec, - validators: Vec, - expected_result: NeutronResult, - } - let test_cases: Vec = vec![TestCase { - stake_denom: "stake".to_string(), - delegations: vec![Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - shares: "340282366920938463463".to_string(), - }], - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "340282366920938463463".to_string(), - delegator_shares: "340282366920938463463".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }], - expected_result: Ok(Delegations { - delegations: vec![StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: StdCoin::new(340282366920938463463u128, "stake"), - }], - }), - }]; - - for ts in &test_cases { - // prepare storage values - let mut st_values: Vec = vec![StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), - value: { - if ts.stake_denom.is_empty() { - return Default::default(); - } - to_json_binary(&ts.stake_denom).unwrap() - }, - }]; - - for (i, d) in ts.delegations.iter().enumerate() { - let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); - let val_addr = decode_and_convert(&d.validator_address).unwrap(); - - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), - value: Binary::from(d.encode_to_vec()), - }); - - if let Some(v) = ts.validators.get(i) { - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr).unwrap()), - value: Binary::from(v.encode_to_vec()), - }); - } - } - - // test reconstruction - let delegations = Delegations::reconstruct(&st_values); - - assert_eq!(delegations, ts.expected_result) - } -} +// use crate::bindings::types::StorageValue; +// use crate::interchain_queries::helpers::decode_and_convert; +// use crate::interchain_queries::types::{AddressBytes, KVReconstruct}; +// use crate::interchain_queries::v045::helpers::{ +// create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, +// create_gov_proposal_key, create_gov_proposal_votes_key, create_params_store_key, +// create_total_denom_key, create_validator_key, create_validator_signing_info_key, +// deconstruct_account_denom_balance_key, +// }; +// use crate::interchain_queries::v045::types::BALANCES_PREFIX; +// use crate::interchain_queries::v045::types::{ +// Balances, Delegations, FeePool, GovernmentProposal, GovernmentProposalVotes, Proposal, +// ProposalVote, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, +// UnbondingDelegations, UnbondingEntry, UnbondingResponse, Validator as ContractValidator, +// ValidatorSigningInfo, WeightedVoteOption, DECIMAL_PLACES, KEY_BOND_DENOM, STAKING_STORE_KEY, +// }; +// use crate::{NeutronError, NeutronResult}; +// use base64::prelude::*; +// use base64::Engine; +// use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; +// use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; +// use cosmos_sdk_proto::cosmos::gov::v1beta1::{ +// Proposal as CosmosProposal, TallyResult as CosmosTallyResult, Vote, +// WeightedVoteOption as CosmosWeightedVoteOption, +// }; +// use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; +// use cosmos_sdk_proto::cosmos::staking::v1beta1::{ +// Commission, CommissionRates, Delegation, Description, Validator, +// }; +// use cosmos_sdk_proto::traits::Message; +// use cosmwasm_std::{to_json_binary, Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; +// use hex; +// use std::ops::Mul; +// use std::str::FromStr; +// +// // raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. +// pub const BALANCES_HEX_RESPONSE: &str = "0a057374616b6512083939393939303030"; +// pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "333030303031303938"; +// pub const FEE_POOL_HEX_RESPONSE: &str = +// "0a1d0a057374616b6512143231393630303030303030303030303030303030"; +// pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "0801129f010a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c127b0a11416464204e65772056616c696461746f721266546869732070726f706f73616c20726571756573747320616464696e672061206e65772076616c696461746f7220746f20746865206e6574776f726b20746f20696d70726f766520646563656e7472616c697a6174696f6e20616e642073656375726974792e1801220c0a01301201301a01302201302a0c08c9fdd3a20610988990d103320c08c9c3dea20610988990d1033a0d0a057374616b65120431303030420b088092b8c398feffffff014a0b088092b8c398feffffff01"; +// pub const GOV_PROPOSAL_VOTES_HEX_RESPONSE: &str = "0804122d636f736d6f73313068397374633576366e7467657967663578663934356e6a717135683332723533757175767722170801121331303030303030303030303030303030303030"; +// pub const STAKING_DENOM_HEX_RESPONSE: &str = "227374616b6522"; +// pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d747112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20b20c07b3eb900df72b48c24e9a2e06ff4fe73bbd255e433af8eae3b1988e698820032a09313030303030303030321b3130303030303030303030303030303030303030303030303030303a080a066d796e6f64654a00524a0a3b0a1231303030303030303030303030303030303012123230303030303030303030303030303030301a113130303030303030303030303030303030120b089cfcd3a20610e0dc890b5a0131"; +// pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73313566716a706a39307275686a353771336c366135686461307274373767366d63757a3777386e1234636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d74711a1b313030303030303030303030303030303030303030303030303030"; +// pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; +// pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; +// +// #[test] +// fn test_balance_reconstruct() { +// struct TestCase { +// addr: String, +// coins: Vec<(String, Uint128)>, +// } +// let test_cases: Vec = vec![ +// TestCase { +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// coins: vec![("uosmo".to_string(), Uint128::from(100u128))], +// }, +// TestCase { +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// coins: vec![ +// ("uosmo".to_string(), Uint128::from(100u128)), +// ("uatom".to_string(), Uint128::from(500u128)), +// ("uluna".to_string(), Uint128::from(80u128)), +// ], +// }, +// TestCase { +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// coins: vec![], +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); +// for coin in &ts.coins { +// let balance_key = +// create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); +// +// let balance_amount = Coin { +// denom: coin.0.clone(), +// amount: coin.1.to_string(), +// }; +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(balance_key), +// value: Binary::new(balance_amount.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let balances = Balances::reconstruct(&st_values).unwrap(); +// assert_eq!(balances.coins.len(), ts.coins.len()); +// for (i, coin) in balances.coins.iter().enumerate() { +// assert_eq!(coin.denom, ts.coins[i].0); +// assert_eq!(coin.amount, ts.coins[i].1) +// } +// } +// } +// +// #[test] +// fn test_bank_total_supply_reconstruct() { +// struct TestValue { +// denom: String, +// amount: String, +// } +// struct TestCase { +// values: Vec, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// values: vec![TestValue { +// denom: "uatom".to_string(), +// amount: "100".to_string(), +// }], +// }, +// TestCase { +// values: vec![ +// TestValue { +// denom: "uatom".to_string(), +// amount: "100".to_string(), +// }, +// TestValue { +// denom: "uosmo".to_string(), +// amount: "200".to_string(), +// }, +// ], +// }, +// TestCase { values: vec![] }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for case in &ts.values { +// let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(denom_key), +// value: Binary::new(case.amount.as_bytes().to_vec()), +// }; +// st_values.push(s); +// } +// +// let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); +// assert_eq!(total_supply.coins.len(), ts.values.len()); +// for (i, coin) in total_supply.coins.iter().enumerate() { +// assert_eq!(coin.denom, ts.values[i].denom); +// assert_eq!( +// coin.amount, +// Uint128::from_str(ts.values[i].amount.as_str()).unwrap() +// ) +// } +// } +// } +// +// #[test] +// fn test_staking_validators_reconstruct() { +// struct TestCase { +// validators: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(StakingValidator { +// validators: vec![ContractValidator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// status: 0, +// consensus_pubkey: None, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// unbonding_height: 0, +// unbonding_time: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }], +// }), +// }, +// TestCase { +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: Some(prost_types::Any { +// type_url: "consensus_pubkey".to_string(), +// value: vec![], +// }), +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: Some(Description { +// moniker: "Test validator".to_string(), +// identity: "JHFDHHFHF".to_string(), +// website: "https://neutron.org".to_string(), +// security_contact: "".to_string(), +// details: "Validator details".to_string(), +// }), +// unbonding_height: 0, +// unbonding_time: Some(prost_types::Timestamp { +// seconds: 1203981203, +// nanos: 123123, +// }), +// commission: Some(Commission { +// commission_rates: Some(CommissionRates { +// rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros +// max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros +// max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros +// }), +// update_time: Some(prost_types::Timestamp { +// seconds: 56324234, +// nanos: 1343, +// }), +// }), +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(StakingValidator { +// validators: vec![ContractValidator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// status: 0, +// consensus_pubkey: Some(vec![]), +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// moniker: Some("Test validator".to_string()), +// identity: Some("JHFDHHFHF".to_string()), +// website: Some("https://neutron.org".to_string()), +// security_contact: Some("".to_string()), +// details: Some("Validator details".to_string()), +// unbonding_height: 0, +// unbonding_time: Some(1203981203), +// rate: Some(Decimal::from_str("5").unwrap()), +// max_rate: Some(Decimal::from_str("20").unwrap()), +// max_change_rate: Some(Decimal::from_str("1").unwrap()), +// update_time: Some(56324234), +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }], +// }), +// }, +// TestCase { +// validators: vec![ +// Validator { +// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" +// .to_string(), +// consensus_pubkey: Some(prost_types::Any { +// type_url: "consensus_pubkey".to_string(), +// value: vec![1u8, 2u8, 3u8, 4u8], +// }), +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// Validator { +// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" +// .to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "2000000000000000000".to_string(), +// delegator_shares: "3000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// ], +// expected_result: Ok(StakingValidator { +// validators: vec![ +// ContractValidator { +// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" +// .to_string(), +// status: 0, +// consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// unbonding_height: 0, +// unbonding_time: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }, +// ContractValidator { +// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" +// .to_string(), +// status: 0, +// consensus_pubkey: None, +// tokens: "2000000000000000000".to_string(), +// delegator_shares: "3000000000000000000".to_string(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// unbonding_height: 0, +// unbonding_time: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }, +// ], +// }), +// }, +// TestCase { +// validators: vec![], +// expected_result: Ok(StakingValidator { validators: vec![] }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for validator in &ts.validators { +// let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); +// +// let validator_key = create_validator_key(&val_addr).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(validator_key), +// value: Binary::new(validator.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let stakin_validator = StakingValidator::reconstruct(&st_values); +// +// assert_eq!(stakin_validator, ts.expected_result) +// } +// } +// +// #[test] +// fn test_validators_signing_infos_reconstruct() { +// struct TestCase { +// signing_infos: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// signing_infos: vec![CosmosValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![ValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// }), +// }, +// TestCase { +// signing_infos: vec![CosmosValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(prost_types::Timestamp { +// seconds: 321654, +// nanos: 123123, +// }), +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![ValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(321654), +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// }), +// }, +// TestCase { +// signing_infos: vec![ +// CosmosValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: true, +// missed_blocks_counter: 987675, +// }, +// CosmosValidatorSigningInfo { +// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(prost_types::Timestamp { +// seconds: 321654, +// nanos: 123123, +// }), +// tombstoned: false, +// missed_blocks_counter: 345012, +// }, +// ], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![ +// ValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: true, +// missed_blocks_counter: 987675, +// }, +// ValidatorSigningInfo { +// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(321654), +// tombstoned: false, +// missed_blocks_counter: 345012, +// }, +// ], +// }), +// }, +// TestCase { +// signing_infos: vec![], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![], +// }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for info in &ts.signing_infos { +// let val_addr = decode_and_convert(info.address.as_str()).unwrap(); +// +// let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(signing_info_key), +// value: Binary::new(info.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let signing_infos = SigningInfo::reconstruct(&st_values); +// +// assert_eq!(signing_infos, ts.expected_result) +// } +// } +// +// #[test] +// fn test_government_proposals_reconstruct() { +// struct TestCase { +// proposals: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// proposals: vec![CosmosProposal { +// proposal_id: 1, +// content: Some(prost_types::Any { +// type_url: "proposal_type".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: None, +// submit_time: None, +// deposit_end_time: None, +// total_deposit: vec![Coin { +// amount: "100000".to_string(), +// denom: "stake".to_string(), +// }], +// voting_start_time: None, +// voting_end_time: None, +// }], +// expected_result: Ok(GovernmentProposal { +// proposals: vec![Proposal { +// proposal_id: 1, +// proposal_type: Some("proposal_type".to_string()), +// total_deposit: vec![StdCoin::new(100000u128, "stake")], +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_start_time: None, +// voting_end_time: None, +// final_tally_result: None, +// }], +// }), +// }, +// TestCase { +// proposals: vec![CosmosProposal { +// proposal_id: 1, +// content: Some(prost_types::Any { +// type_url: "proposal_type".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: Some(CosmosTallyResult { +// abstain: "1".to_string(), +// no: "2".to_string(), +// no_with_veto: "3".to_string(), +// yes: "4".to_string(), +// }), +// submit_time: Some(prost_types::Timestamp { +// seconds: 2222222, +// nanos: 123123, +// }), +// deposit_end_time: Some(prost_types::Timestamp { +// seconds: 3333333, +// nanos: 123123, +// }), +// total_deposit: vec![Coin { +// amount: "100000".to_string(), +// denom: "stake".to_string(), +// }], +// voting_start_time: Some(prost_types::Timestamp { +// seconds: 4444444, +// nanos: 123123, +// }), +// voting_end_time: Some(prost_types::Timestamp { +// seconds: 555555555, +// nanos: 123123, +// }), +// }], +// expected_result: Ok(GovernmentProposal { +// proposals: vec![Proposal { +// proposal_id: 1, +// proposal_type: Some("proposal_type".to_string()), +// total_deposit: vec![StdCoin::new(100000u128, "stake")], +// status: 1, +// submit_time: Some(2222222), +// deposit_end_time: Some(3333333), +// voting_start_time: Some(4444444), +// voting_end_time: Some(555555555), +// final_tally_result: Some(TallyResult { +// abstain: Uint128::from(1u64), +// no: Uint128::from(2u64), +// no_with_veto: Uint128::from(3u64), +// yes: Uint128::from(4u64), +// }), +// }], +// }), +// }, +// TestCase { +// proposals: vec![ +// CosmosProposal { +// proposal_id: 1, +// content: Some(prost_types::Any { +// type_url: "proposal_type1".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: None, +// submit_time: None, +// deposit_end_time: None, +// total_deposit: vec![Coin { +// amount: "100000".to_string(), +// denom: "stake".to_string(), +// }], +// voting_start_time: None, +// voting_end_time: None, +// }, +// CosmosProposal { +// proposal_id: 2, +// content: Some(prost_types::Any { +// type_url: "proposal_type2".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: None, +// submit_time: None, +// deposit_end_time: None, +// total_deposit: vec![Coin { +// amount: "200000".to_string(), +// denom: "osmo".to_string(), +// }], +// voting_start_time: None, +// voting_end_time: None, +// }, +// ], +// expected_result: Ok(GovernmentProposal { +// proposals: vec![ +// Proposal { +// proposal_id: 1, +// proposal_type: Some("proposal_type1".to_string()), +// total_deposit: vec![StdCoin::new(100000u128, "stake")], +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_start_time: None, +// voting_end_time: None, +// final_tally_result: None, +// }, +// Proposal { +// proposal_id: 2, +// proposal_type: Some("proposal_type2".to_string()), +// total_deposit: vec![StdCoin::new(200000u128, "osmo")], +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_start_time: None, +// voting_end_time: None, +// final_tally_result: None, +// }, +// ], +// }), +// }, +// TestCase { +// proposals: vec![], +// expected_result: Ok(GovernmentProposal { proposals: vec![] }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for proposal in &ts.proposals { +// let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(proposal_key), +// value: Binary::new(proposal.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let gov_proposal = GovernmentProposal::reconstruct(&st_values); +// +// assert_eq!(gov_proposal, ts.expected_result) +// } +// } +// +// #[allow(deprecated)] +// #[test] +// fn test_proposal_votes_reconstruct() { +// struct TestCase { +// proposal_votes: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// proposal_votes: vec![Vote { +// proposal_id: 1, +// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// option: 0, +// options: vec![CosmosWeightedVoteOption { +// weight: "1000000000000000000".to_string(), +// option: 1, +// }], +// }], +// expected_result: Ok(GovernmentProposalVotes { +// proposal_votes: vec![ProposalVote { +// proposal_id: 1, +// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// options: vec![WeightedVoteOption { +// weight: "1000000000000000000".to_string(), +// option: 1, +// }], +// }], +// }), +// }, +// TestCase { +// proposal_votes: vec![ +// Vote { +// proposal_id: 1, +// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// option: 0, +// options: vec![CosmosWeightedVoteOption { +// weight: "1000000000000000000".to_string(), +// option: 1, +// }], +// }, +// Vote { +// proposal_id: 2, +// voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// option: 0, +// options: vec![CosmosWeightedVoteOption { +// weight: "567890".to_string(), +// option: 2, +// }], +// }, +// ], +// expected_result: Ok(GovernmentProposalVotes { +// proposal_votes: vec![ +// ProposalVote { +// proposal_id: 1, +// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// options: vec![WeightedVoteOption { +// weight: "1000000000000000000".to_string(), +// option: 1, +// }], +// }, +// ProposalVote { +// proposal_id: 2, +// voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// options: vec![WeightedVoteOption { +// weight: "567890".to_string(), +// option: 2, +// }], +// }, +// ], +// }), +// }, +// TestCase { +// proposal_votes: vec![], +// expected_result: Ok(GovernmentProposalVotes { +// proposal_votes: vec![], +// }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for votes in &ts.proposal_votes { +// let proposal_key = create_gov_proposal_votes_key(votes.proposal_id).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(proposal_key), +// value: Binary::new(votes.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let gov_proposals_votes = GovernmentProposalVotes::reconstruct(&st_values); +// +// assert_eq!(gov_proposals_votes, ts.expected_result) +// } +// } +// +// #[test] +// fn test_fee_pool_reconstruct() { +// struct TestCase { +// coins: Vec<(String, Uint128)>, +// } +// let test_cases: Vec = vec![ +// TestCase { +// coins: vec![("uosmo".to_string(), Uint128::from(100u128))], +// }, +// TestCase { +// coins: vec![ +// ("uosmo".to_string(), Uint128::from(100u128)), +// ("uatom".to_string(), Uint128::from(500u128)), +// ("uluna".to_string(), Uint128::from(80u128)), +// ], +// }, +// TestCase { coins: vec![] }, +// ]; +// +// for ts in test_cases { +// let mut coins: Vec = vec![]; +// +// for coin in &ts.coins { +// let balance_amount = DecCoin { +// denom: coin.0.clone(), +// amount: coin +// .1 +// .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format +// .to_string(), +// }; +// +// coins.push(balance_amount); +// } +// +// let fee_pool = CosmosFeePool { +// community_pool: coins, +// }; +// +// let fee_pool_key = create_fee_pool_key().unwrap(); +// +// let st_value = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(fee_pool_key), +// value: Binary::new(fee_pool.encode_to_vec()), +// }; +// +// let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); +// assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); +// for (i, coin) in fee_pool_coins.coins.iter().enumerate() { +// assert_eq!(coin.denom, ts.coins[i].0); +// assert_eq!(coin.amount, ts.coins[i].1) +// } +// } +// } +// +// #[test] +// fn test_delegations_reconstruct() { +// struct TestCase { +// stake_denom: String, +// delegations: Vec, +// validators: Vec, +// expected_result: NeutronResult, +// } +// let test_cases: Vec = vec![ +// TestCase { +// stake_denom: "stake".to_string(), +// delegations: vec![Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// shares: "1000000000000000000".to_string(), +// }], +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(Delegations { +// delegations: vec![StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: StdCoin::new(1000000000000000000u128, "stake"), +// }], +// }), +// }, +// TestCase { +// stake_denom: "stake".to_string(), +// delegations: vec![ +// Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// shares: "1000000000000000000".to_string(), +// }, +// Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" +// .to_string(), +// shares: "1000000000000000000".to_string(), +// }, +// ], +// validators: vec![ +// Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// Validator { +// operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" +// .to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// ], +// expected_result: Ok(Delegations { +// delegations: vec![ +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: StdCoin::new(1000000000000000000u128, "stake"), +// }, +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), +// amount: StdCoin::new(1000000000000000000u128, "stake"), +// }, +// ], +// }), +// }, +// TestCase { +// stake_denom: "stake".to_string(), +// delegations: vec![], +// validators: vec![], +// expected_result: Ok(Delegations { +// delegations: vec![], +// }), +// }, +// TestCase { +// stake_denom: Default::default(), +// delegations: vec![], +// validators: vec![], +// expected_result: Err(NeutronError::InvalidQueryResultFormat( +// "denom is empty".into(), +// )), +// }, +// TestCase { +// stake_denom: "stake".to_string(), +// delegations: vec![Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// shares: "1000000000000000000".to_string(), +// }], +// validators: vec![], +// expected_result: Err(NeutronError::InvalidQueryResultFormat( +// "validator is empty".into(), +// )), +// }, +// ]; +// +// for ts in &test_cases { +// // prepare storage values +// let mut st_values: Vec = vec![StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), +// value: { +// if ts.stake_denom.is_empty() { +// return Default::default(); +// } +// to_json_binary(&ts.stake_denom).unwrap() +// }, +// }]; +// +// for (i, d) in ts.delegations.iter().enumerate() { +// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); +// let val_addr = decode_and_convert(&d.validator_address).unwrap(); +// +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), +// value: Binary::from(d.encode_to_vec()), +// }); +// +// if let Some(v) = ts.validators.get(i) { +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_validator_key(&val_addr).unwrap()), +// value: Binary::from(v.encode_to_vec()), +// }); +// } +// } +// +// // test reconstruction +// let delegations = Delegations::reconstruct(&st_values); +// +// assert_eq!(delegations, ts.expected_result) +// } +// } +// +// #[test] +// fn test_balance_reconstruct_from_hex() { +// let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// let balance_key = create_account_denom_balance_key( +// decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), +// "uosmo", +// ) +// .unwrap(); +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::from(balance_key), +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let bank_balances = Balances::reconstruct(&[s]).unwrap(); +// assert_eq!( +// bank_balances, +// Balances { +// coins: vec![StdCoin { +// denom: String::from("uosmo"), +// amount: Uint128::from(99999000u64), +// }] +// } +// ); +// } +// +// #[test] +// fn test_balance_reconstruct_from_empty_value() { +// let balance_key = create_account_denom_balance_key( +// decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), +// "uosmo", +// ) +// .unwrap(); +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::from(balance_key), +// value: Binary::from(vec![]), +// }; +// let bank_balances = Balances::reconstruct(&[s]).unwrap(); +// assert_eq!( +// bank_balances, +// Balances { +// coins: vec![StdCoin::new(0u128, "uosmo")] +// } +// ); +// } +// +// #[test] +// fn test_bank_total_supply_reconstruct_from_hex() { +// let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::new(create_total_denom_key("stake").unwrap()), +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); +// assert_eq!( +// total_supply, +// TotalSupply { +// coins: vec![StdCoin { +// denom: String::from("stake"), +// amount: Uint128::from(300001098u64), // mutating +// }] +// } +// ); +// } +// +// #[test] +// fn test_staking_validators_reconstruct_from_hex() { +// let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); +// assert_eq!( +// staking_validator, +// StakingValidator { +// validators: vec![ContractValidator { +// operator_address: String::from( +// "cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq" // mutating +// ), +// consensus_pubkey: Some(vec![ +// 10, 32, 178, 12, 7, 179, 235, 144, 13, 247, 43, 72, 194, 78, 154, 46, 6, 255, +// 79, 231, 59, 189, 37, 94, 67, 58, 248, 234, 227, 177, 152, 142, 105, 136, +// ]), +// jailed: false, +// status: 3, +// tokens: String::from("100000000"), +// delegator_shares: String::from("100000000000000000000000000"), +// moniker: Some(String::from("mynode")), +// identity: Some(String::from("")), +// website: Some(String::from("")), +// security_contact: Some(String::from("")), +// details: Some(String::from("")), +// unbonding_height: 0u64, +// unbonding_time: Some(0u64), +// rate: Some(Decimal::from_str("0.100000000000000000").unwrap()), +// max_rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), +// max_change_rate: Some(Decimal::from_str("0.010000000000000000").unwrap()), +// update_time: Some(1683291676u64), // mutating +// min_self_delegation: Decimal::one(), +// }] +// } +// ); +// } +// +// #[test] +// fn test_validators_signing_infos_reconstruct_from_hex() { +// let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); +// assert_eq!( +// signing_info, +// SigningInfo { +// signing_infos: vec![ValidatorSigningInfo { +// address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), +// start_height: 0, +// index_offset: 16, +// jailed_until: Some(0), +// tombstoned: false, +// missed_blocks_counter: 0, +// }] +// } +// ); +// } +// +// #[test] +// fn test_government_proposals_reconstruct_from_hex() { +// let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); +// assert_eq!( +// proposals, +// GovernmentProposal { +// proposals: vec![Proposal { +// proposal_id: 1u64, +// proposal_type: Some(String::from("/cosmos.gov.v1beta1.TextProposal")), +// total_deposit: vec![StdCoin { +// denom: String::from("stake"), +// amount: Uint128::from(1000u64), +// }], +// status: 1i32, +// submit_time: Some(1683291849u64), // mutating +// deposit_end_time: Some(1683464649u64), // mutating +// voting_start_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z +// voting_end_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z +// final_tally_result: Some(TallyResult { +// yes: Uint128::zero(), +// no: Uint128::zero(), +// abstain: Uint128::zero(), +// no_with_veto: Uint128::zero(), +// }), +// }] +// } +// ); +// } +// +// #[test] +// fn test_proposal_votes_reconstruct_from_hex() { +// let bytes = hex::decode(GOV_PROPOSAL_VOTES_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let votes = GovernmentProposalVotes::reconstruct(&[s]).unwrap(); +// assert_eq!( +// votes, +// GovernmentProposalVotes { +// proposal_votes: vec![ProposalVote { +// proposal_id: 4, +// voter: "cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw".to_string(), +// options: vec![WeightedVoteOption { +// weight: "1000000000000000000".to_string(), +// option: 1, +// }], +// }], +// } +// ); +// } +// +// #[test] +// fn test_fee_pool_reconstruct_from_hex() { +// let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let fee_pool = FeePool::reconstruct(&[s]).unwrap(); +// assert_eq!( +// fee_pool, +// FeePool { +// coins: vec![StdCoin { +// denom: String::from("stake"), +// amount: Uint128::from(21u64), // mutating +// }] +// } +// ); +// } +// +// #[test] +// fn test_delegations_reconstruct_from_hex() { +// let staking_denom_bytes = hex::decode(STAKING_DENOM_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let staking_denom_base64_input = BASE64_STANDARD.encode(staking_denom_bytes); // encode bytes to base64 string +// let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string +// let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string +// +// let mut st_values: Vec = vec![StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(staking_denom_base64_input.as_str()).unwrap(), +// }]; +// st_values.push(StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(delegation_base64_input.as_str()).unwrap(), +// }); +// st_values.push(StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap(), +// }); +// +// let delegations = Delegations::reconstruct(&st_values).unwrap(); +// assert_eq!( +// delegations, +// Delegations { +// delegations: vec![StdDelegation { +// delegator: Addr::unchecked("cosmos15fqjpj90ruhj57q3l6a5hda0rt77g6mcuz7w8n"), // mutating +// validator: String::from("cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq"), // mutating +// amount: StdCoin { +// denom: String::from("stake"), +// amount: Uint128::from(100000000u64), +// }, +// }], +// } +// ); +// } +// +// #[test] +// fn test_unbonding_delegations_reconstruct_from_hex() { +// let unbonding_delegations_bytes = +// hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string +// +// let st_values: Vec = vec![StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap(), +// }]; +// +// let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); +// assert_eq!( +// unbonding_delegations, +// UnbondingDelegations { +// unbonding_responses: vec![UnbondingResponse { +// delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), +// validator_address: String::from( +// "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" +// ), +// entries: vec![ +// UnbondingEntry { +// balance: Uint128::new(10_000), +// completion_time: Some(Timestamp::from_nanos(1704872890570185206)), +// creation_height: 365, +// initial_balance: Uint128::new(10_000), +// }, +// UnbondingEntry { +// balance: Uint128::new(20_000), +// completion_time: Some(Timestamp::from_nanos(1704872903002248037)), +// creation_height: 377, +// initial_balance: Uint128::new(20_000), +// }, +// ], +// }] +// } +// ); +// } +// +// #[test] +// fn test_deconstruct_account_denom_balance_key() { +// struct TestCase { +// key: Vec, +// expected_result: NeutronResult<(AddressBytes, String)>, +// } +// +// let testcases = vec![ +// TestCase { +// // valid key +// key: create_account_denom_balance_key("addr1", "uatom").unwrap(), +// expected_result: Ok(( +// "addr1".bytes().collect::(), +// "uatom".to_string(), +// )), +// }, +// TestCase { +// // empty key +// key: vec![], +// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( +// "invalid key length".to_string(), +// )), +// }, +// TestCase { +// // first element in the key is not BALANCES_PREFIX +// key: vec![81], +// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( +// "first element in key does not equal to BALANCES_PREFIX: 81 != 2".to_string(), +// )), +// }, +// TestCase { +// // first element in the key is BALANCES_PREFIX but key length is invalid +// key: vec![BALANCES_PREFIX], +// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( +// "invalid key length".to_string(), +// )), +// }, +// TestCase { +// // invalid address length in key +// // second element must define addr length, but here we say that length is 10, +// // but actually it's 1 which is wrong +// key: vec![BALANCES_PREFIX, 10, 1], +// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( +// "address length in key is invalid".to_string(), +// )), +// }, +// TestCase { +// // first element is correct, addr length is good, but there is no denom in the key +// key: vec![BALANCES_PREFIX, 2, 1, 2], +// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( +// "denom in key can't be empty".to_string(), +// )), +// }, +// TestCase { +// // must fail since [0, 159, 146, 150] are invalid UTF-8 bytes +// key: vec![BALANCES_PREFIX, 2, 1, 2, 0, 159, 146, 150], +// expected_result: Err(NeutronError::FromUTF8Error( +// String::from_utf8(vec![0, 159, 146, 150]).unwrap_err(), +// )), +// }, +// ]; +// +// for tc in testcases { +// assert_eq!( +// deconstruct_account_denom_balance_key(tc.key), +// tc.expected_result +// ); +// } +// } +// +// #[test] +// fn test_delegations_reconstruct_overflow() { +// struct TestCase { +// stake_denom: String, +// delegations: Vec, +// validators: Vec, +// expected_result: NeutronResult, +// } +// let test_cases: Vec = vec![TestCase { +// stake_denom: "stake".to_string(), +// delegations: vec![Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// shares: "340282366920938463463".to_string(), +// }], +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "340282366920938463463".to_string(), +// delegator_shares: "340282366920938463463".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(Delegations { +// delegations: vec![StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: StdCoin::new(340282366920938463463u128, "stake"), +// }], +// }), +// }]; +// +// for ts in &test_cases { +// // prepare storage values +// let mut st_values: Vec = vec![StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), +// value: { +// if ts.stake_denom.is_empty() { +// return Default::default(); +// } +// to_json_binary(&ts.stake_denom).unwrap() +// }, +// }]; +// +// for (i, d) in ts.delegations.iter().enumerate() { +// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); +// let val_addr = decode_and_convert(&d.validator_address).unwrap(); +// +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), +// value: Binary::from(d.encode_to_vec()), +// }); +// +// if let Some(v) = ts.validators.get(i) { +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_validator_key(&val_addr).unwrap()), +// value: Binary::from(v.encode_to_vec()), +// }); +// } +// } +// +// // test reconstruction +// let delegations = Delegations::reconstruct(&st_values); +// +// assert_eq!(delegations, ts.expected_result) +// } +// } diff --git a/packages/neutron-sdk/src/interchain_queries/v047/testing.rs b/packages/neutron-sdk/src/interchain_queries/v047/testing.rs index 5dec56c1..ba97a2d2 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/testing.rs @@ -1,1324 +1,1324 @@ -use crate::bindings::types::StorageValue; -use crate::interchain_queries::helpers::decode_and_convert; -use crate::interchain_queries::types::KVReconstruct; -use crate::interchain_queries::v045::helpers::create_params_store_key; -use crate::interchain_queries::v045::types::KEY_BOND_DENOM; -use crate::interchain_queries::v047::helpers::{ - create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, - create_gov_proposal_key, create_total_denom_key, create_validator_key, - create_validator_signing_info_key, -}; -use crate::interchain_queries::v047::types::{ - Balances, Delegations, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, - StdDelegation, TallyResult, TotalSupply, UnbondingDelegations, UnbondingEntry, - UnbondingResponse, Validator as ContractValidator, ValidatorSigningInfo, DECIMAL_PLACES, - STAKING_PARAMS_KEY, STAKING_STORE_KEY, -}; -use crate::{NeutronError, NeutronResult}; -use base64::prelude::*; -use base64::Engine; -use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; -use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; -use cosmos_sdk_proto::cosmos::gov::v1beta1::{ - Proposal as CosmosProposal, TallyResult as CosmosTallyResult, -}; -use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; -use cosmos_sdk_proto::cosmos::staking::v1beta1::{ - Commission, CommissionRates, Delegation, Description, Params, Validator, -}; -use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; -use hex; -use std::ops::Mul; -use std::str::FromStr; - -// raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. -pub const BALANCES_HEX_RESPONSE: &str = "343934323133353631"; -pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "31363434313731393838393035373639"; -pub const FEE_POOL_HEX_RESPONSE: &str = - "0a630a446962632f31324441343233303445453143453936303731463731324141344435383138364144313143333136354330444344413731453031374135344633393335453636121b3434343235323231373030303030303030303030303030303030300a630a446962632f31344639424333453434423841394331424531464230383938304641423837303334433939303545463137434632463530303846433038353231383831314343121b3138393735333433323030303030303030303030303030303030300a620a446962632f31464244443538443433384234443034443236434246423245373232433138393834413046314135323436384334463432463337443130324633443346333939121a32353435353334383030303030303030303030303030303030300a620a446962632f32313831414142303231384541433234424339463836424431333634464242464133453645334643433235453838453345363843313544433645373532443836121a38393736343437323030303030303030303030303030303030300a5e0a446962632f323731373130394139353535394633413137454643304338393742373639314532324132323742333046433343354345374137434538383438313632393730341216393030303030303030303030303030303030303030300a640a446962632f34324534374135424137303845424536453043323237303036323534463237383445323039463444424433433642423737454443344232394546383735453845121c323332353636383932303030303030303030303030303030303030300a620a446962632f38314430384243333946423532304542443934384346303137393130444436393730324433344246354143313630463736443342354346433434344542434530121a33333633393935353030303030303030303030303030303030300a1c0a0574686574611213313531373130393430373239393334333933380a290a057561746f6d12203133353338343330393338303535303237343635383338343139363137323031"; -pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "08011291030a232f636f736d6f732e676f762e76312e4d7367457865634c6567616379436f6e74656e7412e9020ab7020a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c1292020a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6512c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863122d636f736d6f73313064303779323635676d6d757674347a30773961773838306a6e73723730306a367a6e396b6e1803222f0a0e3937313138393033353236373939120c3430323338303537373233341a0c3332303534353430303030302201302a0b0897c1c7e40510e4838e13320b0897ab91e50510e4838e133a120a057561746f6d1209353132313030303030420c088fcccae405109399d2ac024a0c088fb694e505109399d2ac025a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6562c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863"; -pub const STAKING_PARAMS_HEX_RESPONSE: &str = "0a040880c60a109601180720904e2a057561746f6d321135303030303030303030303030303030303a1532353030303030303030303030303030303030303042123235303030303030303030303030303030304a12353030303030303030303030303030303030"; -pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a396112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20da3f8d90a407031bb7eaf76ecb5b031c96487998e2ee7c67995222cefd3b329120032a0f32353030323832373430353233363432213235303032383237343035323336343030303030303030303030303030303030303a3f0a0a656172746820f09f8c8e1210436f696e6261736520437573746f64791a0a68797068612e636f6f702a134120746573746e65742076616c696461746f7240f4b5704a0c0893efd1f605109bfa83af02524d0a3e0a123230303030303030303030303030303030301213313030303030303030303030303030303030301a1331303030303030303030303030303030303030120b08ff98e8f10510b7c886275a0731303030303030721b3130323030303030333030303030303030303030303030303030307a1c38363935303034363237303030303030303030303030303030303030"; -pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f7331706d6a776d306138707673326d3870617579673272756c6479386e657934716e387a676439361234636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a39611a1635303030303030303030303030303030303030303030"; -pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; -pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; - -#[test] -fn test_balance_reconstruct() { - struct TestCase { - addr: String, - coins: Vec<(String, String)>, - } - let test_cases: Vec = vec![ - TestCase { - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - coins: vec![("uosmo".to_string(), "100".to_string())], - }, - TestCase { - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - coins: vec![ - ("uosmo".to_string(), "100".to_string()), - ("uatom".to_string(), "500".to_string()), - ("uluna".to_string(), "80".to_string()), - ], - }, - TestCase { - addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - coins: vec![("uluna".to_string(), "".to_string())], - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); - for coin in &ts.coins { - let balance_key = - create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); - - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(balance_key), - value: Binary::new(coin.1.clone().into_bytes()), - }; - st_values.push(s); - } - - let balances = Balances::reconstruct(&st_values).unwrap(); - assert_eq!(balances.coins.len(), ts.coins.len()); - for (i, coin) in balances.coins.iter().enumerate() { - assert_eq!(coin.denom, ts.coins[i].0); - // special testcase where value is an empty string - if ts.coins[i].1.is_empty() { - assert_eq!(coin.amount, Uint128::zero()); - continue; - } - assert_eq!(coin.amount, Uint128::from_str(&ts.coins[i].1).unwrap()) - } - } -} - -#[test] -fn test_bank_total_supply_reconstruct() { - struct TestValue { - denom: String, - amount: String, - } - struct TestCase { - values: Vec, - } - - let test_cases: Vec = vec![ - TestCase { - values: vec![TestValue { - denom: "uatom".to_string(), - amount: "100".to_string(), - }], - }, - TestCase { - values: vec![ - TestValue { - denom: "uatom".to_string(), - amount: "100".to_string(), - }, - TestValue { - denom: "uosmo".to_string(), - amount: "200".to_string(), - }, - ], - }, - TestCase { values: vec![] }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for case in &ts.values { - let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(denom_key), - value: Binary::new(case.amount.as_bytes().to_vec()), - }; - st_values.push(s); - } - - let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); - assert_eq!(total_supply.coins.len(), ts.values.len()); - for (i, coin) in total_supply.coins.iter().enumerate() { - assert_eq!(coin.denom, ts.values[i].denom); - assert_eq!( - coin.amount, - Uint128::from_str(ts.values[i].amount.as_str()).unwrap() - ) - } - } -} - -#[test] -fn test_staking_validators_reconstruct() { - struct TestCase { - validators: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }], - expected_result: Ok(StakingValidator { - validators: vec![ContractValidator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - status: 0, - consensus_pubkey: None, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - unbonding_height: 0, - unbonding_time: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }], - }), - }, - TestCase { - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: Some(prost_types::Any { - type_url: "consensus_pubkey".to_string(), - value: vec![], - }), - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: Some(Description { - moniker: "Test validator".to_string(), - identity: "JHFDHHFHF".to_string(), - website: "https://neutron.org".to_string(), - security_contact: "".to_string(), - details: "Validator details".to_string(), - }), - unbonding_height: 0, - unbonding_time: Some(prost_types::Timestamp { - seconds: 1203981203, - nanos: 123123, - }), - commission: Some(Commission { - commission_rates: Some(CommissionRates { - rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros - max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros - max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros - }), - update_time: Some(prost_types::Timestamp { - seconds: 56324234, - nanos: 1343, - }), - }), - min_self_delegation: "".to_string(), - }], - expected_result: Ok(StakingValidator { - validators: vec![ContractValidator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - status: 0, - consensus_pubkey: Some(vec![]), - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - moniker: Some("Test validator".to_string()), - identity: Some("JHFDHHFHF".to_string()), - website: Some("https://neutron.org".to_string()), - security_contact: Some("".to_string()), - details: Some("Validator details".to_string()), - unbonding_height: 0, - unbonding_time: Some(1203981203), - rate: Some(Decimal::from_str("5").unwrap()), - max_rate: Some(Decimal::from_str("20").unwrap()), - max_change_rate: Some(Decimal::from_str("1").unwrap()), - update_time: Some(56324234), - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }], - }), - }, - TestCase { - validators: vec![ - Validator { - operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" - .to_string(), - consensus_pubkey: Some(prost_types::Any { - type_url: "consensus_pubkey".to_string(), - value: vec![1u8, 2u8, 3u8, 4u8], - }), - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - Validator { - operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" - .to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "2000000000000000000".to_string(), - delegator_shares: "3000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - ], - expected_result: Ok(StakingValidator { - validators: vec![ - ContractValidator { - operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" - .to_string(), - status: 0, - consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - unbonding_height: 0, - unbonding_time: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }, - ContractValidator { - operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" - .to_string(), - status: 0, - consensus_pubkey: None, - tokens: "2000000000000000000".to_string(), - delegator_shares: "3000000000000000000".to_string(), - moniker: None, - identity: None, - website: None, - security_contact: None, - details: None, - unbonding_height: 0, - unbonding_time: None, - rate: None, - max_rate: None, - max_change_rate: None, - update_time: None, - min_self_delegation: Decimal::from_str("0").unwrap(), - jailed: false, - }, - ], - }), - }, - TestCase { - validators: vec![], - expected_result: Ok(StakingValidator { validators: vec![] }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for validator in &ts.validators { - let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); - - let validator_key = create_validator_key(&val_addr).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(validator_key), - value: Binary::new(validator.encode_to_vec()), - }; - st_values.push(s); - } - - let stakin_validator = StakingValidator::reconstruct(&st_values); - - assert_eq!(stakin_validator, ts.expected_result) - } -} - -#[test] -fn test_validators_signing_infos_reconstruct() { - struct TestCase { - signing_infos: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - signing_infos: vec![CosmosValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: false, - missed_blocks_counter: 987675, - }], - expected_result: Ok(SigningInfo { - signing_infos: vec![ValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: false, - missed_blocks_counter: 987675, - }], - }), - }, - TestCase { - signing_infos: vec![CosmosValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(prost_types::Timestamp { - seconds: 321654, - nanos: 123123, - }), - tombstoned: false, - missed_blocks_counter: 987675, - }], - expected_result: Ok(SigningInfo { - signing_infos: vec![ValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(321654), - tombstoned: false, - missed_blocks_counter: 987675, - }], - }), - }, - TestCase { - signing_infos: vec![ - CosmosValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: true, - missed_blocks_counter: 987675, - }, - CosmosValidatorSigningInfo { - address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(prost_types::Timestamp { - seconds: 321654, - nanos: 123123, - }), - tombstoned: false, - missed_blocks_counter: 345012, - }, - ], - expected_result: Ok(SigningInfo { - signing_infos: vec![ - ValidatorSigningInfo { - address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: None, - tombstoned: true, - missed_blocks_counter: 987675, - }, - ValidatorSigningInfo { - address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), - start_height: 1, - index_offset: 1, - jailed_until: Some(321654), - tombstoned: false, - missed_blocks_counter: 345012, - }, - ], - }), - }, - TestCase { - signing_infos: vec![], - expected_result: Ok(SigningInfo { - signing_infos: vec![], - }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for info in &ts.signing_infos { - let val_addr = decode_and_convert(info.address.as_str()).unwrap(); - - let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(signing_info_key), - value: Binary::new(info.encode_to_vec()), - }; - st_values.push(s); - } - - let signing_infos = SigningInfo::reconstruct(&st_values); - - assert_eq!(signing_infos, ts.expected_result) - } -} - -#[test] -fn test_government_proposals_reconstruct() { - struct TestCase { - proposals: Vec, - expected_result: NeutronResult, - } - - let test_cases: Vec = vec![ - TestCase { - proposals: vec![CosmosProposal { - proposal_id: 1, - content: Some(prost_types::Any { - type_url: "proposal_type".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: None, - submit_time: None, - deposit_end_time: None, - total_deposit: vec![Coin { - amount: "100000".to_string(), - denom: "stake".to_string(), - }], - voting_start_time: None, - voting_end_time: None, - }], - expected_result: Ok(GovernmentProposal { - proposals: vec![Proposal { - proposal_id: 1, - proposal_type: Some("proposal_type".to_string()), - total_deposit: vec![StdCoin::new(100000u128, "stake")], - status: 1, - submit_time: None, - deposit_end_time: None, - voting_start_time: None, - voting_end_time: None, - final_tally_result: None, - }], - }), - }, - TestCase { - proposals: vec![CosmosProposal { - proposal_id: 1, - content: Some(prost_types::Any { - type_url: "proposal_type".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: Some(CosmosTallyResult { - abstain: "1".to_string(), - no: "2".to_string(), - no_with_veto: "3".to_string(), - yes: "4".to_string(), - }), - submit_time: Some(prost_types::Timestamp { - seconds: 2222222, - nanos: 123123, - }), - deposit_end_time: Some(prost_types::Timestamp { - seconds: 3333333, - nanos: 123123, - }), - total_deposit: vec![Coin { - amount: "100000".to_string(), - denom: "stake".to_string(), - }], - voting_start_time: Some(prost_types::Timestamp { - seconds: 4444444, - nanos: 123123, - }), - voting_end_time: Some(prost_types::Timestamp { - seconds: 555555555, - nanos: 123123, - }), - }], - expected_result: Ok(GovernmentProposal { - proposals: vec![Proposal { - proposal_id: 1, - proposal_type: Some("proposal_type".to_string()), - total_deposit: vec![StdCoin::new(100000u128, "stake")], - status: 1, - submit_time: Some(2222222), - deposit_end_time: Some(3333333), - voting_start_time: Some(4444444), - voting_end_time: Some(555555555), - final_tally_result: Some(TallyResult { - abstain: Uint128::from(1u128), - no: Uint128::from(2u128), - no_with_veto: Uint128::from(3u128), - yes: Uint128::from(4u128), - }), - }], - }), - }, - TestCase { - proposals: vec![ - CosmosProposal { - proposal_id: 1, - content: Some(prost_types::Any { - type_url: "proposal_type1".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: None, - submit_time: None, - deposit_end_time: None, - total_deposit: vec![Coin { - amount: "100000".to_string(), - denom: "stake".to_string(), - }], - voting_start_time: None, - voting_end_time: None, - }, - CosmosProposal { - proposal_id: 2, - content: Some(prost_types::Any { - type_url: "proposal_type2".to_string(), - value: vec![], - }), - status: 1, - final_tally_result: None, - submit_time: None, - deposit_end_time: None, - total_deposit: vec![Coin { - amount: "200000".to_string(), - denom: "osmo".to_string(), - }], - voting_start_time: None, - voting_end_time: None, - }, - ], - expected_result: Ok(GovernmentProposal { - proposals: vec![ - Proposal { - proposal_id: 1, - proposal_type: Some("proposal_type1".to_string()), - total_deposit: vec![StdCoin::new(100000u128, "stake")], - status: 1, - submit_time: None, - deposit_end_time: None, - voting_start_time: None, - voting_end_time: None, - final_tally_result: None, - }, - Proposal { - proposal_id: 2, - proposal_type: Some("proposal_type2".to_string()), - total_deposit: vec![StdCoin::new(200000u128, "osmo")], - status: 1, - submit_time: None, - deposit_end_time: None, - voting_start_time: None, - voting_end_time: None, - final_tally_result: None, - }, - ], - }), - }, - TestCase { - proposals: vec![], - expected_result: Ok(GovernmentProposal { proposals: vec![] }), - }, - ]; - - for ts in test_cases { - let mut st_values: Vec = vec![]; - - for proposal in &ts.proposals { - let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); - let s = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(proposal_key), - value: Binary::new(proposal.encode_to_vec()), - }; - st_values.push(s); - } - - let gov_proposal = GovernmentProposal::reconstruct(&st_values); - - assert_eq!(gov_proposal, ts.expected_result) - } -} - -#[test] -fn test_fee_pool_reconstruct() { - struct TestCase { - coins: Vec<(String, Uint128)>, - } - let test_cases: Vec = vec![ - TestCase { - coins: vec![("uosmo".to_string(), Uint128::from(100u128))], - }, - TestCase { - coins: vec![ - ("uosmo".to_string(), Uint128::from(100u128)), - ("uatom".to_string(), Uint128::from(500u128)), - ("uluna".to_string(), Uint128::from(80u128)), - ], - }, - TestCase { coins: vec![] }, - ]; - - for ts in test_cases { - let mut coins: Vec = vec![]; - - for coin in &ts.coins { - let balance_amount = DecCoin { - denom: coin.0.clone(), - amount: coin - .1 - .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format - .to_string(), - }; - - coins.push(balance_amount); - } - - let fee_pool = CosmosFeePool { - community_pool: coins, - }; - - let fee_pool_key = create_fee_pool_key().unwrap(); - - let st_value = StorageValue { - storage_prefix: "".to_string(), - key: Binary::new(fee_pool_key), - value: Binary::new(fee_pool.encode_to_vec()), - }; - - let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); - assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); - for (i, coin) in fee_pool_coins.coins.iter().enumerate() { - assert_eq!(coin.denom, ts.coins[i].0); - assert_eq!(coin.amount, ts.coins[i].1) - } - } -} - -#[test] -fn test_delegations_reconstruct() { - struct TestCase { - staking_params: Params, - delegations: Vec, - validators: Vec, - expected_result: NeutronResult, - } - let test_cases: Vec = vec![ - TestCase { - staking_params: Params { - unbonding_time: None, - max_validators: 0, - max_entries: 0, - historical_entries: 0, - bond_denom: "stake".to_string(), - min_commission_rate: "".to_string(), - }, - delegations: vec![Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - shares: "1000000000000000000".to_string(), - }], - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }], - expected_result: Ok(Delegations { - delegations: vec![StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: StdCoin::new(1000000000000000000u128, "stake"), - }], - }), - }, - TestCase { - staking_params: Params { - unbonding_time: None, - max_validators: 0, - max_entries: 0, - historical_entries: 0, - bond_denom: "stake".to_string(), - min_commission_rate: "".to_string(), - }, - delegations: vec![ - Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - shares: "1000000000000000000".to_string(), - }, - Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" - .to_string(), - shares: "1000000000000000000".to_string(), - }, - ], - validators: vec![ - Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" - .to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - Validator { - operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" - .to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "1000000000000000000".to_string(), - delegator_shares: "1000000000000000000".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }, - ], - expected_result: Ok(Delegations { - delegations: vec![ - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: StdCoin::new(1000000000000000000u128, "stake"), - }, - StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), - amount: StdCoin::new(1000000000000000000u128, "stake"), - }, - ], - }), - }, - TestCase { - staking_params: Params { - unbonding_time: None, - max_validators: 0, - max_entries: 0, - historical_entries: 0, - bond_denom: "stake".to_string(), - min_commission_rate: "".to_string(), - }, - delegations: vec![], - validators: vec![], - expected_result: Ok(Delegations { - delegations: vec![], - }), - }, - TestCase { - staking_params: Default::default(), - delegations: vec![], - validators: vec![], - expected_result: Err(NeutronError::InvalidQueryResultFormat( - "params is empty".into(), - )), - }, - TestCase { - staking_params: Params { - unbonding_time: None, - max_validators: 0, - max_entries: 0, - historical_entries: 0, - bond_denom: "stake".to_string(), - min_commission_rate: "".to_string(), - }, - delegations: vec![Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - shares: "1000000000000000000".to_string(), - }], - validators: vec![], - expected_result: Err(NeutronError::InvalidQueryResultFormat( - "validator is empty".into(), - )), - }, - ]; - - for ts in &test_cases { - // prepare storage values - let mut st_values: Vec = vec![StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(vec![STAKING_PARAMS_KEY]), - value: { - if ts.staking_params.bond_denom.is_empty() { - return Default::default(); - } - Binary::from(ts.staking_params.encode_to_vec()) - }, - }]; - - for (i, d) in ts.delegations.iter().enumerate() { - let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); - let val_addr = decode_and_convert(&d.validator_address).unwrap(); - - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), - value: Binary::from(d.encode_to_vec()), - }); - - if let Some(v) = ts.validators.get(i) { - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr).unwrap()), - value: Binary::from(v.encode_to_vec()), - }); - } - } - - // test reconstruction - let delegations = Delegations::reconstruct(&st_values); - - assert_eq!(delegations, ts.expected_result) - } -} - -#[test] -fn test_balance_reconstruct_from_hex() { - let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::new(create_account_denom_balance_key("addr", "uatom").unwrap()), - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let bank_balances = Balances::reconstruct(&[s]).unwrap(); - assert_eq!( - bank_balances, - Balances { - coins: vec![StdCoin::new(494213561u128, "uatom")] - } - ); -} - -#[test] -fn test_balance_reconstruct_from_empty_value() { - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::new(create_account_denom_balance_key("addr", "uatom").unwrap()), - value: Binary::from(vec![]), - }; - let bank_balances = Balances::reconstruct(&[s]).unwrap(); - assert_eq!( - bank_balances, - Balances { - coins: vec![StdCoin::new(0u128, "uatom")] - } - ); -} - -#[test] -fn test_bank_total_supply_reconstruct_from_hex() { - let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::new(create_total_denom_key("stake").unwrap()), - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); - assert_eq!( - total_supply, - TotalSupply { - coins: vec![StdCoin { - denom: String::from("stake"), - amount: Uint128::from(1644171988905769u64), // mutating - }] - } - ); -} - -#[test] -fn test_delegations_reconstruct_overflow() { - struct TestCase { - staking_params: Params, - delegations: Vec, - validators: Vec, - expected_result: NeutronResult, - } - let test_cases: Vec = vec![TestCase { - staking_params: Params { - unbonding_time: None, - max_validators: 0, - max_entries: 0, - historical_entries: 0, - bond_denom: "stake".to_string(), - min_commission_rate: "".to_string(), - }, - delegations: vec![Delegation { - delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), - validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - shares: "340282366920938463463".to_string(), - }], - validators: vec![Validator { - operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - consensus_pubkey: None, - jailed: false, - status: 0, - tokens: "340282366920938463463".to_string(), - delegator_shares: "340282366920938463463".to_string(), - description: None, - unbonding_height: 0, - unbonding_time: None, - commission: None, - min_self_delegation: "".to_string(), - }], - expected_result: Ok(Delegations { - delegations: vec![StdDelegation { - delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), - validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), - amount: StdCoin::new(340282366920938463463u128, "stake"), - }], - }), - }]; - - for ts in &test_cases { - // prepare storage values - let mut st_values: Vec = vec![StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), - value: { - if ts.staking_params.bond_denom.is_empty() { - return Default::default(); - } - Binary::from(ts.staking_params.encode_to_vec()) - }, - }]; - - for (i, d) in ts.delegations.iter().enumerate() { - let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); - let val_addr = decode_and_convert(&d.validator_address).unwrap(); - - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), - value: Binary::from(d.encode_to_vec()), - }); - - if let Some(v) = ts.validators.get(i) { - st_values.push(StorageValue { - storage_prefix: STAKING_STORE_KEY.to_string(), - key: Binary::new(create_validator_key(&val_addr).unwrap()), - value: Binary::from(v.encode_to_vec()), - }); - } - } - - // test reconstruction - let delegations = Delegations::reconstruct(&st_values); - - assert_eq!(delegations, ts.expected_result) - } -} - -#[test] -fn test_staking_validators_reconstruct_from_hex() { - let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); - assert_eq!( - staking_validator, - StakingValidator { - validators: vec![ContractValidator { - operator_address: String::from( - "cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a" // mutating - ), - consensus_pubkey: Some(vec![ - 10, 32, 218, 63, 141, 144, 164, 7, 3, 27, 183, 234, 247, 110, 203, 91, 3, 28, - 150, 72, 121, 152, 226, 238, 124, 103, 153, 82, 34, 206, 253, 59, 50, 145, - ]), - jailed: false, - status: 3, - tokens: String::from("250028274052364"), - delegator_shares: String::from("250028274052364000000000000000000"), - moniker: Some(String::from("earth 🌎")), - identity: Some(String::from("Coinbase Custody")), - website: Some(String::from("hypha.coop")), - security_contact: Some(String::from("")), - details: Some(String::from("A testnet validator")), - unbonding_height: 1841908u64, - unbonding_time: Some(1590982547u64), - rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), - max_rate: Some(Decimal::from_str("1.00000000000000000").unwrap()), - max_change_rate: Some(Decimal::from_str("1.000000000000000000").unwrap()), - update_time: Some(1580862591u64), // mutating - min_self_delegation: Decimal::from_str("1000000").unwrap(), - }] - } - ); -} - -#[test] -fn test_validators_signing_infos_reconstruct_from_hex() { - let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); - assert_eq!( - signing_info, - SigningInfo { - signing_infos: vec![ValidatorSigningInfo { - address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), - start_height: 0, - index_offset: 16, - jailed_until: Some(0), - tombstoned: false, - missed_blocks_counter: 0, - }] - } - ); -} - -#[test] -fn test_government_proposals_reconstruct_from_hex() { - let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); - assert_eq!( - proposals, - GovernmentProposal { - proposals: vec![Proposal { - proposal_id: 1u64, - proposal_type: Some(String::from("/cosmos.gov.v1.MsgExecLegacyContent")), - total_deposit: vec![StdCoin { - denom: String::from("uatom"), - amount: Uint128::from(512100000u64), - }], - status: 3i32, - submit_time: Some(1553064087u64), // mutating - deposit_end_time: Some(1554273687u64), // mutating - voting_start_time: Some(1553114639u64), // 0001-01-01T00:00:00Z - voting_end_time: Some(1554324239u64), // 0001-01-01T00:00:00Z - final_tally_result: Some(TallyResult { - yes: Uint128::from(97118903526799u128), - no: Uint128::from(320545400000u128), - abstain: Uint128::from(402380577234u128), - no_with_veto: Uint128::zero(), - }), - }] - } - ); -} - -#[test] -fn test_fee_pool_reconstruct_from_hex() { - let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string - - let s = StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(base64_input.as_str()).unwrap(), - }; - let fee_pool = FeePool::reconstruct(&[s]).unwrap(); - assert_eq!( - fee_pool, - FeePool { - coins: vec![ - StdCoin { - denom: String::from( - "ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66" - ), - amount: Uint128::from(444252217u64), // mutating - }, - StdCoin { - denom: String::from( - "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC" - ), - amount: Uint128::from(189753432u64), // mutating - }, - StdCoin { - denom: String::from( - "ibc/1FBDD58D438B4D04D26CBFB2E722C18984A0F1A52468C4F42F37D102F3D3F399" - ), - amount: Uint128::from(25455348u64), // mutating - }, - StdCoin { - denom: String::from( - "ibc/2181AAB0218EAC24BC9F86BD1364FBBFA3E6E3FCC25E88E3E68C15DC6E752D86" - ), - amount: Uint128::from(89764472u64), // mutating - }, - StdCoin { - denom: String::from( - "ibc/2717109A95559F3A17EFC0C897B7691E22A227B30FC3C5CE7A7CE88481629704" - ), - amount: Uint128::from(9000u64), // mutating - }, - StdCoin { - denom: String::from( - "ibc/42E47A5BA708EBE6E0C227006254F2784E209F4DBD3C6BB77EDC4B29EF875E8E" - ), - amount: Uint128::from(2325668920u64), // mutating - }, - StdCoin { - denom: String::from( - "ibc/81D08BC39FB520EBD948CF017910DD69702D34BF5AC160F76D3B5CFC444EBCE0" - ), - amount: Uint128::from(33639955u64), // mutating - }, - StdCoin { - denom: String::from("theta"), - amount: Uint128::from(1u64), // mutating - }, - StdCoin { - denom: String::from("uatom"), - amount: Uint128::from(13538430938055u64), // mutating - }, - ] - } - ); -} - -#[test] -fn test_delegations_reconstruct_from_hex() { - let staking_params_bytes = hex::decode(STAKING_PARAMS_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let staking_params_base64_input = BASE64_STANDARD.encode(staking_params_bytes); // encode bytes to base64 string - let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string - let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string - - let mut st_values: Vec = vec![StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(staking_params_base64_input.as_str()).unwrap(), - }]; - st_values.push(StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(delegation_base64_input.as_str()).unwrap(), - }); - st_values.push(StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap(), - }); - - let delegations = Delegations::reconstruct(&st_values).unwrap(); - assert_eq!( - delegations, - Delegations { - delegations: vec![StdDelegation { - delegator: Addr::unchecked("cosmos1pmjwm0a8pvs2m8pauyg2ruldy8ney4qn8zgd96"), // mutating - validator: String::from("cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a"), // mutating - amount: StdCoin { - denom: String::from("uatom"), - amount: Uint128::from(5000u64), - }, - }], - } - ); -} - -#[test] -fn test_unbonding_delegations_reconstruct_from_hex() { - let unbonding_delegations_bytes = - hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes - let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string - - let st_values: Vec = vec![StorageValue { - storage_prefix: String::default(), // not used in reconstruct - key: Binary::default(), // not used in reconstruct - value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap(), - }]; - - let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); - assert_eq!( - unbonding_delegations, - UnbondingDelegations { - unbonding_responses: vec![UnbondingResponse { - delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), - validator_address: String::from( - "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" - ), - entries: vec![ - UnbondingEntry { - balance: Uint128::new(10_000), - completion_time: Some(Timestamp::from_nanos(1704872890570185206)), - creation_height: 365, - initial_balance: Uint128::new(10_000), - }, - UnbondingEntry { - balance: Uint128::new(20_000), - completion_time: Some(Timestamp::from_nanos(1704872903002248037)), - creation_height: 377, - initial_balance: Uint128::new(20_000), - }, - ], - }] - } - ); -} +// use crate::bindings::types::StorageValue; +// use crate::interchain_queries::helpers::decode_and_convert; +// use crate::interchain_queries::types::KVReconstruct; +// use crate::interchain_queries::v045::helpers::create_params_store_key; +// use crate::interchain_queries::v045::types::KEY_BOND_DENOM; +// use crate::interchain_queries::v047::helpers::{ +// create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, +// create_gov_proposal_key, create_total_denom_key, create_validator_key, +// create_validator_signing_info_key, +// }; +// use crate::interchain_queries::v047::types::{ +// Balances, Delegations, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, +// StdDelegation, TallyResult, TotalSupply, UnbondingDelegations, UnbondingEntry, +// UnbondingResponse, Validator as ContractValidator, ValidatorSigningInfo, DECIMAL_PLACES, +// STAKING_PARAMS_KEY, STAKING_STORE_KEY, +// }; +// use crate::{NeutronError, NeutronResult}; +// use base64::prelude::*; +// use base64::Engine; +// use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; +// use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; +// use cosmos_sdk_proto::cosmos::gov::v1beta1::{ +// Proposal as CosmosProposal, TallyResult as CosmosTallyResult, +// }; +// use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; +// use cosmos_sdk_proto::cosmos::staking::v1beta1::{ +// Commission, CommissionRates, Delegation, Description, Params, Validator, +// }; +// use cosmos_sdk_proto::traits::Message; +// use cosmwasm_std::{Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; +// use hex; +// use std::ops::Mul; +// use std::str::FromStr; +// +// // raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. +// pub const BALANCES_HEX_RESPONSE: &str = "343934323133353631"; +// pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "31363434313731393838393035373639"; +// pub const FEE_POOL_HEX_RESPONSE: &str = +// "0a630a446962632f31324441343233303445453143453936303731463731324141344435383138364144313143333136354330444344413731453031374135344633393335453636121b3434343235323231373030303030303030303030303030303030300a630a446962632f31344639424333453434423841394331424531464230383938304641423837303334433939303545463137434632463530303846433038353231383831314343121b3138393735333433323030303030303030303030303030303030300a620a446962632f31464244443538443433384234443034443236434246423245373232433138393834413046314135323436384334463432463337443130324633443346333939121a32353435353334383030303030303030303030303030303030300a620a446962632f32313831414142303231384541433234424339463836424431333634464242464133453645334643433235453838453345363843313544433645373532443836121a38393736343437323030303030303030303030303030303030300a5e0a446962632f323731373130394139353535394633413137454643304338393742373639314532324132323742333046433343354345374137434538383438313632393730341216393030303030303030303030303030303030303030300a640a446962632f34324534374135424137303845424536453043323237303036323534463237383445323039463444424433433642423737454443344232394546383735453845121c323332353636383932303030303030303030303030303030303030300a620a446962632f38314430384243333946423532304542443934384346303137393130444436393730324433344246354143313630463736443342354346433434344542434530121a33333633393935353030303030303030303030303030303030300a1c0a0574686574611213313531373130393430373239393334333933380a290a057561746f6d12203133353338343330393338303535303237343635383338343139363137323031"; +// pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "08011291030a232f636f736d6f732e676f762e76312e4d7367457865634c6567616379436f6e74656e7412e9020ab7020a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c1292020a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6512c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863122d636f736d6f73313064303779323635676d6d757674347a30773961773838306a6e73723730306a367a6e396b6e1803222f0a0e3937313138393033353236373939120c3430323338303537373233341a0c3332303534353430303030302201302a0b0897c1c7e40510e4838e13320b0897ab91e50510e4838e133a120a057561746f6d1209353132313030303030420c088fcccae405109399d2ac024a0c088fb694e505109399d2ac025a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6562c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863"; +// pub const STAKING_PARAMS_HEX_RESPONSE: &str = "0a040880c60a109601180720904e2a057561746f6d321135303030303030303030303030303030303a1532353030303030303030303030303030303030303042123235303030303030303030303030303030304a12353030303030303030303030303030303030"; +// pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a396112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20da3f8d90a407031bb7eaf76ecb5b031c96487998e2ee7c67995222cefd3b329120032a0f32353030323832373430353233363432213235303032383237343035323336343030303030303030303030303030303030303a3f0a0a656172746820f09f8c8e1210436f696e6261736520437573746f64791a0a68797068612e636f6f702a134120746573746e65742076616c696461746f7240f4b5704a0c0893efd1f605109bfa83af02524d0a3e0a123230303030303030303030303030303030301213313030303030303030303030303030303030301a1331303030303030303030303030303030303030120b08ff98e8f10510b7c886275a0731303030303030721b3130323030303030333030303030303030303030303030303030307a1c38363935303034363237303030303030303030303030303030303030"; +// pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f7331706d6a776d306138707673326d3870617579673272756c6479386e657934716e387a676439361234636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a39611a1635303030303030303030303030303030303030303030"; +// pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; +// pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; +// +// #[test] +// fn test_balance_reconstruct() { +// struct TestCase { +// addr: String, +// coins: Vec<(String, String)>, +// } +// let test_cases: Vec = vec![ +// TestCase { +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// coins: vec![("uosmo".to_string(), "100".to_string())], +// }, +// TestCase { +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// coins: vec![ +// ("uosmo".to_string(), "100".to_string()), +// ("uatom".to_string(), "500".to_string()), +// ("uluna".to_string(), "80".to_string()), +// ], +// }, +// TestCase { +// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// coins: vec![("uluna".to_string(), "".to_string())], +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); +// for coin in &ts.coins { +// let balance_key = +// create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); +// +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(balance_key), +// value: Binary::new(coin.1.clone().into_bytes()), +// }; +// st_values.push(s); +// } +// +// let balances = Balances::reconstruct(&st_values).unwrap(); +// assert_eq!(balances.coins.len(), ts.coins.len()); +// for (i, coin) in balances.coins.iter().enumerate() { +// assert_eq!(coin.denom, ts.coins[i].0); +// // special testcase where value is an empty string +// if ts.coins[i].1.is_empty() { +// assert_eq!(coin.amount, Uint128::zero()); +// continue; +// } +// assert_eq!(coin.amount, Uint128::from_str(&ts.coins[i].1).unwrap()) +// } +// } +// } +// +// #[test] +// fn test_bank_total_supply_reconstruct() { +// struct TestValue { +// denom: String, +// amount: String, +// } +// struct TestCase { +// values: Vec, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// values: vec![TestValue { +// denom: "uatom".to_string(), +// amount: "100".to_string(), +// }], +// }, +// TestCase { +// values: vec![ +// TestValue { +// denom: "uatom".to_string(), +// amount: "100".to_string(), +// }, +// TestValue { +// denom: "uosmo".to_string(), +// amount: "200".to_string(), +// }, +// ], +// }, +// TestCase { values: vec![] }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for case in &ts.values { +// let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(denom_key), +// value: Binary::new(case.amount.as_bytes().to_vec()), +// }; +// st_values.push(s); +// } +// +// let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); +// assert_eq!(total_supply.coins.len(), ts.values.len()); +// for (i, coin) in total_supply.coins.iter().enumerate() { +// assert_eq!(coin.denom, ts.values[i].denom); +// assert_eq!( +// coin.amount, +// Uint128::from_str(ts.values[i].amount.as_str()).unwrap() +// ) +// } +// } +// } +// +// #[test] +// fn test_staking_validators_reconstruct() { +// struct TestCase { +// validators: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(StakingValidator { +// validators: vec![ContractValidator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// status: 0, +// consensus_pubkey: None, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// unbonding_height: 0, +// unbonding_time: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }], +// }), +// }, +// TestCase { +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: Some(prost_types::Any { +// type_url: "consensus_pubkey".to_string(), +// value: vec![], +// }), +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: Some(Description { +// moniker: "Test validator".to_string(), +// identity: "JHFDHHFHF".to_string(), +// website: "https://neutron.org".to_string(), +// security_contact: "".to_string(), +// details: "Validator details".to_string(), +// }), +// unbonding_height: 0, +// unbonding_time: Some(prost_types::Timestamp { +// seconds: 1203981203, +// nanos: 123123, +// }), +// commission: Some(Commission { +// commission_rates: Some(CommissionRates { +// rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros +// max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros +// max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros +// }), +// update_time: Some(prost_types::Timestamp { +// seconds: 56324234, +// nanos: 1343, +// }), +// }), +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(StakingValidator { +// validators: vec![ContractValidator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// status: 0, +// consensus_pubkey: Some(vec![]), +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// moniker: Some("Test validator".to_string()), +// identity: Some("JHFDHHFHF".to_string()), +// website: Some("https://neutron.org".to_string()), +// security_contact: Some("".to_string()), +// details: Some("Validator details".to_string()), +// unbonding_height: 0, +// unbonding_time: Some(1203981203), +// rate: Some(Decimal::from_str("5").unwrap()), +// max_rate: Some(Decimal::from_str("20").unwrap()), +// max_change_rate: Some(Decimal::from_str("1").unwrap()), +// update_time: Some(56324234), +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }], +// }), +// }, +// TestCase { +// validators: vec![ +// Validator { +// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" +// .to_string(), +// consensus_pubkey: Some(prost_types::Any { +// type_url: "consensus_pubkey".to_string(), +// value: vec![1u8, 2u8, 3u8, 4u8], +// }), +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// Validator { +// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" +// .to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "2000000000000000000".to_string(), +// delegator_shares: "3000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// ], +// expected_result: Ok(StakingValidator { +// validators: vec![ +// ContractValidator { +// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" +// .to_string(), +// status: 0, +// consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// unbonding_height: 0, +// unbonding_time: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }, +// ContractValidator { +// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" +// .to_string(), +// status: 0, +// consensus_pubkey: None, +// tokens: "2000000000000000000".to_string(), +// delegator_shares: "3000000000000000000".to_string(), +// moniker: None, +// identity: None, +// website: None, +// security_contact: None, +// details: None, +// unbonding_height: 0, +// unbonding_time: None, +// rate: None, +// max_rate: None, +// max_change_rate: None, +// update_time: None, +// min_self_delegation: Decimal::from_str("0").unwrap(), +// jailed: false, +// }, +// ], +// }), +// }, +// TestCase { +// validators: vec![], +// expected_result: Ok(StakingValidator { validators: vec![] }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for validator in &ts.validators { +// let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); +// +// let validator_key = create_validator_key(&val_addr).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(validator_key), +// value: Binary::new(validator.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let stakin_validator = StakingValidator::reconstruct(&st_values); +// +// assert_eq!(stakin_validator, ts.expected_result) +// } +// } +// +// #[test] +// fn test_validators_signing_infos_reconstruct() { +// struct TestCase { +// signing_infos: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// signing_infos: vec![CosmosValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![ValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// }), +// }, +// TestCase { +// signing_infos: vec![CosmosValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(prost_types::Timestamp { +// seconds: 321654, +// nanos: 123123, +// }), +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![ValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(321654), +// tombstoned: false, +// missed_blocks_counter: 987675, +// }], +// }), +// }, +// TestCase { +// signing_infos: vec![ +// CosmosValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: true, +// missed_blocks_counter: 987675, +// }, +// CosmosValidatorSigningInfo { +// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(prost_types::Timestamp { +// seconds: 321654, +// nanos: 123123, +// }), +// tombstoned: false, +// missed_blocks_counter: 345012, +// }, +// ], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![ +// ValidatorSigningInfo { +// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: None, +// tombstoned: true, +// missed_blocks_counter: 987675, +// }, +// ValidatorSigningInfo { +// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), +// start_height: 1, +// index_offset: 1, +// jailed_until: Some(321654), +// tombstoned: false, +// missed_blocks_counter: 345012, +// }, +// ], +// }), +// }, +// TestCase { +// signing_infos: vec![], +// expected_result: Ok(SigningInfo { +// signing_infos: vec![], +// }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for info in &ts.signing_infos { +// let val_addr = decode_and_convert(info.address.as_str()).unwrap(); +// +// let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(signing_info_key), +// value: Binary::new(info.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let signing_infos = SigningInfo::reconstruct(&st_values); +// +// assert_eq!(signing_infos, ts.expected_result) +// } +// } +// +// #[test] +// fn test_government_proposals_reconstruct() { +// struct TestCase { +// proposals: Vec, +// expected_result: NeutronResult, +// } +// +// let test_cases: Vec = vec![ +// TestCase { +// proposals: vec![CosmosProposal { +// proposal_id: 1, +// content: Some(prost_types::Any { +// type_url: "proposal_type".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: None, +// submit_time: None, +// deposit_end_time: None, +// total_deposit: vec![Coin { +// amount: "100000".to_string(), +// denom: "stake".to_string(), +// }], +// voting_start_time: None, +// voting_end_time: None, +// }], +// expected_result: Ok(GovernmentProposal { +// proposals: vec![Proposal { +// proposal_id: 1, +// proposal_type: Some("proposal_type".to_string()), +// total_deposit: vec![StdCoin::new(100000u128, "stake")], +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_start_time: None, +// voting_end_time: None, +// final_tally_result: None, +// }], +// }), +// }, +// TestCase { +// proposals: vec![CosmosProposal { +// proposal_id: 1, +// content: Some(prost_types::Any { +// type_url: "proposal_type".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: Some(CosmosTallyResult { +// abstain: "1".to_string(), +// no: "2".to_string(), +// no_with_veto: "3".to_string(), +// yes: "4".to_string(), +// }), +// submit_time: Some(prost_types::Timestamp { +// seconds: 2222222, +// nanos: 123123, +// }), +// deposit_end_time: Some(prost_types::Timestamp { +// seconds: 3333333, +// nanos: 123123, +// }), +// total_deposit: vec![Coin { +// amount: "100000".to_string(), +// denom: "stake".to_string(), +// }], +// voting_start_time: Some(prost_types::Timestamp { +// seconds: 4444444, +// nanos: 123123, +// }), +// voting_end_time: Some(prost_types::Timestamp { +// seconds: 555555555, +// nanos: 123123, +// }), +// }], +// expected_result: Ok(GovernmentProposal { +// proposals: vec![Proposal { +// proposal_id: 1, +// proposal_type: Some("proposal_type".to_string()), +// total_deposit: vec![StdCoin::new(100000u128, "stake")], +// status: 1, +// submit_time: Some(2222222), +// deposit_end_time: Some(3333333), +// voting_start_time: Some(4444444), +// voting_end_time: Some(555555555), +// final_tally_result: Some(TallyResult { +// abstain: Uint128::from(1u128), +// no: Uint128::from(2u128), +// no_with_veto: Uint128::from(3u128), +// yes: Uint128::from(4u128), +// }), +// }], +// }), +// }, +// TestCase { +// proposals: vec![ +// CosmosProposal { +// proposal_id: 1, +// content: Some(prost_types::Any { +// type_url: "proposal_type1".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: None, +// submit_time: None, +// deposit_end_time: None, +// total_deposit: vec![Coin { +// amount: "100000".to_string(), +// denom: "stake".to_string(), +// }], +// voting_start_time: None, +// voting_end_time: None, +// }, +// CosmosProposal { +// proposal_id: 2, +// content: Some(prost_types::Any { +// type_url: "proposal_type2".to_string(), +// value: vec![], +// }), +// status: 1, +// final_tally_result: None, +// submit_time: None, +// deposit_end_time: None, +// total_deposit: vec![Coin { +// amount: "200000".to_string(), +// denom: "osmo".to_string(), +// }], +// voting_start_time: None, +// voting_end_time: None, +// }, +// ], +// expected_result: Ok(GovernmentProposal { +// proposals: vec![ +// Proposal { +// proposal_id: 1, +// proposal_type: Some("proposal_type1".to_string()), +// total_deposit: vec![StdCoin::new(100000u128, "stake")], +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_start_time: None, +// voting_end_time: None, +// final_tally_result: None, +// }, +// Proposal { +// proposal_id: 2, +// proposal_type: Some("proposal_type2".to_string()), +// total_deposit: vec![StdCoin::new(200000u128, "osmo")], +// status: 1, +// submit_time: None, +// deposit_end_time: None, +// voting_start_time: None, +// voting_end_time: None, +// final_tally_result: None, +// }, +// ], +// }), +// }, +// TestCase { +// proposals: vec![], +// expected_result: Ok(GovernmentProposal { proposals: vec![] }), +// }, +// ]; +// +// for ts in test_cases { +// let mut st_values: Vec = vec![]; +// +// for proposal in &ts.proposals { +// let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); +// let s = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(proposal_key), +// value: Binary::new(proposal.encode_to_vec()), +// }; +// st_values.push(s); +// } +// +// let gov_proposal = GovernmentProposal::reconstruct(&st_values); +// +// assert_eq!(gov_proposal, ts.expected_result) +// } +// } +// +// #[test] +// fn test_fee_pool_reconstruct() { +// struct TestCase { +// coins: Vec<(String, Uint128)>, +// } +// let test_cases: Vec = vec![ +// TestCase { +// coins: vec![("uosmo".to_string(), Uint128::from(100u128))], +// }, +// TestCase { +// coins: vec![ +// ("uosmo".to_string(), Uint128::from(100u128)), +// ("uatom".to_string(), Uint128::from(500u128)), +// ("uluna".to_string(), Uint128::from(80u128)), +// ], +// }, +// TestCase { coins: vec![] }, +// ]; +// +// for ts in test_cases { +// let mut coins: Vec = vec![]; +// +// for coin in &ts.coins { +// let balance_amount = DecCoin { +// denom: coin.0.clone(), +// amount: coin +// .1 +// .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format +// .to_string(), +// }; +// +// coins.push(balance_amount); +// } +// +// let fee_pool = CosmosFeePool { +// community_pool: coins, +// }; +// +// let fee_pool_key = create_fee_pool_key().unwrap(); +// +// let st_value = StorageValue { +// storage_prefix: "".to_string(), +// key: Binary::new(fee_pool_key), +// value: Binary::new(fee_pool.encode_to_vec()), +// }; +// +// let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); +// assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); +// for (i, coin) in fee_pool_coins.coins.iter().enumerate() { +// assert_eq!(coin.denom, ts.coins[i].0); +// assert_eq!(coin.amount, ts.coins[i].1) +// } +// } +// } +// +// #[test] +// fn test_delegations_reconstruct() { +// struct TestCase { +// staking_params: Params, +// delegations: Vec, +// validators: Vec, +// expected_result: NeutronResult, +// } +// let test_cases: Vec = vec![ +// TestCase { +// staking_params: Params { +// unbonding_time: None, +// max_validators: 0, +// max_entries: 0, +// historical_entries: 0, +// bond_denom: "stake".to_string(), +// min_commission_rate: "".to_string(), +// }, +// delegations: vec![Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// shares: "1000000000000000000".to_string(), +// }], +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(Delegations { +// delegations: vec![StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: StdCoin::new(1000000000000000000u128, "stake"), +// }], +// }), +// }, +// TestCase { +// staking_params: Params { +// unbonding_time: None, +// max_validators: 0, +// max_entries: 0, +// historical_entries: 0, +// bond_denom: "stake".to_string(), +// min_commission_rate: "".to_string(), +// }, +// delegations: vec![ +// Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// shares: "1000000000000000000".to_string(), +// }, +// Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" +// .to_string(), +// shares: "1000000000000000000".to_string(), +// }, +// ], +// validators: vec![ +// Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" +// .to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// Validator { +// operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" +// .to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "1000000000000000000".to_string(), +// delegator_shares: "1000000000000000000".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }, +// ], +// expected_result: Ok(Delegations { +// delegations: vec![ +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: StdCoin::new(1000000000000000000u128, "stake"), +// }, +// StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), +// amount: StdCoin::new(1000000000000000000u128, "stake"), +// }, +// ], +// }), +// }, +// TestCase { +// staking_params: Params { +// unbonding_time: None, +// max_validators: 0, +// max_entries: 0, +// historical_entries: 0, +// bond_denom: "stake".to_string(), +// min_commission_rate: "".to_string(), +// }, +// delegations: vec![], +// validators: vec![], +// expected_result: Ok(Delegations { +// delegations: vec![], +// }), +// }, +// TestCase { +// staking_params: Default::default(), +// delegations: vec![], +// validators: vec![], +// expected_result: Err(NeutronError::InvalidQueryResultFormat( +// "params is empty".into(), +// )), +// }, +// TestCase { +// staking_params: Params { +// unbonding_time: None, +// max_validators: 0, +// max_entries: 0, +// historical_entries: 0, +// bond_denom: "stake".to_string(), +// min_commission_rate: "".to_string(), +// }, +// delegations: vec![Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// shares: "1000000000000000000".to_string(), +// }], +// validators: vec![], +// expected_result: Err(NeutronError::InvalidQueryResultFormat( +// "validator is empty".into(), +// )), +// }, +// ]; +// +// for ts in &test_cases { +// // prepare storage values +// let mut st_values: Vec = vec![StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(vec![STAKING_PARAMS_KEY]), +// value: { +// if ts.staking_params.bond_denom.is_empty() { +// return Default::default(); +// } +// Binary::from(ts.staking_params.encode_to_vec()) +// }, +// }]; +// +// for (i, d) in ts.delegations.iter().enumerate() { +// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); +// let val_addr = decode_and_convert(&d.validator_address).unwrap(); +// +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), +// value: Binary::from(d.encode_to_vec()), +// }); +// +// if let Some(v) = ts.validators.get(i) { +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_validator_key(&val_addr).unwrap()), +// value: Binary::from(v.encode_to_vec()), +// }); +// } +// } +// +// // test reconstruction +// let delegations = Delegations::reconstruct(&st_values); +// +// assert_eq!(delegations, ts.expected_result) +// } +// } +// +// #[test] +// fn test_balance_reconstruct_from_hex() { +// let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::new(create_account_denom_balance_key("addr", "uatom").unwrap()), +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let bank_balances = Balances::reconstruct(&[s]).unwrap(); +// assert_eq!( +// bank_balances, +// Balances { +// coins: vec![StdCoin::new(494213561u128, "uatom")] +// } +// ); +// } +// +// #[test] +// fn test_balance_reconstruct_from_empty_value() { +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::new(create_account_denom_balance_key("addr", "uatom").unwrap()), +// value: Binary::from(vec![]), +// }; +// let bank_balances = Balances::reconstruct(&[s]).unwrap(); +// assert_eq!( +// bank_balances, +// Balances { +// coins: vec![StdCoin::new(0u128, "uatom")] +// } +// ); +// } +// +// #[test] +// fn test_bank_total_supply_reconstruct_from_hex() { +// let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::new(create_total_denom_key("stake").unwrap()), +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); +// assert_eq!( +// total_supply, +// TotalSupply { +// coins: vec![StdCoin { +// denom: String::from("stake"), +// amount: Uint128::from(1644171988905769u64), // mutating +// }] +// } +// ); +// } +// +// #[test] +// fn test_delegations_reconstruct_overflow() { +// struct TestCase { +// staking_params: Params, +// delegations: Vec, +// validators: Vec, +// expected_result: NeutronResult, +// } +// let test_cases: Vec = vec![TestCase { +// staking_params: Params { +// unbonding_time: None, +// max_validators: 0, +// max_entries: 0, +// historical_entries: 0, +// bond_denom: "stake".to_string(), +// min_commission_rate: "".to_string(), +// }, +// delegations: vec![Delegation { +// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), +// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// shares: "340282366920938463463".to_string(), +// }], +// validators: vec![Validator { +// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// consensus_pubkey: None, +// jailed: false, +// status: 0, +// tokens: "340282366920938463463".to_string(), +// delegator_shares: "340282366920938463463".to_string(), +// description: None, +// unbonding_height: 0, +// unbonding_time: None, +// commission: None, +// min_self_delegation: "".to_string(), +// }], +// expected_result: Ok(Delegations { +// delegations: vec![StdDelegation { +// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), +// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), +// amount: StdCoin::new(340282366920938463463u128, "stake"), +// }], +// }), +// }]; +// +// for ts in &test_cases { +// // prepare storage values +// let mut st_values: Vec = vec![StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), +// value: { +// if ts.staking_params.bond_denom.is_empty() { +// return Default::default(); +// } +// Binary::from(ts.staking_params.encode_to_vec()) +// }, +// }]; +// +// for (i, d) in ts.delegations.iter().enumerate() { +// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); +// let val_addr = decode_and_convert(&d.validator_address).unwrap(); +// +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), +// value: Binary::from(d.encode_to_vec()), +// }); +// +// if let Some(v) = ts.validators.get(i) { +// st_values.push(StorageValue { +// storage_prefix: STAKING_STORE_KEY.to_string(), +// key: Binary::new(create_validator_key(&val_addr).unwrap()), +// value: Binary::from(v.encode_to_vec()), +// }); +// } +// } +// +// // test reconstruction +// let delegations = Delegations::reconstruct(&st_values); +// +// assert_eq!(delegations, ts.expected_result) +// } +// } +// +// #[test] +// fn test_staking_validators_reconstruct_from_hex() { +// let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); +// assert_eq!( +// staking_validator, +// StakingValidator { +// validators: vec![ContractValidator { +// operator_address: String::from( +// "cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a" // mutating +// ), +// consensus_pubkey: Some(vec![ +// 10, 32, 218, 63, 141, 144, 164, 7, 3, 27, 183, 234, 247, 110, 203, 91, 3, 28, +// 150, 72, 121, 152, 226, 238, 124, 103, 153, 82, 34, 206, 253, 59, 50, 145, +// ]), +// jailed: false, +// status: 3, +// tokens: String::from("250028274052364"), +// delegator_shares: String::from("250028274052364000000000000000000"), +// moniker: Some(String::from("earth 🌎")), +// identity: Some(String::from("Coinbase Custody")), +// website: Some(String::from("hypha.coop")), +// security_contact: Some(String::from("")), +// details: Some(String::from("A testnet validator")), +// unbonding_height: 1841908u64, +// unbonding_time: Some(1590982547u64), +// rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), +// max_rate: Some(Decimal::from_str("1.00000000000000000").unwrap()), +// max_change_rate: Some(Decimal::from_str("1.000000000000000000").unwrap()), +// update_time: Some(1580862591u64), // mutating +// min_self_delegation: Decimal::from_str("1000000").unwrap(), +// }] +// } +// ); +// } +// +// #[test] +// fn test_validators_signing_infos_reconstruct_from_hex() { +// let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); +// assert_eq!( +// signing_info, +// SigningInfo { +// signing_infos: vec![ValidatorSigningInfo { +// address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), +// start_height: 0, +// index_offset: 16, +// jailed_until: Some(0), +// tombstoned: false, +// missed_blocks_counter: 0, +// }] +// } +// ); +// } +// +// #[test] +// fn test_government_proposals_reconstruct_from_hex() { +// let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); +// assert_eq!( +// proposals, +// GovernmentProposal { +// proposals: vec![Proposal { +// proposal_id: 1u64, +// proposal_type: Some(String::from("/cosmos.gov.v1.MsgExecLegacyContent")), +// total_deposit: vec![StdCoin { +// denom: String::from("uatom"), +// amount: Uint128::from(512100000u64), +// }], +// status: 3i32, +// submit_time: Some(1553064087u64), // mutating +// deposit_end_time: Some(1554273687u64), // mutating +// voting_start_time: Some(1553114639u64), // 0001-01-01T00:00:00Z +// voting_end_time: Some(1554324239u64), // 0001-01-01T00:00:00Z +// final_tally_result: Some(TallyResult { +// yes: Uint128::from(97118903526799u128), +// no: Uint128::from(320545400000u128), +// abstain: Uint128::from(402380577234u128), +// no_with_veto: Uint128::zero(), +// }), +// }] +// } +// ); +// } +// +// #[test] +// fn test_fee_pool_reconstruct_from_hex() { +// let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string +// +// let s = StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(base64_input.as_str()).unwrap(), +// }; +// let fee_pool = FeePool::reconstruct(&[s]).unwrap(); +// assert_eq!( +// fee_pool, +// FeePool { +// coins: vec![ +// StdCoin { +// denom: String::from( +// "ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66" +// ), +// amount: Uint128::from(444252217u64), // mutating +// }, +// StdCoin { +// denom: String::from( +// "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC" +// ), +// amount: Uint128::from(189753432u64), // mutating +// }, +// StdCoin { +// denom: String::from( +// "ibc/1FBDD58D438B4D04D26CBFB2E722C18984A0F1A52468C4F42F37D102F3D3F399" +// ), +// amount: Uint128::from(25455348u64), // mutating +// }, +// StdCoin { +// denom: String::from( +// "ibc/2181AAB0218EAC24BC9F86BD1364FBBFA3E6E3FCC25E88E3E68C15DC6E752D86" +// ), +// amount: Uint128::from(89764472u64), // mutating +// }, +// StdCoin { +// denom: String::from( +// "ibc/2717109A95559F3A17EFC0C897B7691E22A227B30FC3C5CE7A7CE88481629704" +// ), +// amount: Uint128::from(9000u64), // mutating +// }, +// StdCoin { +// denom: String::from( +// "ibc/42E47A5BA708EBE6E0C227006254F2784E209F4DBD3C6BB77EDC4B29EF875E8E" +// ), +// amount: Uint128::from(2325668920u64), // mutating +// }, +// StdCoin { +// denom: String::from( +// "ibc/81D08BC39FB520EBD948CF017910DD69702D34BF5AC160F76D3B5CFC444EBCE0" +// ), +// amount: Uint128::from(33639955u64), // mutating +// }, +// StdCoin { +// denom: String::from("theta"), +// amount: Uint128::from(1u64), // mutating +// }, +// StdCoin { +// denom: String::from("uatom"), +// amount: Uint128::from(13538430938055u64), // mutating +// }, +// ] +// } +// ); +// } +// +// #[test] +// fn test_delegations_reconstruct_from_hex() { +// let staking_params_bytes = hex::decode(STAKING_PARAMS_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let staking_params_base64_input = BASE64_STANDARD.encode(staking_params_bytes); // encode bytes to base64 string +// let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string +// let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string +// +// let mut st_values: Vec = vec![StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(staking_params_base64_input.as_str()).unwrap(), +// }]; +// st_values.push(StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(delegation_base64_input.as_str()).unwrap(), +// }); +// st_values.push(StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap(), +// }); +// +// let delegations = Delegations::reconstruct(&st_values).unwrap(); +// assert_eq!( +// delegations, +// Delegations { +// delegations: vec![StdDelegation { +// delegator: Addr::unchecked("cosmos1pmjwm0a8pvs2m8pauyg2ruldy8ney4qn8zgd96"), // mutating +// validator: String::from("cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a"), // mutating +// amount: StdCoin { +// denom: String::from("uatom"), +// amount: Uint128::from(5000u64), +// }, +// }], +// } +// ); +// } +// +// #[test] +// fn test_unbonding_delegations_reconstruct_from_hex() { +// let unbonding_delegations_bytes = +// hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes +// let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string +// +// let st_values: Vec = vec![StorageValue { +// storage_prefix: String::default(), // not used in reconstruct +// key: Binary::default(), // not used in reconstruct +// value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap(), +// }]; +// +// let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); +// assert_eq!( +// unbonding_delegations, +// UnbondingDelegations { +// unbonding_responses: vec![UnbondingResponse { +// delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), +// validator_address: String::from( +// "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" +// ), +// entries: vec![ +// UnbondingEntry { +// balance: Uint128::new(10_000), +// completion_time: Some(Timestamp::from_nanos(1704872890570185206)), +// creation_height: 365, +// initial_balance: Uint128::new(10_000), +// }, +// UnbondingEntry { +// balance: Uint128::new(20_000), +// completion_time: Some(Timestamp::from_nanos(1704872903002248037)), +// creation_height: 377, +// initial_balance: Uint128::new(20_000), +// }, +// ], +// }] +// } +// ); +// } From 97917938957b5434ef65f907aabc5c60c4ade5b2 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:21:49 +0400 Subject: [PATCH 08/35] fix compilation for interchain_txs contract --- contracts/ibc_transfer/src/contract.rs | 53 +++++-- .../src/contract.rs | 140 +++++++++++++---- .../src/bin/neutron_interchain_txs_schema.rs | 5 - .../neutron_interchain_txs/src/contract.rs | 100 ++++++++---- contracts/neutron_interchain_txs/src/msg.rs | 2 +- packages/neutron-sdk/src/bindings/msg.rs | 9 +- .../src/interchain_queries/queries.rs | 17 ++- .../src/interchain_queries/v045/helpers.rs | 13 +- .../v045/register_queries.rs | 142 +++++++++++++----- .../src/interchain_queries/v045/types.rs | 14 +- .../v047/register_queries.rs | 9 +- .../src/interchain_queries/v047/types.rs | 2 +- 12 files changed, 356 insertions(+), 150 deletions(-) diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index e470711a..159fb065 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -3,17 +3,16 @@ use cosmwasm_std::{ StdError, StdResult, SubMsg, }; use cw2::set_contract_version; -use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; use neutron_sdk::interchain_txs::helpers::decode_message_response; use neutron_sdk::{ sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg}, NeutronResult, }; +use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; +// TODO: rename use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; // TODO: rename -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use crate::{ msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, state::{ @@ -21,6 +20,8 @@ use crate::{ IBC_SUDO_ID_RANGE_END, IBC_SUDO_ID_RANGE_START, }, }; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; // Default timeout for IbcTransfer is 10000000 blocks const DEFAULT_TIMEOUT_HEIGHT: u64 = 10000000; @@ -41,12 +42,7 @@ pub fn instantiate( } #[entry_point] -pub fn execute( - deps: DepsMut, - env: Env, - _: MessageInfo, - msg: ExecuteMsg, -) -> StdResult { +pub fn execute(deps: DepsMut, env: Env, _: MessageInfo, msg: ExecuteMsg) -> StdResult { match msg { // NOTE: this is an example contract that shows how to make IBC transfers! // Please add necessary authorization or other protection mechanisms @@ -156,7 +152,10 @@ fn execute_send( source_channel: channel.clone(), sender: env.contract.address.to_string(), receiver: to.clone(), - token: Some(SuperCoin{ denom: denom.clone(), amount: amount.to_string() }), + token: Some(SuperCoin { + denom: denom.clone(), + amount: amount.to_string(), + }), timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { revision_number: 2, revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), @@ -170,7 +169,10 @@ fn execute_send( source_channel: channel, sender: env.contract.address.to_string(), receiver: to, - token: Some(SuperCoin{ denom, amount: (2 * amount).to_string() }), + token: Some(SuperCoin { + denom, + amount: (2 * amount).to_string(), + }), timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { revision_number: 2, revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), @@ -277,23 +279,42 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult StdResult { let querier = FeerefunderQuerier::new(&deps.querier); let params = querier.params()?; - let params_inner = params.params.ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; - let min_fee = params_inner.min_fee.ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; + let params_inner = params + .params + .ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; + let min_fee = params_inner + .min_fee + .ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; Ok(min_fee) } fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { neutron_std::types::neutron::feerefunder::Fee { - recv_fee: fee.recv_fee.iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ).collect(), + recv_fee: fee + .recv_fee + .iter() + .map(|r| SuperCoin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) + .collect(), ack_fee: fee .ack_fee - .iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ) + .iter() + .map(|r| SuperCoin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) .filter(|a| a.denom == FEE_DENOM) .collect(), timeout_fee: fee .timeout_fee - .iter().map(|r| SuperCoin{ denom: r.denom.to_string(), amount: r.amount.clone() } ) + .iter() + .map(|r| SuperCoin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) .filter(|a| a.denom == FEE_DENOM) .collect(), } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 98513f23..6fd0ff1e 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -1,12 +1,20 @@ use cosmos_sdk_proto::cosmos::bank::v1beta1::MsgSend; use cosmos_sdk_proto::cosmos::tx::v1beta1::{TxBody, TxRaw}; use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{entry_point, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, Uint128}; +use cosmwasm_std::{ + entry_point, to_json_binary, Addr, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, + Response, StdError, StdResult, Uint128, +}; use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; -use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, RegisteredQuery, QueryResult, KvKey}; +use neutron_std::types::neutron::interchainqueries::{ + InterchainqueriesQuerier, KvKey, QueryResult, RegisteredQuery, +}; // TODO: fix name -use neutron_sdk::interchain_queries::v045::register_queries::{update_interchain_query as helpers_update_interchain_query, remove_interchain_query as helpers_remove_interchain_query}; +use neutron_sdk::interchain_queries::v045::register_queries::{ + remove_interchain_query as helpers_remove_interchain_query, + update_interchain_query as helpers_update_interchain_query, +}; use crate::msg::{ Cw20BalanceResponse, ExecuteMsg, GetRecipientTxsResponse, InstantiateMsg, MigrateMsg, QueryMsg, @@ -72,37 +80,71 @@ pub fn execute( addr, denoms, update_period, - } => register_balances_query(env.contract.address, connection_id, addr, denoms, update_period), + } => register_balances_query( + env.contract.address, + connection_id, + addr, + denoms, + update_period, + ), ExecuteMsg::RegisterBankTotalSupplyQuery { connection_id, denoms, update_period, - } => register_bank_total_supply_query(env.contract.address, connection_id, denoms, update_period), + } => register_bank_total_supply_query( + env.contract.address, + connection_id, + denoms, + update_period, + ), ExecuteMsg::RegisterDistributionFeePoolQuery { connection_id, update_period, - } => register_distribution_fee_pool_query(env.contract.address, connection_id, update_period), + } => { + register_distribution_fee_pool_query(env.contract.address, connection_id, update_period) + } ExecuteMsg::RegisterGovernmentProposalsQuery { connection_id, proposals_ids, update_period, - } => register_gov_proposal_query(env.contract.address, connection_id, proposals_ids, update_period), + } => register_gov_proposal_query( + env.contract.address, + connection_id, + proposals_ids, + update_period, + ), ExecuteMsg::RegisterStakingValidatorsQuery { connection_id, validators, update_period, - } => register_staking_validators_query(env.contract.address, connection_id, validators, update_period), + } => register_staking_validators_query( + env.contract.address, + connection_id, + validators, + update_period, + ), ExecuteMsg::RegisterValidatorsSigningInfosQuery { connection_id, validators, update_period, - } => register_validators_signing_infos_query(env.contract.address, connection_id, validators, update_period), + } => register_validators_signing_infos_query( + env.contract.address, + connection_id, + validators, + update_period, + ), ExecuteMsg::RegisterDelegatorDelegationsQuery { connection_id, delegator, validators, update_period, - } => register_delegations_query(env.contract.address, connection_id, delegator, validators, update_period), + } => register_delegations_query( + env.contract.address, + connection_id, + delegator, + validators, + update_period, + ), ExecuteMsg::RegisterDelegatorUnbondingDelegationsQuery { connection_id, delegator, @@ -120,7 +162,13 @@ pub fn execute( recipient, update_period, min_height, - } => register_transfers_query(env.contract.address, connection_id, recipient, update_period, min_height), + } => register_transfers_query( + env.contract.address, + connection_id, + recipient, + update_period, + min_height, + ), ExecuteMsg::RegisterCw20BalanceQuery { connection_id, update_period, @@ -138,8 +186,16 @@ pub fn execute( new_keys, new_update_period, new_recipient, - } => update_interchain_query(env.contract.address, query_id, new_keys, new_update_period, new_recipient), - ExecuteMsg::RemoveInterchainQuery { query_id } => remove_interchain_query(env.contract.address, query_id), + } => update_interchain_query( + env.contract.address, + query_id, + new_keys, + new_update_period, + new_recipient, + ), + ExecuteMsg::RemoveInterchainQuery { query_id } => { + remove_interchain_query(env.contract.address, query_id) + } } } @@ -150,7 +206,9 @@ pub fn register_balances_query( denoms: Vec, update_period: u64, ) -> NeutronResult { - let msg: CosmosMsg = new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?.into(); + let msg: CosmosMsg = + new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)? + .into(); Ok(Response::new().add_message(msg)) } @@ -161,7 +219,8 @@ pub fn register_bank_total_supply_query( denoms: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_bank_total_supply_query_msg(contract, connection_id, denoms, update_period)?; + let msg = + new_register_bank_total_supply_query_msg(contract, connection_id, denoms, update_period)?; Ok(Response::new().add_message(msg)) } @@ -182,7 +241,12 @@ pub fn register_gov_proposal_query( proposals_ids: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_gov_proposals_query_msg(contract, connection_id, proposals_ids, update_period)?; + let msg = new_register_gov_proposals_query_msg( + contract, + connection_id, + proposals_ids, + update_period, + )?; Ok(Response::new().add_message(msg)) } @@ -193,7 +257,12 @@ pub fn register_staking_validators_query( validators: Vec, update_period: u64, ) -> NeutronResult { - let msg = new_register_staking_validators_query_msg(contract, connection_id, validators, update_period)?; + let msg = new_register_staking_validators_query_msg( + contract, + connection_id, + validators, + update_period, + )?; Ok(Response::new().add_message(msg)) } @@ -204,8 +273,12 @@ pub fn register_validators_signing_infos_query( validators: Vec, update_period: u64, ) -> NeutronResult { - let msg = - new_register_validators_signing_infos_query_msg(contract, connection_id, validators, update_period)?; + let msg = new_register_validators_signing_infos_query_msg( + contract, + connection_id, + validators, + update_period, + )?; Ok(Response::new().add_message(msg)) } @@ -253,8 +326,13 @@ pub fn register_transfers_query( update_period: u64, min_height: Option, ) -> NeutronResult { - let msg = - new_register_transfers_query_msg(contract, connection_id, recipient, update_period, min_height)?; + let msg = new_register_transfers_query_msg( + contract, + connection_id, + recipient, + update_period, + min_height, + )?; Ok(Response::new().add_message(msg)) } @@ -298,13 +376,18 @@ pub fn update_interchain_query( }] }); - let update_msg = - helpers_update_interchain_query(contract, query_id, new_keys, new_update_period, new_filter)?; + let update_msg = helpers_update_interchain_query( + contract, + query_id, + new_keys, + new_update_period, + new_filter, + )?; Ok(Response::new().add_message(update_msg)) } pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult { - let remove_msg = helpers_remove_interchain_query(contract, query_id); + let remove_msg = helpers_remove_interchain_query(contract, query_id)?; Ok(Response::new().add_message(remove_msg)) } @@ -400,8 +483,7 @@ pub fn sudo_tx_query_result( let body: TxBody = TxBody::decode(tx.body_bytes.as_slice())?; // Get the registered query by ID and retrieve the raw query string - let registered_query: RegisteredQuery = - get_registered_query(deps.as_ref(), query_id)?; + let registered_query: RegisteredQuery = get_registered_query(deps.as_ref(), query_id)?; let transactions_filter = registered_query.transactions_filter; #[allow(clippy::match_single_binding)] @@ -507,11 +589,7 @@ fn check_deposits_size(deposits: &Vec) -> StdResult<()> { /// sudo_kv_query_result is the contract's callback for KV query results. Note that only the query /// id is provided, so you need to read the query result from the state. -pub fn sudo_kv_query_result( - deps: DepsMut, - _env: Env, - query_id: u64, -) -> NeutronResult { +pub fn sudo_kv_query_result(deps: DepsMut, _env: Env, query_id: u64) -> NeutronResult { deps.api.debug( format!( "WASMDEBUG: sudo_kv_query_result received; query_id: {:?}", diff --git a/contracts/neutron_interchain_txs/src/bin/neutron_interchain_txs_schema.rs b/contracts/neutron_interchain_txs/src/bin/neutron_interchain_txs_schema.rs index 536d2c67..22c9e034 100644 --- a/contracts/neutron_interchain_txs/src/bin/neutron_interchain_txs_schema.rs +++ b/contracts/neutron_interchain_txs/src/bin/neutron_interchain_txs_schema.rs @@ -1,6 +1,5 @@ use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; use neutron_interchain_txs::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; -use neutron_sdk::bindings::query::QueryInterchainAccountAddressResponse; use neutron_sdk::sudo::msg::SudoMsg; use std::env::current_dir; use std::fs::create_dir_all; @@ -16,8 +15,4 @@ fn main() { export_schema(&schema_for!(SudoMsg), &out_dir); export_schema(&schema_for!(QueryMsg), &out_dir); export_schema(&schema_for!(ExecuteMsg), &out_dir); - export_schema( - &schema_for!(QueryInterchainAccountAddressResponse), - &out_dir, - ); } diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 12a850fe..e12884b5 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -1,15 +1,11 @@ use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ - to_json_binary, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, + to_json_binary, Addr, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; use neutron_std::shim::Timestamp; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; -use neutron_std::types::cosmos::base::v1beta1::Coin; -use neutron_std::types::cosmos::staking::v1beta1::{MsgDelegate, MsgDelegateResponse, MsgUndelegateResponse}; -use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; +// TODO: rename use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use crate::storage::{ add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload, @@ -17,17 +13,25 @@ use crate::storage::{ ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; use neutron_sdk::bindings::msg::{ChannelOrdering, IbcFee}; +use neutron_sdk::interchain_queries::v045::register_queries::register_interchain_account; use neutron_sdk::{ - bindings::{ - types::ProtobufAny, - }, + bindings::types::ProtobufAny, interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, sudo::msg::{RequestPacket, SudoMsg}, NeutronError, NeutronResult, }; -use neutron_sdk::interchain_queries::v045::register_queries::register_interchain_account; -use neutron_std::types::neutron::interchaintxs::v1::{InterchaintxsQuerier, MsgSubmitTxResponse}; +use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; +use neutron_std::types::cosmos::base::v1beta1::Coin; +use neutron_std::types::cosmos::staking::v1beta1::{ + MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, +}; +use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; +use neutron_std::types::neutron::interchaintxs::v1::{ + InterchaintxsQuerier, MsgSubmitTx, MsgSubmitTxResponse, +}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; // Default timeout for SubmitTX is two weeks const DEFAULT_TIMEOUT_SECONDS: u64 = 60 * 60 * 24 * 7 * 2; @@ -65,7 +69,7 @@ pub fn execute( env: Env, _: MessageInfo, msg: ExecuteMsg, -) -> NeutronResult{ +) -> NeutronResult { deps.api .debug(format!("WASMDEBUG: execute: received msg: {:?}", msg).as_str()); match msg { @@ -204,7 +208,7 @@ fn execute_register_ica( interchain_account_id.clone(), register_fee, ordering, - ); + )?; let key = get_port_id(&env.contract.address.to_string(), &interchain_account_id); // we are saving empty data here because we handle response of registering ICA in sudo_open_ack method INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?; @@ -222,7 +226,7 @@ fn execute_delegate( ) -> NeutronResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?.min_fee); + let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgDelegate { delegator_address: delegator, @@ -241,12 +245,13 @@ fn execute_delegate( )))); } - let any_msg = ProtobufAny { + let any_msg = neutron_std::shim::Any { type_url: "/cosmos.staking.v1beta1.MsgDelegateResponse".to_string(), - value: Binary::from(buf), + value: buf, }; let cosmos_msg = submit_tx( + env.contract.address.clone(), connection_id, interchain_account_id.clone(), vec![any_msg], @@ -269,6 +274,27 @@ fn execute_delegate( Ok(Response::default().add_submessages(vec![submsg])) } +fn submit_tx( + contract: Addr, + connection_id: String, + interchain_account_id: String, + msgs: Vec, + memo: String, + timeout: u64, + fee: Fee, +) -> CosmosMsg { + MsgSubmitTx { + from_address: contract.to_string(), + interchain_account_id, + connection_id, + msgs, + memo, + timeout, + fee: Some(fee), + } + .into() +} + fn execute_undelegate( mut deps: DepsMut, env: Env, @@ -280,7 +306,7 @@ fn execute_undelegate( ) -> NeutronResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_ibc_fee(deps.as_ref())?.min_fee); + let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgUndelegate { delegator_address: delegator, @@ -299,12 +325,13 @@ fn execute_undelegate( )))); } - let any_msg = ProtobufAny { + let any_msg = neutron_std::shim::Any { type_url: "/cosmos.staking.v1beta1.MsgUndelegate".to_string(), - value: Binary::from(buf), + value: buf, }; let cosmos_msg = submit_tx( + env.contract.address.clone(), connection_id, interchain_account_id.clone(), vec![any_msg], @@ -628,17 +655,32 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { } } -fn min_ntrn_ibc_fee(fee: IbcFee) -> IbcFee { - IbcFee { - recv_fee: fee.recv_fee, +fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { + neutron_std::types::neutron::feerefunder::Fee { + recv_fee: fee + .recv_fee + .iter() + .map(|r| SuperCoin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) + .collect(), ack_fee: fee .ack_fee - .into_iter() + .iter() + .map(|r| SuperCoin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) .filter(|a| a.denom == FEE_DENOM) .collect(), timeout_fee: fee .timeout_fee - .into_iter() + .iter() + .map(|r| SuperCoin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) .filter(|a| a.denom == FEE_DENOM) .collect(), } @@ -647,8 +689,12 @@ fn min_ntrn_ibc_fee(fee: IbcFee) -> IbcFee { fn query_min_fee(deps: Deps) -> StdResult { let querier = FeerefunderQuerier::new(&deps.querier); let params = querier.params()?; - let params_inner = params.params.ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; - let min_fee = params_inner.min_fee.ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; + let params_inner = params + .params + .ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; + let min_fee = params_inner + .min_fee + .ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; Ok(min_fee) -} \ No newline at end of file +} diff --git a/contracts/neutron_interchain_txs/src/msg.rs b/contracts/neutron_interchain_txs/src/msg.rs index d27ca561..50a2cc3d 100644 --- a/contracts/neutron_interchain_txs/src/msg.rs +++ b/contracts/neutron_interchain_txs/src/msg.rs @@ -1,5 +1,5 @@ -use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_sdk::bindings::msg::ChannelOrdering; +use neutron_std::types::cosmos::base::v1beta1::Coin; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index ddec2207..092231e0 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -27,7 +27,7 @@ pub struct IbcFee { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] pub enum ChannelOrdering { - OrderUnordered , + OrderUnordered, OrderOrdered, } @@ -35,12 +35,15 @@ impl Into for ChannelOrdering { fn into(self) -> i32 { match self { ChannelOrdering::OrderUnordered => 1, - ChannelOrdering::OrderOrdered => 2 + ChannelOrdering::OrderOrdered => 2, } } } -#[deprecated(note = "Please use neutron-std autogenerated messages instead of wasmbindings", since = "0.12.0")] +#[deprecated( + note = "Please use neutron-std autogenerated messages instead of wasmbindings", + since = "0.12.0" +)] #[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. diff --git a/packages/neutron-sdk/src/interchain_queries/queries.rs b/packages/neutron-sdk/src/interchain_queries/queries.rs index fdde90e7..671ce519 100644 --- a/packages/neutron-sdk/src/interchain_queries/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/queries.rs @@ -2,7 +2,9 @@ use crate::errors::error::NeutronResult; use crate::interchain_queries::types::{KVReconstruct, QueryType}; use crate::NeutronError; use cosmwasm_std::{Deps, StdError}; -use neutron_std::types::neutron::interchainqueries::{InterchainqueriesQuerier, RegisteredQuery, QueryResult}; +use neutron_std::types::neutron::interchainqueries::{ + InterchainqueriesQuerier, QueryResult, RegisteredQuery, +}; /// Checks **actual** query type is **expected** query type pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<()> { @@ -22,15 +24,14 @@ pub fn get_registered_query( ) -> NeutronResult { let querier = InterchainqueriesQuerier::new(&deps.querier); let query_res = querier.registered_query(interchain_query_id)?; - let res= query_res.registered_query.ok_or_else(|| StdError::generic_err("no registered query"))?; + let res = query_res + .registered_query + .ok_or_else(|| StdError::generic_err("no registered query"))?; Ok(res) } /// Reads submitted raw KV values for Interchain Query with **query_id** from the storage and reconstructs the result -pub fn query_kv_result( - deps: Deps, - query_id: u64, -) -> NeutronResult { +pub fn query_kv_result(deps: Deps, query_id: u64) -> NeutronResult { let registered_query_result = get_raw_interchain_query_result(deps, query_id)?; KVReconstruct::reconstruct(registered_query_result.kv_results.as_slice()) } @@ -45,7 +46,9 @@ pub fn get_raw_interchain_query_result( ) -> NeutronResult { let querier = InterchainqueriesQuerier::new(&deps.querier); let query_res = querier.query_result(interchain_query_id.into())?; - let res = query_res.result.ok_or_else(|| StdError::generic_err("no result in registered query"))?; + let res = query_res + .result + .ok_or_else(|| StdError::generic_err("no result in registered query"))?; Ok(res) } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs index e9b33560..f24fb6bc 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs @@ -1,3 +1,4 @@ +use super::types::{GOV_STORE_KEY, VOTES_KEY_PREFIX}; use crate::errors::error::NeutronResult; use crate::interchain_queries::helpers::{decode_and_convert, length_prefix}; use crate::interchain_queries::types::AddressBytes; @@ -9,9 +10,8 @@ use crate::interchain_queries::v045::types::{ use crate::NeutronError; use cosmos_sdk_proto::cosmos::staking::v1beta1::Commission as ValidatorCommission; use cosmwasm_std::{Binary, Decimal, Uint128}; -use std::str::{from_utf8, FromStr}; use neutron_std::types::neutron::interchainqueries::KvKey; -use super::types::{GOV_STORE_KEY, VOTES_KEY_PREFIX}; +use std::str::{from_utf8, FromStr}; /// Creates KV key to get **module** param by **key** pub fn create_params_store_key(module: &str, key: &str) -> Vec { @@ -284,10 +284,7 @@ pub fn create_gov_proposals_voters_votes_keys( for proposal_id in proposals_ids.clone() { let kv_key = KvKey { path: GOV_STORE_KEY.to_string(), - key: create_gov_proposal_voter_votes_key( - proposal_id, - &voter_addr, - )?, + key: create_gov_proposal_voter_votes_key(proposal_id, &voter_addr)?, }; kv_keys.push(kv_key) @@ -338,5 +335,7 @@ pub fn get_total_supply_denom(denom: &Vec) -> Option { /// Returns total supply amount from StorageValue key pub fn get_total_supply_amount(amount: &Vec) -> Option { - from_utf8(amount.as_slice()).ok().map(|a| Uint128::from_str(a).ok())? + from_utf8(amount.as_slice()) + .ok() + .map(|a| Uint128::from_str(a).ok())? } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs index 33ebdcfc..9d30bf85 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs @@ -1,4 +1,7 @@ -use crate::interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue}; +use crate::bindings::msg::ChannelOrdering; +use crate::interchain_queries::types::{ + QueryPayload, QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, +}; use crate::interchain_queries::v045::types::{ BANK_STORE_KEY, DISTRIBUTION_STORE_KEY, HEIGHT_FIELD, KEY_BOND_DENOM, PARAMS_STORE_KEY, RECIPIENT_FIELD, SLASHING_STORE_KEY, STAKING_STORE_KEY, WASM_STORE_KEY, @@ -14,11 +17,13 @@ use crate::{ }, }; use cosmwasm_std::{Addr, CosmosMsg, StdError}; -use neutron_std::types::neutron::interchainqueries::{KvKey, MsgRegisterInterchainQuery, MsgRemoveInterchainQueryRequest, MsgUpdateInterchainQueryRequest}; +use neutron_std::types::cosmos::base::v1beta1::Coin; +use neutron_std::types::neutron::interchainqueries::{ + KvKey, MsgRegisterInterchainQuery, MsgRemoveInterchainQueryRequest, + MsgUpdateInterchainQueryRequest, +}; use neutron_std::types::neutron::interchaintxs::v1::MsgRegisterInterchainAccount; use serde_json_wasm::to_string; -use crate::bindings::msg::ChannelOrdering; -use neutron_std::types::cosmos::base::v1beta1::Coin; /// Creates a message to register an Interchain Query to get balance of account on remote chain for list of denoms /// @@ -32,9 +37,14 @@ pub fn new_register_balances_query_msg( addr: String, denoms: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let kv_keys = create_balances_query_keys(addr, denoms)?; - register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(kv_keys), + connection_id, + update_period, + ) } /// Creates a message to register an Interchain Query to get balance of account on remote chain for a particular denom @@ -50,7 +60,7 @@ pub fn new_register_balance_query_msg( addr: String, denom: String, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { new_register_balances_query_msg(contract, connection_id, addr, vec![denom], update_period) } @@ -64,7 +74,7 @@ pub fn new_register_bank_total_supply_query_msg( connection_id: String, denoms: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let mut kv_keys: Vec = Vec::with_capacity(denoms.len()); for denom in denoms { @@ -78,7 +88,12 @@ pub fn new_register_bank_total_supply_query_msg( kv_keys.push(kv_key) } - register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(kv_keys), + connection_id, + update_period, + ) } /// Creates a message to register an Interchain Query to get fee pool on remote chain from distribution module @@ -89,7 +104,7 @@ pub fn new_register_distribution_fee_pool_query_msg( contract: Addr, connection_id: String, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let kv_key = KvKey { path: DISTRIBUTION_STORE_KEY.to_string(), key: create_fee_pool_key()?, @@ -113,10 +128,15 @@ pub fn new_register_gov_proposals_query_msg( connection_id: String, proposals_ids: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let kv_keys = create_gov_proposal_keys(proposals_ids)?; - register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(kv_keys), + connection_id, + update_period, + ) } /// Creates a message to update an Interchain Query to get governance proposals on remote chain @@ -129,7 +149,7 @@ pub fn update_gov_proposals_query_msg( query_id: u64, proposals_ids: Vec, new_update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let kv_keys = create_gov_proposal_keys(proposals_ids)?; update_interchain_query(contract, query_id, kv_keys, new_update_period, None) @@ -147,10 +167,15 @@ pub fn new_register_gov_proposals_voters_votes_query_msg( proposals_ids: Vec, voters: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let kv_keys = create_gov_proposals_voters_votes_keys(proposals_ids, voters)?; - register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(kv_keys), + connection_id, + update_period, + ) } /// Creates a message to update an Interchain Query to get governance proposals votes on the remote chain @@ -165,7 +190,7 @@ pub fn update_gov_proposals_votes_query_msg( proposals_ids: Vec, voters: Vec, new_update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let kv_keys = create_gov_proposals_voters_votes_keys(proposals_ids, voters)?; update_interchain_query(contract, query_id, kv_keys, new_update_period, None) @@ -181,7 +206,7 @@ pub fn new_register_staking_validators_query_msg( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let mut kv_keys: Vec = Vec::with_capacity(validators.len()); for validator in validators { @@ -195,7 +220,12 @@ pub fn new_register_staking_validators_query_msg( kv_keys.push(kv_key) } - register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(kv_keys), + connection_id, + update_period, + ) } /// Creates a message to register an Interchain Query to get validators signing infos on remote chain @@ -208,7 +238,7 @@ pub fn new_register_validators_signing_infos_query_msg( connection_id: String, validators: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let mut kv_keys: Vec = Vec::with_capacity(validators.len()); for validator in validators { @@ -222,7 +252,12 @@ pub fn new_register_validators_signing_infos_query_msg( kv_keys.push(kv_key) } - register_interchain_query(contract, QueryPayload::KV(kv_keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(kv_keys), + connection_id, + update_period, + ) } /// Creates a message to register an Interchain Query to get delegations of particular delegator on remote chain. @@ -237,7 +272,7 @@ pub fn new_register_delegator_delegations_query_msg( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory for such KV keys as: @@ -268,7 +303,12 @@ pub fn new_register_delegator_delegations_query_msg( }) } - register_interchain_query(contract, QueryPayload::KV(keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(keys), + connection_id, + update_period, + ) } /// Creates a message to register an Interchain Query to get unbonding delegations of particular delegator on remote chain. @@ -283,7 +323,7 @@ pub fn new_register_delegator_unbonding_delegations_query_msg( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory, one KV key per validator @@ -299,7 +339,12 @@ pub fn new_register_delegator_unbonding_delegations_query_msg( }) } - register_interchain_query(contract, QueryPayload::KV(keys), connection_id, update_period) + register_interchain_query( + contract, + QueryPayload::KV(keys), + connection_id, + update_period, + ) } /// Creates a message to register an Interchain Query to get wasm contract store on remote chain @@ -321,7 +366,7 @@ pub fn new_register_wasm_contract_store_query_msg( contract_address: String, key: impl AsRef<[u8]>, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let converted_addr_bytes = decode_and_convert(contract_address.as_str())?; let wasm_key = create_wasm_contract_store_key(converted_addr_bytes, key.as_ref())?; @@ -350,7 +395,7 @@ pub fn new_register_transfers_query_msg( recipient: String, update_period: u64, min_height: Option, -) -> NeutronResult>> { +) -> NeutronResult { let mut query_data = vec![TransactionFilterItem { field: RECIPIENT_FIELD.to_string(), op: TransactionFilterOp::Eq, @@ -380,9 +425,14 @@ pub fn new_register_transfers_query_msg( /// maximum allowed number of filters is 32. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **update_period** is used to say how often (in neutron blocks) the query must be updated. -fn register_interchain_query(contract: Addr, query: QueryPayload, connection_id: String, update_period: u64) -> NeutronResult>> { - Ok(Box::new(match query { - QueryPayload::KV(keys) => MsgRegisterInterchainQuery{ +fn register_interchain_query( + contract: Addr, + query: QueryPayload, + connection_id: String, + update_period: u64, +) -> NeutronResult { + Ok(match query { + QueryPayload::KV(keys) => MsgRegisterInterchainQuery { sender: contract.to_string(), query_type: QueryType::KV.into(), keys, @@ -399,7 +449,8 @@ fn register_interchain_query(contract: Addr, query: QueryPayload, connection_id: connection_id, update_period, }, - })) + } + .into()) } /// Basic helper to define a update interchain query message: @@ -412,8 +463,8 @@ pub fn update_interchain_query( new_keys: Vec, new_update_period: u64, new_transactions_filter: Option>, -) -> NeutronResult>> { - Ok(Box::new(MsgUpdateInterchainQueryRequest { +) -> NeutronResult { + Ok(MsgUpdateInterchainQueryRequest { sender: contract.to_string(), query_id, new_keys, @@ -425,25 +476,36 @@ pub fn update_interchain_query( // TODO: check if passing empty string is correct None => "".to_string(), }, - })) + } + .into()) } /// Basic helper to define a remove interchain query message: /// * **query_id** is ID of the query we want to remove. -pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult>> { - Ok(Box::new(MsgRemoveInterchainQueryRequest { +pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult { + Ok(MsgRemoveInterchainQueryRequest { sender: contract.to_string(), query_id, - })) + } + .into()) } // TODO: comment -pub fn register_interchain_account(contract: Addr, connection_id: String, interchain_account_id: String, register_fee: Vec, ordering: Option) -> NeutronResult>> { - Ok(Box::new(MsgRegisterInterchainAccount{ +pub fn register_interchain_account( + contract: Addr, + connection_id: String, + interchain_account_id: String, + register_fee: Vec, + ordering: Option, +) -> NeutronResult { + Ok(MsgRegisterInterchainAccount { from_address: contract.to_string(), connection_id, interchain_account_id, register_fee, - ordering: ordering.unwrap_or_else(|| ChannelOrdering::OrderOrdered).into(), - })) + ordering: ordering + .unwrap_or_else(|| ChannelOrdering::OrderOrdered) + .into(), + } + .into()) } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/types.rs b/packages/neutron-sdk/src/interchain_queries/v045/types.rs index 0588598c..77d04554 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/types.rs @@ -1,9 +1,11 @@ +use super::helpers::{ + get_max_change_rate, get_max_rate, get_rate, get_total_supply_amount, get_total_supply_denom, + get_update_time, +}; +use crate::errors::error::{NeutronError, NeutronResult}; use crate::interchain_queries::helpers::uint256_to_u128; use crate::interchain_queries::types::KVReconstruct; use crate::interchain_queries::v045::helpers::deconstruct_account_denom_balance_key; -use crate::{ - errors::error::{NeutronError, NeutronResult}, -}; use cosmos_sdk_proto::cosmos::gov::v1beta1::Vote; use cosmos_sdk_proto::cosmos::{ base::v1beta1::Coin as CosmosCoin, @@ -14,14 +16,10 @@ use cosmos_sdk_proto::cosmos::{ }; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{from_json, Addr, Coin, Decimal, Decimal256, Timestamp, Uint128, Uint256}; +use neutron_std::types::neutron::interchainqueries::StorageValue; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::{ops::Div, str::FromStr}; -use neutron_std::types::neutron::interchainqueries::StorageValue; -use super::helpers::{ - get_max_change_rate, get_max_rate, get_rate, get_total_supply_amount, get_total_supply_denom, - get_update_time, -}; pub const DECIMAL_PLACES: u32 = 18; pub const DECIMAL_FRACTIONAL: u128 = 10u128.pow(DECIMAL_PLACES); diff --git a/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs index 6889d560..43dbfae9 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/register_queries.rs @@ -9,7 +9,7 @@ use crate::interchain_queries::v045::types::STAKING_STORE_KEY; use crate::interchain_queries::v047::types::STAKING_PARAMS_KEY; use crate::NeutronResult; use cosmwasm_std::{Addr, CosmosMsg}; -use neutron_std::types::neutron::interchainqueries::{MsgRegisterInterchainQuery, KvKey}; +use neutron_std::types::neutron::interchainqueries::{KvKey, MsgRegisterInterchainQuery}; /// Creates a message to register an Interchain Query to get delegations of particular delegator on remote chain. /// @@ -23,7 +23,7 @@ pub fn new_register_delegator_delegations_query_msg( delegator: String, validators: Vec, update_period: u64, -) -> NeutronResult>> { +) -> NeutronResult { let delegator_addr = decode_and_convert(&delegator)?; // Allocate memory for such KV keys as: @@ -54,12 +54,13 @@ pub fn new_register_delegator_delegations_query_msg( }) } - Ok(Box::new(MsgRegisterInterchainQuery{ + Ok(MsgRegisterInterchainQuery { query_type: QueryType::KV.into(), keys, transactions_filter: "".to_string(), connection_id, update_period, sender: contract.to_string(), - })) + } + .into()) } diff --git a/packages/neutron-sdk/src/interchain_queries/v047/types.rs b/packages/neutron-sdk/src/interchain_queries/v047/types.rs index 9cfa4f4d..0ebaf7e1 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/types.rs @@ -16,10 +16,10 @@ use cosmos_sdk_proto::cosmos::staking::v1beta1::{ }; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{Addr, Coin, Decimal256, Uint128, Uint256}; +use neutron_std::types::neutron::interchainqueries::StorageValue; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::str::FromStr; -use neutron_std::types::neutron::interchainqueries::StorageValue; /// Key for Staking Params in the **staking** module's storage /// From 6da2278cd76c2f14d5285327bc81b7e115de1459 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:40:42 +0400 Subject: [PATCH 09/35] fix compile and warning errors --- contracts/ibc_transfer/src/contract.rs | 9 +- .../src/contract.rs | 4 +- .../neutron_interchain_txs/src/contract.rs | 7 +- packages/neutron-sdk/schema/neutron_msg.json | 1740 ----------------- .../neutron-sdk/schema/neutron_query.json | 1139 ----------- .../neutron-sdk/src/bin/neutron-sdk-schema.rs | 3 - packages/neutron-sdk/src/bindings/msg.rs | 13 +- packages/neutron-sdk/src/bindings/types.rs | 224 +-- .../src/interchain_queries/types.rs | 5 +- .../src/interchain_queries/v045/helpers.rs | 2 +- packages/neutron-sdk/src/lib.rs | 1 - packages/neutron-sdk/src/serde/mod.rs | 104 - 12 files changed, 15 insertions(+), 3236 deletions(-) delete mode 100644 packages/neutron-sdk/schema/neutron_msg.json delete mode 100644 packages/neutron-sdk/schema/neutron_query.json delete mode 100644 packages/neutron-sdk/src/bin/neutron-sdk-schema.rs delete mode 100644 packages/neutron-sdk/src/serde/mod.rs diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index 159fb065..c506225f 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -1,13 +1,10 @@ use cosmwasm_std::{ - coin, entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, - StdError, StdResult, SubMsg, + entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, + StdResult, SubMsg, }; use cw2::set_contract_version; use neutron_sdk::interchain_txs::helpers::decode_message_response; -use neutron_sdk::{ - sudo::msg::{RequestPacket, RequestPacketTimeoutHeight, TransferSudoMsg}, - NeutronResult, -}; +use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg}; use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; // TODO: rename use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 6fd0ff1e..b6ab93b4 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -7,9 +7,7 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; -use neutron_std::types::neutron::interchainqueries::{ - InterchainqueriesQuerier, KvKey, QueryResult, RegisteredQuery, -}; +use neutron_std::types::neutron::interchainqueries::{KvKey, RegisteredQuery}; // TODO: fix name use neutron_sdk::interchain_queries::v045::register_queries::{ remove_interchain_query as helpers_remove_interchain_query, diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index e12884b5..4697af1a 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -1,7 +1,7 @@ use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ - to_json_binary, Addr, Binary, Coin as CoinSDK, CosmosMsg, CustomQuery, Deps, DepsMut, Env, - MessageInfo, Reply, Response, StdError, StdResult, SubMsg, + to_json_binary, Addr, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, + Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; use neutron_std::shim::Timestamp; @@ -12,10 +12,9 @@ use crate::storage::{ save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload, ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; -use neutron_sdk::bindings::msg::{ChannelOrdering, IbcFee}; +use neutron_sdk::bindings::msg::ChannelOrdering; use neutron_sdk::interchain_queries::v045::register_queries::register_interchain_account; use neutron_sdk::{ - bindings::types::ProtobufAny, interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, sudo::msg::{RequestPacket, SudoMsg}, diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json deleted file mode 100644 index d43ee446..00000000 --- a/packages/neutron-sdk/schema/neutron_msg.json +++ /dev/null @@ -1,1740 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "NeutronMsg", - "description": "A number of Custom messages that can call into the Neutron bindings.", - "oneOf": [ - { - "description": "RegisterInterchainAccount registers an interchain account on remote chain.", - "type": "object", - "required": [ - "register_interchain_account" - ], - "properties": { - "register_interchain_account": { - "type": "object", - "required": [ - "connection_id", - "interchain_account_id" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", - "type": "string" - }, - "interchain_account_id": { - "description": "**interchain_account_id** is an identifier of your new interchain account. Can be any string. This identifier allows contracts to have multiple interchain accounts on remote chains.", - "type": "string" - }, - "ordering": { - "description": "**ordering** is an order of channel. Can be ordered or unordered. Set to ordered if not specified.", - "anyOf": [ - { - "$ref": "#/definitions/ChannelOrdering" - }, - { - "type": "null" - } - ] - }, - "register_fee": { - "description": "*register_fee** is a fees required to be payed to register interchain account", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Coin" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.", - "type": "object", - "required": [ - "submit_tx" - ], - "properties": { - "submit_tx": { - "type": "object", - "required": [ - "connection_id", - "fee", - "interchain_account_id", - "memo", - "msgs", - "timeout" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", - "type": "string" - }, - "fee": { - "description": "**fee** is an ibc fee for the transaction.", - "allOf": [ - { - "$ref": "#/definitions/IbcFee" - } - ] - }, - "interchain_account_id": { - "description": "*interchain_account_id** is an identifier of your interchain account from which you want to execute msgs.", - "type": "string" - }, - "memo": { - "description": "*memo** is a memo you want to attach to your interchain transaction.It behaves like a memo in usual Cosmos transaction.", - "type": "string" - }, - "msgs": { - "description": "*msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain.", - "type": "array", - "items": { - "$ref": "#/definitions/ProtobufAny" - } - }, - "timeout": { - "description": "*timeout** is a timeout in seconds after which the packet times out.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RegisterInterchainQuery registers an interchain query.", - "type": "object", - "required": [ - "register_interchain_query" - ], - "properties": { - "register_interchain_query": { - "type": "object", - "required": [ - "connection_id", - "keys", - "query_type", - "transactions_filter", - "update_period" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain.", - "type": "string" - }, - "keys": { - "description": "*keys** is the KV-storage keys for which we want to get values from remote chain.", - "type": "array", - "items": { - "$ref": "#/definitions/KVKey" - } - }, - "query_type": { - "description": "*query_type** is a query type identifier ('tx' or 'kv' for now).", - "type": "string" - }, - "transactions_filter": { - "description": "*transactions_filter** is the filter for transaction search ICQ.", - "type": "string" - }, - "update_period": { - "description": "*update_period** is used to say how often the query must be updated.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RegisterInterchainQuery updates an interchain query.", - "type": "object", - "required": [ - "update_interchain_query" - ], - "properties": { - "update_interchain_query": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "new_keys": { - "description": "*new_keys** is the new query keys to retrieve.", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/KVKey" - } - }, - "new_transactions_filter": { - "description": "*new_transactions_filter** is a new transactions filter of the query.", - "type": [ - "string", - "null" - ] - }, - "new_update_period": { - "description": "*new_update_period** is a new update period of the query.", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "query_id": { - "description": "*query_id** is the ID of the query we want to update.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RemoveInterchainQuery removes as interchain query.", - "type": "object", - "required": [ - "remove_interchain_query" - ], - "properties": { - "remove_interchain_query": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "query_id": { - "description": "*query_id** is ID of the query we want to remove.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "IbcTransfer sends a fungible token packet over IBC.", - "type": "object", - "required": [ - "ibc_transfer" - ], - "properties": { - "ibc_transfer": { - "type": "object", - "required": [ - "fee", - "memo", - "receiver", - "sender", - "source_channel", - "source_port", - "timeout_height", - "timeout_timestamp", - "token" - ], - "properties": { - "fee": { - "$ref": "#/definitions/IbcFee" - }, - "memo": { - "type": "string" - }, - "receiver": { - "type": "string" - }, - "sender": { - "type": "string" - }, - "source_channel": { - "type": "string" - }, - "source_port": { - "type": "string" - }, - "timeout_height": { - "$ref": "#/definitions/RequestPacketTimeoutHeight" - }, - "timeout_timestamp": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "token": { - "$ref": "#/definitions/Coin" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "SubmitAdminProposal sends a proposal to neutron's Admin module. This type of messages can be only executed by Neutron DAO.", - "type": "object", - "required": [ - "submit_admin_proposal" - ], - "properties": { - "submit_admin_proposal": { - "type": "object", - "required": [ - "admin_proposal" - ], - "properties": { - "admin_proposal": { - "$ref": "#/definitions/AdminProposal" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can create denoms, namespaced under the contract's address. A contract may create any number of independent sub-denoms.", - "type": "object", - "required": [ - "create_denom" - ], - "properties": { - "create_denom": { - "type": "object", - "required": [ - "subdenom" - ], - "properties": { - "subdenom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can change the admin of a denom that they are the admin of.", - "type": "object", - "required": [ - "change_admin" - ], - "properties": { - "change_admin": { - "type": "object", - "required": [ - "denom", - "new_admin_address" - ], - "properties": { - "denom": { - "type": "string" - }, - "new_admin_address": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can mint native tokens for an existing factory denom that they are the admin of.", - "type": "object", - "required": [ - "mint_tokens" - ], - "properties": { - "mint_tokens": { - "type": "object", - "required": [ - "amount", - "denom", - "mint_to_address" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - }, - "mint_to_address": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can burn native tokens for an existing factory denom that they are the admin of. Currently, the burn from address must be the admin contract.", - "type": "object", - "required": [ - "burn_tokens" - ], - "properties": { - "burn_tokens": { - "type": "object", - "required": [ - "amount", - "burn_from_address", - "denom" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "burn_from_address": { - "description": "Must be set to `\"\"` for now", - "type": "string" - }, - "denom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory message. Contracts can set before send hooks for denoms, namespaced under the contract's address.", - "type": "object", - "required": [ - "set_before_send_hook" - ], - "properties": { - "set_before_send_hook": { - "type": "object", - "required": [ - "contract_addr", - "denom" - ], - "properties": { - "contract_addr": { - "type": "string" - }, - "denom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactoryMessage Contracts can force specified `amount` of an existing factory denom that they are admin of to a `transfer_to_address` from a `transfer_from_address`.", - "type": "object", - "required": [ - "force_transfer" - ], - "properties": { - "force_transfer": { - "type": "object", - "required": [ - "amount", - "denom", - "transfer_from_address", - "transfer_to_address" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - }, - "transfer_from_address": { - "type": "string" - }, - "transfer_to_address": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactoryMessage Contracts can set a metadata for of an existing factory denom that they are admin of.", - "type": "object", - "required": [ - "set_denom_metadata" - ], - "properties": { - "set_denom_metadata": { - "type": "object", - "required": [ - "base", - "denom_units", - "description", - "display", - "name", - "symbol", - "uri", - "uri_hash" - ], - "properties": { - "base": { - "description": "*base** represents the base denom (should be the DenomUnit with exponent = 0).", - "type": "string" - }, - "denom_units": { - "description": "*denom_units** represents the list of DenomUnit's for a given coin", - "type": "array", - "items": { - "$ref": "#/definitions/DenomUnit" - } - }, - "description": { - "description": "*description** description of a token", - "type": "string" - }, - "display": { - "description": "**display** indicates the suggested denom that should be displayed in clients.", - "type": "string" - }, - "name": { - "description": "*name** defines the name of the token (eg: Cosmos Atom)", - "type": "string" - }, - "symbol": { - "description": "**symbol** is the token symbol usually shown on exchanges (eg: ATOM). This can be the same as the display.", - "type": "string" - }, - "uri": { - "description": "*uri** to a document (on or off-chain) that contains additional information. Optional.", - "type": "string" - }, - "uri_hash": { - "description": "**uri_hash** is a sha256 hash of a document pointed by URI. It's used to verify that the document didn't change. Optional.", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "AddSchedule adds new schedule with a given `name`. Until schedule is removed it will execute all `msgs` every `period` blocks. First execution is at least on `current_block + period` block. [Permissioned - DAO Only]", - "type": "object", - "required": [ - "add_schedule" - ], - "properties": { - "add_schedule": { - "type": "object", - "required": [ - "msgs", - "name", - "period" - ], - "properties": { - "msgs": { - "description": "list of cosmwasm messages to be executed", - "type": "array", - "items": { - "$ref": "#/definitions/MsgExecuteContract" - } - }, - "name": { - "description": "Name of a new schedule. Needed to be able to `RemoveSchedule` and to log information about it", - "type": "string" - }, - "period": { - "description": "period in blocks with which `msgs` will be executed", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "RemoveSchedule removes the schedule with a given `name`. [Permissioned - DAO or Security DAO only]", - "type": "object", - "required": [ - "remove_schedule" - ], - "properties": { - "remove_schedule": { - "type": "object", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contractmanager message Resubmits failed acknowledgement. Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. [Permissioned - only from contract that is initial caller of IBC transaction]", - "type": "object", - "required": [ - "resubmit_failure" - ], - "properties": { - "resubmit_failure": { - "type": "object", - "required": [ - "failure_id" - ], - "properties": { - "failure_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Dex messages", - "type": "object", - "required": [ - "dex" - ], - "properties": { - "dex": { - "$ref": "#/definitions/DexMsg" - } - }, - "additionalProperties": false - } - ], - "definitions": { - "AdminProposal": { - "description": "AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.", - "oneOf": [ - { - "description": "Proposal to change params. Note that this works for old params. New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage`", - "type": "object", - "required": [ - "param_change_proposal" - ], - "properties": { - "param_change_proposal": { - "$ref": "#/definitions/ParamChangeProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to upgrade IBC client", - "deprecated": true, - "type": "object", - "required": [ - "upgrade_proposal" - ], - "properties": { - "upgrade_proposal": { - "$ref": "#/definitions/UpgradeProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to update IBC client", - "deprecated": true, - "type": "object", - "required": [ - "client_update_proposal" - ], - "properties": { - "client_update_proposal": { - "$ref": "#/definitions/ClientUpdateProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Proposal to execute CosmosMsg.", - "type": "object", - "required": [ - "proposal_execute_message" - ], - "properties": { - "proposal_execute_message": { - "$ref": "#/definitions/ProposalExecuteMessage" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to upgrade network", - "deprecated": true, - "type": "object", - "required": [ - "software_upgrade_proposal" - ], - "properties": { - "software_upgrade_proposal": { - "$ref": "#/definitions/SoftwareUpgradeProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to cancel existing software upgrade", - "deprecated": true, - "type": "object", - "required": [ - "cancel_software_upgrade_proposal" - ], - "properties": { - "cancel_software_upgrade_proposal": { - "$ref": "#/definitions/CancelSoftwareUpgradeProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Will fail to execute if you use it. Deprecated. Proposal to pin wasm contract codes", - "deprecated": true, - "type": "object", - "required": [ - "pin_codes_proposal" - ], - "properties": { - "pin_codes_proposal": { - "$ref": "#/definitions/PinCodesProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Deprecated. Proposal to unpin wasm contract codes.", - "deprecated": true, - "type": "object", - "required": [ - "unpin_codes_proposal" - ], - "properties": { - "unpin_codes_proposal": { - "$ref": "#/definitions/UnpinCodesProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to call sudo on contract.", - "deprecated": true, - "type": "object", - "required": [ - "sudo_contract_proposal" - ], - "properties": { - "sudo_contract_proposal": { - "$ref": "#/definitions/SudoContractProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to update contract admin.", - "deprecated": true, - "type": "object", - "required": [ - "update_admin_proposal" - ], - "properties": { - "update_admin_proposal": { - "$ref": "#/definitions/UpdateAdminProposal" - } - }, - "additionalProperties": false - }, - { - "description": "Deprecated. Proposal to clear contract admin.", - "deprecated": true, - "type": "object", - "required": [ - "clear_admin_proposal" - ], - "properties": { - "clear_admin_proposal": { - "$ref": "#/definitions/ClearAdminProposal" - } - }, - "additionalProperties": false - } - ] - }, - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" - }, - "CancelSoftwareUpgradeProposal": { - "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ChannelOrdering": { - "type": "string", - "enum": [ - "ORDER_ORDERED", - "ORDER_UNORDERED" - ] - }, - "ClearAdminProposal": { - "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", - "deprecated": true, - "type": "object", - "required": [ - "contract", - "description", - "title" - ], - "properties": { - "contract": { - "description": "*contract** is an address of contract admin will be removed.", - "type": "string" - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ClientUpdateProposal": { - "description": "ClientUpdateProposal defines the struct for client update proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "subject_client_id", - "substitute_client_id", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "subject_client_id": { - "description": "*subject_client_id** is a subject client id.", - "type": "string" - }, - "substitute_client_id": { - "description": "*substitute_client_id** is a substitute client id.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "Coin": { - "type": "object", - "required": [ - "amount", - "denom" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Uint128" - }, - "denom": { - "type": "string" - } - }, - "additionalProperties": false - }, - "DenomUnit": { - "description": "Replicates the cosmos-sdk bank module DenomUnit type", - "type": "object", - "required": [ - "aliases", - "denom", - "exponent" - ], - "properties": { - "aliases": { - "type": "array", - "items": { - "type": "string" - } - }, - "denom": { - "type": "string" - }, - "exponent": { - "type": "integer", - "format": "uint32", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, - "DepositOptions": { - "type": "object", - "properties": { - "disable_autoswap": { - "type": [ - "boolean", - "null" - ] - }, - "fail_tx_on_bel": { - "type": [ - "boolean", - "null" - ] - } - }, - "additionalProperties": false - }, - "DexMsg": { - "oneOf": [ - { - "description": "Deposit provides liquidity to a specific trading pair by depositing tokens at a specific price into one or both sides of the pair in “a liquidity pool”", - "type": "object", - "required": [ - "deposit" - ], - "properties": { - "deposit": { - "type": "object", - "required": [ - "amounts_a", - "amounts_b", - "fees", - "options", - "receiver", - "tick_indexes_a_to_b", - "token_a", - "token_b" - ], - "properties": { - "amounts_a": { - "description": "Amounts of tokenA to deposit", - "type": "array", - "items": { - "$ref": "#/definitions/Uint128" - } - }, - "amounts_b": { - "description": "Amounts of tokenB to deposit", - "type": "array", - "items": { - "$ref": "#/definitions/Uint128" - } - }, - "fees": { - "description": "Fees to use for each deposit", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "options": { - "description": "Additional deposit options", - "type": "array", - "items": { - "$ref": "#/definitions/DepositOptions" - } - }, - "receiver": { - "description": "The account to which PoolShares will be issued", - "type": "string" - }, - "tick_indexes_a_to_b": { - "description": "Tick indexes to deposit at defined in terms of TokenA to TokenB (ie. TokenA is on the left)", - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "token_a": { - "description": "Denom for one side of the deposit", - "type": "string" - }, - "token_b": { - "description": "Denom for the opposing side of the deposit", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Withdraw is used to redeem PoolShares for the user’s pro-rata portion of tokens within a liquidity pool. Users can withdraw from a pool at any time", - "type": "object", - "required": [ - "withdrawal" - ], - "properties": { - "withdrawal": { - "type": "object", - "required": [ - "fees", - "receiver", - "shares_to_remove", - "tick_indexes_a_to_b", - "token_a", - "token_b" - ], - "properties": { - "fees": { - "description": "Fee for the target LiquidityPools", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "receiver": { - "description": "The account to which the tokens are credited", - "type": "string" - }, - "shares_to_remove": { - "description": "Amount of shares to remove from each pool", - "type": "array", - "items": { - "$ref": "#/definitions/Uint128" - } - }, - "tick_indexes_a_to_b": { - "description": "Tick indexes of the target LiquidityPools defined in terms of TokenA to TokenB (ie. TokenA is on the left)", - "type": "array", - "items": { - "type": "integer", - "format": "int64" - } - }, - "token_a": { - "description": "Denom for one side of the deposit", - "type": "string" - }, - "token_b": { - "description": "Denom for the opposing side of the deposit", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "PlaceLimitOrder provides the primary mechanism for trading on the Duality Dex. Limit orders can provide liquidity to the Dex (“Maker Limit Orders”) and/or can be used to trade against preexisting liquidity (“Taker Limit Orders”)", - "type": "object", - "required": [ - "place_limit_order" - ], - "properties": { - "place_limit_order": { - "type": "object", - "required": [ - "amount_in", - "limit_sell_price", - "order_type", - "receiver", - "tick_index_in_to_out", - "token_in", - "token_out" - ], - "properties": { - "amount_in": { - "description": "Amount of TokenIn to be traded", - "allOf": [ - { - "$ref": "#/definitions/Uint128" - } - ] - }, - "expiration_time": { - "description": "Expiration time for order. Only valid for GOOD_TIL_TIME limit orders", - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "limit_sell_price": { - "description": "Accepts standard decimals and decimals with scientific notation (ie. 1234.23E-7)", - "type": "string" - }, - "max_amount_out": { - "description": "Maximum amount of TokenB can be bought. For everything except JUST_IN_TIME OrderType", - "anyOf": [ - { - "$ref": "#/definitions/Uint128" - }, - { - "type": "null" - } - ] - }, - "order_type": { - "description": "Type of limit order to be used. Must be one of: GOOD_TIL_CANCELLED, FILL_OR_KILL, IMMEDIATE_OR_CANCEL, JUST_IN_TIME, or GOOD_TIL_TIME", - "allOf": [ - { - "$ref": "#/definitions/LimitOrderType" - } - ] - }, - "receiver": { - "description": "Account to which TokenOut is credited or that will be allowed to withdraw or cancel a maker order", - "type": "string" - }, - "tick_index_in_to_out": { - "description": "Limit tick for a limit order, specified in terms of TokenIn to TokenOut", - "type": "integer", - "format": "int64" - }, - "token_in": { - "description": "Token being “sold”", - "type": "string" - }, - "token_out": { - "description": "Token being “bought”", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "WithdrawFilledLimitOrder. Once a limit order has been filled – either partially or in its entirety, it can be withdrawn at any time. Withdrawing from a limit order credits all available proceeds to the user. Withdraw can be called on a limit order multiple times as new proceeds become available", - "type": "object", - "required": [ - "withdraw_filled_limit_order" - ], - "properties": { - "withdraw_filled_limit_order": { - "type": "object", - "required": [ - "tranche_key" - ], - "properties": { - "tranche_key": { - "description": "TrancheKey for the target limit order", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "CancelLimitOrder. Standard Taker limit orders (Good-til-cancelled & Good-til-Time) can be canceled at any time if they have not been completely filled", - "type": "object", - "required": [ - "cancel_limit_order" - ], - "properties": { - "cancel_limit_order": { - "type": "object", - "required": [ - "tranche_key" - ], - "properties": { - "tranche_key": { - "description": "TrancheKey for the target limit order", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "MultiHopSwap provides a swapping mechanism to achieve better prices by routing through a series of pools", - "type": "object", - "required": [ - "multi_hop_swap" - ], - "properties": { - "multi_hop_swap": { - "type": "object", - "required": [ - "amount_in", - "exit_limit_price", - "pick_best_route", - "receiver", - "routes" - ], - "properties": { - "amount_in": { - "description": "Amount of TokenIn to swap", - "allOf": [ - { - "$ref": "#/definitions/Uint128" - } - ] - }, - "exit_limit_price": { - "description": "Minimum price that that must be satisfied for a route to succeed", - "allOf": [ - { - "$ref": "#/definitions/PrecDec" - } - ] - }, - "pick_best_route": { - "description": "If true all routes are run and the route with the best price is used", - "type": "boolean" - }, - "receiver": { - "description": "Account to which TokenOut is credited", - "type": "string" - }, - "routes": { - "description": "Array of possible routes", - "type": "array", - "items": { - "$ref": "#/definitions/MultiHopRoute" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "IbcFee": { - "description": "IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. Unused fee kind will be returned back to message sender. Please refer to these links for more information: IBC transaction structure - General mechanics of fee payments - ", - "type": "object", - "required": [ - "ack_fee", - "recv_fee", - "timeout_fee" - ], - "properties": { - "ack_fee": { - "description": "*ack_fee** is an amount of coins to refund relayer for submitting ack message for a particular IBC packet.", - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "recv_fee": { - "description": "**recv_fee** currently is used for compatibility with ICS-29 interface only and must be set to zero (i.e. 0untrn), because Neutron's fee module can't refund relayer for submission of Recv IBC packets due to compatibility with target chains.", - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "timeout_fee": { - "description": "*timeout_fee** amount of coins to refund relayer for submitting timeout message for a particular IBC packet.", - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - } - }, - "additionalProperties": false - }, - "KVKey": { - "description": "Describes a KV key for which you want to get value from the storage on remote chain", - "type": "object", - "required": [ - "key", - "path" - ], - "properties": { - "key": { - "description": "*key** is a key you want to read from the storage", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "path": { - "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", - "type": "string" - } - }, - "additionalProperties": false - }, - "LimitOrderType": { - "oneOf": [ - { - "description": "Good-til-Cancelled limit orders are hybrid maker and taker limit orders. They will attempt to trade the supplied AmountIn at the TickIndex or better. However, if they total AmountIn cannot be traded at the limit price they are remaining amount will be placed as a maker limit order. The proceeds from the taker portion are deposited into the user’s account immediately, however, the proceeds from the maker portion must be explicitly withdrawn via WithdrawLimitOrder.", - "type": "string", - "enum": [ - "GOOD_TIL_CANCELLED" - ] - }, - { - "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` ( ErrGoodTilOrderWithoutExpiration).", - "type": "string", - "enum": [ - "FILL_OR_KILL" - ] - }, - { - "description": "Immediate-or-Cancel limit orders are taker orders that will swap as much as of the AmountIn as possible given available liquidity above the supplied TickIndex. Unlike Fill-or-Kill orders they will still successfully complete even if they are only able to partially trade through the AmountIn at the TickIndex or better.", - "type": "string", - "enum": [ - "IMMEDIATE_OR_CANCEL" - ] - }, - { - "description": "Just-in-Time limit orders are an advanced maker limit order that provides tradeable liquidity for exactly one block. At the end of the same block in which the Just-in-Time order was submitted the order is canceled and any untraded portion will no longer be usable as active liquidity.", - "type": "string", - "enum": [ - "JUST_IN_TIME" - ] - }, - { - "description": "Good-til-Time limit order function exactly the same as Good-til-Cancelled limit orders first trying to trade as a taker limit order and then placing any remaining amount as a maker limit order. However, the maker portion of the limit order has a specified ExpirationTime. After the ExpirationTime the order will be cancelled and can no longer be traded against. When withdrawing a Good-til-Time limit order the user will receive both the successfully traded portion of the limit order (TokenOut) as well as any remaining untraded amount (TokenIn).", - "type": "string", - "enum": [ - "GOOD_TIL_TIME" - ] - } - ] - }, - "MsgExecuteContract": { - "description": "MsgExecuteContract defines a call to the contract execution", - "type": "object", - "required": [ - "contract", - "msg" - ], - "properties": { - "contract": { - "description": "*contract** is a contract address that will be called", - "type": "string" - }, - "msg": { - "description": "*msg** is a contract call message", - "type": "string" - } - }, - "additionalProperties": false - }, - "MultiHopRoute": { - "type": "object", - "required": [ - "hops" - ], - "properties": { - "hops": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, - "ParamChange": { - "description": "ParamChange defines the struct for parameter change request.", - "type": "object", - "required": [ - "key", - "subspace", - "value" - ], - "properties": { - "key": { - "description": "*key** is a name of parameter. Unique for subspace.", - "type": "string" - }, - "subspace": { - "description": "*subspace** is a key of module to which the parameter to change belongs. Unique for each module.", - "type": "string" - }, - "value": { - "description": "*value** is a new value for given parameter. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ParamChangeProposal": { - "description": "ParamChangeProposal defines the struct for single parameter change proposal.", - "type": "object", - "required": [ - "description", - "param_changes", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "param_changes": { - "description": "*param_changes** is a vector of params to be changed. Non unique.", - "type": "array", - "items": { - "$ref": "#/definitions/ParamChange" - } - }, - "title": { - "description": "*title** is a text title of proposal. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "PinCodesProposal": { - "description": "Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.", - "deprecated": true, - "type": "object", - "required": [ - "code_ids", - "description", - "title" - ], - "properties": { - "code_ids": { - "description": "*code_ids** is an array of codes to be pined.", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "Plan": { - "description": "Plan defines the struct for planned upgrade.", - "type": "object", - "required": [ - "height", - "info", - "name" - ], - "properties": { - "height": { - "description": "*height** is a height at which the upgrade must be performed", - "type": "integer", - "format": "int64" - }, - "info": { - "description": "*info** is any application specific upgrade info to be included on-chain", - "type": "string" - }, - "name": { - "description": "*name** is a name for the upgrade", - "type": "string" - } - }, - "additionalProperties": false - }, - "PrecDec": { - "type": "object", - "required": [ - "i" - ], - "properties": { - "i": { - "type": "string" - } - }, - "additionalProperties": false - }, - "ProposalExecuteMessage": { - "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "description": "*message** is a json representing an sdk message passed to admin module to execute.", - "type": "string" - } - }, - "additionalProperties": false - }, - "ProtobufAny": { - "description": "Type for wrapping any protobuf message", - "type": "object", - "required": [ - "type_url", - "value" - ], - "properties": { - "type_url": { - "description": "*type_url** describes the type of the serialized message", - "type": "string" - }, - "value": { - "description": "*value** must be a valid serialized protocol buffer of the above specified type", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - } - }, - "additionalProperties": false - }, - "RequestPacketTimeoutHeight": { - "type": "object", - "properties": { - "revision_height": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "revision_number": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - }, - "SoftwareUpgradeProposal": { - "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "plan", - "title" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal. Non unique.", - "type": "string" - }, - "plan": { - "description": "*plan** is a plan of upgrade.", - "allOf": [ - { - "$ref": "#/definitions/Plan" - } - ] - }, - "title": { - "description": "*title** is a text title of proposal. Non unique.", - "type": "string" - } - }, - "additionalProperties": false - }, - "SudoContractProposal": { - "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", - "deprecated": true, - "type": "object", - "required": [ - "contract", - "description", - "msg", - "title" - ], - "properties": { - "contract": { - "description": "*contract** is an address of contract to be executed.", - "type": "string" - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "msg": { - "description": "**msg*** is a sudo message.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "Uint128": { - "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", - "type": "string" - }, - "UnpinCodesProposal": { - "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", - "deprecated": true, - "type": "object", - "required": [ - "code_ids", - "description", - "title" - ], - "properties": { - "code_ids": { - "description": "*code_ids** is an array of codes to be unpined.", - "type": "array", - "items": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "UpdateAdminProposal": { - "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", - "deprecated": true, - "type": "object", - "required": [ - "contract", - "description", - "new_admin", - "title" - ], - "properties": { - "contract": { - "description": "*contract** is an address of contract to update admin.", - "type": "string" - }, - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "new_admin": { - "description": "**new_admin*** is an address of new admin", - "type": "string" - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - } - }, - "additionalProperties": false - }, - "UpgradeProposal": { - "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", - "deprecated": true, - "type": "object", - "required": [ - "description", - "plan", - "title", - "upgraded_client_state" - ], - "properties": { - "description": { - "description": "*description** is a text description of proposal.", - "type": "string" - }, - "plan": { - "description": "*plan** is a plan of upgrade.", - "allOf": [ - { - "$ref": "#/definitions/Plan" - } - ] - }, - "title": { - "description": "*title** is a text title of proposal.", - "type": "string" - }, - "upgraded_client_state": { - "description": "*upgraded_client_state** is an upgraded client state.", - "allOf": [ - { - "$ref": "#/definitions/ProtobufAny" - } - ] - } - }, - "additionalProperties": false - } - } -} diff --git a/packages/neutron-sdk/schema/neutron_query.json b/packages/neutron-sdk/schema/neutron_query.json deleted file mode 100644 index 48a911b0..00000000 --- a/packages/neutron-sdk/schema/neutron_query.json +++ /dev/null @@ -1,1139 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "NeutronQuery", - "description": "The queries to interact with neutron specific blockchain modules.", - "oneOf": [ - { - "description": "Query a result of registered interchain query on remote chain", - "type": "object", - "required": [ - "interchain_query_result" - ], - "properties": { - "interchain_query_result": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "query_id": { - "description": "*query_id** is an ID registered interchain query", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query a registered interchain account address for a specific connection_id Every contract may have as many interchain accounts as necessary.", - "type": "object", - "required": [ - "interchain_account_address" - ], - "properties": { - "interchain_account_address": { - "type": "object", - "required": [ - "connection_id", - "interchain_account_id", - "owner_address" - ], - "properties": { - "connection_id": { - "description": "*connection_id** is an IBC connection identifier between Neutron and remote chain", - "type": "string" - }, - "interchain_account_id": { - "description": "**interchain_account_id** is an identifier of your interchain account. Can be any string This identifier allows contracts to have multiple interchain accounts on remote chains", - "type": "string" - }, - "owner_address": { - "description": "*owner_address** is an address of contract which registered interchain account", - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query all registered interchain queries on all remote chains", - "type": "object", - "required": [ - "registered_interchain_queries" - ], - "properties": { - "registered_interchain_queries": { - "type": "object", - "required": [ - "connection_id", - "owners", - "pagination" - ], - "properties": { - "connection_id": { - "type": "string" - }, - "owners": { - "type": "array", - "items": { - "type": "string" - } - }, - "pagination": { - "$ref": "#/definitions/PageRequest" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query registered interchain query with a specific query_id", - "type": "object", - "required": [ - "registered_interchain_query" - ], - "properties": { - "registered_interchain_query": { - "type": "object", - "required": [ - "query_id" - ], - "properties": { - "query_id": { - "description": "*query_id** is an ID registered interchain query", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query total amount of burned neutron fees", - "type": "object", - "required": [ - "total_burned_neutrons_amount" - ], - "properties": { - "total_burned_neutrons_amount": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Query minimum IBC fee", - "type": "object", - "required": [ - "min_ibc_fee" - ], - "properties": { - "min_ibc_fee": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory query. Given a subdenom minted by a contract via [`NeutronMsg::MintTokens`](crate::bindings::msg::NeutronMsg::MintTokens), returns the full denom as used by [`BankMsg::Send`](cosmwasm_std::BankMsg::Send).", - "type": "object", - "required": [ - "full_denom" - ], - "properties": { - "full_denom": { - "type": "object", - "required": [ - "creator_addr", - "subdenom" - ], - "properties": { - "creator_addr": { - "type": "string" - }, - "subdenom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory query. Returns the admin of a denom, if the denom is a TokenFactory denom.", - "type": "object", - "required": [ - "denom_admin" - ], - "properties": { - "denom_admin": { - "type": "object", - "required": [ - "subdenom" - ], - "properties": { - "subdenom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "TokenFactory query. Returns the before send hook address of a denom, if the denom is a TokenFactory denom.", - "type": "object", - "required": [ - "before_send_hook" - ], - "properties": { - "before_send_hook": { - "type": "object", - "required": [ - "denom" - ], - "properties": { - "denom": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Contractmanager query. Returns the failures for a particular contract address.", - "type": "object", - "required": [ - "failures" - ], - "properties": { - "failures": { - "type": "object", - "required": [ - "address", - "pagination" - ], - "properties": { - "address": { - "type": "string" - }, - "pagination": { - "$ref": "#/definitions/PageRequest" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "dex" - ], - "properties": { - "dex": { - "$ref": "#/definitions/DexQuery" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "market_map" - ], - "properties": { - "market_map": { - "$ref": "#/definitions/MarketMapQuery" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "oracle" - ], - "properties": { - "oracle": { - "$ref": "#/definitions/OracleQuery" - } - }, - "additionalProperties": false - } - ], - "definitions": { - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" - }, - "CurrencyPair": { - "type": "object", - "required": [ - "Base", - "Quote" - ], - "properties": { - "Base": { - "type": "string" - }, - "Quote": { - "type": "string" - } - }, - "additionalProperties": false - }, - "DexQuery": { - "oneOf": [ - { - "description": "Parameters queries the parameters of the module.", - "type": "object", - "required": [ - "params" - ], - "properties": { - "params": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a LimitOrderTrancheUser by index.", - "type": "object", - "required": [ - "limit_order_tranche_user" - ], - "properties": { - "limit_order_tranche_user": { - "type": "object", - "required": [ - "address", - "tranche_key" - ], - "properties": { - "address": { - "type": "string" - }, - "tranche_key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of LimitOrderTrancheMap items.", - "type": "object", - "required": [ - "limit_order_tranche_user_all" - ], - "properties": { - "limit_order_tranche_user_all": { - "type": "object", - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of LimitOrderTrancheUser items for a given address.", - "type": "object", - "required": [ - "limit_order_tranche_user_all_by_address" - ], - "properties": { - "limit_order_tranche_user_all_by_address": { - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "type": "string" - }, - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a LimitOrderTranche by index.", - "type": "object", - "required": [ - "limit_order_tranche" - ], - "properties": { - "limit_order_tranche": { - "type": "object", - "required": [ - "pair_id", - "tick_index", - "token_in", - "tranche_key" - ], - "properties": { - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - }, - "tranche_key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of LimitOrderTranche items for a given pairID / TokenIn combination.", - "type": "object", - "required": [ - "limit_order_tranche_all" - ], - "properties": { - "limit_order_tranche_all": { - "type": "object", - "required": [ - "pair_id", - "token_in" - ], - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - }, - "pair_id": { - "type": "string" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of UserDeposits items.", - "type": "object", - "required": [ - "user_deposit_all" - ], - "properties": { - "user_deposit_all": { - "type": "object", - "required": [ - "address", - "include_pool_data" - ], - "properties": { - "address": { - "type": "string" - }, - "include_pool_data": { - "type": "boolean" - }, - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of TickLiquidity items.", - "type": "object", - "required": [ - "tick_liquidity_all" - ], - "properties": { - "tick_liquidity_all": { - "type": "object", - "required": [ - "pair_id", - "token_in" - ], - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - }, - "pair_id": { - "type": "string" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a InactiveLimitOrderTranche by index.", - "type": "object", - "required": [ - "inactive_limit_order_tranche" - ], - "properties": { - "inactive_limit_order_tranche": { - "type": "object", - "required": [ - "pair_id", - "tick_index", - "token_in", - "tranche_key" - ], - "properties": { - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - }, - "tranche_key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of InactiveLimitOrderTranche items.", - "type": "object", - "required": [ - "inactive_limit_order_tranche_all" - ], - "properties": { - "inactive_limit_order_tranche_all": { - "type": "object", - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of PoolReserves items.", - "type": "object", - "required": [ - "pool_reserves_all" - ], - "properties": { - "pool_reserves_all": { - "type": "object", - "required": [ - "pair_id", - "token_in" - ], - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - }, - "pair_id": { - "type": "string" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a PoolReserve by index", - "type": "object", - "required": [ - "pool_reserves" - ], - "properties": { - "pool_reserves": { - "type": "object", - "required": [ - "fee", - "pair_id", - "tick_index", - "token_in" - ], - "properties": { - "fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries the simulated result of a multihop swap", - "type": "object", - "required": [ - "estimate_multi_hop_swap" - ], - "properties": { - "estimate_multi_hop_swap": { - "type": "object", - "required": [ - "amount_in", - "creator", - "exit_limit_price", - "pick_best_route", - "receiver", - "routes" - ], - "properties": { - "amount_in": { - "$ref": "#/definitions/Int128" - }, - "creator": { - "type": "string" - }, - "exit_limit_price": { - "$ref": "#/definitions/PrecDec" - }, - "pick_best_route": { - "type": "boolean" - }, - "receiver": { - "type": "string" - }, - "routes": { - "type": "array", - "items": { - "$ref": "#/definitions/MultiHopRoute" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries the simulated result of a PlaceLimit order", - "type": "object", - "required": [ - "estimate_place_limit_order" - ], - "properties": { - "estimate_place_limit_order": { - "type": "object", - "required": [ - "amount_in", - "creator", - "order_type", - "receiver", - "tick_index_in_to_out", - "token_in", - "token_out" - ], - "properties": { - "amount_in": { - "$ref": "#/definitions/Int128" - }, - "creator": { - "type": "string" - }, - "expiration_time": { - "type": [ - "integer", - "null" - ], - "format": "uint64", - "minimum": 0.0 - }, - "max_amount_out": { - "anyOf": [ - { - "$ref": "#/definitions/Int128" - }, - { - "type": "null" - } - ] - }, - "order_type": { - "$ref": "#/definitions/LimitOrderType" - }, - "receiver": { - "type": "string" - }, - "tick_index_in_to_out": { - "type": "integer", - "format": "int64" - }, - "token_in": { - "type": "string" - }, - "token_out": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a pool by pair, tick and fee", - "type": "object", - "required": [ - "pool" - ], - "properties": { - "pool": { - "type": "object", - "required": [ - "fee", - "pair_id", - "tick_index" - ], - "properties": { - "fee": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "pair_id": { - "type": "string" - }, - "tick_index": { - "type": "integer", - "format": "int64" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a pool by ID", - "type": "object", - "required": [ - "pool_by_id" - ], - "properties": { - "pool_by_id": { - "type": "object", - "required": [ - "pool_id" - ], - "properties": { - "pool_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a PoolMetadata by ID", - "type": "object", - "required": [ - "pool_metadata" - ], - "properties": { - "pool_metadata": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "description": "Queries a list of PoolMetadata items.", - "type": "object", - "required": [ - "pool_metadata_all" - ], - "properties": { - "pool_metadata_all": { - "type": "object", - "properties": { - "pagination": { - "anyOf": [ - { - "$ref": "#/definitions/PageRequest" - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "Int128": { - "description": "An implementation of i128 that is using strings for JSON encoding/decoding, such that the full i128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `i128` to get the value out:\n\n``` # use cosmwasm_std::Int128; let a = Int128::from(258i128); assert_eq!(a.i128(), 258); ```", - "type": "string" - }, - "LimitOrderType": { - "oneOf": [ - { - "description": "Good-til-Cancelled limit orders are hybrid maker and taker limit orders. They will attempt to trade the supplied AmountIn at the TickIndex or better. However, if they total AmountIn cannot be traded at the limit price they are remaining amount will be placed as a maker limit order. The proceeds from the taker portion are deposited into the user’s account immediately, however, the proceeds from the maker portion must be explicitly withdrawn via WithdrawLimitOrder.", - "type": "string", - "enum": [ - "GOOD_TIL_CANCELLED" - ] - }, - { - "description": "Fill-or-Kill limit orders are taker limit orders that either successfully swap 100% of the supplied AmountIn or return an error. If there is insufficient liquidity to complete the trade at or above the supplied TickIndex a Fill-or-Kill order will return an error `codespace: dex, code: 1134` ( ErrGoodTilOrderWithoutExpiration).", - "type": "string", - "enum": [ - "FILL_OR_KILL" - ] - }, - { - "description": "Immediate-or-Cancel limit orders are taker orders that will swap as much as of the AmountIn as possible given available liquidity above the supplied TickIndex. Unlike Fill-or-Kill orders they will still successfully complete even if they are only able to partially trade through the AmountIn at the TickIndex or better.", - "type": "string", - "enum": [ - "IMMEDIATE_OR_CANCEL" - ] - }, - { - "description": "Just-in-Time limit orders are an advanced maker limit order that provides tradeable liquidity for exactly one block. At the end of the same block in which the Just-in-Time order was submitted the order is canceled and any untraded portion will no longer be usable as active liquidity.", - "type": "string", - "enum": [ - "JUST_IN_TIME" - ] - }, - { - "description": "Good-til-Time limit order function exactly the same as Good-til-Cancelled limit orders first trying to trade as a taker limit order and then placing any remaining amount as a maker limit order. However, the maker portion of the limit order has a specified ExpirationTime. After the ExpirationTime the order will be cancelled and can no longer be traded against. When withdrawing a Good-til-Time limit order the user will receive both the successfully traded portion of the limit order (TokenOut) as well as any remaining untraded amount (TokenIn).", - "type": "string", - "enum": [ - "GOOD_TIL_TIME" - ] - } - ] - }, - "MarketMapQuery": { - "oneOf": [ - { - "description": "Parameters queries the parameters of the module.", - "type": "object", - "required": [ - "params" - ], - "properties": { - "params": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "last_updated" - ], - "properties": { - "last_updated": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "market_map" - ], - "properties": { - "market_map": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "market" - ], - "properties": { - "market": { - "type": "object", - "required": [ - "currency_pair" - ], - "properties": { - "currency_pair": { - "$ref": "#/definitions/CurrencyPair" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "MultiHopRoute": { - "type": "object", - "required": [ - "hops" - ], - "properties": { - "hops": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - }, - "OracleQuery": { - "oneOf": [ - { - "type": "object", - "required": [ - "get_all_currency_pairs" - ], - "properties": { - "get_all_currency_pairs": { - "type": "object", - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "get_price" - ], - "properties": { - "get_price": { - "type": "object", - "required": [ - "currency_pair" - ], - "properties": { - "currency_pair": { - "$ref": "#/definitions/CurrencyPair" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "get_prices" - ], - "properties": { - "get_prices": { - "type": "object", - "required": [ - "currency_pair_ids" - ], - "properties": { - "currency_pair_ids": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false - } - ] - }, - "PageRequest": { - "type": "object", - "required": [ - "count_total", - "key", - "limit", - "offset", - "reverse" - ], - "properties": { - "count_total": { - "description": "**count_total** is set to true to indicate that the result set should include a count of the total number of items available for pagination in UIs. count_total is only respected when offset is used. It is ignored when key is set.", - "type": "boolean" - }, - "key": { - "description": "**key** is a value returned in PageResponse.next_key to begin querying the next page most efficiently. Only one of offset or key should be set.", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "limit": { - "description": "**limit** is the total number of results to be returned in the result page. If left empty it will default to a value to be set by each app.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "offset": { - "description": "**offset** is a numeric offset that can be used when key is unavailable. It is less efficient than using key. Only one of offset or key should be set.", - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "reverse": { - "description": "reverse is set to true if results are to be returned in the descending order.", - "type": "boolean" - } - }, - "additionalProperties": false - }, - "PrecDec": { - "type": "object", - "required": [ - "i" - ], - "properties": { - "i": { - "type": "string" - } - }, - "additionalProperties": false - } - } -} diff --git a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs b/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs deleted file mode 100644 index 31ce2532..00000000 --- a/packages/neutron-sdk/src/bin/neutron-sdk-schema.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - // TODO: remove this file -} diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 092231e0..23ed7465 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,13 +1,7 @@ -use crate::{ - bindings::types::ProtobufAny, - interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem}, - sudo::msg::RequestPacketTimeoutHeight, - NeutronResult, -}; -use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg, DenomUnit, StdError, Uint128}; +use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg}; +use neutron_std::shim::Any; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_json_wasm::to_string; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] /// IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. @@ -226,7 +220,8 @@ pub struct UpgradeProposal { /// **plan** is a plan of upgrade. pub plan: Plan, /// **upgraded_client_state** is an upgraded client state. - pub upgraded_client_state: ProtobufAny, + // TODO: correct? + pub upgraded_client_state: Any, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] diff --git a/packages/neutron-sdk/src/bindings/types.rs b/packages/neutron-sdk/src/bindings/types.rs index 791731d7..3c92fe92 100644 --- a/packages/neutron-sdk/src/bindings/types.rs +++ b/packages/neutron-sdk/src/bindings/types.rs @@ -1,10 +1,8 @@ -use cosmwasm_std::{Binary, Coin}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::fmt::Write as _; -use crate::interchain_queries::types::QueryType; - +// TODO: do we need it? /// Encodes bytes slice into hex string pub fn encode_hex(bytes: &[u8]) -> String { let mut s = String::with_capacity(bytes.len() * 2); @@ -14,6 +12,7 @@ pub fn encode_hex(bytes: &[u8]) -> String { s } +// TODO: do we need it? /// Decodes hex string into bytes vec pub fn decode_hex(s: &str) -> Option> { (0..s.len()) @@ -22,40 +21,6 @@ pub fn decode_hex(s: &str) -> Option> { .collect() } -// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -// #[serde(rename_all = "snake_case")] -// pub struct RegisteredQuery { -// /// The unique id of the registered query. -// pub id: u64, -// /// The address that registered the query. -// pub owner: String, -// /// The KV-storage keys for which we want to get values from remote chain -// pub keys: Vec, -// /// The query type identifier (i.e. 'kv' or 'tx' for now) -// pub query_type: QueryType, -// /// The filter for transaction search ICQ -// pub transactions_filter: String, -// /// The IBC connection ID for getting ConsensusState to verify proofs. -// pub connection_id: String, -// /// Parameter that defines how often the query must be updated. -// pub update_period: u64, -// /// The local chain last block height when the query result was updated. -// #[serde(default)] -// pub last_submitted_result_local_height: u64, -// /// The remote chain last block height when the query result was updated. -// #[serde(default)] -// pub last_submitted_result_remote_height: Height, -// /// Amount of coins deposited for the query. -// #[serde(default)] -// pub deposit: Vec, -// /// Timeout before query becomes available for everybody to remove. -// #[serde(default)] -// pub submit_timeout: u64, -// /// The local chain height when the query was registered. -// #[serde(default)] -// pub registered_at_height: u64, -// } - #[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct Height { @@ -66,188 +31,3 @@ pub struct Height { #[serde(default)] pub revision_height: u64, } - -/// InterchainQueryResult is a result data for a registered query -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct InterchainQueryResult { - /// **kv_results** is a raw key-value pairs of query result - pub kv_results: Vec, - - /// **height** is a height of remote chain - pub height: u64, - - #[serde(default)] - /// **revision** is a revision of remote chain - pub revision: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// Describes value in the Cosmos-SDK KV-storage on remote chain -pub struct StorageValue { - /// **storage_prefix** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.) - pub storage_prefix: String, - - /// **key** is a key under which the **value** is stored in the storage on remote chain - pub key: Binary, - - /// **value** is a value which is stored under the **key** in the storage on remote chain - pub value: Binary, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// Acknowledgement Failure of sudo handler; can be resubmitted. -pub struct Failure { - /// **address** of the failed contract - pub address: String, - /// **id** of the failure under specific address - pub id: u64, - /// **ack_type** is an acknowledgement type ('ack' or 'timeout') - pub ack_type: String, - /// **packet** is an IBC Packet that was sent - pub packet: Option, - /// **ack** is an acknowledgement data - pub ack: Option, -} - -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] -#[serde(rename_all = "snake_case")] -/// IBC packet -pub struct Packet { - /// **sequence** number of packet in ordered channel - pub sequence: u64, - - /// **source_port** of packet packet - pub source_port: String, - - /// **source_channel** of a packet - pub source_channel: String, - - /// **destination_port** of a packet - pub destination_port: String, - - /// **destination_channel** of a packet - pub destination_channel: String, - - /// **data** of a packet - pub data: Binary, - - /// **timeout_height** of a packet - pub timeout_height: Option, - - /// **timeout_timestamp** of a packet - pub timeout_timestamp: Option, -} - -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] -#[serde(rename_all = "snake_case")] -/// IBC message Acknowledgement -pub struct Acknowledgement { - #[serde(rename(serialize = "response", deserialize = "Response"))] - pub response: AcknowledgementResponse, -} - -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] -#[serde(rename_all = "snake_case")] -/// IBC message acknowledgement response -pub enum AcknowledgementResponse { - /// Error response - Error(String), - /// Successful response with result as encoded binary - Result(Binary), -} - -#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)] -#[serde(rename_all = "snake_case")] -/// Type for wrapping any protobuf message -pub struct ProtobufAny { - /// **type_url** describes the type of the serialized message - pub type_url: String, - - /// **value** must be a valid serialized protocol buffer of the above specified type - pub value: Binary, -} - -impl ProtobufAny { - /// Helper to create new ProtobufAny type: - /// * **type_url** describes the type of the serialized message - /// * **value** must be a valid serialized protocol buffer of the above specified type - pub fn new(type_url: String, value: Binary) -> Self { - ProtobufAny { type_url, value } - } -} - -const KV_PATH_KEY_DELIMITER: &str = "/"; -const KV_KEYS_DELIMITER: &str = ","; - -// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -// #[serde(rename_all = "snake_case")] -// /// Describes a KV key for which you want to get value from the storage on remote chain -// pub struct KVKey { -// /// **path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.) -// pub path: String, -// -// /// **key** is a key you want to read from the storage -// pub key: Binary, -// } -// -// impl KVKey { -// /// Creates KVKey from string -// /// Returns None on failure -// pub fn from_string>(s: S) -> Option { -// let split: Vec<&str> = s.as_ref().split(KV_PATH_KEY_DELIMITER).collect(); -// if split.len() < 2 { -// return None; -// } -// -// Some(KVKey { -// path: split[0].to_string(), -// key: Binary::new(decode_hex(split[1])?), -// }) -// } -// } -// -// #[allow(clippy::from_over_into)] -// impl Into for &KVKey { -// fn into(self) -> String { -// let mut s = String::with_capacity( -// self.path.len() + KV_PATH_KEY_DELIMITER.len() + self.key.len() * 2, -// ); -// -// s.push_str(&self.path); -// s.push_str(KV_PATH_KEY_DELIMITER); -// s.push_str(&encode_hex(&self.key)); -// -// s -// } -// } -// -// /// KVKeys describes vec of KVKey structures -// pub struct KVKeys(pub Vec); -// -// impl KVKeys { -// /// Creates KVKeys from string -// /// Returns None on failure -// pub fn from_string>(s: S) -> Option { -// let split = s.as_ref().split(KV_KEYS_DELIMITER); -// -// Some(KVKeys( -// split -// .map(KVKey::from_string) -// .collect::>>()?, -// )) -// } -// } -// -// #[allow(clippy::from_over_into)] -// impl Into for KVKeys { -// fn into(self) -> String { -// self.0 -// .iter() -// .map(|kv| kv.into()) -// .collect::>() -// .join(KV_KEYS_DELIMITER) -// } -// } diff --git a/packages/neutron-sdk/src/interchain_queries/types.rs b/packages/neutron-sdk/src/interchain_queries/types.rs index ddc53a78..7225bbbf 100644 --- a/packages/neutron-sdk/src/interchain_queries/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/types.rs @@ -1,7 +1,4 @@ -use crate::{ - // bindings::types::{StorageValue}, - errors::error::NeutronResult, -}; +use crate::errors::error::NeutronResult; use cosmwasm_std::{from_json, StdError, Uint128}; use neutron_std::types::neutron::interchainqueries::{KvKey, StorageValue}; use schemars::{JsonSchema, _serde_json::Value}; diff --git a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs index f24fb6bc..6bdc90da 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs @@ -9,7 +9,7 @@ use crate::interchain_queries::v045::types::{ }; use crate::NeutronError; use cosmos_sdk_proto::cosmos::staking::v1beta1::Commission as ValidatorCommission; -use cosmwasm_std::{Binary, Decimal, Uint128}; +use cosmwasm_std::{Decimal, Uint128}; use neutron_std::types::neutron::interchainqueries::KvKey; use std::str::{from_utf8, FromStr}; diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index aae2f460..c7ba23e0 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -12,7 +12,6 @@ pub mod bindings; mod errors; pub mod interchain_queries; pub mod interchain_txs; -mod serde; pub mod sudo; pub use errors::error::{NeutronError, NeutronResult}; diff --git a/packages/neutron-sdk/src/serde/mod.rs b/packages/neutron-sdk/src/serde/mod.rs deleted file mode 100644 index 5461e99a..00000000 --- a/packages/neutron-sdk/src/serde/mod.rs +++ /dev/null @@ -1,104 +0,0 @@ -pub mod as_str { - use serde::{de, Deserialize, Deserializer, Serializer}; - use std::{fmt::Display, str::FromStr}; - - pub fn deserialize<'de, T, D>(deserializer: D) -> Result - where - T: FromStr, - T::Err: Display, - D: Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - T::from_str(&s).map_err(de::Error::custom) - } - - pub fn serialize(value: &T, serializer: S) -> Result - where - S: Serializer, - T: Display, - { - serializer.serialize_str(&value.to_string()) - } -} - -pub mod as_str_vec { - use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - use std::{fmt::Display, str::FromStr}; - - pub fn deserialize<'de, T, D>(deserializer: D) -> Result, D::Error> - where - T: FromStr, - T::Err: Display, - D: Deserializer<'de>, - { - let vec_of_strings: Vec = Vec::deserialize(deserializer)?; - vec_of_strings - .into_iter() - .map(|s| T::from_str(&s).map_err(de::Error::custom)) - .collect() - } - - pub fn serialize(values: &[T], serializer: S) -> Result - where - S: Serializer, - T: Display, - { - let vec_of_strings: Vec = values.iter().map(|value| value.to_string()).collect(); - vec_of_strings.serialize(serializer) - } -} - -pub mod as_base64_encoded_string { - use cosmwasm_std::Binary; - use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - - pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> - where - D: Deserializer<'de>, - { - let encoded_string = String::deserialize(deserializer)?; - Binary::from_base64(&encoded_string) - .map(|b| b.to_vec()) - .map_err(de::Error::custom) - } - - pub fn serialize(values: &[u8], serializer: S) -> Result - where - S: Serializer, - { - Binary::new(values.to_vec()) - .to_base64() - .serialize(serializer) - } -} - -pub mod as_option_base64_encoded_string { - use cosmwasm_std::Binary; - use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; - - pub fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error> - where - D: Deserializer<'de>, - { - let encoded_string: Option = Option::deserialize(deserializer)?; - match encoded_string { - Some(s) => Binary::from_base64(&s) - .map(|b| Some(b.to_vec())) - .map_err(de::Error::custom), - None => Ok(None), - } - } - - pub fn serialize(value: &Option>, serializer: S) -> Result - where - S: Serializer, - { - match value { - Some(vec) => { - let encoded_string = Binary::new(vec.clone()).to_base64(); - encoded_string.serialize(serializer) - } - None => serializer.serialize_none(), - } - } -} From f01ca63bb200a51a147bd155278daaa71867d542 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:42:31 +0400 Subject: [PATCH 10/35] fix compile and warning errors --- packages/neutron-sdk/src/bindings/msg.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 23ed7465..ba12f506 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -25,9 +25,9 @@ pub enum ChannelOrdering { OrderOrdered, } -impl Into for ChannelOrdering { - fn into(self) -> i32 { - match self { +impl From for i32 { + fn from(ordering: ChannelOrdering) -> Self { + match ordering { ChannelOrdering::OrderUnordered => 1, ChannelOrdering::OrderOrdered => 2, } From a097d934ce27531be3bb7368f5fac90268a52f22 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 11 Oct 2024 18:44:42 +0400 Subject: [PATCH 11/35] fix clippy errors --- contracts/ibc_transfer/src/contract.rs | 4 ++-- contracts/neutron_interchain_queries/src/contract.rs | 3 +-- packages/neutron-sdk/src/interchain_queries/queries.rs | 4 ++-- packages/neutron-sdk/src/interchain_queries/v045/helpers.rs | 2 +- .../src/interchain_queries/v045/register_queries.rs | 4 +--- packages/neutron-sdk/src/interchain_queries/v045/types.rs | 6 +++--- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index c506225f..fc139f4d 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -155,7 +155,7 @@ fn execute_send( }), timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { revision_number: 2, - revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), + revision_height: timeout_height.unwrap_or(DEFAULT_TIMEOUT_HEIGHT), }), timeout_timestamp: 0, memo: "".to_string(), @@ -172,7 +172,7 @@ fn execute_send( }), timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height { revision_number: 2, - revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT), + revision_height: timeout_height.unwrap_or(DEFAULT_TIMEOUT_HEIGHT), }), timeout_timestamp: 0, memo: "".to_string(), diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index b6ab93b4..43198306 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -205,8 +205,7 @@ pub fn register_balances_query( update_period: u64, ) -> NeutronResult { let msg: CosmosMsg = - new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)? - .into(); + new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?; Ok(Response::new().add_message(msg)) } diff --git a/packages/neutron-sdk/src/interchain_queries/queries.rs b/packages/neutron-sdk/src/interchain_queries/queries.rs index 671ce519..664ff624 100644 --- a/packages/neutron-sdk/src/interchain_queries/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/queries.rs @@ -11,7 +11,7 @@ pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<() let expected_str: String = expected.into(); if actual != expected_str { return Err(NeutronError::InvalidQueryType { - query_type: actual.into(), + query_type: actual, }); } Ok(()) @@ -45,7 +45,7 @@ pub fn get_raw_interchain_query_result( interchain_query_id: u64, ) -> NeutronResult { let querier = InterchainqueriesQuerier::new(&deps.querier); - let query_res = querier.query_result(interchain_query_id.into())?; + let query_res = querier.query_result(interchain_query_id)?; let res = query_res .result .ok_or_else(|| StdError::generic_err("no result in registered query"))?; diff --git a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs index 6bdc90da..351aaabe 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/helpers.rs @@ -321,7 +321,7 @@ pub fn get_update_time(commission: &Option) -> Option } /// Returns denom for total supply from StorageValue key -pub fn get_total_supply_denom(denom: &Vec) -> Option { +pub fn get_total_supply_denom(denom: &[u8]) -> Option { if denom.len() < 2 { return None; } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs index 9d30bf85..1b677b08 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs @@ -503,9 +503,7 @@ pub fn register_interchain_account( connection_id, interchain_account_id, register_fee, - ordering: ordering - .unwrap_or_else(|| ChannelOrdering::OrderOrdered) - .into(), + ordering: ordering.unwrap_or(ChannelOrdering::OrderOrdered).into(), } .into()) } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/types.rs b/packages/neutron-sdk/src/interchain_queries/v045/types.rs index 77d04554..ba0bbc65 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/types.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/types.rs @@ -111,11 +111,11 @@ impl KVReconstruct for Balances { for kv in storage_values { let (_, denom) = deconstruct_account_denom_balance_key(kv.key.to_vec())?; - let amount = if kv.value.len() > 0 { + let amount = if kv.value.is_empty() { + 0u128 + } else { let balance: CosmosCoin = CosmosCoin::decode(kv.value.as_slice())?; Uint128::from_str(balance.amount.as_str())?.u128() - } else { - 0u128 }; coins.push(Coin::new(amount, denom)) From 236d124be8ace7bfc9a3e656e265f2e9207eefe9 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 14:27:48 +0400 Subject: [PATCH 12/35] extract interchain helpers out --- contracts/ibc_transfer/Cargo.toml | 2 +- contracts/ibc_transfer/src/contract.rs | 34 +++--- .../src/contract.rs | 9 +- .../neutron_interchain_txs/src/contract.rs | 10 +- packages/neutron-sdk/src/bindings/msg.rs | 18 +-- .../src/interchain_queries/helpers.rs | 84 +++++++++++++- .../src/interchain_queries/queries.rs | 4 +- .../v045/register_queries.rs | 105 +----------------- .../neutron-sdk/src/interchain_txs/helpers.rs | 23 +++- 9 files changed, 136 insertions(+), 153 deletions(-) diff --git a/contracts/ibc_transfer/Cargo.toml b/contracts/ibc_transfer/Cargo.toml index d75daf42..a9e57178 100644 --- a/contracts/ibc_transfer/Cargo.toml +++ b/contracts/ibc_transfer/Cargo.toml @@ -26,7 +26,7 @@ serde-json-wasm = { workspace = true } cw-storage-plus = { workspace = true, features = ["iterator"]} cosmwasm-schema = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } -neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } +neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "f8168e5727bf8d397b144e700b9c22af40c9710c" } [dev-dependencies] cosmwasm-schema = { workspace = true } diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index fc139f4d..a8858cbf 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -1,3 +1,10 @@ +use crate::{ + msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, + state::{ + read_reply_payload, read_sudo_payload, save_reply_payload, save_sudo_payload, + IBC_SUDO_ID_RANGE_END, IBC_SUDO_ID_RANGE_START, + }, +}; use cosmwasm_std::{ entry_point, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, @@ -5,18 +12,9 @@ use cosmwasm_std::{ use cw2::set_contract_version; use neutron_sdk::interchain_txs::helpers::decode_message_response; use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg}; -use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; -// TODO: rename -use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; +use neutron_std::types::cosmos::base::v1beta1::Coin as SDKCoin; use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; -// TODO: rename -use crate::{ - msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}, - state::{ - read_reply_payload, read_sudo_payload, save_reply_payload, save_sudo_payload, - IBC_SUDO_ID_RANGE_END, IBC_SUDO_ID_RANGE_START, - }, -}; +use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -149,7 +147,7 @@ fn execute_send( source_channel: channel.clone(), sender: env.contract.address.to_string(), receiver: to.clone(), - token: Some(SuperCoin { + token: Some(SDKCoin { denom: denom.clone(), amount: amount.to_string(), }), @@ -166,7 +164,7 @@ fn execute_send( source_channel: channel, sender: env.contract.address.to_string(), receiver: to, - token: Some(SuperCoin { + token: Some(SDKCoin { denom, amount: (2 * amount).to_string(), }), @@ -286,12 +284,12 @@ fn query_min_fee(deps: Deps) -> StdResult { Ok(min_fee) } -fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { - neutron_std::types::neutron::feerefunder::Fee { +fn min_ntrn_ibc_fee(fee: Fee) -> Fee { + Fee { recv_fee: fee .recv_fee .iter() - .map(|r| SuperCoin { + .map(|r| SDKCoin { denom: r.denom.to_string(), amount: r.amount.clone(), }) @@ -299,7 +297,7 @@ fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { ack_fee: fee .ack_fee .iter() - .map(|r| SuperCoin { + .map(|r| SDKCoin { denom: r.denom.to_string(), amount: r.amount.clone(), }) @@ -308,7 +306,7 @@ fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { timeout_fee: fee .timeout_fee .iter() - .map(|r| SuperCoin { + .map(|r| SDKCoin { denom: r.denom.to_string(), amount: r.amount.clone(), }) diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 43198306..6db7b11b 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -8,17 +8,16 @@ use cosmwasm_std::{ use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; use neutron_std::types::neutron::interchainqueries::{KvKey, RegisteredQuery}; -// TODO: fix name -use neutron_sdk::interchain_queries::v045::register_queries::{ - remove_interchain_query as helpers_remove_interchain_query, - update_interchain_query as helpers_update_interchain_query, -}; use crate::msg::{ Cw20BalanceResponse, ExecuteMsg, GetRecipientTxsResponse, InstantiateMsg, MigrateMsg, QueryMsg, }; use crate::state::{Transfer, RECIPIENT_TXS, TRANSFERS}; use neutron_sdk::bindings::types::Height; +use neutron_sdk::interchain_queries::helpers::{ + remove_interchain_query as helpers_remove_interchain_query, + update_interchain_query as helpers_update_interchain_query, +}; use neutron_sdk::interchain_queries::v047::queries::{ query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, query_government_proposals, query_staking_validators, query_unbonding_delegations, diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 4697af1a..dcc8cb54 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -13,14 +13,14 @@ use crate::storage::{ ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; use neutron_sdk::bindings::msg::ChannelOrdering; -use neutron_sdk::interchain_queries::v045::register_queries::register_interchain_account; +use neutron_sdk::interchain_txs::helpers::register_interchain_account; use neutron_sdk::{ interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, sudo::msg::{RequestPacket, SudoMsg}, NeutronError, NeutronResult, }; -use neutron_std::types::cosmos::base::v1beta1::Coin as SuperCoin; +use neutron_std::types::cosmos::base::v1beta1::Coin as SDKCoin; use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_std::types::cosmos::staking::v1beta1::{ MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, @@ -659,7 +659,7 @@ fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { recv_fee: fee .recv_fee .iter() - .map(|r| SuperCoin { + .map(|r| SDKCoin { denom: r.denom.to_string(), amount: r.amount.clone(), }) @@ -667,7 +667,7 @@ fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { ack_fee: fee .ack_fee .iter() - .map(|r| SuperCoin { + .map(|r| SDKCoin { denom: r.denom.to_string(), amount: r.amount.clone(), }) @@ -676,7 +676,7 @@ fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { timeout_fee: fee .timeout_fee .iter() - .map(|r| SuperCoin { + .map(|r| SDKCoin { denom: r.denom.to_string(), amount: r.amount.clone(), }) diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index ba12f506..bd2b4cd7 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,24 +1,8 @@ -use cosmwasm_std::{Binary, Coin, CosmosMsg, CustomMsg}; +use cosmwasm_std::{Binary, CosmosMsg, CustomMsg}; use neutron_std::shim::Any; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -/// IbcFee defines struct for fees that refund the relayer for `SudoMsg` messages submission. -/// Unused fee kind will be returned back to message sender. -/// Please refer to these links for more information: -/// IBC transaction structure - -/// General mechanics of fee payments - -pub struct IbcFee { - /// **recv_fee** currently is used for compatibility with ICS-29 interface only and must be set to zero (i.e. 0untrn), - /// because Neutron's fee module can't refund relayer for submission of Recv IBC packets due to compatibility with target chains. - pub recv_fee: Vec, - /// **ack_fee** is an amount of coins to refund relayer for submitting ack message for a particular IBC packet. - pub ack_fee: Vec, - /// **timeout_fee** amount of coins to refund relayer for submitting timeout message for a particular IBC packet. - pub timeout_fee: Vec, -} - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] pub enum ChannelOrdering { OrderUnordered, diff --git a/packages/neutron-sdk/src/interchain_queries/helpers.rs b/packages/neutron-sdk/src/interchain_queries/helpers.rs index 9f64e857..abe47ebe 100644 --- a/packages/neutron-sdk/src/interchain_queries/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/helpers.rs @@ -1,6 +1,13 @@ use crate::errors::error::{NeutronError, NeutronResult}; -use crate::interchain_queries::types::{AddressBytes, MAX_ADDR_LEN}; -use cosmwasm_std::{StdError, Uint128, Uint256}; +use crate::interchain_queries::types::{ + AddressBytes, QueryPayload, QueryType, TransactionFilterItem, MAX_ADDR_LEN, +}; +use cosmwasm_std::{Addr, CosmosMsg, StdError, Uint128, Uint256}; +use neutron_std::types::neutron::interchainqueries::{ + KvKey, MsgRegisterInterchainQuery, MsgRemoveInterchainQueryRequest, + MsgUpdateInterchainQueryRequest, +}; +use serde_json_wasm::to_string; /// Decodes a bech32 encoded string and converts to base64 encoded bytes /// @@ -37,3 +44,76 @@ pub fn uint256_to_u128(value: Uint256) -> Result { .map_err(|_| StdError::generic_err("Uint256 value exceeds u128 limits"))?; Ok(converted.u128()) } + +/// Basic helper to define a register interchain query message: +/// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload: +/// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get +/// values from remote chain; +/// - when the query enum is 'tx' then payload is the filters for transaction search ICQ, +/// maximum allowed number of filters is 32. +/// * **connection_id** is an IBC connection identifier between Neutron and remote chain; +/// * **update_period** is used to say how often (in neutron blocks) the query must be updated. +pub fn register_interchain_query( + contract: Addr, + query: QueryPayload, + connection_id: String, + update_period: u64, +) -> NeutronResult { + Ok(match query { + QueryPayload::KV(keys) => MsgRegisterInterchainQuery { + sender: contract.to_string(), + query_type: QueryType::KV.into(), + keys, + transactions_filter: String::new(), + connection_id, + update_period, + }, + QueryPayload::TX(transactions_filters) => MsgRegisterInterchainQuery { + sender: contract.to_string(), + query_type: QueryType::TX.into(), + keys: vec![], + transactions_filter: to_string(&transactions_filters) + .map_err(|e| StdError::generic_err(e.to_string()))?, + connection_id, + update_period, + }, + } + .into()) +} + +/// Basic helper to define a update interchain query message: +/// * **query_id** is ID of the query we want to update; +/// * **new_keys** is encoded keys to query; +/// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated. +pub fn update_interchain_query( + contract: Addr, + query_id: u64, + new_keys: Vec, + new_update_period: u64, + new_transactions_filter: Option>, +) -> NeutronResult { + Ok(MsgUpdateInterchainQueryRequest { + sender: contract.to_string(), + query_id, + new_keys, + new_update_period, + new_transactions_filter: match new_transactions_filter { + Some(filters) => { + to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))? + } + // TODO: check if passing empty string is correct + None => "".to_string(), + }, + } + .into()) +} + +/// Basic helper to define a remove interchain query message: +/// * **query_id** is ID of the query we want to remove. +pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult { + Ok(MsgRemoveInterchainQueryRequest { + sender: contract.to_string(), + query_id, + } + .into()) +} diff --git a/packages/neutron-sdk/src/interchain_queries/queries.rs b/packages/neutron-sdk/src/interchain_queries/queries.rs index 664ff624..15736e12 100644 --- a/packages/neutron-sdk/src/interchain_queries/queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/queries.rs @@ -10,9 +10,7 @@ use neutron_std::types::neutron::interchainqueries::{ pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<()> { let expected_str: String = expected.into(); if actual != expected_str { - return Err(NeutronError::InvalidQueryType { - query_type: actual, - }); + return Err(NeutronError::InvalidQueryType { query_type: actual }); } Ok(()) } diff --git a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs index 1b677b08..043d0c72 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs @@ -1,6 +1,6 @@ -use crate::bindings::msg::ChannelOrdering; +use crate::interchain_queries::helpers::{register_interchain_query, update_interchain_query}; use crate::interchain_queries::types::{ - QueryPayload, QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, + QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; use crate::interchain_queries::v045::types::{ BANK_STORE_KEY, DISTRIBUTION_STORE_KEY, HEIGHT_FIELD, KEY_BOND_DENOM, PARAMS_STORE_KEY, @@ -16,14 +16,8 @@ use crate::{ create_validator_signing_info_key, create_wasm_contract_store_key, }, }; -use cosmwasm_std::{Addr, CosmosMsg, StdError}; -use neutron_std::types::cosmos::base::v1beta1::Coin; -use neutron_std::types::neutron::interchainqueries::{ - KvKey, MsgRegisterInterchainQuery, MsgRemoveInterchainQueryRequest, - MsgUpdateInterchainQueryRequest, -}; -use neutron_std::types::neutron::interchaintxs::v1::MsgRegisterInterchainAccount; -use serde_json_wasm::to_string; +use cosmwasm_std::{Addr, CosmosMsg}; +use neutron_std::types::neutron::interchainqueries::KvKey; /// Creates a message to register an Interchain Query to get balance of account on remote chain for list of denoms /// @@ -416,94 +410,3 @@ pub fn new_register_transfers_query_msg( update_period, ) } - -/// Basic helper to define a register interchain query message: -/// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload: -/// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get -/// values from remote chain; -/// - when the query enum is 'tx' then payload is the filters for transaction search ICQ, -/// maximum allowed number of filters is 32. -/// * **connection_id** is an IBC connection identifier between Neutron and remote chain; -/// * **update_period** is used to say how often (in neutron blocks) the query must be updated. -fn register_interchain_query( - contract: Addr, - query: QueryPayload, - connection_id: String, - update_period: u64, -) -> NeutronResult { - Ok(match query { - QueryPayload::KV(keys) => MsgRegisterInterchainQuery { - sender: contract.to_string(), - query_type: QueryType::KV.into(), - keys, - transactions_filter: String::new(), - connection_id, - update_period, - }, - QueryPayload::TX(transactions_filters) => MsgRegisterInterchainQuery { - sender: contract.to_string(), - query_type: QueryType::TX.into(), - keys: vec![], - transactions_filter: to_string(&transactions_filters) - .map_err(|e| StdError::generic_err(e.to_string()))?, - connection_id, - update_period, - }, - } - .into()) -} - -/// Basic helper to define a update interchain query message: -/// * **query_id** is ID of the query we want to update; -/// * **new_keys** is encoded keys to query; -/// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated. -pub fn update_interchain_query( - contract: Addr, - query_id: u64, - new_keys: Vec, - new_update_period: u64, - new_transactions_filter: Option>, -) -> NeutronResult { - Ok(MsgUpdateInterchainQueryRequest { - sender: contract.to_string(), - query_id, - new_keys, - new_update_period, - new_transactions_filter: match new_transactions_filter { - Some(filters) => { - to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))? - } - // TODO: check if passing empty string is correct - None => "".to_string(), - }, - } - .into()) -} - -/// Basic helper to define a remove interchain query message: -/// * **query_id** is ID of the query we want to remove. -pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult { - Ok(MsgRemoveInterchainQueryRequest { - sender: contract.to_string(), - query_id, - } - .into()) -} - -// TODO: comment -pub fn register_interchain_account( - contract: Addr, - connection_id: String, - interchain_account_id: String, - register_fee: Vec, - ordering: Option, -) -> NeutronResult { - Ok(MsgRegisterInterchainAccount { - from_address: contract.to_string(), - connection_id, - interchain_account_id, - register_fee, - ordering: ordering.unwrap_or(ChannelOrdering::OrderOrdered).into(), - } - .into()) -} diff --git a/packages/neutron-sdk/src/interchain_txs/helpers.rs b/packages/neutron-sdk/src/interchain_txs/helpers.rs index 9cecc007..2411b723 100644 --- a/packages/neutron-sdk/src/interchain_txs/helpers.rs +++ b/packages/neutron-sdk/src/interchain_txs/helpers.rs @@ -1,5 +1,9 @@ +use crate::bindings::msg::ChannelOrdering; +use crate::NeutronResult; use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{StdError, StdResult}; +use cosmwasm_std::{Addr, CosmosMsg, StdError, StdResult}; +use neutron_std::types::cosmos::base::v1beta1::Coin; +use neutron_std::types::neutron::interchaintxs::v1::MsgRegisterInterchainAccount; /// Decodes protobuf any item into T structure pub fn decode_message_response(item: &Vec) -> StdResult { @@ -21,3 +25,20 @@ pub fn get_port_id>(contract_address: R, interchain_account_id: R) + ICA_OWNER_DELIMITER + interchain_account_id.as_ref() } + +pub fn register_interchain_account( + contract: Addr, + connection_id: String, + interchain_account_id: String, + register_fee: Vec, + ordering: Option, +) -> NeutronResult { + Ok(MsgRegisterInterchainAccount { + from_address: contract.to_string(), + connection_id, + interchain_account_id, + register_fee, + ordering: ordering.unwrap_or(ChannelOrdering::OrderOrdered).into(), + } + .into()) +} From 716ae7cf4913b1cfea34d49a9d74f898b3b1c179 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 15:06:09 +0400 Subject: [PATCH 13/35] use workspace for neutron-std --- Cargo.toml | 1 + contracts/ibc_transfer/Cargo.toml | 2 +- contracts/neutron_interchain_queries/Cargo.toml | 3 +-- contracts/neutron_interchain_txs/Cargo.toml | 3 +-- packages/neutron-sdk/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e49faa4f..c6a1089e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ overflow-checks = true [workspace.dependencies] cosmwasm-std = "2.1.0" +neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "feat/clean-bindings" } cosmwasm-schema = { version = "2.1.0", default-features = false } cw2 = "2.0.0" cw-storage-plus = "2.0.0" diff --git a/contracts/ibc_transfer/Cargo.toml b/contracts/ibc_transfer/Cargo.toml index a9e57178..6835cf5f 100644 --- a/contracts/ibc_transfer/Cargo.toml +++ b/contracts/ibc_transfer/Cargo.toml @@ -26,7 +26,7 @@ serde-json-wasm = { workspace = true } cw-storage-plus = { workspace = true, features = ["iterator"]} cosmwasm-schema = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } -neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "f8168e5727bf8d397b144e700b9c22af40c9710c" } +neutron-std = { workspace = true } [dev-dependencies] cosmwasm-schema = { workspace = true } diff --git a/contracts/neutron_interchain_queries/Cargo.toml b/contracts/neutron_interchain_queries/Cargo.toml index 25d9fd5b..fa49e2b3 100644 --- a/contracts/neutron_interchain_queries/Cargo.toml +++ b/contracts/neutron_interchain_queries/Cargo.toml @@ -27,8 +27,7 @@ cw-storage-plus = { workspace = true } serde-json-wasm = { workspace = true } prost-types = { workspace = true } cosmwasm-schema = { workspace = true } -# TODO: use workspace everywhere? -neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } +neutron-std = { workspace = true } [dev-dependencies] base64 = { workspace = true } diff --git a/contracts/neutron_interchain_txs/Cargo.toml b/contracts/neutron_interchain_txs/Cargo.toml index 54c4358f..4b2b3984 100644 --- a/contracts/neutron_interchain_txs/Cargo.toml +++ b/contracts/neutron_interchain_txs/Cargo.toml @@ -27,5 +27,4 @@ cosmos-sdk-proto = { workspace = true } neutron-sdk = { path = "../../packages/neutron-sdk", default-features = false } prost-types = { workspace = true } cosmwasm-schema = { workspace = true } -# TODO: fixme -neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } +neutron-std = { workspace = true } \ No newline at end of file diff --git a/packages/neutron-sdk/Cargo.toml b/packages/neutron-sdk/Cargo.toml index 62ff3095..dc620d12 100644 --- a/packages/neutron-sdk/Cargo.toml +++ b/packages/neutron-sdk/Cargo.toml @@ -25,7 +25,7 @@ prost-types = { workspace = true } tendermint-proto = { workspace = true } speedate = { workspace = true } chrono = { version = "0.4.22", default-features = false } -neutron-std = { git = "https://github.com/neutron-org/neutron-std", rev = "cc49ece967353bcae7ad29ce04f75d2cc167b028" } +neutron-std = { workspace = true } neutron-std-derive = { version = "0.20.1", path = "../neutron-std-derive" } [dev-dependencies] From a329bd96f9ed2d4d43fe01582f0e4d5a61820c67 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 15:34:59 +0400 Subject: [PATCH 14/35] add submit_tx helper --- .../neutron_interchain_txs/src/contract.rs | 4 +-- .../neutron-sdk/src/interchain_txs/helpers.rs | 32 ++++++++++++++++++- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index dcc8cb54..bf10056a 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -654,8 +654,8 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { } } -fn min_ntrn_ibc_fee(fee: Fee) -> neutron_std::types::neutron::feerefunder::Fee { - neutron_std::types::neutron::feerefunder::Fee { +fn min_ntrn_ibc_fee(fee: Fee) -> Fee { + Fee { recv_fee: fee .recv_fee .iter() diff --git a/packages/neutron-sdk/src/interchain_txs/helpers.rs b/packages/neutron-sdk/src/interchain_txs/helpers.rs index 2411b723..5e4d0027 100644 --- a/packages/neutron-sdk/src/interchain_txs/helpers.rs +++ b/packages/neutron-sdk/src/interchain_txs/helpers.rs @@ -2,8 +2,10 @@ use crate::bindings::msg::ChannelOrdering; use crate::NeutronResult; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{Addr, CosmosMsg, StdError, StdResult}; +use neutron_std::shim::Any; use neutron_std::types::cosmos::base::v1beta1::Coin; -use neutron_std::types::neutron::interchaintxs::v1::MsgRegisterInterchainAccount; +use neutron_std::types::neutron::feerefunder::Fee; +use neutron_std::types::neutron::interchaintxs::v1::{MsgRegisterInterchainAccount, MsgSubmitTx}; /// Decodes protobuf any item into T structure pub fn decode_message_response(item: &Vec) -> StdResult { @@ -42,3 +44,31 @@ pub fn register_interchain_account( } .into()) } + +/// Basic helper to define a submit tx message: +/// * **contract** is a contract that is sending the message +/// * **connection_id** is an IBC connection identifier between Neutron and remote chain; +/// * **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs; +/// * **msgs** is a list of protobuf encoded Cosmos-SDK messages you want to execute on remote chain; +/// * **memo** is a memo you want to attach to your interchain transaction. It behaves like a memo in usual Cosmos transaction; +/// * **timeout** is a timeout in seconds after which the packet times out. +/// * **fee** is a fee that is used for different kinds of callbacks. Unused fee types will be returned to msg sender. +pub fn submit_tx( + contract: Addr, + connection_id: String, + interchain_account_id: String, + msgs: Vec, + memo: String, + timeout: u64, + fee: Fee, +) -> CosmosMsg { + MsgSubmitTx { + from_address: contract.to_string(), + connection_id, + interchain_account_id, + msgs, + memo, + timeout, + fee: Some(fee), + }.into() +} From bdaa2d4eebe464ff048499517092412a404317ae Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 15:48:55 +0400 Subject: [PATCH 15/35] cleanup return func --- contracts/neutron_interchain_txs/src/contract.rs | 2 +- packages/neutron-sdk/src/interchain_txs/helpers.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index bf10056a..05f7ab7d 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -207,7 +207,7 @@ fn execute_register_ica( interchain_account_id.clone(), register_fee, ordering, - )?; + ); let key = get_port_id(&env.contract.address.to_string(), &interchain_account_id); // we are saving empty data here because we handle response of registering ICA in sudo_open_ack method INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?; diff --git a/packages/neutron-sdk/src/interchain_txs/helpers.rs b/packages/neutron-sdk/src/interchain_txs/helpers.rs index 5e4d0027..09d23a47 100644 --- a/packages/neutron-sdk/src/interchain_txs/helpers.rs +++ b/packages/neutron-sdk/src/interchain_txs/helpers.rs @@ -1,5 +1,4 @@ use crate::bindings::msg::ChannelOrdering; -use crate::NeutronResult; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{Addr, CosmosMsg, StdError, StdResult}; use neutron_std::shim::Any; @@ -34,15 +33,15 @@ pub fn register_interchain_account( interchain_account_id: String, register_fee: Vec, ordering: Option, -) -> NeutronResult { - Ok(MsgRegisterInterchainAccount { +) -> CosmosMsg { + MsgRegisterInterchainAccount { from_address: contract.to_string(), connection_id, interchain_account_id, register_fee, ordering: ordering.unwrap_or(ChannelOrdering::OrderOrdered).into(), } - .into()) + .into() } /// Basic helper to define a submit tx message: From 4841d0231fae18e6ac39571e9b8b2b1bcf67faf9 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 15:55:42 +0400 Subject: [PATCH 16/35] fix height type --- packages/neutron-sdk/src/sudo/msg.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/neutron-sdk/src/sudo/msg.rs b/packages/neutron-sdk/src/sudo/msg.rs index 6fcbf43d..03301146 100644 --- a/packages/neutron-sdk/src/sudo/msg.rs +++ b/packages/neutron-sdk/src/sudo/msg.rs @@ -1,5 +1,5 @@ -use crate::bindings::types::Height; use cosmwasm_std::Binary; +use neutron_std::types::ibc::core::client::v1::Height; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -14,6 +14,7 @@ pub struct RequestPacket { pub timeout_height: Option, pub timeout_timestamp: Option, } + #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] pub struct RequestPacketTimeoutHeight { pub revision_number: Option, From 2f88f4e79fa1abcecca714d5588d6d41e0dd049d Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 16:24:22 +0400 Subject: [PATCH 17/35] remove more bindings --- .../src/contract.rs | 2 +- packages/neutron-sdk/src/bindings/msg.rs | 38 ------------------- packages/neutron-sdk/src/bindings/types.rs | 13 ------- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 6db7b11b..15336a5b 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -6,6 +6,7 @@ use cosmwasm_std::{ Response, StdError, StdResult, Uint128, }; use cw2::set_contract_version; +use neutron_std::types::ibc::core::client::v1::Height; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; use neutron_std::types::neutron::interchainqueries::{KvKey, RegisteredQuery}; @@ -13,7 +14,6 @@ use crate::msg::{ Cw20BalanceResponse, ExecuteMsg, GetRecipientTxsResponse, InstantiateMsg, MigrateMsg, QueryMsg, }; use crate::state::{Transfer, RECIPIENT_TXS, TRANSFERS}; -use neutron_sdk::bindings::types::Height; use neutron_sdk::interchain_queries::helpers::{ remove_interchain_query as helpers_remove_interchain_query, update_interchain_query as helpers_update_interchain_query, diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index bd2b4cd7..8ba453ea 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -39,44 +39,6 @@ impl From for CosmosMsg { impl CustomMsg for NeutronMsg {} -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// Describes response structure for **RegisterInterchainQuery** msg. -pub struct MsgRegisterInterchainQueryResponse { - /// **id** is an identifier of newly registered interchain query. - pub id: u64, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// MsgRegisterInterchainAccountResponse defines the Msg/RegisterInterchainAccount response type. -pub struct MsgRegisterInterchainAccountResponse { - /// **channel_id** is a ... - pub channel_id: String, - /// **port_id** is a ... - pub port_id: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// MsgSubmitTxResponse defines the response for Msg/SubmitTx. -pub struct MsgSubmitTxResponse { - /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel. - pub sequence_id: u64, - /// **channel** is a src channel on neutron side transaction was submitted from. - pub channel: String, -} - -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -/// MsgIbcTransferResponse defines the response for Msg/IbcTransfer. -pub struct MsgIbcTransferResponse { - /// **sequence_id** is a channel's sequence_id for outgoing ibc packet. Unique per a channel. - pub sequence_id: u64, - /// **channel** is a src channel on neutron side transaction was submitted from. - pub channel: String, -} - #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] /// AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept. diff --git a/packages/neutron-sdk/src/bindings/types.rs b/packages/neutron-sdk/src/bindings/types.rs index 3c92fe92..21c24cb5 100644 --- a/packages/neutron-sdk/src/bindings/types.rs +++ b/packages/neutron-sdk/src/bindings/types.rs @@ -1,5 +1,3 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use std::fmt::Write as _; // TODO: do we need it? @@ -20,14 +18,3 @@ pub fn decode_hex(s: &str) -> Option> { .map(|i| u8::from_str_radix(&s[i..i + 2], 16).ok()) .collect() } - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Height { - /// the revision that the client is currently on - #[serde(default)] - pub revision_number: u64, - /// **height** is a height of remote chain - #[serde(default)] - pub revision_height: u64, -} From 6c4b026991a5b3ec5dcfaeee1d086dd28b51bd62 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 16:43:53 +0400 Subject: [PATCH 18/35] remove channelOrdering --- .../neutron_interchain_queries/src/contract.rs | 2 +- contracts/neutron_interchain_txs/src/contract.rs | 4 ++-- contracts/neutron_interchain_txs/src/msg.rs | 4 ++-- .../neutron-sdk/src/bindings/{types.rs => hex.rs} | 0 packages/neutron-sdk/src/bindings/mod.rs | 2 +- packages/neutron-sdk/src/bindings/msg.rs | 15 --------------- .../neutron-sdk/src/interchain_txs/helpers.rs | 9 +++++---- 7 files changed, 11 insertions(+), 25 deletions(-) rename packages/neutron-sdk/src/bindings/{types.rs => hex.rs} (100%) diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 15336a5b..514db6c9 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -6,8 +6,8 @@ use cosmwasm_std::{ Response, StdError, StdResult, Uint128, }; use cw2::set_contract_version; -use neutron_std::types::ibc::core::client::v1::Height; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; +use neutron_std::types::ibc::core::client::v1::Height; use neutron_std::types::neutron::interchainqueries::{KvKey, RegisteredQuery}; use crate::msg::{ diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 05f7ab7d..469be41f 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -12,7 +12,6 @@ use crate::storage::{ save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload, ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; -use neutron_sdk::bindings::msg::ChannelOrdering; use neutron_sdk::interchain_txs::helpers::register_interchain_account; use neutron_sdk::{ interchain_txs::helpers::{decode_message_response, get_port_id}, @@ -25,6 +24,7 @@ use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_std::types::cosmos::staking::v1beta1::{ MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, }; +use neutron_std::types::ibc::core::channel::v1::Order; use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use neutron_std::types::neutron::interchaintxs::v1::{ InterchaintxsQuerier, MsgSubmitTx, MsgSubmitTxResponse, @@ -199,7 +199,7 @@ fn execute_register_ica( connection_id: String, interchain_account_id: String, register_fee: Vec, - ordering: Option, + ordering: Option, ) -> NeutronResult { let register = register_interchain_account( env.contract.address.clone(), diff --git a/contracts/neutron_interchain_txs/src/msg.rs b/contracts/neutron_interchain_txs/src/msg.rs index 50a2cc3d..a446be90 100644 --- a/contracts/neutron_interchain_txs/src/msg.rs +++ b/contracts/neutron_interchain_txs/src/msg.rs @@ -1,5 +1,5 @@ -use neutron_sdk::bindings::msg::ChannelOrdering; use neutron_std::types::cosmos::base::v1beta1::Coin; +use neutron_std::types::ibc::core::channel::v1::Order; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -37,7 +37,7 @@ pub enum ExecuteMsg { connection_id: String, interchain_account_id: String, register_fee: Vec, - ordering: Option, + ordering: Option, }, Delegate { interchain_account_id: String, diff --git a/packages/neutron-sdk/src/bindings/types.rs b/packages/neutron-sdk/src/bindings/hex.rs similarity index 100% rename from packages/neutron-sdk/src/bindings/types.rs rename to packages/neutron-sdk/src/bindings/hex.rs diff --git a/packages/neutron-sdk/src/bindings/mod.rs b/packages/neutron-sdk/src/bindings/mod.rs index 08938b58..9cf737ba 100644 --- a/packages/neutron-sdk/src/bindings/mod.rs +++ b/packages/neutron-sdk/src/bindings/mod.rs @@ -1,3 +1,3 @@ +pub mod hex; #[allow(deprecated)] pub mod msg; -pub mod types; diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 8ba453ea..09297cc2 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -3,21 +3,6 @@ use neutron_std::shim::Any; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -pub enum ChannelOrdering { - OrderUnordered, - OrderOrdered, -} - -impl From for i32 { - fn from(ordering: ChannelOrdering) -> Self { - match ordering { - ChannelOrdering::OrderUnordered => 1, - ChannelOrdering::OrderOrdered => 2, - } - } -} - #[deprecated( note = "Please use neutron-std autogenerated messages instead of wasmbindings", since = "0.12.0" diff --git a/packages/neutron-sdk/src/interchain_txs/helpers.rs b/packages/neutron-sdk/src/interchain_txs/helpers.rs index 09d23a47..67e0e867 100644 --- a/packages/neutron-sdk/src/interchain_txs/helpers.rs +++ b/packages/neutron-sdk/src/interchain_txs/helpers.rs @@ -1,8 +1,8 @@ -use crate::bindings::msg::ChannelOrdering; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{Addr, CosmosMsg, StdError, StdResult}; use neutron_std::shim::Any; use neutron_std::types::cosmos::base::v1beta1::Coin; +use neutron_std::types::ibc::core::channel::v1::Order; use neutron_std::types::neutron::feerefunder::Fee; use neutron_std::types::neutron::interchaintxs::v1::{MsgRegisterInterchainAccount, MsgSubmitTx}; @@ -32,14 +32,14 @@ pub fn register_interchain_account( connection_id: String, interchain_account_id: String, register_fee: Vec, - ordering: Option, + ordering: Option, ) -> CosmosMsg { MsgRegisterInterchainAccount { from_address: contract.to_string(), connection_id, interchain_account_id, register_fee, - ordering: ordering.unwrap_or(ChannelOrdering::OrderOrdered).into(), + ordering: ordering.unwrap_or(Order::Ordered).into(), } .into() } @@ -69,5 +69,6 @@ pub fn submit_tx( memo, timeout, fee: Some(fee), - }.into() + } + .into() } From 82e4e338ba92c3bd4d6f2f22c10aa597c09a7e3c Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 16:49:30 +0400 Subject: [PATCH 19/35] move hex to helpers out of bindings --- packages/neutron-sdk/src/bindings/mod.rs | 1 - .../neutron-sdk/src/{bindings => interchain_queries}/hex.rs | 2 -- packages/neutron-sdk/src/interchain_queries/mod.rs | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) rename packages/neutron-sdk/src/{bindings => interchain_queries}/hex.rs (90%) diff --git a/packages/neutron-sdk/src/bindings/mod.rs b/packages/neutron-sdk/src/bindings/mod.rs index 9cf737ba..55ed60a4 100644 --- a/packages/neutron-sdk/src/bindings/mod.rs +++ b/packages/neutron-sdk/src/bindings/mod.rs @@ -1,3 +1,2 @@ -pub mod hex; #[allow(deprecated)] pub mod msg; diff --git a/packages/neutron-sdk/src/bindings/hex.rs b/packages/neutron-sdk/src/interchain_queries/hex.rs similarity index 90% rename from packages/neutron-sdk/src/bindings/hex.rs rename to packages/neutron-sdk/src/interchain_queries/hex.rs index 21c24cb5..11de7aeb 100644 --- a/packages/neutron-sdk/src/bindings/hex.rs +++ b/packages/neutron-sdk/src/interchain_queries/hex.rs @@ -1,6 +1,5 @@ use std::fmt::Write as _; -// TODO: do we need it? /// Encodes bytes slice into hex string pub fn encode_hex(bytes: &[u8]) -> String { let mut s = String::with_capacity(bytes.len() * 2); @@ -10,7 +9,6 @@ pub fn encode_hex(bytes: &[u8]) -> String { s } -// TODO: do we need it? /// Decodes hex string into bytes vec pub fn decode_hex(s: &str) -> Option> { (0..s.len()) diff --git a/packages/neutron-sdk/src/interchain_queries/mod.rs b/packages/neutron-sdk/src/interchain_queries/mod.rs index 507603ea..91162bb9 100644 --- a/packages/neutron-sdk/src/interchain_queries/mod.rs +++ b/packages/neutron-sdk/src/interchain_queries/mod.rs @@ -3,5 +3,6 @@ pub mod queries; pub mod types; pub mod v045; pub mod v047; +pub mod hex; pub use queries::{check_query_type, get_registered_query, query_kv_result}; From 25bdfbd340e78510f792d5b816bd2855a67301ff Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 15 Oct 2024 17:56:08 +0400 Subject: [PATCH 20/35] kv_key_from_string --- .../neutron-sdk/src/interchain_queries/helpers.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/neutron-sdk/src/interchain_queries/helpers.rs b/packages/neutron-sdk/src/interchain_queries/helpers.rs index abe47ebe..4b01b078 100644 --- a/packages/neutron-sdk/src/interchain_queries/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/helpers.rs @@ -8,6 +8,7 @@ use neutron_std::types::neutron::interchainqueries::{ MsgUpdateInterchainQueryRequest, }; use serde_json_wasm::to_string; +use crate::interchain_queries::hex::decode_hex; /// Decodes a bech32 encoded string and converts to base64 encoded bytes /// @@ -117,3 +118,17 @@ pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult>(s: S) -> Option { + let split: Vec<&str> = s.as_ref().split(KV_PATH_KEY_DELIMITER).collect(); + if split.len() < 2 { + return None; + } + + Some(KvKey { + path: split[0].to_string(), + key: decode_hex(split[1])?, + }) +} \ No newline at end of file From abebb3e6e315d44b05aa1f681a412f9b89293900 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 16 Oct 2024 17:07:30 +0400 Subject: [PATCH 21/35] fix interchainqueries tests --- .../neutron_interchain_queries/Cargo.toml | 1 + .../src/contract.rs | 2 +- .../src/testing/mock_querier.rs | 231 +- .../src/testing/tests.rs | 2290 +++++++++-------- .../src/interchain_queries/helpers.rs | 4 +- .../neutron-sdk/src/interchain_queries/mod.rs | 2 +- 6 files changed, 1273 insertions(+), 1257 deletions(-) diff --git a/contracts/neutron_interchain_queries/Cargo.toml b/contracts/neutron_interchain_queries/Cargo.toml index fa49e2b3..f0cb9d21 100644 --- a/contracts/neutron_interchain_queries/Cargo.toml +++ b/contracts/neutron_interchain_queries/Cargo.toml @@ -28,6 +28,7 @@ serde-json-wasm = { workspace = true } prost-types = { workspace = true } cosmwasm-schema = { workspace = true } neutron-std = { workspace = true } +prost = { workspace = true } [dev-dependencies] base64 = { workspace = true } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 514db6c9..4805923f 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -516,8 +516,8 @@ pub fn sudo_tx_query_result( let mut stored_transfers: u64 = TRANSFERS.load(deps.storage).unwrap_or_default(); stored_transfers += deposits.len() as u64; TRANSFERS.save(deps.storage, &stored_transfers)?; - check_deposits_size(&deposits)?; + let mut stored_deposits: Vec = RECIPIENT_TXS .load(deps.storage, recipient) .unwrap_or_default(); diff --git a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs index 0477543e..9b6aa350 100644 --- a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs +++ b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs @@ -1,120 +1,111 @@ -// use std::collections::HashMap; -// use std::marker::PhantomData; -// -// use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; -// use cosmwasm_std::{ -// from_json, Binary, Coin, ContractResult, CustomQuery, FullDelegation, OwnedDeps, Querier, -// QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, Validator, -// }; -// use schemars::JsonSchema; -// use serde::{Deserialize, Serialize}; -// -// pub const MOCK_CONTRACT_ADDR: &str = "cosmos2contract"; -// -// #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -// #[serde(rename_all = "snake_case")] -// pub struct CustomQueryWrapper {} -// -// // implement custom query -// impl CustomQuery for CustomQueryWrapper {} -// -// pub fn mock_dependencies( -// contract_balance: &[Coin], -// ) -> OwnedDeps { -// let contract_addr = MOCK_CONTRACT_ADDR; -// let custom_querier: WasmMockQuerier = -// WasmMockQuerier::new(MockQuerier::new(&[(contract_addr, contract_balance)])); -// -// OwnedDeps { -// storage: MockStorage::default(), -// api: MockApi::default(), -// querier: custom_querier, -// custom_query_type: PhantomData, -// } -// } -// -// pub struct WasmMockQuerier { -// base: MockQuerier, -// query_responses: HashMap, -// registered_queries: HashMap, -// } -// -// impl Querier for WasmMockQuerier { -// fn raw_query(&self, bin_request: &[u8]) -> QuerierResult { -// let request: QueryRequest = match from_json(bin_request) { -// Ok(v) => v, -// Err(e) => { -// return QuerierResult::Err(SystemError::InvalidRequest { -// error: format!("Parsing query request: {}", e), -// request: bin_request.into(), -// }); -// } -// }; -// self.handle_query(&request) -// } -// } -// -// // TODO: fix -// impl WasmMockQuerier { -// pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { -// match &request { -// QueryRequest::Custom(NeutronQuery::InterchainQueryResult { query_id }) => { -// SystemResult::Ok(ContractResult::Ok( -// (*self.query_responses.get(query_id).unwrap()).clone(), -// )) -// } -// QueryRequest::Custom(NeutronQuery::RegisteredInterchainQuery { query_id }) => { -// SystemResult::Ok(ContractResult::Ok( -// (*self.registered_queries.get(query_id).unwrap()).clone(), -// )) -// } -// QueryRequest::Custom(NeutronQuery::RegisteredInterchainQueries { -// owners: _owners, -// connection_id: _connection_id, -// pagination: _pagination, -// }) => { -// todo!() -// } -// QueryRequest::Custom(NeutronQuery::InterchainAccountAddress { .. }) => { -// todo!() -// } -// _ => self.base.handle_query(request), -// } -// } -// -// pub fn _update_staking( -// &mut self, -// denom: &str, -// validators: &[Validator], -// delegations: &[FullDelegation], -// ) { -// self.base.staking.update(denom, validators, delegations); -// } -// -// pub fn add_query_response(&mut self, query_id: u64, response: Binary) { -// self.query_responses.insert(query_id, response); -// } -// pub fn add_registered_queries(&mut self, query_id: u64, response: Binary) { -// self.registered_queries.insert(query_id, response); -// } -// } -// -// #[derive(Clone, Default)] -// pub struct BalanceQuerier { -// _balances: HashMap, -// } -// -// #[derive(Clone, Default)] -// pub struct TokenQuerier { -// _balances: HashMap>, -// } -// -// impl WasmMockQuerier { -// pub fn new(base: MockQuerier) -> Self { -// WasmMockQuerier { -// base, -// query_responses: HashMap::new(), -// registered_queries: HashMap::new(), -// } -// } -// } +use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; +use cosmwasm_std::{ + from_json, Binary, Coin, ContractResult, CustomQuery, FullDelegation, GrpcQuery, OwnedDeps, + Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, Validator, +}; +use neutron_std::types::neutron::interchainqueries::{ + QueryRegisteredQueryRequest, QueryRegisteredQueryResultRequest, +}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::marker::PhantomData; + +pub const MOCK_CONTRACT_ADDR: &str = "cosmos2contract"; + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct CustomQueryWrapper {} + +// implement custom query +impl CustomQuery for CustomQueryWrapper {} + +pub fn mock_dependencies( + contract_balance: &[Coin], +) -> OwnedDeps { + let contract_addr = MOCK_CONTRACT_ADDR; + let custom_querier: WasmMockQuerier = + WasmMockQuerier::new(MockQuerier::new(&[(contract_addr, contract_balance)])); + + OwnedDeps { + storage: MockStorage::default(), + api: MockApi::default(), + querier: custom_querier, + custom_query_type: PhantomData, + } +} + +pub struct WasmMockQuerier { + base: MockQuerier, + query_responses: HashMap, + registered_queries: HashMap, +} + +impl Querier for WasmMockQuerier { + fn raw_query(&self, bin_request: &[u8]) -> QuerierResult { + let request: QueryRequest = match from_json(bin_request) { + Ok(v) => v, + Err(e) => { + return QuerierResult::Err(SystemError::InvalidRequest { + error: format!("Parsing query request: {}", e), + request: bin_request.into(), + }); + } + }; + self.handle_query(&request) + } +} + +impl WasmMockQuerier { + pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { + match &request { + QueryRequest::Grpc(GrpcQuery { path, data }) => { + let quoted_path = path.trim_matches('"').to_string(); + if "ed_path == "/neutron.interchainqueries.Query/QueryResult" { + let request: QueryRegisteredQueryResultRequest = + ::prost::Message::decode(&data[..]).unwrap(); + SystemResult::Ok(ContractResult::Ok( + (*self.query_responses.get(&request.query_id).unwrap()).clone(), + )) + } else if "ed_path == "/neutron.interchainqueries.Query/RegisteredQuery" { + let request: QueryRegisteredQueryRequest = + ::prost::Message::decode(&data[..]).unwrap(); + SystemResult::Ok(ContractResult::Ok( + (*self.registered_queries.get(&request.query_id).unwrap()).clone(), + )) + } else { + println!("PATH: {}", quoted_path); + self.base.handle_query(request) + } + } + _ => self.base.handle_query(request), + } + } + + pub fn add_query_response(&mut self, query_id: u64, response: Binary) { + self.query_responses.insert(query_id, response); + } + pub fn add_registered_queries(&mut self, query_id: u64, response: Binary) { + self.registered_queries.insert(query_id, response); + } +} + +#[derive(Clone, Default)] +pub struct BalanceQuerier { + _balances: HashMap, +} + +#[derive(Clone, Default)] +pub struct TokenQuerier { + _balances: HashMap>, +} + +impl WasmMockQuerier { + pub fn new(base: MockQuerier) -> Self { + WasmMockQuerier { + base, + query_responses: HashMap::new(), + registered_queries: HashMap::new(), + } + } +} diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 36eab253..7ad0536e 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -1,1133 +1,1157 @@ -// use base64::{prelude::*, Engine}; -// use std::str::FromStr; -// -// use super::mock_querier::mock_dependencies as dependencies; -// use crate::contract::{execute, query, sudo_tx_query_result}; -// use crate::msg::{ExecuteMsg, QueryMsg}; -// use crate::state::{Transfer, RECIPIENT_TXS}; -// use crate::testing::mock_querier::WasmMockQuerier; -// use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin as CosmosCoin, DecCoin as CosmosDecCoin}; -// use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; -// use cosmos_sdk_proto::cosmos::gov::v1beta1::{ -// Proposal as CosmosProposal, TallyResult as CosmosTallyResult, -// }; -// use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; -// use cosmos_sdk_proto::cosmos::staking::v1beta1::Validator as CosmosValidator; -// use cosmos_sdk_proto::traits::Message; -// use cosmos_sdk_proto::Any; -// use cosmwasm_std::testing::{message_info, mock_env, MockApi, MockStorage}; -// use cosmwasm_std::{ -// from_json, to_json_binary, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, -// Uint128, -// }; -// use neutron_sdk::bindings::query::{ -// NeutronQuery, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse, -// }; -// use neutron_sdk::bindings::types::{ -// decode_hex, Height, InterchainQueryResult, KVKey, KVKeys, RegisteredQuery, StorageValue, -// }; -// use neutron_sdk::interchain_queries::helpers::decode_and_convert; -// use neutron_sdk::interchain_queries::types::{ -// QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, -// }; -// use neutron_sdk::interchain_queries::v047::helpers::{ -// create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, -// create_total_denom_key, create_validator_key, -// }; -// use neutron_sdk::interchain_queries::v047::types::{ -// Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, -// TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, -// }; -// -// use neutron_sdk::interchain_queries::v047::queries::{ -// BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse, -// TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, -// }; -// use neutron_sdk::NeutronError; -// use schemars::_serde_json::to_string; -// -// enum QueryParam { -// Keys(Vec), -// TransactionsFilter(String), -// } -// -// fn build_registered_query_response( -// id: u64, -// param: QueryParam, -// query_type: QueryType, -// last_submitted_result_local_height: u64, -// ) -> Binary { -// let mut resp = QueryRegisteredQueryResponse { -// registered_query: RegisteredQuery { -// id, -// owner: "".to_string(), -// keys: vec![], -// query_type, -// transactions_filter: "".to_string(), -// connection_id: "".to_string(), -// update_period: 0, -// last_submitted_result_local_height, -// last_submitted_result_remote_height: Height { -// revision_number: 0, -// revision_height: 0, -// }, -// deposit: Vec::from([Coin { -// denom: "stake".to_string(), -// amount: Uint128::from_str("100").unwrap(), -// }]), -// submit_timeout: 0, -// registered_at_height: 0, -// }, -// }; -// match param { -// QueryParam::Keys(keys) => resp.registered_query.keys = keys, -// QueryParam::TransactionsFilter(transactions_filter) => { -// resp.registered_query.transactions_filter = transactions_filter -// } -// } -// -// Binary::from(to_string(&resp).unwrap().as_bytes()) -// } -// -// fn build_interchain_query_bank_total_denom_value(denom: String, amount: String) -> StorageValue { -// let bank_total_key = create_total_denom_key(denom).unwrap(); -// -// let amount = amount.as_bytes().to_vec(); -// -// StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(bank_total_key), -// value: Binary::new(amount), -// } -// } -// -// fn build_interchain_query_distribution_fee_pool_response(denom: String, amount: String) -> Binary { -// let fee_pool_key = create_fee_pool_key().unwrap(); -// -// let community_pool_amount = CosmosDecCoin { denom, amount }; -// -// let fee_pool = CosmosFeePool { -// community_pool: vec![community_pool_amount], -// }; -// -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(fee_pool_key), -// value: Binary::new(fee_pool.encode_to_vec()), -// }; -// Binary::from( -// to_string(&QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// kv_results: vec![s], -// height: 123456, -// revision: 2, -// }, -// }) -// .unwrap() -// .as_bytes(), -// ) -// } -// -// fn build_interchain_query_staking_validator_value(validator: String) -> StorageValue { -// let operator_address = decode_and_convert(validator.as_str()).unwrap(); -// let validator_key = create_validator_key(operator_address).unwrap(); -// -// let validator = CosmosValidator { -// operator_address: validator, -// consensus_pubkey: Some(Any { -// type_url: "".to_string(), -// value: vec![], -// }), -// status: 1, -// tokens: "1".to_string(), -// jailed: false, -// delegator_shares: "1".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "1".to_string(), -// }; -// -// StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(validator_key), -// value: Binary::new(validator.encode_to_vec()), -// } -// } -// -// fn build_interchain_query_validator_signing_info_value( -// validator: String, -// jailed_until: Option, -// ) -> StorageValue { -// let operator_address = decode_and_convert(validator.as_str()).unwrap(); -// let validator_key = create_validator_key(operator_address).unwrap(); -// -// let validator = CosmosValidatorSigningInfo { -// address: validator, -// start_height: 1, -// index_offset: 20, -// jailed_until, -// tombstoned: false, -// missed_blocks_counter: 13, -// }; -// -// StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(validator_key), -// value: Binary::new(validator.encode_to_vec()), -// } -// } -// -// fn build_interchain_query_gov_proposal_value(proposal_id: u64) -> StorageValue { -// let proposal_key = create_gov_proposal_key(proposal_id).unwrap(); -// -// let proposal = CosmosProposal { -// proposal_id, -// content: Some(Any { -// type_url: "/cosmos.gov.v1beta1.TextProposal".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: Some(CosmosTallyResult { -// abstain: "0".to_string(), -// yes: "0".to_string(), -// no: "0".to_string(), -// no_with_veto: "0".to_string(), -// }), -// deposit_end_time: None, -// submit_time: None, -// total_deposit: Vec::from([CosmosCoin { -// denom: "stake".to_string(), -// amount: "100".to_string(), -// }]), -// voting_start_time: None, -// voting_end_time: None, -// }; -// -// StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(proposal_key), -// value: Binary::new(proposal.encode_to_vec()), -// } -// } -// -// fn build_interchain_query_balances_response(addr: Addr, balances: Vec) -> Binary { -// let converted_addr_bytes = decode_and_convert(addr.as_str()).unwrap(); -// -// let s: Vec = balances -// .iter() -// .map(|c| { -// let balance_key = -// create_account_denom_balance_key(converted_addr_bytes.clone(), c.denom.clone()) -// .unwrap(); -// StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(balance_key), -// value: Binary::new(c.amount.to_string().into_bytes()), -// } -// }) -// .collect(); -// -// Binary::from( -// to_string(&QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// kv_results: s, -// height: 123456, -// revision: 2, -// }, -// }) -// .unwrap() -// .as_bytes(), -// ) -// } -// -// // registers an interchain query -// fn register_query( -// deps: &mut OwnedDeps, -// env: Env, -// info: MessageInfo, -// msg: ExecuteMsg, -// ) -> KVKeys { -// let reg_msgs = execute(deps.as_mut(), env, info, msg).unwrap(); -// for attr in reg_msgs.attributes { -// if attr.key == "kv_keys" && !attr.value.is_empty() { -// return KVKeys::from_string(attr.value).unwrap(); -// } -// } -// -// KVKeys(vec![]) -// } -// -// #[test] -// fn test_query_balance() { -// let mut deps = dependencies(&[]); -// -// let msg = ExecuteMsg::RegisterBalancesQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// denoms: vec!["uosmo".to_string()], -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier.add_query_response( -// 1, -// build_interchain_query_balances_response( -// Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// vec![Coin::new(8278104u128, "uosmo")], -// ), -// ); -// let query_balance = QueryMsg::Balance { query_id: 1 }; -// let resp: BalanceResponse = -// from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); -// assert_eq!( -// resp, -// BalanceResponse { -// last_submitted_local_height: 987, -// balances: Balances { -// coins: vec![Coin::new(8278104u128, "uosmo")] -// }, -// } -// ) -// } -// -// #[test] -// fn test_query_balances() { -// let mut deps = dependencies(&[]); -// -// let msg = ExecuteMsg::RegisterBalancesQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// denoms: vec!["uosmo".to_string(), "uatom".to_string()], -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier.add_query_response( -// 1, -// build_interchain_query_balances_response( -// Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// vec![ -// Coin::new(8278104u128, "uosmo"), -// Coin::new(1234567u128, "uatom"), -// ], -// ), -// ); -// let query_balance = QueryMsg::Balance { query_id: 1 }; -// let resp: BalanceResponse = -// from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); -// assert_eq!( -// resp, -// BalanceResponse { -// last_submitted_local_height: 987, -// balances: Balances { -// coins: vec![ -// Coin::new(8278104u128, "uosmo"), -// Coin::new(1234567u128, "uatom") -// ] -// }, -// } -// ) -// } -// -// #[test] -// fn test_bank_total_supply_query() { -// let mut deps = dependencies(&[]); -// -// let denoms = vec!["uosmo".to_string(), "uatom".to_string()]; -// -// let msg = ExecuteMsg::RegisterBankTotalSupplyQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// denoms: denoms.clone(), -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// let mut kv_results: Vec = vec![]; -// -// for denom in denoms { -// let value = -// build_interchain_query_bank_total_denom_value(denom.to_string(), "8278104".to_string()); -// kv_results.push(value); -// } -// -// let total_supply_response = QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// kv_results, -// height: 0, -// revision: 0, -// }, -// }; -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier -// .add_query_response(1, to_json_binary(&total_supply_response).unwrap()); -// let bank_total_balance = QueryMsg::BankTotalSupply { query_id: 1 }; -// -// let resp: TotalSupplyResponse = -// from_json(query(deps.as_ref(), mock_env(), bank_total_balance).unwrap()).unwrap(); -// assert_eq!( -// resp, -// TotalSupplyResponse { -// last_submitted_local_height: 987, -// supply: TotalSupply { -// coins: vec![ -// Coin::new(8278104u128, "uosmo"), -// Coin::new(8278104u128, "uatom"), -// ] -// }, -// } -// ); -// } -// -// #[test] -// fn test_distribution_fee_pool_query() { -// let mut deps = dependencies(&[]); -// -// let msg = ExecuteMsg::RegisterDistributionFeePoolQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier.add_query_response( -// 1, -// build_interchain_query_distribution_fee_pool_response( -// "uosmo".to_string(), -// "8278104000000000000000000".to_string(), // 8278104 + 18 zeros -// ), -// ); -// let fee_pool_balance = QueryMsg::DistributionFeePool { query_id: 1 }; -// let resp: FeePoolResponse = -// from_json(query(deps.as_ref(), mock_env(), fee_pool_balance).unwrap()).unwrap(); -// assert_eq!( -// resp, -// FeePoolResponse { -// last_submitted_local_height: 987, -// pool: FeePool { -// coins: vec![Coin::new(8278104u128, "uosmo")] -// }, -// } -// ) -// } -// -// #[test] -// fn test_gov_proposals_query() { -// let mut deps = dependencies(&[]); -// -// let proposals_ids = vec![1, 2, 3]; -// -// let msg = ExecuteMsg::RegisterGovernmentProposalsQuery { -// connection_id: "connection".to_string(), -// proposals_ids: proposals_ids.clone(), -// update_period: 10, -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// let mut kv_results: Vec = vec![]; -// -// for id in proposals_ids { -// let value = build_interchain_query_gov_proposal_value(id); -// kv_results.push(value); -// } -// -// let proposals_response = QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// kv_results, -// height: 0, -// revision: 0, -// }, -// }; -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier -// .add_query_response(1, to_json_binary(&proposals_response).unwrap()); -// -// let government_proposal = QueryMsg::GovernmentProposals { query_id: 1 }; -// let resp: ProposalResponse = -// from_json(query(deps.as_ref(), mock_env(), government_proposal).unwrap()).unwrap(); -// assert_eq!( -// resp, -// ProposalResponse { -// last_submitted_local_height: 987, -// proposals: GovernmentProposal { -// proposals: vec![ -// Proposal { -// proposal_id: 1, -// proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), -// total_deposit: Vec::from([Coin { -// denom: "stake".to_string(), -// amount: Uint128::from_str("100").unwrap(), -// }]), -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_end_time: None, -// voting_start_time: None, -// final_tally_result: Some(TallyResult { -// abstain: Uint128::zero(), -// yes: Uint128::zero(), -// no: Uint128::zero(), -// no_with_veto: Uint128::zero(), -// }), -// }, -// Proposal { -// proposal_id: 2, -// proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), -// total_deposit: Vec::from([Coin { -// denom: "stake".to_string(), -// amount: Uint128::from_str("100").unwrap(), -// }]), -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_end_time: None, -// voting_start_time: None, -// final_tally_result: Some(TallyResult { -// abstain: Uint128::zero(), -// yes: Uint128::zero(), -// no: Uint128::zero(), -// no_with_veto: Uint128::zero(), -// }), -// }, -// Proposal { -// proposal_id: 3, -// proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), -// total_deposit: Vec::from([Coin { -// denom: "stake".to_string(), -// amount: Uint128::from_str("100").unwrap(), -// }]), -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_end_time: None, -// voting_start_time: None, -// final_tally_result: Some(TallyResult { -// abstain: Uint128::zero(), -// yes: Uint128::zero(), -// no: Uint128::zero(), -// no_with_veto: Uint128::zero(), -// }), -// }, -// ] -// }, -// } -// ) -// } -// -// #[test] -// fn test_staking_validators_query() { -// let mut deps = dependencies(&[]); -// let validators = vec![ -// "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), -// "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), -// ]; -// -// let msg = ExecuteMsg::RegisterStakingValidatorsQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// validators: validators.clone(), -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// let mut kv_results: Vec = vec![]; -// -// for validator in validators { -// let value = build_interchain_query_staking_validator_value(validator); -// kv_results.push(value); -// } -// -// let validators_response = QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// kv_results, -// height: 0, -// revision: 0, -// }, -// }; -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier -// .add_query_response(1, to_json_binary(&validators_response).unwrap()); -// let staking_validators = QueryMsg::StakingValidators { query_id: 1 }; -// let resp: ValidatorResponse = -// from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); -// assert_eq!( -// resp, -// ValidatorResponse { -// last_submitted_local_height: 987, -// validator: StakingValidator { -// validators: vec![ -// Validator { -// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" -// .to_string(), -// status: 1, -// consensus_pubkey: Some(vec!()), -// tokens: "1".to_string(), -// jailed: false, -// delegator_shares: "1".to_string(), -// unbonding_height: 0, -// unbonding_time: None, -// min_self_delegation: Decimal::from_str("1").unwrap(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// }, -// Validator { -// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" -// .to_string(), -// status: 1, -// consensus_pubkey: Some(vec!()), -// tokens: "1".to_string(), -// jailed: false, -// delegator_shares: "1".to_string(), -// unbonding_height: 0, -// unbonding_time: None, -// min_self_delegation: Decimal::from_str("1").unwrap(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// }, -// ] -// }, -// } -// ) -// } -// -// #[test] -// fn test_validators_signing_infos_query() { -// let mut deps = dependencies(&[]); -// let validators = vec![ -// ( -// "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), -// None, -// ), -// ( -// "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), -// Some(prost_types::Timestamp { -// seconds: 1203981203, -// nanos: 123123, -// }), -// ), -// ]; -// -// let msg = ExecuteMsg::RegisterValidatorsSigningInfosQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// validators: validators.clone().into_iter().map(|(v, _)| v).collect(), -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// let mut kv_results: Vec = vec![]; -// -// for validator in validators { -// let value = build_interchain_query_validator_signing_info_value(validator.0, validator.1); -// kv_results.push(value); -// } -// -// let validators_response = QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// kv_results, -// height: 0, -// revision: 0, -// }, -// }; -// -// deps.querier.add_registered_queries(1, registered_query); -// deps.querier -// .add_query_response(1, to_json_binary(&validators_response).unwrap()); -// let staking_validators = QueryMsg::ValidatorsSigningInfos { query_id: 1 }; -// let resp: ValidatorSigningInfoResponse = -// from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); -// assert_eq!( -// resp, -// ValidatorSigningInfoResponse { -// last_submitted_local_height: 987, -// signing_infos: SigningInfo { -// signing_infos: vec![ -// ValidatorSigningInfo { -// address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), -// start_height: 1, -// index_offset: 20, -// jailed_until: None, -// tombstoned: false, -// missed_blocks_counter: 13, -// }, -// ValidatorSigningInfo { -// address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), -// start_height: 1, -// index_offset: 20, -// jailed_until: Some(1203981203), -// tombstoned: false, -// missed_blocks_counter: 13, -// }, -// ] -// }, -// } -// ) -// } -// -// #[test] -// fn test_query_delegator_delegations() { -// let mut deps = dependencies(&[]); -// -// let msg = ExecuteMsg::RegisterDelegatorDelegationsQuery { -// connection_id: "connection".to_string(), -// update_period: 10, -// delegator: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validators: vec![ -// "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), -// "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), -// ], -// }; -// -// let keys = register_query( -// &mut deps, -// mock_env(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ); -// -// let delegations_response = QueryRegisteredQueryResultResponse { -// result: InterchainQueryResult { -// // response for `RegisterDelegatorDelegationsQuery` with necessary KV values to test reconstruction logic. -// // The values are taken from osmosis network -// kv_results: vec![ -// // params value of staking module for key 'staking/params' -// // value: Params -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from([STAKING_PARAMS_KEY]), -// value: Binary::from(BASE64_STANDARD.decode("CgQIgN9uEGQYByCQTioFdWF0b20yATA6FC0xMDAwMDAwMDAwMDAwMDAwMDAwQhMxMDAwMDAwMDAwMDAwMDAwMDAwShMxMDAwMDAwMDAwMDAwMDAwMDAw").unwrap()), -// }, -// // delegation -// // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs -// // to: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 -// // delegation_shares: "5177628000000000000000000" -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b8141ab940697a73dd080edafeb538ad408b5cae0264").unwrap()), -// value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxoZNTE3NzYyODAwMDAwMDAwMDAwMDAwMDAwMA==").unwrap()), -// }, -// // validator: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 -// // delegator_shares: "2845862840643000000000000000000" -// // total tokens: "2845862840643" -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from(decode_hex("21141ab940697a73dd080edafeb538ad408b5cae0264").unwrap()), -// value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiCaZhCbacCetQorko3LfUUJX2UEyX38qBGVri8GyH8lcCADKg0yODQ1ODYyODQwNjQzMh8yODQ1ODYyODQwNjQzMDAwMDAwMDAwMDAwMDAwMDAwOqQCChRzdHJhbmdlbG92ZS12ZW50dXJlcxIQRDBEOEI4MEYxQzVDNzBCNRocaHR0cHM6Ly9zdHJhbmdlbG92ZS52ZW50dXJlcyrbAScuLi5iZWNhdXNlIG9mIHRoZSBhdXRvbWF0ZWQgYW5kIGlycmV2b2NhYmxlIGRlY2lzaW9uLW1ha2luZyBwcm9jZXNzIHdoaWNoIHJ1bGVzIG91dCBodW1hbiBtZWRkbGluZywgdGhlIERvb21zZGF5IG1hY2hpbmUgaXMgdGVycmlmeWluZyBhbmQgc2ltcGxlIHRvIHVuZGVyc3RhbmQgYW5kIGNvbXBsZXRlbHkgY3JlZGlibGUgYW5kIGNvbnZpbmNpbmcuJyAtIERyLiBTdHJhbmdlbG92ZUoAUkwKPAoRNTAwMDAwMDAwMDAwMDAwMDASEzEwMDAwMDAwMDAwMDAwMDAwMDAaEjUwMDAwMDAwMDAwMDAwMDAwMBIMCPetyYYGEKPoosUCWgEx").unwrap()), -// }, -// // delegation -// // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs -// // to: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t -// // delegation_shares: "29620221000000000000000000" -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814cc9598513212c12c36a1775e2233b962e4d5128e").unwrap()), -// value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBoaMjk2MjAyMjEwMDAwMDAwMDAwMDAwMDAwMDA=").unwrap()), -// }, -// // validator: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t -// // delegator_shares: "3054477259038000000000000000000" -// // total tokens: "3054477259038" -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from(decode_hex("2114cc9598513212c12c36a1775e2233b962e4d5128e").unwrap()), -// value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiA27dgAuZV/uS9FdsILGWLBw8eYPy+ZEyv1Df2VsrjXDiADKg0zMDU0NDc3MjU5MDM4Mh8zMDU0NDc3MjU5MDM4MDAwMDAwMDAwMDAwMDAwMDAwOoEBChFGcmVucyAo8J+knSzwn6SdKRIQQzQ3ODQ1MjI2NjYyQUY0NxoSaHR0cHM6Ly9mcmVucy5hcm15IhtzZWN1cml0eUBraWRzb250aGVibG9jay54eXoqKVlvdXIgZnJpZW5kbHkgdmFsaWRhdG9yIGZvciBjb3Ntb3MgY2hhaW5zQP3HpQFKCwj3zq6PBhCfrO86UkoKOgoRNTAwMDAwMDAwMDAwMDAwMDASEjUwMDAwMDAwMDAwMDAwMDAwMBoRNTAwMDAwMDAwMDAwMDAwMDASDAjg1rSQBhDkudCDAVoDNTAw").unwrap()), -// }, -// // delegation -// // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs -// // to: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we -// // delegation_shares: "219920000000000000000000" -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from(decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap()), -// value: Binary::from(BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRoYMjE5OTIwMDAwMDAwMDAwMDAwMDAwMDAw").unwrap()), -// }, -// // validator: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we -// // delegator_shares: "3201438898476000000000000000000" -// // total tokens: "3201438898476" -// StorageValue { -// storage_prefix: "staking".to_string(), -// key: Binary::from(decode_hex("2114f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap()), -// value: Binary::from(BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiBPXCnkQvO+pU6oGbp4ZiJBBZ7RNoLYtXYFOEdpXGH+uSADKg0zMjAxNDM4ODk4NDc2Mh8zMjAxNDM4ODk4NDc2MDAwMDAwMDAwMDAwMDAwMDAwOp8CCgtDaXRhZGVsLm9uZRIQRUJCMDNFQjRCQjRDRkNBNxoTaHR0cHM6Ly9jaXRhZGVsLm9uZSroAUNpdGFkZWwub25lIGlzIGEgbXVsdGktYXNzZXQgbm9uLWN1c3RvZGlhbCBzdGFraW5nIHBsYXRmb3JtIHRoYXQgbGV0cyBhbnlvbmUgYmVjb21lIGEgcGFydCBvZiBkZWNlbnRyYWxpemVkIGluZnJhc3RydWN0dXJlIGFuZCBlYXJuIHBhc3NpdmUgaW5jb21lLiBTdGFrZSB3aXRoIG91ciBub2RlcyBvciBhbnkgb3RoZXIgdmFsaWRhdG9yIGFjcm9zcyBtdWx0aXBsZSBuZXR3b3JrcyBpbiBhIGZldyBjbGlja3NKAFJECjoKETUwMDAwMDAwMDAwMDAwMDAwEhIyMDAwMDAwMDAwMDAwMDAwMDAaETMwMDAwMDAwMDAwMDAwMDAwEgYIkKKzhgZaATE=").unwrap()), -// }, -// ], -// height: 0, -// revision: 0, -// }, -// }; -// -// let registered_query = -// build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 987); -// -// deps.querier -// .add_query_response(1, to_json_binary(&delegations_response).unwrap()); -// deps.querier.add_registered_queries(1, registered_query); -// -// let query_delegations = QueryMsg::GetDelegations { query_id: 1 }; -// let resp: DelegatorDelegationsResponse = -// from_json(query(deps.as_ref(), mock_env(), query_delegations).unwrap()).unwrap(); -// -// assert_eq!( -// resp, -// DelegatorDelegationsResponse { -// last_submitted_local_height: 987, -// delegations: vec![ -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: Coin::new(5177628u128, "uatom".to_string()), -// }, -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), -// amount: Coin::new(29620221u128, "uatom".to_string()), -// }, -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), -// amount: Coin::new(219920u128, "uatom".to_string()), -// }, -// ], -// } -// ) -// } -// -// #[test] -// fn test_sudo_tx_query_result_callback() { -// let mut deps = dependencies(&[]); -// let env = mock_env(); -// let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); -// let query_id: u64 = 1u64; -// let height: u64 = 1u64; -// let msg = ExecuteMsg::RegisterTransfersQuery { -// connection_id: "connection".to_string(), -// update_period: 1u64, -// recipient: watched_addr.clone(), -// min_height: None, -// }; -// execute( -// deps.as_mut(), -// env.clone(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ) -// .unwrap(); -// let registered_query = build_registered_query_response( -// 1, -// QueryParam::TransactionsFilter( -// to_string(&vec![&TransactionFilterItem { -// field: RECIPIENT_FIELD.to_string(), -// op: TransactionFilterOp::Eq, -// value: TransactionFilterValue::String(watched_addr.clone()), -// }]) -// .unwrap(), -// ), -// QueryType::TX, -// 0, -// ); -// deps.querier.add_registered_queries(1, registered_query); -// -// // simulate neutron's SudoTxQueryResult call with the following payload: -// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake -// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); -// sudo_tx_query_result( -// deps.as_mut(), -// env.clone(), -// query_id, -// Height { -// revision_number: 0, -// revision_height: height, -// }, -// data, -// ) -// .unwrap(); -// -// // ensure the callback has worked and contract's state has changed -// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); -// assert_eq!( -// txs, -// Vec::from([Transfer { -// recipient: watched_addr.clone(), -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// }]) -// ); -// -// // simulate neutron's SudoTxQueryResult call with the following payload: -// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake -// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); -// let res = sudo_tx_query_result( -// deps.as_mut(), -// env.clone(), -// query_id, -// Height { -// revision_number: 0, -// revision_height: height, -// }, -// data, -// ); -// -// // ensure the callback has returned an error and contract's state hasn't changed -// assert_eq!( -// res.unwrap_err(), -// NeutronError::Std(StdError::generic_err( -// "failed to find a matching transaction message", -// )) -// ); -// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); -// assert_eq!( -// txs, -// Vec::from([Transfer { -// recipient: watched_addr.clone(), -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// }]) -// ); -// -// // simulate neutron's SudoTxQueryResult call with the following payload: -// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake -// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); -// sudo_tx_query_result( -// deps.as_mut(), -// env, -// query_id, -// Height { -// revision_number: 0, -// revision_height: height, -// }, -// data, -// ) -// .unwrap(); -// -// // ensure the callback has worked and contract's state has changed again -// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); -// assert_eq!( -// txs, -// Vec::from([ -// Transfer { -// recipient: watched_addr.clone(), -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// }, -// Transfer { -// recipient: watched_addr, -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// } -// ]) -// ); -// } -// -// #[test] -// fn test_sudo_tx_query_result_min_height_callback() { -// let mut deps = dependencies(&[]); -// let env = mock_env(); -// let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); -// let query_id: u64 = 1u64; -// let height: u64 = 1u64; -// let msg = ExecuteMsg::RegisterTransfersQuery { -// connection_id: "connection".to_string(), -// update_period: 1u64, -// recipient: watched_addr.clone(), -// min_height: Some(100000), -// }; -// execute( -// deps.as_mut(), -// env.clone(), -// message_info(&Addr::unchecked(""), &[]), -// msg, -// ) -// .unwrap(); -// let registered_query = build_registered_query_response( -// 1, -// QueryParam::TransactionsFilter( -// to_string(&vec![&TransactionFilterItem { -// field: RECIPIENT_FIELD.to_string(), -// op: TransactionFilterOp::Eq, -// value: TransactionFilterValue::String(watched_addr.clone()), -// }]) -// .unwrap(), -// ), -// QueryType::TX, -// 0, -// ); -// deps.querier.add_registered_queries(1, registered_query); -// -// // simulate neutron's SudoTxQueryResult call with the following payload: -// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake -// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); -// sudo_tx_query_result( -// deps.as_mut(), -// env.clone(), -// query_id, -// Height { -// revision_number: 0, -// revision_height: height, -// }, -// data, -// ) -// .unwrap(); -// -// // ensure the callback has worked and contract's state has changed -// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); -// assert_eq!( -// txs, -// Vec::from([Transfer { -// recipient: watched_addr.clone(), -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// }]) -// ); -// -// // simulate neutron's SudoTxQueryResult call with the following payload: -// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake -// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); -// let res = sudo_tx_query_result( -// deps.as_mut(), -// env.clone(), -// query_id, -// Height { -// revision_number: 0, -// revision_height: height, -// }, -// data, -// ); -// -// // ensure the callback has returned an error and contract's state hasn't changed -// assert_eq!( -// res.unwrap_err(), -// NeutronError::Std(StdError::generic_err( -// "failed to find a matching transaction message", -// )) -// ); -// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); -// assert_eq!( -// txs, -// Vec::from([Transfer { -// recipient: watched_addr.clone(), -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// }]) -// ); -// -// // simulate neutron's SudoTxQueryResult call with the following payload: -// // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake -// let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); -// sudo_tx_query_result( -// deps.as_mut(), -// env, -// query_id, -// Height { -// revision_number: 0, -// revision_height: height, -// }, -// data, -// ) -// .unwrap(); -// -// // ensure the callback has worked and contract's state has changed again -// let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); -// assert_eq!( -// txs, -// Vec::from([ -// Transfer { -// recipient: watched_addr.clone(), -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// }, -// Transfer { -// recipient: watched_addr, -// sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), -// denom: "stake".to_string(), -// amount: "10000".to_string(), -// } -// ]) -// ); -// } +use base64::{prelude::*, Engine}; +use std::str::FromStr; + +use super::mock_querier::mock_dependencies as dependencies; +use crate::contract::{execute, query, sudo_tx_query_result}; +use crate::msg::{ExecuteMsg, QueryMsg}; +use crate::state::{Transfer, RECIPIENT_TXS}; +use crate::testing::mock_querier::WasmMockQuerier; +use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin as CosmosCoin, DecCoin as CosmosDecCoin}; +use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; +use cosmos_sdk_proto::cosmos::gov::v1beta1::{ + Proposal as CosmosProposal, TallyResult as CosmosTallyResult, +}; +use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; +use cosmos_sdk_proto::cosmos::staking::v1beta1::Validator as CosmosValidator; +use cosmos_sdk_proto::traits::Message; +use cosmos_sdk_proto::Any; +use cosmwasm_std::testing::{message_info, mock_env, MockApi, MockStorage}; +use cosmwasm_std::{ + from_json, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, + Uint128, +}; +use neutron_sdk::interchain_queries::helpers::{decode_and_convert, kv_key_from_string}; +use neutron_sdk::interchain_queries::types::{ + QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, +}; +use neutron_sdk::interchain_queries::v047::helpers::{ + create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, + create_total_denom_key, create_validator_key, +}; +use neutron_sdk::interchain_queries::v047::types::{ + Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, + TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, +}; +use neutron_std::types::cosmos::base::v1beta1::Coin as StdCoin; +use neutron_std::types::ibc::core::client::v1::Height; +use neutron_std::types::neutron::interchainqueries::{ + KvKey, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse, QueryResult, + RegisteredQuery, StorageValue, +}; + +use neutron_sdk::interchain_queries::hex::decode_hex; +use neutron_sdk::interchain_queries::v047::queries::{ + BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse, + TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, +}; +use neutron_sdk::NeutronError; +use schemars::_serde_json::to_string; + +enum QueryParam { + Keys(Vec), + TransactionsFilter(String), +} + +fn build_registered_query_response( + id: u64, + param: QueryParam, + query_type: QueryType, + last_submitted_result_local_height: u64, +) -> Binary { + let mut registered_keys = vec![]; + let mut transactions_filter = "".to_string(); + match param { + QueryParam::Keys(keys) => registered_keys = keys, + QueryParam::TransactionsFilter(filter) => transactions_filter = filter, + } + let resp = QueryRegisteredQueryResponse { + registered_query: Some(RegisteredQuery { + id, + owner: "".to_string(), + keys: registered_keys, + query_type: query_type.into(), + transactions_filter, + connection_id: "".to_string(), + update_period: 0, + last_submitted_result_local_height, + last_submitted_result_remote_height: Some(Height { + revision_number: 0, + revision_height: 0, + }), + deposit: Vec::from([StdCoin { + denom: "stake".to_string(), + amount: "100".to_string(), + }]), + submit_timeout: 0, + registered_at_height: 0, + }), + }; + + let res = Message::encode_to_vec(&resp); + Binary::from(res.as_slice()) +} + +fn build_interchain_query_bank_total_denom_value(denom: String, amount: String) -> StorageValue { + let bank_total_key = create_total_denom_key(denom).unwrap(); + + let amount = amount.as_bytes().to_vec(); + + StorageValue { + storage_prefix: "".to_string(), + key: bank_total_key, + value: amount, + proof: None, + } +} + +fn build_interchain_query_distribution_fee_pool_response(denom: String, amount: String) -> Binary { + let fee_pool_key = create_fee_pool_key().unwrap(); + + let community_pool_amount = CosmosDecCoin { denom, amount }; + + let fee_pool = CosmosFeePool { + community_pool: vec![community_pool_amount], + }; + + let s = StorageValue { + storage_prefix: "".to_string(), + key: fee_pool_key, + value: fee_pool.encode_to_vec(), + proof: None, + }; + + let res = Message::encode_to_vec(&QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + kv_results: vec![s], + block: None, + height: 123456, + revision: 2, + allow_kv_callbacks: false, + }) + }); + Binary::from(res.as_slice()) +} + +fn build_interchain_query_staking_validator_value(validator: String) -> StorageValue { + let operator_address = decode_and_convert(validator.as_str()).unwrap(); + let validator_key = create_validator_key(operator_address).unwrap(); + + let validator = CosmosValidator { + operator_address: validator, + consensus_pubkey: Some(Any { + type_url: "".to_string(), + value: vec![], + }), + status: 1, + tokens: "1".to_string(), + jailed: false, + delegator_shares: "1".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "1".to_string(), + }; + + StorageValue { + storage_prefix: "".to_string(), + key: validator_key, + value: validator.encode_to_vec(), + proof: None, + } +} + +fn build_interchain_query_validator_signing_info_value( + validator: String, + jailed_until: Option, +) -> StorageValue { + let operator_address = decode_and_convert(validator.as_str()).unwrap(); + let validator_key = create_validator_key(operator_address).unwrap(); + + let validator = CosmosValidatorSigningInfo { + address: validator, + start_height: 1, + index_offset: 20, + jailed_until, + tombstoned: false, + missed_blocks_counter: 13, + }; + + StorageValue { + storage_prefix: "".to_string(), + key: validator_key, + value: validator.encode_to_vec(), + proof: None, + } +} + +fn build_interchain_query_gov_proposal_value(proposal_id: u64) -> StorageValue { + let proposal_key = create_gov_proposal_key(proposal_id).unwrap(); + + let proposal = CosmosProposal { + proposal_id, + content: Some(Any { + type_url: "/cosmos.gov.v1beta1.TextProposal".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: Some(CosmosTallyResult { + abstain: "0".to_string(), + yes: "0".to_string(), + no: "0".to_string(), + no_with_veto: "0".to_string(), + }), + deposit_end_time: None, + submit_time: None, + total_deposit: Vec::from([CosmosCoin { + denom: "stake".to_string(), + amount: "100".to_string(), + }]), + voting_start_time: None, + voting_end_time: None, + }; + + StorageValue { + storage_prefix: "".to_string(), + key: proposal_key, + value: proposal.encode_to_vec(), + proof: None, + } +} + +fn build_interchain_query_balances_response(addr: Addr, balances: Vec) -> Binary { + let converted_addr_bytes = decode_and_convert(addr.as_str()).unwrap(); + + let s: Vec = balances + .iter() + .map(|c| { + let balance_key = + create_account_denom_balance_key(converted_addr_bytes.clone(), c.denom.clone()) + .unwrap(); + StorageValue { + storage_prefix: "".to_string(), + key: balance_key, + value: c.amount.to_string().into_bytes(), + proof: None, + } + }) + .collect(); + + let resp = QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + kv_results: s, + block: None, + height: 123456, + revision: 2, + allow_kv_callbacks: false, + }), + }; + let res = Message::encode_to_vec(&resp); + Binary::from(res.as_slice()) +} + +// registers an interchain query +fn register_query( + deps: &mut OwnedDeps, + env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Vec { + let reg_msgs = execute(deps.as_mut(), env, info, msg).unwrap(); + for attr in reg_msgs.attributes { + if attr.key == "kv_keys" && !attr.value.is_empty() { + return vec![kv_key_from_string(attr.value).unwrap()]; + } + } + + vec![] +} + +#[test] +fn test_query_balance() { + let mut deps = dependencies(&[]); + + let msg = ExecuteMsg::RegisterBalancesQuery { + connection_id: "connection".to_string(), + update_period: 10, + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + denoms: vec!["uosmo".to_string()], + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + build_interchain_query_balances_response( + Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + vec![Coin::new(8278104u128, "uosmo")], + ), + ); + let query_balance = QueryMsg::Balance { query_id: 1 }; + let resp: BalanceResponse = + from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); + assert_eq!( + resp, + BalanceResponse { + last_submitted_local_height: 987, + balances: Balances { + coins: vec![Coin::new(8278104u128, "uosmo")] + }, + } + ) +} + +#[test] +fn test_query_balances() { + let mut deps = dependencies(&[]); + + let msg = ExecuteMsg::RegisterBalancesQuery { + connection_id: "connection".to_string(), + update_period: 10, + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + denoms: vec!["uosmo".to_string(), "uatom".to_string()], + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + build_interchain_query_balances_response( + Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + vec![ + Coin::new(8278104u128, "uosmo"), + Coin::new(1234567u128, "uatom"), + ], + ), + ); + let query_balance = QueryMsg::Balance { query_id: 1 }; + let resp: BalanceResponse = + from_json(query(deps.as_ref(), mock_env(), query_balance).unwrap()).unwrap(); + assert_eq!( + resp, + BalanceResponse { + last_submitted_local_height: 987, + balances: Balances { + coins: vec![ + Coin::new(8278104u128, "uosmo"), + Coin::new(1234567u128, "uatom") + ] + }, + } + ) +} + +#[test] +fn test_bank_total_supply_query() { + let mut deps = dependencies(&[]); + + let denoms = vec!["uosmo".to_string(), "uatom".to_string()]; + + let msg = ExecuteMsg::RegisterBankTotalSupplyQuery { + connection_id: "connection".to_string(), + update_period: 10, + denoms: denoms.clone(), + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + let mut kv_results: Vec = vec![]; + + for denom in denoms { + let value = + build_interchain_query_bank_total_denom_value(denom.to_string(), "8278104".to_string()); + kv_results.push(value); + } + + let total_supply_response = QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + kv_results, + block: None, + height: 0, + revision: 0, + allow_kv_callbacks: false, + }), + }; + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + Binary::from(Message::encode_to_vec(&total_supply_response).as_slice()), + ); + let bank_total_balance = QueryMsg::BankTotalSupply { query_id: 1 }; + + let resp: TotalSupplyResponse = + from_json(query(deps.as_ref(), mock_env(), bank_total_balance).unwrap()).unwrap(); + assert_eq!( + resp, + TotalSupplyResponse { + last_submitted_local_height: 987, + supply: TotalSupply { + coins: vec![ + Coin::new(8278104u128, "uosmo"), + Coin::new(8278104u128, "uatom"), + ] + }, + } + ); +} + +#[test] +fn test_distribution_fee_pool_query() { + let mut deps = dependencies(&[]); + + let msg = ExecuteMsg::RegisterDistributionFeePoolQuery { + connection_id: "connection".to_string(), + update_period: 10, + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + build_interchain_query_distribution_fee_pool_response( + "uosmo".to_string(), + "8278104000000000000000000".to_string(), // 8278104 + 18 zeros + ), + ); + let fee_pool_balance = QueryMsg::DistributionFeePool { query_id: 1 }; + let resp: FeePoolResponse = + from_json(query(deps.as_ref(), mock_env(), fee_pool_balance).unwrap()).unwrap(); + assert_eq!( + resp, + FeePoolResponse { + last_submitted_local_height: 987, + pool: FeePool { + coins: vec![Coin::new(8278104u128, "uosmo")] + }, + } + ) +} + +#[test] +fn test_gov_proposals_query() { + let mut deps = dependencies(&[]); + + let proposals_ids = vec![1, 2, 3]; + + let msg = ExecuteMsg::RegisterGovernmentProposalsQuery { + connection_id: "connection".to_string(), + proposals_ids: proposals_ids.clone(), + update_period: 10, + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + let mut kv_results: Vec = vec![]; + + for id in proposals_ids { + let value = build_interchain_query_gov_proposal_value(id); + kv_results.push(value); + } + + let proposals_response = QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + kv_results, + block: None, + height: 0, + revision: 0, + allow_kv_callbacks: false, + }), + }; + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + Binary::from(Message::encode_to_vec(&proposals_response).as_slice()), + ); + + let government_proposal = QueryMsg::GovernmentProposals { query_id: 1 }; + let resp: ProposalResponse = + from_json(query(deps.as_ref(), mock_env(), government_proposal).unwrap()).unwrap(); + assert_eq!( + resp, + ProposalResponse { + last_submitted_local_height: 987, + proposals: GovernmentProposal { + proposals: vec![ + Proposal { + proposal_id: 1, + proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), + total_deposit: Vec::from([Coin { + denom: "stake".to_string(), + amount: Uint128::from_str("100").unwrap(), + }]), + status: 1, + submit_time: None, + deposit_end_time: None, + voting_end_time: None, + voting_start_time: None, + final_tally_result: Some(TallyResult { + abstain: Uint128::zero(), + yes: Uint128::zero(), + no: Uint128::zero(), + no_with_veto: Uint128::zero(), + }), + }, + Proposal { + proposal_id: 2, + proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), + total_deposit: Vec::from([Coin { + denom: "stake".to_string(), + amount: Uint128::from_str("100").unwrap(), + }]), + status: 1, + submit_time: None, + deposit_end_time: None, + voting_end_time: None, + voting_start_time: None, + final_tally_result: Some(TallyResult { + abstain: Uint128::zero(), + yes: Uint128::zero(), + no: Uint128::zero(), + no_with_veto: Uint128::zero(), + }), + }, + Proposal { + proposal_id: 3, + proposal_type: Some("/cosmos.gov.v1beta1.TextProposal".to_string()), + total_deposit: Vec::from([Coin { + denom: "stake".to_string(), + amount: Uint128::from_str("100").unwrap(), + }]), + status: 1, + submit_time: None, + deposit_end_time: None, + voting_end_time: None, + voting_start_time: None, + final_tally_result: Some(TallyResult { + abstain: Uint128::zero(), + yes: Uint128::zero(), + no: Uint128::zero(), + no_with_veto: Uint128::zero(), + }), + }, + ] + }, + } + ) +} + +#[test] +fn test_staking_validators_query() { + let mut deps = dependencies(&[]); + let validators = vec![ + "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), + "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), + ]; + + let msg = ExecuteMsg::RegisterStakingValidatorsQuery { + connection_id: "connection".to_string(), + update_period: 10, + validators: validators.clone(), + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + let mut kv_results: Vec = vec![]; + + for validator in validators { + let value = build_interchain_query_staking_validator_value(validator); + kv_results.push(value); + } + + let validators_response = QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + kv_results, + block: None, + height: 0, + revision: 0, + allow_kv_callbacks: false, + }), + }; + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + Binary::from(Message::encode_to_vec(&validators_response).as_slice()), + ); + let staking_validators = QueryMsg::StakingValidators { query_id: 1 }; + let resp: ValidatorResponse = + from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); + assert_eq!( + resp, + ValidatorResponse { + last_submitted_local_height: 987, + validator: StakingValidator { + validators: vec![ + Validator { + operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" + .to_string(), + status: 1, + consensus_pubkey: Some(vec!()), + tokens: "1".to_string(), + jailed: false, + delegator_shares: "1".to_string(), + unbonding_height: 0, + unbonding_time: None, + min_self_delegation: Decimal::from_str("1").unwrap(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + }, + Validator { + operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" + .to_string(), + status: 1, + consensus_pubkey: Some(vec!()), + tokens: "1".to_string(), + jailed: false, + delegator_shares: "1".to_string(), + unbonding_height: 0, + unbonding_time: None, + min_self_delegation: Decimal::from_str("1").unwrap(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + }, + ] + }, + } + ) +} + +#[test] +fn test_validators_signing_infos_query() { + let mut deps = dependencies(&[]); + let validators = vec![ + ( + "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), + None, + ), + ( + "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), + Some(prost_types::Timestamp { + seconds: 1203981203, + nanos: 123123, + }), + ), + ]; + + let msg = ExecuteMsg::RegisterValidatorsSigningInfosQuery { + connection_id: "connection".to_string(), + update_period: 10, + validators: validators.clone().into_iter().map(|(v, _)| v).collect(), + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + let mut kv_results: Vec = vec![]; + + for validator in validators { + let value = build_interchain_query_validator_signing_info_value(validator.0, validator.1); + kv_results.push(value); + } + + let validators_response = QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + kv_results, + block: None, + height: 0, + revision: 0, + allow_kv_callbacks: false, + }), + }; + + deps.querier.add_registered_queries(1, registered_query); + deps.querier.add_query_response( + 1, + Binary::from(Message::encode_to_vec(&validators_response).as_slice()), + ); + let staking_validators = QueryMsg::ValidatorsSigningInfos { query_id: 1 }; + let resp: ValidatorSigningInfoResponse = + from_json(query(deps.as_ref(), mock_env(), staking_validators).unwrap()).unwrap(); + assert_eq!( + resp, + ValidatorSigningInfoResponse { + last_submitted_local_height: 987, + signing_infos: SigningInfo { + signing_infos: vec![ + ValidatorSigningInfo { + address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w".to_string(), + start_height: 1, + index_offset: 20, + jailed_until: None, + tombstoned: false, + missed_blocks_counter: 13, + }, + ValidatorSigningInfo { + address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0".to_string(), + start_height: 1, + index_offset: 20, + jailed_until: Some(1203981203), + tombstoned: false, + missed_blocks_counter: 13, + }, + ] + }, + } + ) +} + +#[test] +fn test_query_delegator_delegations() { + let mut deps = dependencies(&[]); + + let msg = ExecuteMsg::RegisterDelegatorDelegationsQuery { + connection_id: "connection".to_string(), + update_period: 10, + delegator: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validators: vec![ + "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), + "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), + ], + }; + + let keys = register_query( + &mut deps, + mock_env(), + message_info(&Addr::unchecked(""), &[]), + msg, + ); + + let delegations_response = QueryRegisteredQueryResultResponse { + result: Some(QueryResult { + // response for `RegisterDelegatorDelegationsQuery` with necessary KV values to test reconstruction logic. + // The values are taken from osmosis network + kv_results: vec![ + // params value of staking module for key 'staking/params' + // value: Params + StorageValue { + storage_prefix: "staking".to_string(), + key: vec![STAKING_PARAMS_KEY], + value: BASE64_STANDARD.decode("CgQIgN9uEGQYByCQTioFdWF0b20yATA6FC0xMDAwMDAwMDAwMDAwMDAwMDAwQhMxMDAwMDAwMDAwMDAwMDAwMDAwShMxMDAwMDAwMDAwMDAwMDAwMDAw").unwrap(), + proof: None, + }, + // delegation + // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs + // to: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 + // delegation_shares: "5177628000000000000000000" + StorageValue { + storage_prefix: "staking".to_string(), + key: decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b8141ab940697a73dd080edafeb538ad408b5cae0264").unwrap(), + value: BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxoZNTE3NzYyODAwMDAwMDAwMDAwMDAwMDAwMA==").unwrap(), + proof: None, + }, + // validator: osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3 + // delegator_shares: "2845862840643000000000000000000" + // total tokens: "2845862840643" + StorageValue { + storage_prefix: "staking".to_string(), + key: decode_hex("21141ab940697a73dd080edafeb538ad408b5cae0264").unwrap(), + value: BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFyMnU1cTZ0Nncwd3Nzcms2bDY2bjN0MnEzZHcydXFueTRnajJlMxJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiCaZhCbacCetQorko3LfUUJX2UEyX38qBGVri8GyH8lcCADKg0yODQ1ODYyODQwNjQzMh8yODQ1ODYyODQwNjQzMDAwMDAwMDAwMDAwMDAwMDAwOqQCChRzdHJhbmdlbG92ZS12ZW50dXJlcxIQRDBEOEI4MEYxQzVDNzBCNRocaHR0cHM6Ly9zdHJhbmdlbG92ZS52ZW50dXJlcyrbAScuLi5iZWNhdXNlIG9mIHRoZSBhdXRvbWF0ZWQgYW5kIGlycmV2b2NhYmxlIGRlY2lzaW9uLW1ha2luZyBwcm9jZXNzIHdoaWNoIHJ1bGVzIG91dCBodW1hbiBtZWRkbGluZywgdGhlIERvb21zZGF5IG1hY2hpbmUgaXMgdGVycmlmeWluZyBhbmQgc2ltcGxlIHRvIHVuZGVyc3RhbmQgYW5kIGNvbXBsZXRlbHkgY3JlZGlibGUgYW5kIGNvbnZpbmNpbmcuJyAtIERyLiBTdHJhbmdlbG92ZUoAUkwKPAoRNTAwMDAwMDAwMDAwMDAwMDASEzEwMDAwMDAwMDAwMDAwMDAwMDAaEjUwMDAwMDAwMDAwMDAwMDAwMBIMCPetyYYGEKPoosUCWgEx").unwrap(), + proof: None, + }, + // delegation + // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs + // to: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t + // delegation_shares: "29620221000000000000000000" + StorageValue { + storage_prefix: "staking".to_string(), + key: decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814cc9598513212c12c36a1775e2233b962e4d5128e").unwrap(), + value: BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBoaMjk2MjAyMjEwMDAwMDAwMDAwMDAwMDAwMDA=").unwrap(), + proof: None, + }, + // validator: osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t + // delegator_shares: "3054477259038000000000000000000" + // total tokens: "3054477259038" + StorageValue { + storage_prefix: "staking".to_string(), + key: decode_hex("2114cc9598513212c12c36a1775e2233b962e4d5128e").unwrap(), + value: BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFlajJlczVmanp0cWpjZDRwd2Ewenl2YWV2dGpkMnk1dzM3d3I5dBJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiA27dgAuZV/uS9FdsILGWLBw8eYPy+ZEyv1Df2VsrjXDiADKg0zMDU0NDc3MjU5MDM4Mh8zMDU0NDc3MjU5MDM4MDAwMDAwMDAwMDAwMDAwMDAwOoEBChFGcmVucyAo8J+knSzwn6SdKRIQQzQ3ODQ1MjI2NjYyQUY0NxoSaHR0cHM6Ly9mcmVucy5hcm15IhtzZWN1cml0eUBraWRzb250aGVibG9jay54eXoqKVlvdXIgZnJpZW5kbHkgdmFsaWRhdG9yIGZvciBjb3Ntb3MgY2hhaW5zQP3HpQFKCwj3zq6PBhCfrO86UkoKOgoRNTAwMDAwMDAwMDAwMDAwMDASEjUwMDAwMDAwMDAwMDAwMDAwMBoRNTAwMDAwMDAwMDAwMDAwMDASDAjg1rSQBhDkudCDAVoDNTAw").unwrap(), + proof: None, + }, + // delegation + // from: osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs + // to: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we + // delegation_shares: "219920000000000000000000" + StorageValue { + storage_prefix: "staking".to_string(), + key: decode_hex("311420a959e0d22e201f727137f2d7c41a5dc63b90b814f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap(), + value: BASE64_STANDARD.decode("Citvc21vMXl6NTRuY3hqOWNzcDd1bjN4bGVkMDNxNnRocnJoeTljenRrZnpzEjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRoYMjE5OTIwMDAwMDAwMDAwMDAwMDAwMDAw").unwrap(), + proof: None, + }, + // validator: osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we + // delegator_shares: "3201438898476000000000000000000" + // total tokens: "3201438898476" + StorageValue { + storage_prefix: "staking".to_string(), + key: decode_hex("2114f8aff987b760a6e4b2b2df48a5a3b7ed2db15006").unwrap(), + value: BASE64_STANDARD.decode("CjJvc21vdmFsb3BlcjFsemhsbnBhaHZ6bndmdjRqbWF5MnRnYWhhNWttejVxeHdtajl3ZRJDCh0vY29zbW9zLmNyeXB0by5lZDI1NTE5LlB1YktleRIiCiBPXCnkQvO+pU6oGbp4ZiJBBZ7RNoLYtXYFOEdpXGH+uSADKg0zMjAxNDM4ODk4NDc2Mh8zMjAxNDM4ODk4NDc2MDAwMDAwMDAwMDAwMDAwMDAwOp8CCgtDaXRhZGVsLm9uZRIQRUJCMDNFQjRCQjRDRkNBNxoTaHR0cHM6Ly9jaXRhZGVsLm9uZSroAUNpdGFkZWwub25lIGlzIGEgbXVsdGktYXNzZXQgbm9uLWN1c3RvZGlhbCBzdGFraW5nIHBsYXRmb3JtIHRoYXQgbGV0cyBhbnlvbmUgYmVjb21lIGEgcGFydCBvZiBkZWNlbnRyYWxpemVkIGluZnJhc3RydWN0dXJlIGFuZCBlYXJuIHBhc3NpdmUgaW5jb21lLiBTdGFrZSB3aXRoIG91ciBub2RlcyBvciBhbnkgb3RoZXIgdmFsaWRhdG9yIGFjcm9zcyBtdWx0aXBsZSBuZXR3b3JrcyBpbiBhIGZldyBjbGlja3NKAFJECjoKETUwMDAwMDAwMDAwMDAwMDAwEhIyMDAwMDAwMDAwMDAwMDAwMDAaETMwMDAwMDAwMDAwMDAwMDAwEgYIkKKzhgZaATE=").unwrap(), + proof: None, + }, + ], + block: None, + height: 0, + revision: 0, + allow_kv_callbacks: false, + }), + }; + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys), QueryType::KV, 987); + + deps.querier.add_query_response( + 1, + Binary::from(Message::encode_to_vec(&delegations_response).as_slice()), + ); + deps.querier.add_registered_queries(1, registered_query); + + let query_delegations = QueryMsg::GetDelegations { query_id: 1 }; + let resp: DelegatorDelegationsResponse = + from_json(query(deps.as_ref(), mock_env(), query_delegations).unwrap()).unwrap(); + + assert_eq!( + resp, + DelegatorDelegationsResponse { + last_submitted_local_height: 987, + delegations: vec![ + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: Coin::new(5177628u128, "uatom".to_string()), + }, + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1ej2es5fjztqjcd4pwa0zyvaevtjd2y5w37wr9t".to_string(), + amount: Coin::new(29620221u128, "uatom".to_string()), + }, + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), + amount: Coin::new(219920u128, "uatom".to_string()), + }, + ], + } + ) +} + +#[test] +fn test_sudo_tx_query_result_callback() { + let mut deps = dependencies(&[]); + let env = mock_env(); + let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); + let query_id: u64 = 1u64; + let height: u64 = 1u64; + let msg = ExecuteMsg::RegisterTransfersQuery { + connection_id: "connection".to_string(), + update_period: 1u64, + recipient: watched_addr.clone(), + min_height: None, + }; + execute( + deps.as_mut(), + env.clone(), + message_info(&Addr::unchecked(""), &[]), + msg, + ) + .unwrap(); + let registered_query = build_registered_query_response( + 1, + QueryParam::TransactionsFilter( + to_string(&vec![&TransactionFilterItem { + field: RECIPIENT_FIELD.to_string(), + op: TransactionFilterOp::Eq, + value: TransactionFilterValue::String(watched_addr.clone()), + }]) + .unwrap(), + ), + QueryType::TX, + 0, + ); + deps.querier.add_registered_queries(1, registered_query); + + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake + let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); + sudo_tx_query_result( + deps.as_mut(), + env.clone(), + query_id, + Height { + revision_number: 0, + revision_height: height, + }, + data, + ) + .unwrap(); + + // ensure the callback has worked and contract's state has changed + let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); + assert_eq!( + txs, + Vec::from([Transfer { + recipient: watched_addr.clone(), + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + }]) + ); + + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake + let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); + let res = sudo_tx_query_result( + deps.as_mut(), + env.clone(), + query_id, + Height { + revision_number: 0, + revision_height: height, + }, + data, + ); + + // ensure the callback has returned an error and contract's state hasn't changed + assert_eq!( + res.unwrap_err(), + NeutronError::Std(StdError::generic_err( + "failed to find a matching transaction message", + )) + ); + let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); + assert_eq!( + txs, + Vec::from([Transfer { + recipient: watched_addr.clone(), + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + }]) + ); + + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake + let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); + sudo_tx_query_result( + deps.as_mut(), + env, + query_id, + Height { + revision_number: 0, + revision_height: height, + }, + data, + ) + .unwrap(); + + // ensure the callback has worked and contract's state has changed again + let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); + assert_eq!( + txs, + Vec::from([ + Transfer { + recipient: watched_addr.clone(), + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + }, + Transfer { + recipient: watched_addr, + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + } + ]) + ); +} + +#[test] +fn test_sudo_tx_query_result_min_height_callback() { + let mut deps = dependencies(&[]); + let env = mock_env(); + let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); + let query_id: u64 = 1u64; + let height = Height { + revision_number: 0u64, + revision_height: 1u64, + }; + let msg = ExecuteMsg::RegisterTransfersQuery { + connection_id: "connection".to_string(), + update_period: 1u64, + recipient: watched_addr.clone(), + min_height: Some(100000), + }; + execute( + deps.as_mut(), + env.clone(), + message_info(&Addr::unchecked(""), &[]), + msg, + ) + .unwrap(); + let registered_query = build_registered_query_response( + 1, + QueryParam::TransactionsFilter( + to_string(&vec![&TransactionFilterItem { + field: RECIPIENT_FIELD.to_string(), + op: TransactionFilterOp::Eq, + value: TransactionFilterValue::String(watched_addr.clone()), + }]) + .unwrap(), + ), + QueryType::TX, + 0, + ); + deps.querier.add_registered_queries(1, registered_query); + + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake + let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); + sudo_tx_query_result(deps.as_mut(), env.clone(), query_id, height.clone(), data).unwrap(); + + // ensure the callback has worked and contract's state has changed + let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); + assert_eq!( + txs, + Vec::from([Transfer { + recipient: watched_addr.clone(), + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + }]) + ); + + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake + let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); + let res = sudo_tx_query_result( + deps.as_mut(), + env.clone(), + query_id, + height.clone(), + data, + ); + + // ensure the callback has returned an error and contract's state hasn't changed + assert_eq!( + res.unwrap_err(), + NeutronError::Std(StdError::generic_err( + "failed to find a matching transaction message", + )) + ); + let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); + assert_eq!( + txs, + Vec::from([Transfer { + recipient: watched_addr.clone(), + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + }]) + ); + + // simulate neutron's SudoTxQueryResult call with the following payload: + // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake + let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); + sudo_tx_query_result( + deps.as_mut(), + env, + query_id, + height, + data, + ) + .unwrap(); + + // ensure the callback has worked and contract's state has changed again + let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); + assert_eq!( + txs, + Vec::from([ + Transfer { + recipient: watched_addr.clone(), + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + }, + Transfer { + recipient: watched_addr, + sender: "neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf".to_string(), + denom: "stake".to_string(), + amount: "10000".to_string(), + } + ]) + ); +} diff --git a/packages/neutron-sdk/src/interchain_queries/helpers.rs b/packages/neutron-sdk/src/interchain_queries/helpers.rs index 4b01b078..41bd1d2a 100644 --- a/packages/neutron-sdk/src/interchain_queries/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/helpers.rs @@ -1,4 +1,5 @@ use crate::errors::error::{NeutronError, NeutronResult}; +use crate::interchain_queries::hex::decode_hex; use crate::interchain_queries::types::{ AddressBytes, QueryPayload, QueryType, TransactionFilterItem, MAX_ADDR_LEN, }; @@ -8,7 +9,6 @@ use neutron_std::types::neutron::interchainqueries::{ MsgUpdateInterchainQueryRequest, }; use serde_json_wasm::to_string; -use crate::interchain_queries::hex::decode_hex; /// Decodes a bech32 encoded string and converts to base64 encoded bytes /// @@ -131,4 +131,4 @@ pub fn kv_key_from_string>(s: S) -> Option { path: split[0].to_string(), key: decode_hex(split[1])?, }) -} \ No newline at end of file +} diff --git a/packages/neutron-sdk/src/interchain_queries/mod.rs b/packages/neutron-sdk/src/interchain_queries/mod.rs index 91162bb9..1bda93e4 100644 --- a/packages/neutron-sdk/src/interchain_queries/mod.rs +++ b/packages/neutron-sdk/src/interchain_queries/mod.rs @@ -1,8 +1,8 @@ pub mod helpers; +pub mod hex; pub mod queries; pub mod types; pub mod v045; pub mod v047; -pub mod hex; pub use queries::{check_query_type, get_registered_query, query_kv_result}; From ba8de0cd679e58446fb902aa4cc865765d74fa3a Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 16 Oct 2024 17:22:39 +0400 Subject: [PATCH 22/35] fix tests in packages --- .../src/testing/mock_querier.rs | 4 +- .../src/interchain_queries/v045/testing.rs | 2925 +++++++++-------- .../src/interchain_queries/v047/testing.rs | 2671 +++++++-------- 3 files changed, 2824 insertions(+), 2776 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs index 9b6aa350..d73b8bcc 100644 --- a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs +++ b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs @@ -1,7 +1,7 @@ use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; use cosmwasm_std::{ - from_json, Binary, Coin, ContractResult, CustomQuery, FullDelegation, GrpcQuery, OwnedDeps, - Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, Validator, + from_json, Binary, Coin, ContractResult, CustomQuery, GrpcQuery, OwnedDeps, + Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, }; use neutron_std::types::neutron::interchainqueries::{ QueryRegisteredQueryRequest, QueryRegisteredQueryResultRequest, diff --git a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs index 53493b9a..847c26df 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs @@ -1,1450 +1,1475 @@ -// use crate::bindings::types::StorageValue; -// use crate::interchain_queries::helpers::decode_and_convert; -// use crate::interchain_queries::types::{AddressBytes, KVReconstruct}; -// use crate::interchain_queries::v045::helpers::{ -// create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, -// create_gov_proposal_key, create_gov_proposal_votes_key, create_params_store_key, -// create_total_denom_key, create_validator_key, create_validator_signing_info_key, -// deconstruct_account_denom_balance_key, -// }; -// use crate::interchain_queries::v045::types::BALANCES_PREFIX; -// use crate::interchain_queries::v045::types::{ -// Balances, Delegations, FeePool, GovernmentProposal, GovernmentProposalVotes, Proposal, -// ProposalVote, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, -// UnbondingDelegations, UnbondingEntry, UnbondingResponse, Validator as ContractValidator, -// ValidatorSigningInfo, WeightedVoteOption, DECIMAL_PLACES, KEY_BOND_DENOM, STAKING_STORE_KEY, -// }; -// use crate::{NeutronError, NeutronResult}; -// use base64::prelude::*; -// use base64::Engine; -// use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; -// use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; -// use cosmos_sdk_proto::cosmos::gov::v1beta1::{ -// Proposal as CosmosProposal, TallyResult as CosmosTallyResult, Vote, -// WeightedVoteOption as CosmosWeightedVoteOption, -// }; -// use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; -// use cosmos_sdk_proto::cosmos::staking::v1beta1::{ -// Commission, CommissionRates, Delegation, Description, Validator, -// }; -// use cosmos_sdk_proto::traits::Message; -// use cosmwasm_std::{to_json_binary, Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; -// use hex; -// use std::ops::Mul; -// use std::str::FromStr; -// -// // raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. -// pub const BALANCES_HEX_RESPONSE: &str = "0a057374616b6512083939393939303030"; -// pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "333030303031303938"; -// pub const FEE_POOL_HEX_RESPONSE: &str = -// "0a1d0a057374616b6512143231393630303030303030303030303030303030"; -// pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "0801129f010a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c127b0a11416464204e65772056616c696461746f721266546869732070726f706f73616c20726571756573747320616464696e672061206e65772076616c696461746f7220746f20746865206e6574776f726b20746f20696d70726f766520646563656e7472616c697a6174696f6e20616e642073656375726974792e1801220c0a01301201301a01302201302a0c08c9fdd3a20610988990d103320c08c9c3dea20610988990d1033a0d0a057374616b65120431303030420b088092b8c398feffffff014a0b088092b8c398feffffff01"; -// pub const GOV_PROPOSAL_VOTES_HEX_RESPONSE: &str = "0804122d636f736d6f73313068397374633576366e7467657967663578663934356e6a717135683332723533757175767722170801121331303030303030303030303030303030303030"; -// pub const STAKING_DENOM_HEX_RESPONSE: &str = "227374616b6522"; -// pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d747112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20b20c07b3eb900df72b48c24e9a2e06ff4fe73bbd255e433af8eae3b1988e698820032a09313030303030303030321b3130303030303030303030303030303030303030303030303030303a080a066d796e6f64654a00524a0a3b0a1231303030303030303030303030303030303012123230303030303030303030303030303030301a113130303030303030303030303030303030120b089cfcd3a20610e0dc890b5a0131"; -// pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73313566716a706a39307275686a353771336c366135686461307274373767366d63757a3777386e1234636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d74711a1b313030303030303030303030303030303030303030303030303030"; -// pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; -// pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; -// -// #[test] -// fn test_balance_reconstruct() { -// struct TestCase { -// addr: String, -// coins: Vec<(String, Uint128)>, -// } -// let test_cases: Vec = vec![ -// TestCase { -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// coins: vec![("uosmo".to_string(), Uint128::from(100u128))], -// }, -// TestCase { -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// coins: vec![ -// ("uosmo".to_string(), Uint128::from(100u128)), -// ("uatom".to_string(), Uint128::from(500u128)), -// ("uluna".to_string(), Uint128::from(80u128)), -// ], -// }, -// TestCase { -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// coins: vec![], -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); -// for coin in &ts.coins { -// let balance_key = -// create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); -// -// let balance_amount = Coin { -// denom: coin.0.clone(), -// amount: coin.1.to_string(), -// }; -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(balance_key), -// value: Binary::new(balance_amount.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let balances = Balances::reconstruct(&st_values).unwrap(); -// assert_eq!(balances.coins.len(), ts.coins.len()); -// for (i, coin) in balances.coins.iter().enumerate() { -// assert_eq!(coin.denom, ts.coins[i].0); -// assert_eq!(coin.amount, ts.coins[i].1) -// } -// } -// } -// -// #[test] -// fn test_bank_total_supply_reconstruct() { -// struct TestValue { -// denom: String, -// amount: String, -// } -// struct TestCase { -// values: Vec, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// values: vec![TestValue { -// denom: "uatom".to_string(), -// amount: "100".to_string(), -// }], -// }, -// TestCase { -// values: vec![ -// TestValue { -// denom: "uatom".to_string(), -// amount: "100".to_string(), -// }, -// TestValue { -// denom: "uosmo".to_string(), -// amount: "200".to_string(), -// }, -// ], -// }, -// TestCase { values: vec![] }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for case in &ts.values { -// let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(denom_key), -// value: Binary::new(case.amount.as_bytes().to_vec()), -// }; -// st_values.push(s); -// } -// -// let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); -// assert_eq!(total_supply.coins.len(), ts.values.len()); -// for (i, coin) in total_supply.coins.iter().enumerate() { -// assert_eq!(coin.denom, ts.values[i].denom); -// assert_eq!( -// coin.amount, -// Uint128::from_str(ts.values[i].amount.as_str()).unwrap() -// ) -// } -// } -// } -// -// #[test] -// fn test_staking_validators_reconstruct() { -// struct TestCase { -// validators: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(StakingValidator { -// validators: vec![ContractValidator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// status: 0, -// consensus_pubkey: None, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// unbonding_height: 0, -// unbonding_time: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }], -// }), -// }, -// TestCase { -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: Some(prost_types::Any { -// type_url: "consensus_pubkey".to_string(), -// value: vec![], -// }), -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: Some(Description { -// moniker: "Test validator".to_string(), -// identity: "JHFDHHFHF".to_string(), -// website: "https://neutron.org".to_string(), -// security_contact: "".to_string(), -// details: "Validator details".to_string(), -// }), -// unbonding_height: 0, -// unbonding_time: Some(prost_types::Timestamp { -// seconds: 1203981203, -// nanos: 123123, -// }), -// commission: Some(Commission { -// commission_rates: Some(CommissionRates { -// rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros -// max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros -// max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros -// }), -// update_time: Some(prost_types::Timestamp { -// seconds: 56324234, -// nanos: 1343, -// }), -// }), -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(StakingValidator { -// validators: vec![ContractValidator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// status: 0, -// consensus_pubkey: Some(vec![]), -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// moniker: Some("Test validator".to_string()), -// identity: Some("JHFDHHFHF".to_string()), -// website: Some("https://neutron.org".to_string()), -// security_contact: Some("".to_string()), -// details: Some("Validator details".to_string()), -// unbonding_height: 0, -// unbonding_time: Some(1203981203), -// rate: Some(Decimal::from_str("5").unwrap()), -// max_rate: Some(Decimal::from_str("20").unwrap()), -// max_change_rate: Some(Decimal::from_str("1").unwrap()), -// update_time: Some(56324234), -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }], -// }), -// }, -// TestCase { -// validators: vec![ -// Validator { -// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" -// .to_string(), -// consensus_pubkey: Some(prost_types::Any { -// type_url: "consensus_pubkey".to_string(), -// value: vec![1u8, 2u8, 3u8, 4u8], -// }), -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// Validator { -// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" -// .to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "2000000000000000000".to_string(), -// delegator_shares: "3000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// ], -// expected_result: Ok(StakingValidator { -// validators: vec![ -// ContractValidator { -// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" -// .to_string(), -// status: 0, -// consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// unbonding_height: 0, -// unbonding_time: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }, -// ContractValidator { -// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" -// .to_string(), -// status: 0, -// consensus_pubkey: None, -// tokens: "2000000000000000000".to_string(), -// delegator_shares: "3000000000000000000".to_string(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// unbonding_height: 0, -// unbonding_time: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }, -// ], -// }), -// }, -// TestCase { -// validators: vec![], -// expected_result: Ok(StakingValidator { validators: vec![] }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for validator in &ts.validators { -// let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); -// -// let validator_key = create_validator_key(&val_addr).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(validator_key), -// value: Binary::new(validator.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let stakin_validator = StakingValidator::reconstruct(&st_values); -// -// assert_eq!(stakin_validator, ts.expected_result) -// } -// } -// -// #[test] -// fn test_validators_signing_infos_reconstruct() { -// struct TestCase { -// signing_infos: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// signing_infos: vec![CosmosValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![ValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// }), -// }, -// TestCase { -// signing_infos: vec![CosmosValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(prost_types::Timestamp { -// seconds: 321654, -// nanos: 123123, -// }), -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![ValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(321654), -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// }), -// }, -// TestCase { -// signing_infos: vec![ -// CosmosValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: true, -// missed_blocks_counter: 987675, -// }, -// CosmosValidatorSigningInfo { -// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(prost_types::Timestamp { -// seconds: 321654, -// nanos: 123123, -// }), -// tombstoned: false, -// missed_blocks_counter: 345012, -// }, -// ], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![ -// ValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: true, -// missed_blocks_counter: 987675, -// }, -// ValidatorSigningInfo { -// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(321654), -// tombstoned: false, -// missed_blocks_counter: 345012, -// }, -// ], -// }), -// }, -// TestCase { -// signing_infos: vec![], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![], -// }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for info in &ts.signing_infos { -// let val_addr = decode_and_convert(info.address.as_str()).unwrap(); -// -// let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(signing_info_key), -// value: Binary::new(info.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let signing_infos = SigningInfo::reconstruct(&st_values); -// -// assert_eq!(signing_infos, ts.expected_result) -// } -// } -// -// #[test] -// fn test_government_proposals_reconstruct() { -// struct TestCase { -// proposals: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// proposals: vec![CosmosProposal { -// proposal_id: 1, -// content: Some(prost_types::Any { -// type_url: "proposal_type".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: None, -// submit_time: None, -// deposit_end_time: None, -// total_deposit: vec![Coin { -// amount: "100000".to_string(), -// denom: "stake".to_string(), -// }], -// voting_start_time: None, -// voting_end_time: None, -// }], -// expected_result: Ok(GovernmentProposal { -// proposals: vec![Proposal { -// proposal_id: 1, -// proposal_type: Some("proposal_type".to_string()), -// total_deposit: vec![StdCoin::new(100000u128, "stake")], -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_start_time: None, -// voting_end_time: None, -// final_tally_result: None, -// }], -// }), -// }, -// TestCase { -// proposals: vec![CosmosProposal { -// proposal_id: 1, -// content: Some(prost_types::Any { -// type_url: "proposal_type".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: Some(CosmosTallyResult { -// abstain: "1".to_string(), -// no: "2".to_string(), -// no_with_veto: "3".to_string(), -// yes: "4".to_string(), -// }), -// submit_time: Some(prost_types::Timestamp { -// seconds: 2222222, -// nanos: 123123, -// }), -// deposit_end_time: Some(prost_types::Timestamp { -// seconds: 3333333, -// nanos: 123123, -// }), -// total_deposit: vec![Coin { -// amount: "100000".to_string(), -// denom: "stake".to_string(), -// }], -// voting_start_time: Some(prost_types::Timestamp { -// seconds: 4444444, -// nanos: 123123, -// }), -// voting_end_time: Some(prost_types::Timestamp { -// seconds: 555555555, -// nanos: 123123, -// }), -// }], -// expected_result: Ok(GovernmentProposal { -// proposals: vec![Proposal { -// proposal_id: 1, -// proposal_type: Some("proposal_type".to_string()), -// total_deposit: vec![StdCoin::new(100000u128, "stake")], -// status: 1, -// submit_time: Some(2222222), -// deposit_end_time: Some(3333333), -// voting_start_time: Some(4444444), -// voting_end_time: Some(555555555), -// final_tally_result: Some(TallyResult { -// abstain: Uint128::from(1u64), -// no: Uint128::from(2u64), -// no_with_veto: Uint128::from(3u64), -// yes: Uint128::from(4u64), -// }), -// }], -// }), -// }, -// TestCase { -// proposals: vec![ -// CosmosProposal { -// proposal_id: 1, -// content: Some(prost_types::Any { -// type_url: "proposal_type1".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: None, -// submit_time: None, -// deposit_end_time: None, -// total_deposit: vec![Coin { -// amount: "100000".to_string(), -// denom: "stake".to_string(), -// }], -// voting_start_time: None, -// voting_end_time: None, -// }, -// CosmosProposal { -// proposal_id: 2, -// content: Some(prost_types::Any { -// type_url: "proposal_type2".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: None, -// submit_time: None, -// deposit_end_time: None, -// total_deposit: vec![Coin { -// amount: "200000".to_string(), -// denom: "osmo".to_string(), -// }], -// voting_start_time: None, -// voting_end_time: None, -// }, -// ], -// expected_result: Ok(GovernmentProposal { -// proposals: vec![ -// Proposal { -// proposal_id: 1, -// proposal_type: Some("proposal_type1".to_string()), -// total_deposit: vec![StdCoin::new(100000u128, "stake")], -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_start_time: None, -// voting_end_time: None, -// final_tally_result: None, -// }, -// Proposal { -// proposal_id: 2, -// proposal_type: Some("proposal_type2".to_string()), -// total_deposit: vec![StdCoin::new(200000u128, "osmo")], -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_start_time: None, -// voting_end_time: None, -// final_tally_result: None, -// }, -// ], -// }), -// }, -// TestCase { -// proposals: vec![], -// expected_result: Ok(GovernmentProposal { proposals: vec![] }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for proposal in &ts.proposals { -// let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(proposal_key), -// value: Binary::new(proposal.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let gov_proposal = GovernmentProposal::reconstruct(&st_values); -// -// assert_eq!(gov_proposal, ts.expected_result) -// } -// } -// -// #[allow(deprecated)] -// #[test] -// fn test_proposal_votes_reconstruct() { -// struct TestCase { -// proposal_votes: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// proposal_votes: vec![Vote { -// proposal_id: 1, -// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// option: 0, -// options: vec![CosmosWeightedVoteOption { -// weight: "1000000000000000000".to_string(), -// option: 1, -// }], -// }], -// expected_result: Ok(GovernmentProposalVotes { -// proposal_votes: vec![ProposalVote { -// proposal_id: 1, -// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// options: vec![WeightedVoteOption { -// weight: "1000000000000000000".to_string(), -// option: 1, -// }], -// }], -// }), -// }, -// TestCase { -// proposal_votes: vec![ -// Vote { -// proposal_id: 1, -// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// option: 0, -// options: vec![CosmosWeightedVoteOption { -// weight: "1000000000000000000".to_string(), -// option: 1, -// }], -// }, -// Vote { -// proposal_id: 2, -// voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// option: 0, -// options: vec![CosmosWeightedVoteOption { -// weight: "567890".to_string(), -// option: 2, -// }], -// }, -// ], -// expected_result: Ok(GovernmentProposalVotes { -// proposal_votes: vec![ -// ProposalVote { -// proposal_id: 1, -// voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// options: vec![WeightedVoteOption { -// weight: "1000000000000000000".to_string(), -// option: 1, -// }], -// }, -// ProposalVote { -// proposal_id: 2, -// voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// options: vec![WeightedVoteOption { -// weight: "567890".to_string(), -// option: 2, -// }], -// }, -// ], -// }), -// }, -// TestCase { -// proposal_votes: vec![], -// expected_result: Ok(GovernmentProposalVotes { -// proposal_votes: vec![], -// }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for votes in &ts.proposal_votes { -// let proposal_key = create_gov_proposal_votes_key(votes.proposal_id).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(proposal_key), -// value: Binary::new(votes.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let gov_proposals_votes = GovernmentProposalVotes::reconstruct(&st_values); -// -// assert_eq!(gov_proposals_votes, ts.expected_result) -// } -// } -// -// #[test] -// fn test_fee_pool_reconstruct() { -// struct TestCase { -// coins: Vec<(String, Uint128)>, -// } -// let test_cases: Vec = vec![ -// TestCase { -// coins: vec![("uosmo".to_string(), Uint128::from(100u128))], -// }, -// TestCase { -// coins: vec![ -// ("uosmo".to_string(), Uint128::from(100u128)), -// ("uatom".to_string(), Uint128::from(500u128)), -// ("uluna".to_string(), Uint128::from(80u128)), -// ], -// }, -// TestCase { coins: vec![] }, -// ]; -// -// for ts in test_cases { -// let mut coins: Vec = vec![]; -// -// for coin in &ts.coins { -// let balance_amount = DecCoin { -// denom: coin.0.clone(), -// amount: coin -// .1 -// .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format -// .to_string(), -// }; -// -// coins.push(balance_amount); -// } -// -// let fee_pool = CosmosFeePool { -// community_pool: coins, -// }; -// -// let fee_pool_key = create_fee_pool_key().unwrap(); -// -// let st_value = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(fee_pool_key), -// value: Binary::new(fee_pool.encode_to_vec()), -// }; -// -// let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); -// assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); -// for (i, coin) in fee_pool_coins.coins.iter().enumerate() { -// assert_eq!(coin.denom, ts.coins[i].0); -// assert_eq!(coin.amount, ts.coins[i].1) -// } -// } -// } -// -// #[test] -// fn test_delegations_reconstruct() { -// struct TestCase { -// stake_denom: String, -// delegations: Vec, -// validators: Vec, -// expected_result: NeutronResult, -// } -// let test_cases: Vec = vec![ -// TestCase { -// stake_denom: "stake".to_string(), -// delegations: vec![Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// shares: "1000000000000000000".to_string(), -// }], -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(Delegations { -// delegations: vec![StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: StdCoin::new(1000000000000000000u128, "stake"), -// }], -// }), -// }, -// TestCase { -// stake_denom: "stake".to_string(), -// delegations: vec![ -// Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// shares: "1000000000000000000".to_string(), -// }, -// Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" -// .to_string(), -// shares: "1000000000000000000".to_string(), -// }, -// ], -// validators: vec![ -// Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// Validator { -// operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" -// .to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// ], -// expected_result: Ok(Delegations { -// delegations: vec![ -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: StdCoin::new(1000000000000000000u128, "stake"), -// }, -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), -// amount: StdCoin::new(1000000000000000000u128, "stake"), -// }, -// ], -// }), -// }, -// TestCase { -// stake_denom: "stake".to_string(), -// delegations: vec![], -// validators: vec![], -// expected_result: Ok(Delegations { -// delegations: vec![], -// }), -// }, -// TestCase { -// stake_denom: Default::default(), -// delegations: vec![], -// validators: vec![], -// expected_result: Err(NeutronError::InvalidQueryResultFormat( -// "denom is empty".into(), -// )), -// }, -// TestCase { -// stake_denom: "stake".to_string(), -// delegations: vec![Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// shares: "1000000000000000000".to_string(), -// }], -// validators: vec![], -// expected_result: Err(NeutronError::InvalidQueryResultFormat( -// "validator is empty".into(), -// )), -// }, -// ]; -// -// for ts in &test_cases { -// // prepare storage values -// let mut st_values: Vec = vec![StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), -// value: { -// if ts.stake_denom.is_empty() { -// return Default::default(); -// } -// to_json_binary(&ts.stake_denom).unwrap() -// }, -// }]; -// -// for (i, d) in ts.delegations.iter().enumerate() { -// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); -// let val_addr = decode_and_convert(&d.validator_address).unwrap(); -// -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), -// value: Binary::from(d.encode_to_vec()), -// }); -// -// if let Some(v) = ts.validators.get(i) { -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_validator_key(&val_addr).unwrap()), -// value: Binary::from(v.encode_to_vec()), -// }); -// } -// } -// -// // test reconstruction -// let delegations = Delegations::reconstruct(&st_values); -// -// assert_eq!(delegations, ts.expected_result) -// } -// } -// -// #[test] -// fn test_balance_reconstruct_from_hex() { -// let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// let balance_key = create_account_denom_balance_key( -// decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), -// "uosmo", -// ) -// .unwrap(); -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::from(balance_key), -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let bank_balances = Balances::reconstruct(&[s]).unwrap(); -// assert_eq!( -// bank_balances, -// Balances { -// coins: vec![StdCoin { -// denom: String::from("uosmo"), -// amount: Uint128::from(99999000u64), -// }] -// } -// ); -// } -// -// #[test] -// fn test_balance_reconstruct_from_empty_value() { -// let balance_key = create_account_denom_balance_key( -// decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), -// "uosmo", -// ) -// .unwrap(); -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::from(balance_key), -// value: Binary::from(vec![]), -// }; -// let bank_balances = Balances::reconstruct(&[s]).unwrap(); -// assert_eq!( -// bank_balances, -// Balances { -// coins: vec![StdCoin::new(0u128, "uosmo")] -// } -// ); -// } -// -// #[test] -// fn test_bank_total_supply_reconstruct_from_hex() { -// let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::new(create_total_denom_key("stake").unwrap()), -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); -// assert_eq!( -// total_supply, -// TotalSupply { -// coins: vec![StdCoin { -// denom: String::from("stake"), -// amount: Uint128::from(300001098u64), // mutating -// }] -// } -// ); -// } -// -// #[test] -// fn test_staking_validators_reconstruct_from_hex() { -// let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); -// assert_eq!( -// staking_validator, -// StakingValidator { -// validators: vec![ContractValidator { -// operator_address: String::from( -// "cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq" // mutating -// ), -// consensus_pubkey: Some(vec![ -// 10, 32, 178, 12, 7, 179, 235, 144, 13, 247, 43, 72, 194, 78, 154, 46, 6, 255, -// 79, 231, 59, 189, 37, 94, 67, 58, 248, 234, 227, 177, 152, 142, 105, 136, -// ]), -// jailed: false, -// status: 3, -// tokens: String::from("100000000"), -// delegator_shares: String::from("100000000000000000000000000"), -// moniker: Some(String::from("mynode")), -// identity: Some(String::from("")), -// website: Some(String::from("")), -// security_contact: Some(String::from("")), -// details: Some(String::from("")), -// unbonding_height: 0u64, -// unbonding_time: Some(0u64), -// rate: Some(Decimal::from_str("0.100000000000000000").unwrap()), -// max_rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), -// max_change_rate: Some(Decimal::from_str("0.010000000000000000").unwrap()), -// update_time: Some(1683291676u64), // mutating -// min_self_delegation: Decimal::one(), -// }] -// } -// ); -// } -// -// #[test] -// fn test_validators_signing_infos_reconstruct_from_hex() { -// let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); -// assert_eq!( -// signing_info, -// SigningInfo { -// signing_infos: vec![ValidatorSigningInfo { -// address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), -// start_height: 0, -// index_offset: 16, -// jailed_until: Some(0), -// tombstoned: false, -// missed_blocks_counter: 0, -// }] -// } -// ); -// } -// -// #[test] -// fn test_government_proposals_reconstruct_from_hex() { -// let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); -// assert_eq!( -// proposals, -// GovernmentProposal { -// proposals: vec![Proposal { -// proposal_id: 1u64, -// proposal_type: Some(String::from("/cosmos.gov.v1beta1.TextProposal")), -// total_deposit: vec![StdCoin { -// denom: String::from("stake"), -// amount: Uint128::from(1000u64), -// }], -// status: 1i32, -// submit_time: Some(1683291849u64), // mutating -// deposit_end_time: Some(1683464649u64), // mutating -// voting_start_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z -// voting_end_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z -// final_tally_result: Some(TallyResult { -// yes: Uint128::zero(), -// no: Uint128::zero(), -// abstain: Uint128::zero(), -// no_with_veto: Uint128::zero(), -// }), -// }] -// } -// ); -// } -// -// #[test] -// fn test_proposal_votes_reconstruct_from_hex() { -// let bytes = hex::decode(GOV_PROPOSAL_VOTES_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let votes = GovernmentProposalVotes::reconstruct(&[s]).unwrap(); -// assert_eq!( -// votes, -// GovernmentProposalVotes { -// proposal_votes: vec![ProposalVote { -// proposal_id: 4, -// voter: "cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw".to_string(), -// options: vec![WeightedVoteOption { -// weight: "1000000000000000000".to_string(), -// option: 1, -// }], -// }], -// } -// ); -// } -// -// #[test] -// fn test_fee_pool_reconstruct_from_hex() { -// let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let fee_pool = FeePool::reconstruct(&[s]).unwrap(); -// assert_eq!( -// fee_pool, -// FeePool { -// coins: vec![StdCoin { -// denom: String::from("stake"), -// amount: Uint128::from(21u64), // mutating -// }] -// } -// ); -// } -// -// #[test] -// fn test_delegations_reconstruct_from_hex() { -// let staking_denom_bytes = hex::decode(STAKING_DENOM_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let staking_denom_base64_input = BASE64_STANDARD.encode(staking_denom_bytes); // encode bytes to base64 string -// let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string -// let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string -// -// let mut st_values: Vec = vec![StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(staking_denom_base64_input.as_str()).unwrap(), -// }]; -// st_values.push(StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(delegation_base64_input.as_str()).unwrap(), -// }); -// st_values.push(StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap(), -// }); -// -// let delegations = Delegations::reconstruct(&st_values).unwrap(); -// assert_eq!( -// delegations, -// Delegations { -// delegations: vec![StdDelegation { -// delegator: Addr::unchecked("cosmos15fqjpj90ruhj57q3l6a5hda0rt77g6mcuz7w8n"), // mutating -// validator: String::from("cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq"), // mutating -// amount: StdCoin { -// denom: String::from("stake"), -// amount: Uint128::from(100000000u64), -// }, -// }], -// } -// ); -// } -// -// #[test] -// fn test_unbonding_delegations_reconstruct_from_hex() { -// let unbonding_delegations_bytes = -// hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string -// -// let st_values: Vec = vec![StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap(), -// }]; -// -// let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); -// assert_eq!( -// unbonding_delegations, -// UnbondingDelegations { -// unbonding_responses: vec![UnbondingResponse { -// delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), -// validator_address: String::from( -// "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" -// ), -// entries: vec![ -// UnbondingEntry { -// balance: Uint128::new(10_000), -// completion_time: Some(Timestamp::from_nanos(1704872890570185206)), -// creation_height: 365, -// initial_balance: Uint128::new(10_000), -// }, -// UnbondingEntry { -// balance: Uint128::new(20_000), -// completion_time: Some(Timestamp::from_nanos(1704872903002248037)), -// creation_height: 377, -// initial_balance: Uint128::new(20_000), -// }, -// ], -// }] -// } -// ); -// } -// -// #[test] -// fn test_deconstruct_account_denom_balance_key() { -// struct TestCase { -// key: Vec, -// expected_result: NeutronResult<(AddressBytes, String)>, -// } -// -// let testcases = vec![ -// TestCase { -// // valid key -// key: create_account_denom_balance_key("addr1", "uatom").unwrap(), -// expected_result: Ok(( -// "addr1".bytes().collect::(), -// "uatom".to_string(), -// )), -// }, -// TestCase { -// // empty key -// key: vec![], -// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( -// "invalid key length".to_string(), -// )), -// }, -// TestCase { -// // first element in the key is not BALANCES_PREFIX -// key: vec![81], -// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( -// "first element in key does not equal to BALANCES_PREFIX: 81 != 2".to_string(), -// )), -// }, -// TestCase { -// // first element in the key is BALANCES_PREFIX but key length is invalid -// key: vec![BALANCES_PREFIX], -// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( -// "invalid key length".to_string(), -// )), -// }, -// TestCase { -// // invalid address length in key -// // second element must define addr length, but here we say that length is 10, -// // but actually it's 1 which is wrong -// key: vec![BALANCES_PREFIX, 10, 1], -// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( -// "address length in key is invalid".to_string(), -// )), -// }, -// TestCase { -// // first element is correct, addr length is good, but there is no denom in the key -// key: vec![BALANCES_PREFIX, 2, 1, 2], -// expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( -// "denom in key can't be empty".to_string(), -// )), -// }, -// TestCase { -// // must fail since [0, 159, 146, 150] are invalid UTF-8 bytes -// key: vec![BALANCES_PREFIX, 2, 1, 2, 0, 159, 146, 150], -// expected_result: Err(NeutronError::FromUTF8Error( -// String::from_utf8(vec![0, 159, 146, 150]).unwrap_err(), -// )), -// }, -// ]; -// -// for tc in testcases { -// assert_eq!( -// deconstruct_account_denom_balance_key(tc.key), -// tc.expected_result -// ); -// } -// } -// -// #[test] -// fn test_delegations_reconstruct_overflow() { -// struct TestCase { -// stake_denom: String, -// delegations: Vec, -// validators: Vec, -// expected_result: NeutronResult, -// } -// let test_cases: Vec = vec![TestCase { -// stake_denom: "stake".to_string(), -// delegations: vec![Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// shares: "340282366920938463463".to_string(), -// }], -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "340282366920938463463".to_string(), -// delegator_shares: "340282366920938463463".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(Delegations { -// delegations: vec![StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: StdCoin::new(340282366920938463463u128, "stake"), -// }], -// }), -// }]; -// -// for ts in &test_cases { -// // prepare storage values -// let mut st_values: Vec = vec![StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), -// value: { -// if ts.stake_denom.is_empty() { -// return Default::default(); -// } -// to_json_binary(&ts.stake_denom).unwrap() -// }, -// }]; -// -// for (i, d) in ts.delegations.iter().enumerate() { -// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); -// let val_addr = decode_and_convert(&d.validator_address).unwrap(); -// -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), -// value: Binary::from(d.encode_to_vec()), -// }); -// -// if let Some(v) = ts.validators.get(i) { -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_validator_key(&val_addr).unwrap()), -// value: Binary::from(v.encode_to_vec()), -// }); -// } -// } -// -// // test reconstruction -// let delegations = Delegations::reconstruct(&st_values); -// -// assert_eq!(delegations, ts.expected_result) -// } -// } +use crate::interchain_queries::helpers::decode_and_convert; +use crate::interchain_queries::types::{AddressBytes, KVReconstruct}; +use crate::interchain_queries::v045::helpers::{ + create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, + create_gov_proposal_key, create_gov_proposal_votes_key, create_params_store_key, + create_total_denom_key, create_validator_key, create_validator_signing_info_key, + deconstruct_account_denom_balance_key, +}; +use crate::interchain_queries::v045::types::BALANCES_PREFIX; +use crate::interchain_queries::v045::types::{ + Balances, Delegations, FeePool, GovernmentProposal, GovernmentProposalVotes, Proposal, + ProposalVote, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, + UnbondingDelegations, UnbondingEntry, UnbondingResponse, Validator as ContractValidator, + ValidatorSigningInfo, WeightedVoteOption, DECIMAL_PLACES, KEY_BOND_DENOM, STAKING_STORE_KEY, +}; +use crate::{NeutronError, NeutronResult}; +use base64::prelude::*; +use base64::Engine; +use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; +use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; +use cosmos_sdk_proto::cosmos::gov::v1beta1::{ + Proposal as CosmosProposal, TallyResult as CosmosTallyResult, Vote, + WeightedVoteOption as CosmosWeightedVoteOption, +}; +use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; +use cosmos_sdk_proto::cosmos::staking::v1beta1::{ + Commission, CommissionRates, Delegation, Description, Validator, +}; +use cosmos_sdk_proto::traits::Message; +use cosmwasm_std::{to_json_binary, Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; +use hex; +use std::ops::Mul; +use std::str::FromStr; +use neutron_std::types::neutron::interchainqueries::StorageValue; + +// raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. +pub const BALANCES_HEX_RESPONSE: &str = "0a057374616b6512083939393939303030"; +pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "333030303031303938"; +pub const FEE_POOL_HEX_RESPONSE: &str = + "0a1d0a057374616b6512143231393630303030303030303030303030303030"; +pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "0801129f010a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c127b0a11416464204e65772056616c696461746f721266546869732070726f706f73616c20726571756573747320616464696e672061206e65772076616c696461746f7220746f20746865206e6574776f726b20746f20696d70726f766520646563656e7472616c697a6174696f6e20616e642073656375726974792e1801220c0a01301201301a01302201302a0c08c9fdd3a20610988990d103320c08c9c3dea20610988990d1033a0d0a057374616b65120431303030420b088092b8c398feffffff014a0b088092b8c398feffffff01"; +pub const GOV_PROPOSAL_VOTES_HEX_RESPONSE: &str = "0804122d636f736d6f73313068397374633576366e7467657967663578663934356e6a717135683332723533757175767722170801121331303030303030303030303030303030303030"; +pub const STAKING_DENOM_HEX_RESPONSE: &str = "227374616b6522"; +pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d747112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20b20c07b3eb900df72b48c24e9a2e06ff4fe73bbd255e433af8eae3b1988e698820032a09313030303030303030321b3130303030303030303030303030303030303030303030303030303a080a066d796e6f64654a00524a0a3b0a1231303030303030303030303030303030303012123230303030303030303030303030303030301a113130303030303030303030303030303030120b089cfcd3a20610e0dc890b5a0131"; +pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73313566716a706a39307275686a353771336c366135686461307274373767366d63757a3777386e1234636f736d6f7376616c6f706572313566716a706a39307275686a353771336c366135686461307274373767366d63656b326d74711a1b313030303030303030303030303030303030303030303030303030"; +pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; +pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; + +#[test] +fn test_balance_reconstruct() { + struct TestCase { + addr: String, + coins: Vec<(String, Uint128)>, + } + let test_cases: Vec = vec![ + TestCase { + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + coins: vec![("uosmo".to_string(), Uint128::from(100u128))], + }, + TestCase { + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + coins: vec![ + ("uosmo".to_string(), Uint128::from(100u128)), + ("uatom".to_string(), Uint128::from(500u128)), + ("uluna".to_string(), Uint128::from(80u128)), + ], + }, + TestCase { + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + coins: vec![], + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); + for coin in &ts.coins { + let balance_key = + create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); + + let balance_amount = Coin { + denom: coin.0.clone(), + amount: coin.1.to_string(), + }; + let s = StorageValue { + storage_prefix: "".to_string(), + key: balance_key, + value: balance_amount.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let balances = Balances::reconstruct(&st_values).unwrap(); + assert_eq!(balances.coins.len(), ts.coins.len()); + for (i, coin) in balances.coins.iter().enumerate() { + assert_eq!(coin.denom, ts.coins[i].0); + assert_eq!(coin.amount, ts.coins[i].1) + } + } +} + +#[test] +fn test_bank_total_supply_reconstruct() { + struct TestValue { + denom: String, + amount: String, + } + struct TestCase { + values: Vec, + } + + let test_cases: Vec = vec![ + TestCase { + values: vec![TestValue { + denom: "uatom".to_string(), + amount: "100".to_string(), + }], + }, + TestCase { + values: vec![ + TestValue { + denom: "uatom".to_string(), + amount: "100".to_string(), + }, + TestValue { + denom: "uosmo".to_string(), + amount: "200".to_string(), + }, + ], + }, + TestCase { values: vec![] }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for case in &ts.values { + let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: denom_key, + value: case.amount.as_bytes().to_vec(), + proof: None, + }; + st_values.push(s); + } + + let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); + assert_eq!(total_supply.coins.len(), ts.values.len()); + for (i, coin) in total_supply.coins.iter().enumerate() { + assert_eq!(coin.denom, ts.values[i].denom); + assert_eq!( + coin.amount, + Uint128::from_str(ts.values[i].amount.as_str()).unwrap() + ) + } + } +} + +#[test] +fn test_staking_validators_reconstruct() { + struct TestCase { + validators: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }], + expected_result: Ok(StakingValidator { + validators: vec![ContractValidator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + status: 0, + consensus_pubkey: None, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + unbonding_height: 0, + unbonding_time: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }], + }), + }, + TestCase { + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: Some(prost_types::Any { + type_url: "consensus_pubkey".to_string(), + value: vec![], + }), + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: Some(Description { + moniker: "Test validator".to_string(), + identity: "JHFDHHFHF".to_string(), + website: "https://neutron.org".to_string(), + security_contact: "".to_string(), + details: "Validator details".to_string(), + }), + unbonding_height: 0, + unbonding_time: Some(prost_types::Timestamp { + seconds: 1203981203, + nanos: 123123, + }), + commission: Some(Commission { + commission_rates: Some(CommissionRates { + rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros + max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros + max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros + }), + update_time: Some(prost_types::Timestamp { + seconds: 56324234, + nanos: 1343, + }), + }), + min_self_delegation: "".to_string(), + }], + expected_result: Ok(StakingValidator { + validators: vec![ContractValidator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + status: 0, + consensus_pubkey: Some(vec![]), + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + moniker: Some("Test validator".to_string()), + identity: Some("JHFDHHFHF".to_string()), + website: Some("https://neutron.org".to_string()), + security_contact: Some("".to_string()), + details: Some("Validator details".to_string()), + unbonding_height: 0, + unbonding_time: Some(1203981203), + rate: Some(Decimal::from_str("5").unwrap()), + max_rate: Some(Decimal::from_str("20").unwrap()), + max_change_rate: Some(Decimal::from_str("1").unwrap()), + update_time: Some(56324234), + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }], + }), + }, + TestCase { + validators: vec![ + Validator { + operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" + .to_string(), + consensus_pubkey: Some(prost_types::Any { + type_url: "consensus_pubkey".to_string(), + value: vec![1u8, 2u8, 3u8, 4u8], + }), + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + Validator { + operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" + .to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "2000000000000000000".to_string(), + delegator_shares: "3000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + ], + expected_result: Ok(StakingValidator { + validators: vec![ + ContractValidator { + operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" + .to_string(), + status: 0, + consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + unbonding_height: 0, + unbonding_time: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }, + ContractValidator { + operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" + .to_string(), + status: 0, + consensus_pubkey: None, + tokens: "2000000000000000000".to_string(), + delegator_shares: "3000000000000000000".to_string(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + unbonding_height: 0, + unbonding_time: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }, + ], + }), + }, + TestCase { + validators: vec![], + expected_result: Ok(StakingValidator { validators: vec![] }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for validator in &ts.validators { + let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); + + let validator_key = create_validator_key(&val_addr).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: validator_key, + value: validator.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let stakin_validator = StakingValidator::reconstruct(&st_values); + + assert_eq!(stakin_validator, ts.expected_result) + } +} + +#[test] +fn test_validators_signing_infos_reconstruct() { + struct TestCase { + signing_infos: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + signing_infos: vec![CosmosValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: false, + missed_blocks_counter: 987675, + }], + expected_result: Ok(SigningInfo { + signing_infos: vec![ValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: false, + missed_blocks_counter: 987675, + }], + }), + }, + TestCase { + signing_infos: vec![CosmosValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(prost_types::Timestamp { + seconds: 321654, + nanos: 123123, + }), + tombstoned: false, + missed_blocks_counter: 987675, + }], + expected_result: Ok(SigningInfo { + signing_infos: vec![ValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(321654), + tombstoned: false, + missed_blocks_counter: 987675, + }], + }), + }, + TestCase { + signing_infos: vec![ + CosmosValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: true, + missed_blocks_counter: 987675, + }, + CosmosValidatorSigningInfo { + address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(prost_types::Timestamp { + seconds: 321654, + nanos: 123123, + }), + tombstoned: false, + missed_blocks_counter: 345012, + }, + ], + expected_result: Ok(SigningInfo { + signing_infos: vec![ + ValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: true, + missed_blocks_counter: 987675, + }, + ValidatorSigningInfo { + address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(321654), + tombstoned: false, + missed_blocks_counter: 345012, + }, + ], + }), + }, + TestCase { + signing_infos: vec![], + expected_result: Ok(SigningInfo { + signing_infos: vec![], + }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for info in &ts.signing_infos { + let val_addr = decode_and_convert(info.address.as_str()).unwrap(); + + let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: signing_info_key, + value: info.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let signing_infos = SigningInfo::reconstruct(&st_values); + + assert_eq!(signing_infos, ts.expected_result) + } +} + +#[test] +fn test_government_proposals_reconstruct() { + struct TestCase { + proposals: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + proposals: vec![CosmosProposal { + proposal_id: 1, + content: Some(prost_types::Any { + type_url: "proposal_type".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: None, + submit_time: None, + deposit_end_time: None, + total_deposit: vec![Coin { + amount: "100000".to_string(), + denom: "stake".to_string(), + }], + voting_start_time: None, + voting_end_time: None, + }], + expected_result: Ok(GovernmentProposal { + proposals: vec![Proposal { + proposal_id: 1, + proposal_type: Some("proposal_type".to_string()), + total_deposit: vec![StdCoin::new(100000u128, "stake")], + status: 1, + submit_time: None, + deposit_end_time: None, + voting_start_time: None, + voting_end_time: None, + final_tally_result: None, + }], + }), + }, + TestCase { + proposals: vec![CosmosProposal { + proposal_id: 1, + content: Some(prost_types::Any { + type_url: "proposal_type".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: Some(CosmosTallyResult { + abstain: "1".to_string(), + no: "2".to_string(), + no_with_veto: "3".to_string(), + yes: "4".to_string(), + }), + submit_time: Some(prost_types::Timestamp { + seconds: 2222222, + nanos: 123123, + }), + deposit_end_time: Some(prost_types::Timestamp { + seconds: 3333333, + nanos: 123123, + }), + total_deposit: vec![Coin { + amount: "100000".to_string(), + denom: "stake".to_string(), + }], + voting_start_time: Some(prost_types::Timestamp { + seconds: 4444444, + nanos: 123123, + }), + voting_end_time: Some(prost_types::Timestamp { + seconds: 555555555, + nanos: 123123, + }), + }], + expected_result: Ok(GovernmentProposal { + proposals: vec![Proposal { + proposal_id: 1, + proposal_type: Some("proposal_type".to_string()), + total_deposit: vec![StdCoin::new(100000u128, "stake")], + status: 1, + submit_time: Some(2222222), + deposit_end_time: Some(3333333), + voting_start_time: Some(4444444), + voting_end_time: Some(555555555), + final_tally_result: Some(TallyResult { + abstain: Uint128::from(1u64), + no: Uint128::from(2u64), + no_with_veto: Uint128::from(3u64), + yes: Uint128::from(4u64), + }), + }], + }), + }, + TestCase { + proposals: vec![ + CosmosProposal { + proposal_id: 1, + content: Some(prost_types::Any { + type_url: "proposal_type1".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: None, + submit_time: None, + deposit_end_time: None, + total_deposit: vec![Coin { + amount: "100000".to_string(), + denom: "stake".to_string(), + }], + voting_start_time: None, + voting_end_time: None, + }, + CosmosProposal { + proposal_id: 2, + content: Some(prost_types::Any { + type_url: "proposal_type2".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: None, + submit_time: None, + deposit_end_time: None, + total_deposit: vec![Coin { + amount: "200000".to_string(), + denom: "osmo".to_string(), + }], + voting_start_time: None, + voting_end_time: None, + }, + ], + expected_result: Ok(GovernmentProposal { + proposals: vec![ + Proposal { + proposal_id: 1, + proposal_type: Some("proposal_type1".to_string()), + total_deposit: vec![StdCoin::new(100000u128, "stake")], + status: 1, + submit_time: None, + deposit_end_time: None, + voting_start_time: None, + voting_end_time: None, + final_tally_result: None, + }, + Proposal { + proposal_id: 2, + proposal_type: Some("proposal_type2".to_string()), + total_deposit: vec![StdCoin::new(200000u128, "osmo")], + status: 1, + submit_time: None, + deposit_end_time: None, + voting_start_time: None, + voting_end_time: None, + final_tally_result: None, + }, + ], + }), + }, + TestCase { + proposals: vec![], + expected_result: Ok(GovernmentProposal { proposals: vec![] }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for proposal in &ts.proposals { + let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: proposal_key, + value: proposal.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let gov_proposal = GovernmentProposal::reconstruct(&st_values); + + assert_eq!(gov_proposal, ts.expected_result) + } +} + +#[allow(deprecated)] +#[test] +fn test_proposal_votes_reconstruct() { + struct TestCase { + proposal_votes: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + proposal_votes: vec![Vote { + proposal_id: 1, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + option: 0, + options: vec![CosmosWeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }], + expected_result: Ok(GovernmentProposalVotes { + proposal_votes: vec![ProposalVote { + proposal_id: 1, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + options: vec![WeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }], + }), + }, + TestCase { + proposal_votes: vec![ + Vote { + proposal_id: 1, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + option: 0, + options: vec![CosmosWeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }, + Vote { + proposal_id: 2, + voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + option: 0, + options: vec![CosmosWeightedVoteOption { + weight: "567890".to_string(), + option: 2, + }], + }, + ], + expected_result: Ok(GovernmentProposalVotes { + proposal_votes: vec![ + ProposalVote { + proposal_id: 1, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + options: vec![WeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }, + ProposalVote { + proposal_id: 2, + voter: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + options: vec![WeightedVoteOption { + weight: "567890".to_string(), + option: 2, + }], + }, + ], + }), + }, + TestCase { + proposal_votes: vec![], + expected_result: Ok(GovernmentProposalVotes { + proposal_votes: vec![], + }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for votes in &ts.proposal_votes { + let proposal_key = create_gov_proposal_votes_key(votes.proposal_id).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: proposal_key, + value: votes.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let gov_proposals_votes = GovernmentProposalVotes::reconstruct(&st_values); + + assert_eq!(gov_proposals_votes, ts.expected_result) + } +} + +#[test] +fn test_fee_pool_reconstruct() { + struct TestCase { + coins: Vec<(String, Uint128)>, + } + let test_cases: Vec = vec![ + TestCase { + coins: vec![("uosmo".to_string(), Uint128::from(100u128))], + }, + TestCase { + coins: vec![ + ("uosmo".to_string(), Uint128::from(100u128)), + ("uatom".to_string(), Uint128::from(500u128)), + ("uluna".to_string(), Uint128::from(80u128)), + ], + }, + TestCase { coins: vec![] }, + ]; + + for ts in test_cases { + let mut coins: Vec = vec![]; + + for coin in &ts.coins { + let balance_amount = DecCoin { + denom: coin.0.clone(), + amount: coin + .1 + .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format + .to_string(), + }; + + coins.push(balance_amount); + } + + let fee_pool = CosmosFeePool { + community_pool: coins, + }; + + let fee_pool_key = create_fee_pool_key().unwrap(); + + let st_value = StorageValue { + storage_prefix: "".to_string(), + key: fee_pool_key, + value: fee_pool.encode_to_vec(), + proof: None, + }; + + let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); + assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); + for (i, coin) in fee_pool_coins.coins.iter().enumerate() { + assert_eq!(coin.denom, ts.coins[i].0); + assert_eq!(coin.amount, ts.coins[i].1) + } + } +} + +#[test] +fn test_delegations_reconstruct() { + struct TestCase { + stake_denom: String, + delegations: Vec, + validators: Vec, + expected_result: NeutronResult, + } + let test_cases: Vec = vec![ + TestCase { + stake_denom: "stake".to_string(), + delegations: vec![Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + shares: "1000000000000000000".to_string(), + }], + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }], + expected_result: Ok(Delegations { + delegations: vec![StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: StdCoin::new(1000000000000000000u128, "stake"), + }], + }), + }, + TestCase { + stake_denom: "stake".to_string(), + delegations: vec![ + Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + shares: "1000000000000000000".to_string(), + }, + Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" + .to_string(), + shares: "1000000000000000000".to_string(), + }, + ], + validators: vec![ + Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + Validator { + operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" + .to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + ], + expected_result: Ok(Delegations { + delegations: vec![ + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: StdCoin::new(1000000000000000000u128, "stake"), + }, + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), + amount: StdCoin::new(1000000000000000000u128, "stake"), + }, + ], + }), + }, + TestCase { + stake_denom: "stake".to_string(), + delegations: vec![], + validators: vec![], + expected_result: Ok(Delegations { + delegations: vec![], + }), + }, + TestCase { + stake_denom: Default::default(), + delegations: vec![], + validators: vec![], + expected_result: Err(NeutronError::InvalidQueryResultFormat( + "denom is empty".into(), + )), + }, + TestCase { + stake_denom: "stake".to_string(), + delegations: vec![Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + shares: "1000000000000000000".to_string(), + }], + validators: vec![], + expected_result: Err(NeutronError::InvalidQueryResultFormat( + "validator is empty".into(), + )), + }, + ]; + + for ts in &test_cases { + // prepare storage values + let mut st_values: Vec = vec![StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM), + value: { + if ts.stake_denom.is_empty() { + return Default::default(); + } + to_json_binary(&ts.stake_denom).unwrap().to_vec() + }, + proof: None, + }]; + + for (i, d) in ts.delegations.iter().enumerate() { + let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); + let val_addr = decode_and_convert(&d.validator_address).unwrap(); + + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_delegation_key(&delegator_addr, &val_addr).unwrap(), + value: d.encode_to_vec(), + proof: None, + }); + + if let Some(v) = ts.validators.get(i) { + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_validator_key(&val_addr).unwrap(), + value: v.encode_to_vec(), + proof: None, + }); + } + } + + // test reconstruction + let delegations = Delegations::reconstruct(&st_values); + + assert_eq!(delegations, ts.expected_result) + } +} + +#[test] +fn test_balance_reconstruct_from_hex() { + let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + let balance_key = create_account_denom_balance_key( + decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), + "uosmo", + ) + .unwrap(); + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: balance_key, + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let bank_balances = Balances::reconstruct(&[s]).unwrap(); + assert_eq!( + bank_balances, + Balances { + coins: vec![StdCoin { + denom: String::from("uosmo"), + amount: Uint128::from(99999000u64), + }] + } + ); +} + +#[test] +fn test_balance_reconstruct_from_empty_value() { + let balance_key = create_account_denom_balance_key( + decode_and_convert("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs").unwrap(), + "uosmo", + ) + .unwrap(); + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: balance_key, + value: vec![], + proof: None, + }; + let bank_balances = Balances::reconstruct(&[s]).unwrap(); + assert_eq!( + bank_balances, + Balances { + coins: vec![StdCoin::new(0u128, "uosmo")] + } + ); +} + +#[test] +fn test_bank_total_supply_reconstruct_from_hex() { + let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: create_total_denom_key("stake").unwrap(), + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); + assert_eq!( + total_supply, + TotalSupply { + coins: vec![StdCoin { + denom: String::from("stake"), + amount: Uint128::from(300001098u64), // mutating + }] + } + ); +} + +#[test] +fn test_staking_validators_reconstruct_from_hex() { + let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); + assert_eq!( + staking_validator, + StakingValidator { + validators: vec![ContractValidator { + operator_address: String::from( + "cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq" // mutating + ), + consensus_pubkey: Some(vec![ + 10, 32, 178, 12, 7, 179, 235, 144, 13, 247, 43, 72, 194, 78, 154, 46, 6, 255, + 79, 231, 59, 189, 37, 94, 67, 58, 248, 234, 227, 177, 152, 142, 105, 136, + ]), + jailed: false, + status: 3, + tokens: String::from("100000000"), + delegator_shares: String::from("100000000000000000000000000"), + moniker: Some(String::from("mynode")), + identity: Some(String::from("")), + website: Some(String::from("")), + security_contact: Some(String::from("")), + details: Some(String::from("")), + unbonding_height: 0u64, + unbonding_time: Some(0u64), + rate: Some(Decimal::from_str("0.100000000000000000").unwrap()), + max_rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), + max_change_rate: Some(Decimal::from_str("0.010000000000000000").unwrap()), + update_time: Some(1683291676u64), // mutating + min_self_delegation: Decimal::one(), + }] + } + ); +} + +#[test] +fn test_validators_signing_infos_reconstruct_from_hex() { + let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); + assert_eq!( + signing_info, + SigningInfo { + signing_infos: vec![ValidatorSigningInfo { + address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), + start_height: 0, + index_offset: 16, + jailed_until: Some(0), + tombstoned: false, + missed_blocks_counter: 0, + }] + } + ); +} + +#[test] +fn test_government_proposals_reconstruct_from_hex() { + let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); + assert_eq!( + proposals, + GovernmentProposal { + proposals: vec![Proposal { + proposal_id: 1u64, + proposal_type: Some(String::from("/cosmos.gov.v1beta1.TextProposal")), + total_deposit: vec![StdCoin { + denom: String::from("stake"), + amount: Uint128::from(1000u64), + }], + status: 1i32, + submit_time: Some(1683291849u64), // mutating + deposit_end_time: Some(1683464649u64), // mutating + voting_start_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z + voting_end_time: Some(18446744011573954816u64), // 0001-01-01T00:00:00Z + final_tally_result: Some(TallyResult { + yes: Uint128::zero(), + no: Uint128::zero(), + abstain: Uint128::zero(), + no_with_veto: Uint128::zero(), + }), + }] + } + ); +} + +#[test] +fn test_proposal_votes_reconstruct_from_hex() { + let bytes = hex::decode(GOV_PROPOSAL_VOTES_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let votes = GovernmentProposalVotes::reconstruct(&[s]).unwrap(); + assert_eq!( + votes, + GovernmentProposalVotes { + proposal_votes: vec![ProposalVote { + proposal_id: 4, + voter: "cosmos10h9stc5v6ntgeygf5xf945njqq5h32r53uquvw".to_string(), + options: vec![WeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }], + } + ); +} + +#[test] +fn test_fee_pool_reconstruct_from_hex() { + let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let fee_pool = FeePool::reconstruct(&[s]).unwrap(); + assert_eq!( + fee_pool, + FeePool { + coins: vec![StdCoin { + denom: String::from("stake"), + amount: Uint128::from(21u64), // mutating + }] + } + ); +} + +#[test] +fn test_delegations_reconstruct_from_hex() { + let staking_denom_bytes = hex::decode(STAKING_DENOM_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let staking_denom_base64_input = BASE64_STANDARD.encode(staking_denom_bytes); // encode bytes to base64 string + let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string + let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string + + let mut st_values: Vec = vec![StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_denom_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }]; + st_values.push(StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(delegation_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }); + st_values.push(StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }); + + let delegations = Delegations::reconstruct(&st_values).unwrap(); + assert_eq!( + delegations, + Delegations { + delegations: vec![StdDelegation { + delegator: Addr::unchecked("cosmos15fqjpj90ruhj57q3l6a5hda0rt77g6mcuz7w8n"), // mutating + validator: String::from("cosmosvaloper15fqjpj90ruhj57q3l6a5hda0rt77g6mcek2mtq"), // mutating + amount: StdCoin { + denom: String::from("stake"), + amount: Uint128::from(100000000u64), + }, + }], + } + ); +} + +#[test] +fn test_unbonding_delegations_reconstruct_from_hex() { + let unbonding_delegations_bytes = + hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string + + let st_values: Vec = vec![StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }]; + + let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); + assert_eq!( + unbonding_delegations, + UnbondingDelegations { + unbonding_responses: vec![UnbondingResponse { + delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), + validator_address: String::from( + "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" + ), + entries: vec![ + UnbondingEntry { + balance: Uint128::new(10_000), + completion_time: Some(Timestamp::from_nanos(1704872890570185206)), + creation_height: 365, + initial_balance: Uint128::new(10_000), + }, + UnbondingEntry { + balance: Uint128::new(20_000), + completion_time: Some(Timestamp::from_nanos(1704872903002248037)), + creation_height: 377, + initial_balance: Uint128::new(20_000), + }, + ], + }] + } + ); +} + +#[test] +fn test_deconstruct_account_denom_balance_key() { + struct TestCase { + key: Vec, + expected_result: NeutronResult<(AddressBytes, String)>, + } + + let testcases = vec![ + TestCase { + // valid key + key: create_account_denom_balance_key("addr1", "uatom").unwrap(), + expected_result: Ok(( + "addr1".bytes().collect::(), + "uatom".to_string(), + )), + }, + TestCase { + // empty key + key: vec![], + expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( + "invalid key length".to_string(), + )), + }, + TestCase { + // first element in the key is not BALANCES_PREFIX + key: vec![81], + expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( + "first element in key does not equal to BALANCES_PREFIX: 81 != 2".to_string(), + )), + }, + TestCase { + // first element in the key is BALANCES_PREFIX but key length is invalid + key: vec![BALANCES_PREFIX], + expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( + "invalid key length".to_string(), + )), + }, + TestCase { + // invalid address length in key + // second element must define addr length, but here we say that length is 10, + // but actually it's 1 which is wrong + key: vec![BALANCES_PREFIX, 10, 1], + expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( + "address length in key is invalid".to_string(), + )), + }, + TestCase { + // first element is correct, addr length is good, but there is no denom in the key + key: vec![BALANCES_PREFIX, 2, 1, 2], + expected_result: Err(NeutronError::AccountDenomBalanceKeyDeconstructionError( + "denom in key can't be empty".to_string(), + )), + }, + TestCase { + // must fail since [0, 159, 146, 150] are invalid UTF-8 bytes + key: vec![BALANCES_PREFIX, 2, 1, 2, 0, 159, 146, 150], + expected_result: Err(NeutronError::FromUTF8Error( + String::from_utf8(vec![0, 159, 146, 150]).unwrap_err(), + )), + }, + ]; + + for tc in testcases { + assert_eq!( + deconstruct_account_denom_balance_key(tc.key), + tc.expected_result + ); + } +} + +#[test] +fn test_delegations_reconstruct_overflow() { + struct TestCase { + stake_denom: String, + delegations: Vec, + validators: Vec, + expected_result: NeutronResult, + } + let test_cases: Vec = vec![TestCase { + stake_denom: "stake".to_string(), + delegations: vec![Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + shares: "340282366920938463463".to_string(), + }], + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "340282366920938463463".to_string(), + delegator_shares: "340282366920938463463".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }], + expected_result: Ok(Delegations { + delegations: vec![StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: StdCoin::new(340282366920938463463u128, "stake"), + }], + }), + }]; + + for ts in &test_cases { + // prepare storage values + let mut st_values: Vec = vec![StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM), + value: { + if ts.stake_denom.is_empty() { + return Default::default(); + } + to_json_binary(&ts.stake_denom).unwrap().to_vec() + }, + proof: None, + }]; + + for (i, d) in ts.delegations.iter().enumerate() { + let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); + let val_addr = decode_and_convert(&d.validator_address).unwrap(); + + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_delegation_key(&delegator_addr, &val_addr).unwrap(), + value: d.encode_to_vec(), + proof: None, + }); + + if let Some(v) = ts.validators.get(i) { + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_validator_key(&val_addr).unwrap(), + value: v.encode_to_vec(), + proof: None, + }); + } + } + + // test reconstruction + let delegations = Delegations::reconstruct(&st_values); + + assert_eq!(delegations, ts.expected_result) + } +} diff --git a/packages/neutron-sdk/src/interchain_queries/v047/testing.rs b/packages/neutron-sdk/src/interchain_queries/v047/testing.rs index ba97a2d2..dd99f20c 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/testing.rs @@ -1,1324 +1,1347 @@ -// use crate::bindings::types::StorageValue; -// use crate::interchain_queries::helpers::decode_and_convert; -// use crate::interchain_queries::types::KVReconstruct; -// use crate::interchain_queries::v045::helpers::create_params_store_key; -// use crate::interchain_queries::v045::types::KEY_BOND_DENOM; -// use crate::interchain_queries::v047::helpers::{ -// create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, -// create_gov_proposal_key, create_total_denom_key, create_validator_key, -// create_validator_signing_info_key, -// }; -// use crate::interchain_queries::v047::types::{ -// Balances, Delegations, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, -// StdDelegation, TallyResult, TotalSupply, UnbondingDelegations, UnbondingEntry, -// UnbondingResponse, Validator as ContractValidator, ValidatorSigningInfo, DECIMAL_PLACES, -// STAKING_PARAMS_KEY, STAKING_STORE_KEY, -// }; -// use crate::{NeutronError, NeutronResult}; -// use base64::prelude::*; -// use base64::Engine; -// use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; -// use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; -// use cosmos_sdk_proto::cosmos::gov::v1beta1::{ -// Proposal as CosmosProposal, TallyResult as CosmosTallyResult, -// }; -// use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; -// use cosmos_sdk_proto::cosmos::staking::v1beta1::{ -// Commission, CommissionRates, Delegation, Description, Params, Validator, -// }; -// use cosmos_sdk_proto::traits::Message; -// use cosmwasm_std::{Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; -// use hex; -// use std::ops::Mul; -// use std::str::FromStr; -// -// // raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. -// pub const BALANCES_HEX_RESPONSE: &str = "343934323133353631"; -// pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "31363434313731393838393035373639"; -// pub const FEE_POOL_HEX_RESPONSE: &str = -// "0a630a446962632f31324441343233303445453143453936303731463731324141344435383138364144313143333136354330444344413731453031374135344633393335453636121b3434343235323231373030303030303030303030303030303030300a630a446962632f31344639424333453434423841394331424531464230383938304641423837303334433939303545463137434632463530303846433038353231383831314343121b3138393735333433323030303030303030303030303030303030300a620a446962632f31464244443538443433384234443034443236434246423245373232433138393834413046314135323436384334463432463337443130324633443346333939121a32353435353334383030303030303030303030303030303030300a620a446962632f32313831414142303231384541433234424339463836424431333634464242464133453645334643433235453838453345363843313544433645373532443836121a38393736343437323030303030303030303030303030303030300a5e0a446962632f323731373130394139353535394633413137454643304338393742373639314532324132323742333046433343354345374137434538383438313632393730341216393030303030303030303030303030303030303030300a640a446962632f34324534374135424137303845424536453043323237303036323534463237383445323039463444424433433642423737454443344232394546383735453845121c323332353636383932303030303030303030303030303030303030300a620a446962632f38314430384243333946423532304542443934384346303137393130444436393730324433344246354143313630463736443342354346433434344542434530121a33333633393935353030303030303030303030303030303030300a1c0a0574686574611213313531373130393430373239393334333933380a290a057561746f6d12203133353338343330393338303535303237343635383338343139363137323031"; -// pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "08011291030a232f636f736d6f732e676f762e76312e4d7367457865634c6567616379436f6e74656e7412e9020ab7020a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c1292020a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6512c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863122d636f736d6f73313064303779323635676d6d757674347a30773961773838306a6e73723730306a367a6e396b6e1803222f0a0e3937313138393033353236373939120c3430323338303537373233341a0c3332303534353430303030302201302a0b0897c1c7e40510e4838e13320b0897ab91e50510e4838e133a120a057561746f6d1209353132313030303030420c088fcccae405109399d2ac024a0c088fb694e505109399d2ac025a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6562c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863"; -// pub const STAKING_PARAMS_HEX_RESPONSE: &str = "0a040880c60a109601180720904e2a057561746f6d321135303030303030303030303030303030303a1532353030303030303030303030303030303030303042123235303030303030303030303030303030304a12353030303030303030303030303030303030"; -// pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a396112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20da3f8d90a407031bb7eaf76ecb5b031c96487998e2ee7c67995222cefd3b329120032a0f32353030323832373430353233363432213235303032383237343035323336343030303030303030303030303030303030303a3f0a0a656172746820f09f8c8e1210436f696e6261736520437573746f64791a0a68797068612e636f6f702a134120746573746e65742076616c696461746f7240f4b5704a0c0893efd1f605109bfa83af02524d0a3e0a123230303030303030303030303030303030301213313030303030303030303030303030303030301a1331303030303030303030303030303030303030120b08ff98e8f10510b7c886275a0731303030303030721b3130323030303030333030303030303030303030303030303030307a1c38363935303034363237303030303030303030303030303030303030"; -// pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f7331706d6a776d306138707673326d3870617579673272756c6479386e657934716e387a676439361234636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a39611a1635303030303030303030303030303030303030303030"; -// pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; -// pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; -// -// #[test] -// fn test_balance_reconstruct() { -// struct TestCase { -// addr: String, -// coins: Vec<(String, String)>, -// } -// let test_cases: Vec = vec![ -// TestCase { -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// coins: vec![("uosmo".to_string(), "100".to_string())], -// }, -// TestCase { -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// coins: vec![ -// ("uosmo".to_string(), "100".to_string()), -// ("uatom".to_string(), "500".to_string()), -// ("uluna".to_string(), "80".to_string()), -// ], -// }, -// TestCase { -// addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// coins: vec![("uluna".to_string(), "".to_string())], -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); -// for coin in &ts.coins { -// let balance_key = -// create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); -// -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(balance_key), -// value: Binary::new(coin.1.clone().into_bytes()), -// }; -// st_values.push(s); -// } -// -// let balances = Balances::reconstruct(&st_values).unwrap(); -// assert_eq!(balances.coins.len(), ts.coins.len()); -// for (i, coin) in balances.coins.iter().enumerate() { -// assert_eq!(coin.denom, ts.coins[i].0); -// // special testcase where value is an empty string -// if ts.coins[i].1.is_empty() { -// assert_eq!(coin.amount, Uint128::zero()); -// continue; -// } -// assert_eq!(coin.amount, Uint128::from_str(&ts.coins[i].1).unwrap()) -// } -// } -// } -// -// #[test] -// fn test_bank_total_supply_reconstruct() { -// struct TestValue { -// denom: String, -// amount: String, -// } -// struct TestCase { -// values: Vec, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// values: vec![TestValue { -// denom: "uatom".to_string(), -// amount: "100".to_string(), -// }], -// }, -// TestCase { -// values: vec![ -// TestValue { -// denom: "uatom".to_string(), -// amount: "100".to_string(), -// }, -// TestValue { -// denom: "uosmo".to_string(), -// amount: "200".to_string(), -// }, -// ], -// }, -// TestCase { values: vec![] }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for case in &ts.values { -// let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(denom_key), -// value: Binary::new(case.amount.as_bytes().to_vec()), -// }; -// st_values.push(s); -// } -// -// let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); -// assert_eq!(total_supply.coins.len(), ts.values.len()); -// for (i, coin) in total_supply.coins.iter().enumerate() { -// assert_eq!(coin.denom, ts.values[i].denom); -// assert_eq!( -// coin.amount, -// Uint128::from_str(ts.values[i].amount.as_str()).unwrap() -// ) -// } -// } -// } -// -// #[test] -// fn test_staking_validators_reconstruct() { -// struct TestCase { -// validators: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(StakingValidator { -// validators: vec![ContractValidator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// status: 0, -// consensus_pubkey: None, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// unbonding_height: 0, -// unbonding_time: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }], -// }), -// }, -// TestCase { -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: Some(prost_types::Any { -// type_url: "consensus_pubkey".to_string(), -// value: vec![], -// }), -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: Some(Description { -// moniker: "Test validator".to_string(), -// identity: "JHFDHHFHF".to_string(), -// website: "https://neutron.org".to_string(), -// security_contact: "".to_string(), -// details: "Validator details".to_string(), -// }), -// unbonding_height: 0, -// unbonding_time: Some(prost_types::Timestamp { -// seconds: 1203981203, -// nanos: 123123, -// }), -// commission: Some(Commission { -// commission_rates: Some(CommissionRates { -// rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros -// max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros -// max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros -// }), -// update_time: Some(prost_types::Timestamp { -// seconds: 56324234, -// nanos: 1343, -// }), -// }), -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(StakingValidator { -// validators: vec![ContractValidator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// status: 0, -// consensus_pubkey: Some(vec![]), -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// moniker: Some("Test validator".to_string()), -// identity: Some("JHFDHHFHF".to_string()), -// website: Some("https://neutron.org".to_string()), -// security_contact: Some("".to_string()), -// details: Some("Validator details".to_string()), -// unbonding_height: 0, -// unbonding_time: Some(1203981203), -// rate: Some(Decimal::from_str("5").unwrap()), -// max_rate: Some(Decimal::from_str("20").unwrap()), -// max_change_rate: Some(Decimal::from_str("1").unwrap()), -// update_time: Some(56324234), -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }], -// }), -// }, -// TestCase { -// validators: vec![ -// Validator { -// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" -// .to_string(), -// consensus_pubkey: Some(prost_types::Any { -// type_url: "consensus_pubkey".to_string(), -// value: vec![1u8, 2u8, 3u8, 4u8], -// }), -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// Validator { -// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" -// .to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "2000000000000000000".to_string(), -// delegator_shares: "3000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// ], -// expected_result: Ok(StakingValidator { -// validators: vec![ -// ContractValidator { -// operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" -// .to_string(), -// status: 0, -// consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// unbonding_height: 0, -// unbonding_time: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }, -// ContractValidator { -// operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" -// .to_string(), -// status: 0, -// consensus_pubkey: None, -// tokens: "2000000000000000000".to_string(), -// delegator_shares: "3000000000000000000".to_string(), -// moniker: None, -// identity: None, -// website: None, -// security_contact: None, -// details: None, -// unbonding_height: 0, -// unbonding_time: None, -// rate: None, -// max_rate: None, -// max_change_rate: None, -// update_time: None, -// min_self_delegation: Decimal::from_str("0").unwrap(), -// jailed: false, -// }, -// ], -// }), -// }, -// TestCase { -// validators: vec![], -// expected_result: Ok(StakingValidator { validators: vec![] }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for validator in &ts.validators { -// let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); -// -// let validator_key = create_validator_key(&val_addr).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(validator_key), -// value: Binary::new(validator.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let stakin_validator = StakingValidator::reconstruct(&st_values); -// -// assert_eq!(stakin_validator, ts.expected_result) -// } -// } -// -// #[test] -// fn test_validators_signing_infos_reconstruct() { -// struct TestCase { -// signing_infos: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// signing_infos: vec![CosmosValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![ValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// }), -// }, -// TestCase { -// signing_infos: vec![CosmosValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(prost_types::Timestamp { -// seconds: 321654, -// nanos: 123123, -// }), -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![ValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(321654), -// tombstoned: false, -// missed_blocks_counter: 987675, -// }], -// }), -// }, -// TestCase { -// signing_infos: vec![ -// CosmosValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: true, -// missed_blocks_counter: 987675, -// }, -// CosmosValidatorSigningInfo { -// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(prost_types::Timestamp { -// seconds: 321654, -// nanos: 123123, -// }), -// tombstoned: false, -// missed_blocks_counter: 345012, -// }, -// ], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![ -// ValidatorSigningInfo { -// address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: None, -// tombstoned: true, -// missed_blocks_counter: 987675, -// }, -// ValidatorSigningInfo { -// address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), -// start_height: 1, -// index_offset: 1, -// jailed_until: Some(321654), -// tombstoned: false, -// missed_blocks_counter: 345012, -// }, -// ], -// }), -// }, -// TestCase { -// signing_infos: vec![], -// expected_result: Ok(SigningInfo { -// signing_infos: vec![], -// }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for info in &ts.signing_infos { -// let val_addr = decode_and_convert(info.address.as_str()).unwrap(); -// -// let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(signing_info_key), -// value: Binary::new(info.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let signing_infos = SigningInfo::reconstruct(&st_values); -// -// assert_eq!(signing_infos, ts.expected_result) -// } -// } -// -// #[test] -// fn test_government_proposals_reconstruct() { -// struct TestCase { -// proposals: Vec, -// expected_result: NeutronResult, -// } -// -// let test_cases: Vec = vec![ -// TestCase { -// proposals: vec![CosmosProposal { -// proposal_id: 1, -// content: Some(prost_types::Any { -// type_url: "proposal_type".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: None, -// submit_time: None, -// deposit_end_time: None, -// total_deposit: vec![Coin { -// amount: "100000".to_string(), -// denom: "stake".to_string(), -// }], -// voting_start_time: None, -// voting_end_time: None, -// }], -// expected_result: Ok(GovernmentProposal { -// proposals: vec![Proposal { -// proposal_id: 1, -// proposal_type: Some("proposal_type".to_string()), -// total_deposit: vec![StdCoin::new(100000u128, "stake")], -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_start_time: None, -// voting_end_time: None, -// final_tally_result: None, -// }], -// }), -// }, -// TestCase { -// proposals: vec![CosmosProposal { -// proposal_id: 1, -// content: Some(prost_types::Any { -// type_url: "proposal_type".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: Some(CosmosTallyResult { -// abstain: "1".to_string(), -// no: "2".to_string(), -// no_with_veto: "3".to_string(), -// yes: "4".to_string(), -// }), -// submit_time: Some(prost_types::Timestamp { -// seconds: 2222222, -// nanos: 123123, -// }), -// deposit_end_time: Some(prost_types::Timestamp { -// seconds: 3333333, -// nanos: 123123, -// }), -// total_deposit: vec![Coin { -// amount: "100000".to_string(), -// denom: "stake".to_string(), -// }], -// voting_start_time: Some(prost_types::Timestamp { -// seconds: 4444444, -// nanos: 123123, -// }), -// voting_end_time: Some(prost_types::Timestamp { -// seconds: 555555555, -// nanos: 123123, -// }), -// }], -// expected_result: Ok(GovernmentProposal { -// proposals: vec![Proposal { -// proposal_id: 1, -// proposal_type: Some("proposal_type".to_string()), -// total_deposit: vec![StdCoin::new(100000u128, "stake")], -// status: 1, -// submit_time: Some(2222222), -// deposit_end_time: Some(3333333), -// voting_start_time: Some(4444444), -// voting_end_time: Some(555555555), -// final_tally_result: Some(TallyResult { -// abstain: Uint128::from(1u128), -// no: Uint128::from(2u128), -// no_with_veto: Uint128::from(3u128), -// yes: Uint128::from(4u128), -// }), -// }], -// }), -// }, -// TestCase { -// proposals: vec![ -// CosmosProposal { -// proposal_id: 1, -// content: Some(prost_types::Any { -// type_url: "proposal_type1".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: None, -// submit_time: None, -// deposit_end_time: None, -// total_deposit: vec![Coin { -// amount: "100000".to_string(), -// denom: "stake".to_string(), -// }], -// voting_start_time: None, -// voting_end_time: None, -// }, -// CosmosProposal { -// proposal_id: 2, -// content: Some(prost_types::Any { -// type_url: "proposal_type2".to_string(), -// value: vec![], -// }), -// status: 1, -// final_tally_result: None, -// submit_time: None, -// deposit_end_time: None, -// total_deposit: vec![Coin { -// amount: "200000".to_string(), -// denom: "osmo".to_string(), -// }], -// voting_start_time: None, -// voting_end_time: None, -// }, -// ], -// expected_result: Ok(GovernmentProposal { -// proposals: vec![ -// Proposal { -// proposal_id: 1, -// proposal_type: Some("proposal_type1".to_string()), -// total_deposit: vec![StdCoin::new(100000u128, "stake")], -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_start_time: None, -// voting_end_time: None, -// final_tally_result: None, -// }, -// Proposal { -// proposal_id: 2, -// proposal_type: Some("proposal_type2".to_string()), -// total_deposit: vec![StdCoin::new(200000u128, "osmo")], -// status: 1, -// submit_time: None, -// deposit_end_time: None, -// voting_start_time: None, -// voting_end_time: None, -// final_tally_result: None, -// }, -// ], -// }), -// }, -// TestCase { -// proposals: vec![], -// expected_result: Ok(GovernmentProposal { proposals: vec![] }), -// }, -// ]; -// -// for ts in test_cases { -// let mut st_values: Vec = vec![]; -// -// for proposal in &ts.proposals { -// let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); -// let s = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(proposal_key), -// value: Binary::new(proposal.encode_to_vec()), -// }; -// st_values.push(s); -// } -// -// let gov_proposal = GovernmentProposal::reconstruct(&st_values); -// -// assert_eq!(gov_proposal, ts.expected_result) -// } -// } -// -// #[test] -// fn test_fee_pool_reconstruct() { -// struct TestCase { -// coins: Vec<(String, Uint128)>, -// } -// let test_cases: Vec = vec![ -// TestCase { -// coins: vec![("uosmo".to_string(), Uint128::from(100u128))], -// }, -// TestCase { -// coins: vec![ -// ("uosmo".to_string(), Uint128::from(100u128)), -// ("uatom".to_string(), Uint128::from(500u128)), -// ("uluna".to_string(), Uint128::from(80u128)), -// ], -// }, -// TestCase { coins: vec![] }, -// ]; -// -// for ts in test_cases { -// let mut coins: Vec = vec![]; -// -// for coin in &ts.coins { -// let balance_amount = DecCoin { -// denom: coin.0.clone(), -// amount: coin -// .1 -// .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format -// .to_string(), -// }; -// -// coins.push(balance_amount); -// } -// -// let fee_pool = CosmosFeePool { -// community_pool: coins, -// }; -// -// let fee_pool_key = create_fee_pool_key().unwrap(); -// -// let st_value = StorageValue { -// storage_prefix: "".to_string(), -// key: Binary::new(fee_pool_key), -// value: Binary::new(fee_pool.encode_to_vec()), -// }; -// -// let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); -// assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); -// for (i, coin) in fee_pool_coins.coins.iter().enumerate() { -// assert_eq!(coin.denom, ts.coins[i].0); -// assert_eq!(coin.amount, ts.coins[i].1) -// } -// } -// } -// -// #[test] -// fn test_delegations_reconstruct() { -// struct TestCase { -// staking_params: Params, -// delegations: Vec, -// validators: Vec, -// expected_result: NeutronResult, -// } -// let test_cases: Vec = vec![ -// TestCase { -// staking_params: Params { -// unbonding_time: None, -// max_validators: 0, -// max_entries: 0, -// historical_entries: 0, -// bond_denom: "stake".to_string(), -// min_commission_rate: "".to_string(), -// }, -// delegations: vec![Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// shares: "1000000000000000000".to_string(), -// }], -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(Delegations { -// delegations: vec![StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: StdCoin::new(1000000000000000000u128, "stake"), -// }], -// }), -// }, -// TestCase { -// staking_params: Params { -// unbonding_time: None, -// max_validators: 0, -// max_entries: 0, -// historical_entries: 0, -// bond_denom: "stake".to_string(), -// min_commission_rate: "".to_string(), -// }, -// delegations: vec![ -// Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// shares: "1000000000000000000".to_string(), -// }, -// Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" -// .to_string(), -// shares: "1000000000000000000".to_string(), -// }, -// ], -// validators: vec![ -// Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" -// .to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// Validator { -// operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" -// .to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "1000000000000000000".to_string(), -// delegator_shares: "1000000000000000000".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }, -// ], -// expected_result: Ok(Delegations { -// delegations: vec![ -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: StdCoin::new(1000000000000000000u128, "stake"), -// }, -// StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), -// amount: StdCoin::new(1000000000000000000u128, "stake"), -// }, -// ], -// }), -// }, -// TestCase { -// staking_params: Params { -// unbonding_time: None, -// max_validators: 0, -// max_entries: 0, -// historical_entries: 0, -// bond_denom: "stake".to_string(), -// min_commission_rate: "".to_string(), -// }, -// delegations: vec![], -// validators: vec![], -// expected_result: Ok(Delegations { -// delegations: vec![], -// }), -// }, -// TestCase { -// staking_params: Default::default(), -// delegations: vec![], -// validators: vec![], -// expected_result: Err(NeutronError::InvalidQueryResultFormat( -// "params is empty".into(), -// )), -// }, -// TestCase { -// staking_params: Params { -// unbonding_time: None, -// max_validators: 0, -// max_entries: 0, -// historical_entries: 0, -// bond_denom: "stake".to_string(), -// min_commission_rate: "".to_string(), -// }, -// delegations: vec![Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// shares: "1000000000000000000".to_string(), -// }], -// validators: vec![], -// expected_result: Err(NeutronError::InvalidQueryResultFormat( -// "validator is empty".into(), -// )), -// }, -// ]; -// -// for ts in &test_cases { -// // prepare storage values -// let mut st_values: Vec = vec![StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(vec![STAKING_PARAMS_KEY]), -// value: { -// if ts.staking_params.bond_denom.is_empty() { -// return Default::default(); -// } -// Binary::from(ts.staking_params.encode_to_vec()) -// }, -// }]; -// -// for (i, d) in ts.delegations.iter().enumerate() { -// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); -// let val_addr = decode_and_convert(&d.validator_address).unwrap(); -// -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), -// value: Binary::from(d.encode_to_vec()), -// }); -// -// if let Some(v) = ts.validators.get(i) { -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_validator_key(&val_addr).unwrap()), -// value: Binary::from(v.encode_to_vec()), -// }); -// } -// } -// -// // test reconstruction -// let delegations = Delegations::reconstruct(&st_values); -// -// assert_eq!(delegations, ts.expected_result) -// } -// } -// -// #[test] -// fn test_balance_reconstruct_from_hex() { -// let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::new(create_account_denom_balance_key("addr", "uatom").unwrap()), -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let bank_balances = Balances::reconstruct(&[s]).unwrap(); -// assert_eq!( -// bank_balances, -// Balances { -// coins: vec![StdCoin::new(494213561u128, "uatom")] -// } -// ); -// } -// -// #[test] -// fn test_balance_reconstruct_from_empty_value() { -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::new(create_account_denom_balance_key("addr", "uatom").unwrap()), -// value: Binary::from(vec![]), -// }; -// let bank_balances = Balances::reconstruct(&[s]).unwrap(); -// assert_eq!( -// bank_balances, -// Balances { -// coins: vec![StdCoin::new(0u128, "uatom")] -// } -// ); -// } -// -// #[test] -// fn test_bank_total_supply_reconstruct_from_hex() { -// let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::new(create_total_denom_key("stake").unwrap()), -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); -// assert_eq!( -// total_supply, -// TotalSupply { -// coins: vec![StdCoin { -// denom: String::from("stake"), -// amount: Uint128::from(1644171988905769u64), // mutating -// }] -// } -// ); -// } -// -// #[test] -// fn test_delegations_reconstruct_overflow() { -// struct TestCase { -// staking_params: Params, -// delegations: Vec, -// validators: Vec, -// expected_result: NeutronResult, -// } -// let test_cases: Vec = vec![TestCase { -// staking_params: Params { -// unbonding_time: None, -// max_validators: 0, -// max_entries: 0, -// historical_entries: 0, -// bond_denom: "stake".to_string(), -// min_commission_rate: "".to_string(), -// }, -// delegations: vec![Delegation { -// delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), -// validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// shares: "340282366920938463463".to_string(), -// }], -// validators: vec![Validator { -// operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// consensus_pubkey: None, -// jailed: false, -// status: 0, -// tokens: "340282366920938463463".to_string(), -// delegator_shares: "340282366920938463463".to_string(), -// description: None, -// unbonding_height: 0, -// unbonding_time: None, -// commission: None, -// min_self_delegation: "".to_string(), -// }], -// expected_result: Ok(Delegations { -// delegations: vec![StdDelegation { -// delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), -// validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), -// amount: StdCoin::new(340282366920938463463u128, "stake"), -// }], -// }), -// }]; -// -// for ts in &test_cases { -// // prepare storage values -// let mut st_values: Vec = vec![StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM)), -// value: { -// if ts.staking_params.bond_denom.is_empty() { -// return Default::default(); -// } -// Binary::from(ts.staking_params.encode_to_vec()) -// }, -// }]; -// -// for (i, d) in ts.delegations.iter().enumerate() { -// let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); -// let val_addr = decode_and_convert(&d.validator_address).unwrap(); -// -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_delegation_key(&delegator_addr, &val_addr).unwrap()), -// value: Binary::from(d.encode_to_vec()), -// }); -// -// if let Some(v) = ts.validators.get(i) { -// st_values.push(StorageValue { -// storage_prefix: STAKING_STORE_KEY.to_string(), -// key: Binary::new(create_validator_key(&val_addr).unwrap()), -// value: Binary::from(v.encode_to_vec()), -// }); -// } -// } -// -// // test reconstruction -// let delegations = Delegations::reconstruct(&st_values); -// -// assert_eq!(delegations, ts.expected_result) -// } -// } -// -// #[test] -// fn test_staking_validators_reconstruct_from_hex() { -// let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); -// assert_eq!( -// staking_validator, -// StakingValidator { -// validators: vec![ContractValidator { -// operator_address: String::from( -// "cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a" // mutating -// ), -// consensus_pubkey: Some(vec![ -// 10, 32, 218, 63, 141, 144, 164, 7, 3, 27, 183, 234, 247, 110, 203, 91, 3, 28, -// 150, 72, 121, 152, 226, 238, 124, 103, 153, 82, 34, 206, 253, 59, 50, 145, -// ]), -// jailed: false, -// status: 3, -// tokens: String::from("250028274052364"), -// delegator_shares: String::from("250028274052364000000000000000000"), -// moniker: Some(String::from("earth 🌎")), -// identity: Some(String::from("Coinbase Custody")), -// website: Some(String::from("hypha.coop")), -// security_contact: Some(String::from("")), -// details: Some(String::from("A testnet validator")), -// unbonding_height: 1841908u64, -// unbonding_time: Some(1590982547u64), -// rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), -// max_rate: Some(Decimal::from_str("1.00000000000000000").unwrap()), -// max_change_rate: Some(Decimal::from_str("1.000000000000000000").unwrap()), -// update_time: Some(1580862591u64), // mutating -// min_self_delegation: Decimal::from_str("1000000").unwrap(), -// }] -// } -// ); -// } -// -// #[test] -// fn test_validators_signing_infos_reconstruct_from_hex() { -// let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); -// assert_eq!( -// signing_info, -// SigningInfo { -// signing_infos: vec![ValidatorSigningInfo { -// address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), -// start_height: 0, -// index_offset: 16, -// jailed_until: Some(0), -// tombstoned: false, -// missed_blocks_counter: 0, -// }] -// } -// ); -// } -// -// #[test] -// fn test_government_proposals_reconstruct_from_hex() { -// let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); -// assert_eq!( -// proposals, -// GovernmentProposal { -// proposals: vec![Proposal { -// proposal_id: 1u64, -// proposal_type: Some(String::from("/cosmos.gov.v1.MsgExecLegacyContent")), -// total_deposit: vec![StdCoin { -// denom: String::from("uatom"), -// amount: Uint128::from(512100000u64), -// }], -// status: 3i32, -// submit_time: Some(1553064087u64), // mutating -// deposit_end_time: Some(1554273687u64), // mutating -// voting_start_time: Some(1553114639u64), // 0001-01-01T00:00:00Z -// voting_end_time: Some(1554324239u64), // 0001-01-01T00:00:00Z -// final_tally_result: Some(TallyResult { -// yes: Uint128::from(97118903526799u128), -// no: Uint128::from(320545400000u128), -// abstain: Uint128::from(402380577234u128), -// no_with_veto: Uint128::zero(), -// }), -// }] -// } -// ); -// } -// -// #[test] -// fn test_fee_pool_reconstruct_from_hex() { -// let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string -// -// let s = StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(base64_input.as_str()).unwrap(), -// }; -// let fee_pool = FeePool::reconstruct(&[s]).unwrap(); -// assert_eq!( -// fee_pool, -// FeePool { -// coins: vec![ -// StdCoin { -// denom: String::from( -// "ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66" -// ), -// amount: Uint128::from(444252217u64), // mutating -// }, -// StdCoin { -// denom: String::from( -// "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC" -// ), -// amount: Uint128::from(189753432u64), // mutating -// }, -// StdCoin { -// denom: String::from( -// "ibc/1FBDD58D438B4D04D26CBFB2E722C18984A0F1A52468C4F42F37D102F3D3F399" -// ), -// amount: Uint128::from(25455348u64), // mutating -// }, -// StdCoin { -// denom: String::from( -// "ibc/2181AAB0218EAC24BC9F86BD1364FBBFA3E6E3FCC25E88E3E68C15DC6E752D86" -// ), -// amount: Uint128::from(89764472u64), // mutating -// }, -// StdCoin { -// denom: String::from( -// "ibc/2717109A95559F3A17EFC0C897B7691E22A227B30FC3C5CE7A7CE88481629704" -// ), -// amount: Uint128::from(9000u64), // mutating -// }, -// StdCoin { -// denom: String::from( -// "ibc/42E47A5BA708EBE6E0C227006254F2784E209F4DBD3C6BB77EDC4B29EF875E8E" -// ), -// amount: Uint128::from(2325668920u64), // mutating -// }, -// StdCoin { -// denom: String::from( -// "ibc/81D08BC39FB520EBD948CF017910DD69702D34BF5AC160F76D3B5CFC444EBCE0" -// ), -// amount: Uint128::from(33639955u64), // mutating -// }, -// StdCoin { -// denom: String::from("theta"), -// amount: Uint128::from(1u64), // mutating -// }, -// StdCoin { -// denom: String::from("uatom"), -// amount: Uint128::from(13538430938055u64), // mutating -// }, -// ] -// } -// ); -// } -// -// #[test] -// fn test_delegations_reconstruct_from_hex() { -// let staking_params_bytes = hex::decode(STAKING_PARAMS_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let staking_params_base64_input = BASE64_STANDARD.encode(staking_params_bytes); // encode bytes to base64 string -// let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string -// let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string -// -// let mut st_values: Vec = vec![StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(staking_params_base64_input.as_str()).unwrap(), -// }]; -// st_values.push(StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(delegation_base64_input.as_str()).unwrap(), -// }); -// st_values.push(StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap(), -// }); -// -// let delegations = Delegations::reconstruct(&st_values).unwrap(); -// assert_eq!( -// delegations, -// Delegations { -// delegations: vec![StdDelegation { -// delegator: Addr::unchecked("cosmos1pmjwm0a8pvs2m8pauyg2ruldy8ney4qn8zgd96"), // mutating -// validator: String::from("cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a"), // mutating -// amount: StdCoin { -// denom: String::from("uatom"), -// amount: Uint128::from(5000u64), -// }, -// }], -// } -// ); -// } -// -// #[test] -// fn test_unbonding_delegations_reconstruct_from_hex() { -// let unbonding_delegations_bytes = -// hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes -// let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string -// -// let st_values: Vec = vec![StorageValue { -// storage_prefix: String::default(), // not used in reconstruct -// key: Binary::default(), // not used in reconstruct -// value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap(), -// }]; -// -// let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); -// assert_eq!( -// unbonding_delegations, -// UnbondingDelegations { -// unbonding_responses: vec![UnbondingResponse { -// delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), -// validator_address: String::from( -// "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" -// ), -// entries: vec![ -// UnbondingEntry { -// balance: Uint128::new(10_000), -// completion_time: Some(Timestamp::from_nanos(1704872890570185206)), -// creation_height: 365, -// initial_balance: Uint128::new(10_000), -// }, -// UnbondingEntry { -// balance: Uint128::new(20_000), -// completion_time: Some(Timestamp::from_nanos(1704872903002248037)), -// creation_height: 377, -// initial_balance: Uint128::new(20_000), -// }, -// ], -// }] -// } -// ); -// } +use crate::interchain_queries::helpers::decode_and_convert; +use crate::interchain_queries::types::KVReconstruct; +use crate::interchain_queries::v045::helpers::create_params_store_key; +use crate::interchain_queries::v045::types::KEY_BOND_DENOM; +use crate::interchain_queries::v047::helpers::{ + create_account_denom_balance_key, create_delegation_key, create_fee_pool_key, + create_gov_proposal_key, create_total_denom_key, create_validator_key, + create_validator_signing_info_key, +}; +use crate::interchain_queries::v047::types::{ + Balances, Delegations, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, + StdDelegation, TallyResult, TotalSupply, UnbondingDelegations, UnbondingEntry, + UnbondingResponse, Validator as ContractValidator, ValidatorSigningInfo, DECIMAL_PLACES, + STAKING_PARAMS_KEY, STAKING_STORE_KEY, +}; +use crate::{NeutronError, NeutronResult}; +use base64::prelude::*; +use base64::Engine; +use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin, DecCoin}; +use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; +use cosmos_sdk_proto::cosmos::gov::v1beta1::{ + Proposal as CosmosProposal, TallyResult as CosmosTallyResult, +}; +use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; +use cosmos_sdk_proto::cosmos::staking::v1beta1::{ + Commission, CommissionRates, Delegation, Description, Params, Validator, +}; +use cosmos_sdk_proto::traits::Message; +use cosmwasm_std::{Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; +use hex; +use std::ops::Mul; +use std::str::FromStr; +use neutron_std::types::neutron::interchainqueries::StorageValue; + +// raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. +pub const BALANCES_HEX_RESPONSE: &str = "343934323133353631"; +pub const TOTAL_SUPPLY_HEX_RESPONSE: &str = "31363434313731393838393035373639"; +pub const FEE_POOL_HEX_RESPONSE: &str = + "0a630a446962632f31324441343233303445453143453936303731463731324141344435383138364144313143333136354330444344413731453031374135344633393335453636121b3434343235323231373030303030303030303030303030303030300a630a446962632f31344639424333453434423841394331424531464230383938304641423837303334433939303545463137434632463530303846433038353231383831314343121b3138393735333433323030303030303030303030303030303030300a620a446962632f31464244443538443433384234443034443236434246423245373232433138393834413046314135323436384334463432463337443130324633443346333939121a32353435353334383030303030303030303030303030303030300a620a446962632f32313831414142303231384541433234424339463836424431333634464242464133453645334643433235453838453345363843313544433645373532443836121a38393736343437323030303030303030303030303030303030300a5e0a446962632f323731373130394139353535394633413137454643304338393742373639314532324132323742333046433343354345374137434538383438313632393730341216393030303030303030303030303030303030303030300a640a446962632f34324534374135424137303845424536453043323237303036323534463237383445323039463444424433433642423737454443344232394546383735453845121c323332353636383932303030303030303030303030303030303030300a620a446962632f38314430384243333946423532304542443934384346303137393130444436393730324433344246354143313630463736443342354346433434344542434530121a33333633393935353030303030303030303030303030303030300a1c0a0574686574611213313531373130393430373239393334333933380a290a057561746f6d12203133353338343330393338303535303237343635383338343139363137323031"; +pub const GOV_PROPOSAL_HEX_RESPONSE: &str = "08011291030a232f636f736d6f732e676f762e76312e4d7367457865634c6567616379436f6e74656e7412e9020ab7020a202f636f736d6f732e676f762e763162657461312e5465787450726f706f73616c1292020a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6512c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863122d636f736d6f73313064303779323635676d6d757674347a30773961773838306a6e73723730306a367a6e396b6e1803222f0a0e3937313138393033353236373939120c3430323338303537373233341a0c3332303534353430303030302201302a0b0897c1c7e40510e4838e13320b0897ab91e50510e4838e133a120a057561746f6d1209353132313030303030420c088fcccae405109399d2ac024a0c088fb694e505109399d2ac025a4441646a7573746d656e74206f6620626c6f636b735f7065725f7965617220746f20636f6d6520616c69676e656420776974682061637475616c20626c6f636b2074696d6562c9015468697320676f7665726e616e63652070726f706f73616c20697320666f722061646a7573746d656e74206f6620626c6f636b735f7065725f7965617220706172616d6574657220746f206e6f726d616c697a652074686520696e666c6174696f6e207261746520616e642072657761726420726174652e5c6e2069706673206c696e6b3a2068747470733a2f2f697066732e696f2f697066732f516d587145427235367865557a4670676a736d444b4d5369743369716e4b6144454c347461627850586f7a397863"; +pub const STAKING_PARAMS_HEX_RESPONSE: &str = "0a040880c60a109601180720904e2a057561746f6d321135303030303030303030303030303030303a1532353030303030303030303030303030303030303042123235303030303030303030303030303030304a12353030303030303030303030303030303030"; +pub const STAKING_VALIDATOR_HEX_RESPONSE: &str = "0a34636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a396112430a1d2f636f736d6f732e63727970746f2e656432353531392e5075624b657912220a20da3f8d90a407031bb7eaf76ecb5b031c96487998e2ee7c67995222cefd3b329120032a0f32353030323832373430353233363432213235303032383237343035323336343030303030303030303030303030303030303a3f0a0a656172746820f09f8c8e1210436f696e6261736520437573746f64791a0a68797068612e636f6f702a134120746573746e65742076616c696461746f7240f4b5704a0c0893efd1f605109bfa83af02524d0a3e0a123230303030303030303030303030303030301213313030303030303030303030303030303030301a1331303030303030303030303030303030303030120b08ff98e8f10510b7c886275a0731303030303030721b3130323030303030333030303030303030303030303030303030307a1c38363935303034363237303030303030303030303030303030303030"; +pub const DELEGATOR_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f7331706d6a776d306138707673326d3870617579673272756c6479386e657934716e387a676439361234636f736d6f7376616c6f70657231307636777664656e65653872396c36776c73706863677572326c746c387a746b6672766a39611a1635303030303030303030303030303030303030303030"; +pub const DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE: &str = "0a2d636f736d6f73316d396c33353878756e6868776473303536387a6134396d7a68767578783975787265357475641234636f736d6f7376616c6f7065723138686c356339786e35647a6532673530756177306c326d723032657735377a6b3061756b746e1a2108ed02120c08ba97f9ac0610f6abf18f021a0531303030302205313030303028011a2008f902120b08c797f9ac0610e59a89011a053230303030220532303030302802"; +pub const VALIDATOR_SIGNING_INFO_HEX_RESPONSE: &str = "0a34636f736d6f7376616c636f6e73313966353366717132387636706d7a383737646e653735643464376c307236356432373530707718102200"; + +#[test] +fn test_balance_reconstruct() { + struct TestCase { + addr: String, + coins: Vec<(String, String)>, + } + let test_cases: Vec = vec![ + TestCase { + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + coins: vec![("uosmo".to_string(), "100".to_string())], + }, + TestCase { + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + coins: vec![ + ("uosmo".to_string(), "100".to_string()), + ("uatom".to_string(), "500".to_string()), + ("uluna".to_string(), "80".to_string()), + ], + }, + TestCase { + addr: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + coins: vec![("uluna".to_string(), "".to_string())], + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + let converted_addr_bytes = decode_and_convert(ts.addr.as_str()).unwrap(); + for coin in &ts.coins { + let balance_key = + create_account_denom_balance_key(converted_addr_bytes.clone(), &coin.0).unwrap(); + + let s = StorageValue { + storage_prefix: "".to_string(), + key: balance_key, + value: coin.1.clone().into_bytes(), + proof: None, + }; + st_values.push(s); + } + + let balances = Balances::reconstruct(&st_values).unwrap(); + assert_eq!(balances.coins.len(), ts.coins.len()); + for (i, coin) in balances.coins.iter().enumerate() { + assert_eq!(coin.denom, ts.coins[i].0); + // special testcase where value is an empty string + if ts.coins[i].1.is_empty() { + assert_eq!(coin.amount, Uint128::zero()); + continue; + } + assert_eq!(coin.amount, Uint128::from_str(&ts.coins[i].1).unwrap()) + } + } +} + +#[test] +fn test_bank_total_supply_reconstruct() { + struct TestValue { + denom: String, + amount: String, + } + struct TestCase { + values: Vec, + } + + let test_cases: Vec = vec![ + TestCase { + values: vec![TestValue { + denom: "uatom".to_string(), + amount: "100".to_string(), + }], + }, + TestCase { + values: vec![ + TestValue { + denom: "uatom".to_string(), + amount: "100".to_string(), + }, + TestValue { + denom: "uosmo".to_string(), + amount: "200".to_string(), + }, + ], + }, + TestCase { values: vec![] }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for case in &ts.values { + let denom_key = create_total_denom_key(case.denom.as_str()).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: denom_key, + value: case.amount.as_bytes().to_vec(), + proof: None, + }; + st_values.push(s); + } + + let total_supply = TotalSupply::reconstruct(&st_values).unwrap(); + assert_eq!(total_supply.coins.len(), ts.values.len()); + for (i, coin) in total_supply.coins.iter().enumerate() { + assert_eq!(coin.denom, ts.values[i].denom); + assert_eq!( + coin.amount, + Uint128::from_str(ts.values[i].amount.as_str()).unwrap() + ) + } + } +} + +#[test] +fn test_staking_validators_reconstruct() { + struct TestCase { + validators: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }], + expected_result: Ok(StakingValidator { + validators: vec![ContractValidator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + status: 0, + consensus_pubkey: None, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + unbonding_height: 0, + unbonding_time: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }], + }), + }, + TestCase { + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: Some(prost_types::Any { + type_url: "consensus_pubkey".to_string(), + value: vec![], + }), + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: Some(Description { + moniker: "Test validator".to_string(), + identity: "JHFDHHFHF".to_string(), + website: "https://neutron.org".to_string(), + security_contact: "".to_string(), + details: "Validator details".to_string(), + }), + unbonding_height: 0, + unbonding_time: Some(prost_types::Timestamp { + seconds: 1203981203, + nanos: 123123, + }), + commission: Some(Commission { + commission_rates: Some(CommissionRates { + rate: "5000000000000000000".to_string(), // Dec(5) is 5+18 zeros + max_rate: "20000000000000000000".to_string(), // Dec(20) is 20+18 zeros + max_change_rate: "1000000000000000000".to_string(), // Dec(1) is 1+18 zeros + }), + update_time: Some(prost_types::Timestamp { + seconds: 56324234, + nanos: 1343, + }), + }), + min_self_delegation: "".to_string(), + }], + expected_result: Ok(StakingValidator { + validators: vec![ContractValidator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + status: 0, + consensus_pubkey: Some(vec![]), + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + moniker: Some("Test validator".to_string()), + identity: Some("JHFDHHFHF".to_string()), + website: Some("https://neutron.org".to_string()), + security_contact: Some("".to_string()), + details: Some("Validator details".to_string()), + unbonding_height: 0, + unbonding_time: Some(1203981203), + rate: Some(Decimal::from_str("5").unwrap()), + max_rate: Some(Decimal::from_str("20").unwrap()), + max_change_rate: Some(Decimal::from_str("1").unwrap()), + update_time: Some(56324234), + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }], + }), + }, + TestCase { + validators: vec![ + Validator { + operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" + .to_string(), + consensus_pubkey: Some(prost_types::Any { + type_url: "consensus_pubkey".to_string(), + value: vec![1u8, 2u8, 3u8, 4u8], + }), + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + Validator { + operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" + .to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "2000000000000000000".to_string(), + delegator_shares: "3000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + ], + expected_result: Ok(StakingValidator { + validators: vec![ + ContractValidator { + operator_address: "cosmosvaloper132juzk0gdmwuxvx4phug7m3ymyatxlh9734g4w" + .to_string(), + status: 0, + consensus_pubkey: Some(vec![1u8, 2u8, 3u8, 4u8]), + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + unbonding_height: 0, + unbonding_time: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }, + ContractValidator { + operator_address: "cosmosvaloper1sjllsnramtg3ewxqwwrwjxfgc4n4ef9u2lcnj0" + .to_string(), + status: 0, + consensus_pubkey: None, + tokens: "2000000000000000000".to_string(), + delegator_shares: "3000000000000000000".to_string(), + moniker: None, + identity: None, + website: None, + security_contact: None, + details: None, + unbonding_height: 0, + unbonding_time: None, + rate: None, + max_rate: None, + max_change_rate: None, + update_time: None, + min_self_delegation: Decimal::from_str("0").unwrap(), + jailed: false, + }, + ], + }), + }, + TestCase { + validators: vec![], + expected_result: Ok(StakingValidator { validators: vec![] }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for validator in &ts.validators { + let val_addr = decode_and_convert(validator.operator_address.as_str()).unwrap(); + + let validator_key = create_validator_key(&val_addr).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: validator_key, + value: validator.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let stakin_validator = StakingValidator::reconstruct(&st_values); + + assert_eq!(stakin_validator, ts.expected_result) + } +} + +#[test] +fn test_validators_signing_infos_reconstruct() { + struct TestCase { + signing_infos: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + signing_infos: vec![CosmosValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: false, + missed_blocks_counter: 987675, + }], + expected_result: Ok(SigningInfo { + signing_infos: vec![ValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: false, + missed_blocks_counter: 987675, + }], + }), + }, + TestCase { + signing_infos: vec![CosmosValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(prost_types::Timestamp { + seconds: 321654, + nanos: 123123, + }), + tombstoned: false, + missed_blocks_counter: 987675, + }], + expected_result: Ok(SigningInfo { + signing_infos: vec![ValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(321654), + tombstoned: false, + missed_blocks_counter: 987675, + }], + }), + }, + TestCase { + signing_infos: vec![ + CosmosValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: true, + missed_blocks_counter: 987675, + }, + CosmosValidatorSigningInfo { + address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(prost_types::Timestamp { + seconds: 321654, + nanos: 123123, + }), + tombstoned: false, + missed_blocks_counter: 345012, + }, + ], + expected_result: Ok(SigningInfo { + signing_infos: vec![ + ValidatorSigningInfo { + address: "cosmosvalcons1yjf46k064988jdjje068zmrqg8xh4fqqe2wwnl".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: None, + tombstoned: true, + missed_blocks_counter: 987675, + }, + ValidatorSigningInfo { + address: "cosmosvalcons16tnak7apushwznnd3wtku8gm0rt3xytz6ut006".to_string(), + start_height: 1, + index_offset: 1, + jailed_until: Some(321654), + tombstoned: false, + missed_blocks_counter: 345012, + }, + ], + }), + }, + TestCase { + signing_infos: vec![], + expected_result: Ok(SigningInfo { + signing_infos: vec![], + }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for info in &ts.signing_infos { + let val_addr = decode_and_convert(info.address.as_str()).unwrap(); + + let signing_info_key = create_validator_signing_info_key(&val_addr).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: signing_info_key, + value: info.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let signing_infos = SigningInfo::reconstruct(&st_values); + + assert_eq!(signing_infos, ts.expected_result) + } +} + +#[test] +fn test_government_proposals_reconstruct() { + struct TestCase { + proposals: Vec, + expected_result: NeutronResult, + } + + let test_cases: Vec = vec![ + TestCase { + proposals: vec![CosmosProposal { + proposal_id: 1, + content: Some(prost_types::Any { + type_url: "proposal_type".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: None, + submit_time: None, + deposit_end_time: None, + total_deposit: vec![Coin { + amount: "100000".to_string(), + denom: "stake".to_string(), + }], + voting_start_time: None, + voting_end_time: None, + }], + expected_result: Ok(GovernmentProposal { + proposals: vec![Proposal { + proposal_id: 1, + proposal_type: Some("proposal_type".to_string()), + total_deposit: vec![StdCoin::new(100000u128, "stake")], + status: 1, + submit_time: None, + deposit_end_time: None, + voting_start_time: None, + voting_end_time: None, + final_tally_result: None, + }], + }), + }, + TestCase { + proposals: vec![CosmosProposal { + proposal_id: 1, + content: Some(prost_types::Any { + type_url: "proposal_type".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: Some(CosmosTallyResult { + abstain: "1".to_string(), + no: "2".to_string(), + no_with_veto: "3".to_string(), + yes: "4".to_string(), + }), + submit_time: Some(prost_types::Timestamp { + seconds: 2222222, + nanos: 123123, + }), + deposit_end_time: Some(prost_types::Timestamp { + seconds: 3333333, + nanos: 123123, + }), + total_deposit: vec![Coin { + amount: "100000".to_string(), + denom: "stake".to_string(), + }], + voting_start_time: Some(prost_types::Timestamp { + seconds: 4444444, + nanos: 123123, + }), + voting_end_time: Some(prost_types::Timestamp { + seconds: 555555555, + nanos: 123123, + }), + }], + expected_result: Ok(GovernmentProposal { + proposals: vec![Proposal { + proposal_id: 1, + proposal_type: Some("proposal_type".to_string()), + total_deposit: vec![StdCoin::new(100000u128, "stake")], + status: 1, + submit_time: Some(2222222), + deposit_end_time: Some(3333333), + voting_start_time: Some(4444444), + voting_end_time: Some(555555555), + final_tally_result: Some(TallyResult { + abstain: Uint128::from(1u128), + no: Uint128::from(2u128), + no_with_veto: Uint128::from(3u128), + yes: Uint128::from(4u128), + }), + }], + }), + }, + TestCase { + proposals: vec![ + CosmosProposal { + proposal_id: 1, + content: Some(prost_types::Any { + type_url: "proposal_type1".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: None, + submit_time: None, + deposit_end_time: None, + total_deposit: vec![Coin { + amount: "100000".to_string(), + denom: "stake".to_string(), + }], + voting_start_time: None, + voting_end_time: None, + }, + CosmosProposal { + proposal_id: 2, + content: Some(prost_types::Any { + type_url: "proposal_type2".to_string(), + value: vec![], + }), + status: 1, + final_tally_result: None, + submit_time: None, + deposit_end_time: None, + total_deposit: vec![Coin { + amount: "200000".to_string(), + denom: "osmo".to_string(), + }], + voting_start_time: None, + voting_end_time: None, + }, + ], + expected_result: Ok(GovernmentProposal { + proposals: vec![ + Proposal { + proposal_id: 1, + proposal_type: Some("proposal_type1".to_string()), + total_deposit: vec![StdCoin::new(100000u128, "stake")], + status: 1, + submit_time: None, + deposit_end_time: None, + voting_start_time: None, + voting_end_time: None, + final_tally_result: None, + }, + Proposal { + proposal_id: 2, + proposal_type: Some("proposal_type2".to_string()), + total_deposit: vec![StdCoin::new(200000u128, "osmo")], + status: 1, + submit_time: None, + deposit_end_time: None, + voting_start_time: None, + voting_end_time: None, + final_tally_result: None, + }, + ], + }), + }, + TestCase { + proposals: vec![], + expected_result: Ok(GovernmentProposal { proposals: vec![] }), + }, + ]; + + for ts in test_cases { + let mut st_values: Vec = vec![]; + + for proposal in &ts.proposals { + let proposal_key = create_gov_proposal_key(proposal.proposal_id).unwrap(); + let s = StorageValue { + storage_prefix: "".to_string(), + key: proposal_key, + value: proposal.encode_to_vec(), + proof: None, + }; + st_values.push(s); + } + + let gov_proposal = GovernmentProposal::reconstruct(&st_values); + + assert_eq!(gov_proposal, ts.expected_result) + } +} + +#[test] +fn test_fee_pool_reconstruct() { + struct TestCase { + coins: Vec<(String, Uint128)>, + } + let test_cases: Vec = vec![ + TestCase { + coins: vec![("uosmo".to_string(), Uint128::from(100u128))], + }, + TestCase { + coins: vec![ + ("uosmo".to_string(), Uint128::from(100u128)), + ("uatom".to_string(), Uint128::from(500u128)), + ("uluna".to_string(), Uint128::from(80u128)), + ], + }, + TestCase { coins: vec![] }, + ]; + + for ts in test_cases { + let mut coins: Vec = vec![]; + + for coin in &ts.coins { + let balance_amount = DecCoin { + denom: coin.0.clone(), + amount: coin + .1 + .mul(Uint128::one().mul(Uint128::from(10u64).pow(DECIMAL_PLACES))) // adjust to Dec gogo proto format + .to_string(), + }; + + coins.push(balance_amount); + } + + let fee_pool = CosmosFeePool { + community_pool: coins, + }; + + let fee_pool_key = create_fee_pool_key().unwrap(); + + let st_value = StorageValue { + storage_prefix: "".to_string(), + key: fee_pool_key, + value: fee_pool.encode_to_vec(), + proof: None, + }; + + let fee_pool_coins = FeePool::reconstruct(&[st_value]).unwrap(); + assert_eq!(fee_pool_coins.coins.len(), ts.coins.len()); + for (i, coin) in fee_pool_coins.coins.iter().enumerate() { + assert_eq!(coin.denom, ts.coins[i].0); + assert_eq!(coin.amount, ts.coins[i].1) + } + } +} + +#[test] +fn test_delegations_reconstruct() { + struct TestCase { + staking_params: Params, + delegations: Vec, + validators: Vec, + expected_result: NeutronResult, + } + let test_cases: Vec = vec![ + TestCase { + staking_params: Params { + unbonding_time: None, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "stake".to_string(), + min_commission_rate: "".to_string(), + }, + delegations: vec![Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + shares: "1000000000000000000".to_string(), + }], + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }], + expected_result: Ok(Delegations { + delegations: vec![StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: StdCoin::new(1000000000000000000u128, "stake"), + }], + }), + }, + TestCase { + staking_params: Params { + unbonding_time: None, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "stake".to_string(), + min_commission_rate: "".to_string(), + }, + delegations: vec![ + Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + shares: "1000000000000000000".to_string(), + }, + Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" + .to_string(), + shares: "1000000000000000000".to_string(), + }, + ], + validators: vec![ + Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3" + .to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + Validator { + operator_address: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we" + .to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "1000000000000000000".to_string(), + delegator_shares: "1000000000000000000".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }, + ], + expected_result: Ok(Delegations { + delegations: vec![ + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: StdCoin::new(1000000000000000000u128, "stake"), + }, + StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1lzhlnpahvznwfv4jmay2tgaha5kmz5qxwmj9we".to_string(), + amount: StdCoin::new(1000000000000000000u128, "stake"), + }, + ], + }), + }, + TestCase { + staking_params: Params { + unbonding_time: None, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "stake".to_string(), + min_commission_rate: "".to_string(), + }, + delegations: vec![], + validators: vec![], + expected_result: Ok(Delegations { + delegations: vec![], + }), + }, + TestCase { + staking_params: Default::default(), + delegations: vec![], + validators: vec![], + expected_result: Err(NeutronError::InvalidQueryResultFormat( + "params is empty".into(), + )), + }, + TestCase { + staking_params: Params { + unbonding_time: None, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "stake".to_string(), + min_commission_rate: "".to_string(), + }, + delegations: vec![Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + shares: "1000000000000000000".to_string(), + }], + validators: vec![], + expected_result: Err(NeutronError::InvalidQueryResultFormat( + "validator is empty".into(), + )), + }, + ]; + + for ts in &test_cases { + // prepare storage values + let mut st_values: Vec = vec![StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: vec![STAKING_PARAMS_KEY], + value: { + if ts.staking_params.bond_denom.is_empty() { + return Default::default(); + } + ts.staking_params.encode_to_vec() + }, + proof: None, + }]; + + for (i, d) in ts.delegations.iter().enumerate() { + let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); + let val_addr = decode_and_convert(&d.validator_address).unwrap(); + + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_delegation_key(&delegator_addr, &val_addr).unwrap(), + value: d.encode_to_vec(), + proof: None, + }); + + if let Some(v) = ts.validators.get(i) { + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_validator_key(&val_addr).unwrap(), + value: v.encode_to_vec(), + proof: None, + }); + } + } + + // test reconstruction + let delegations = Delegations::reconstruct(&st_values); + + assert_eq!(delegations, ts.expected_result) + } +} + +#[test] +fn test_balance_reconstruct_from_hex() { + let bytes = hex::decode(BALANCES_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: create_account_denom_balance_key("addr", "uatom").unwrap(), + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let bank_balances = Balances::reconstruct(&[s]).unwrap(); + assert_eq!( + bank_balances, + Balances { + coins: vec![StdCoin::new(494213561u128, "uatom")] + } + ); +} + +#[test] +fn test_balance_reconstruct_from_empty_value() { + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: create_account_denom_balance_key("addr", "uatom").unwrap(), + value: vec![], + proof: None, + }; + let bank_balances = Balances::reconstruct(&[s]).unwrap(); + assert_eq!( + bank_balances, + Balances { + coins: vec![StdCoin::new(0u128, "uatom")] + } + ); +} + +#[test] +fn test_bank_total_supply_reconstruct_from_hex() { + let bytes = hex::decode(TOTAL_SUPPLY_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: create_total_denom_key("stake").unwrap(), + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let total_supply = TotalSupply::reconstruct(&[s]).unwrap(); + assert_eq!( + total_supply, + TotalSupply { + coins: vec![StdCoin { + denom: String::from("stake"), + amount: Uint128::from(1644171988905769u64), // mutating + }] + } + ); +} + +#[test] +fn test_delegations_reconstruct_overflow() { + struct TestCase { + staking_params: Params, + delegations: Vec, + validators: Vec, + expected_result: NeutronResult, + } + let test_cases: Vec = vec![TestCase { + staking_params: Params { + unbonding_time: None, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "stake".to_string(), + min_commission_rate: "".to_string(), + }, + delegations: vec![Delegation { + delegator_address: "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + validator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + shares: "340282366920938463463".to_string(), + }], + validators: vec![Validator { + operator_address: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + consensus_pubkey: None, + jailed: false, + status: 0, + tokens: "340282366920938463463".to_string(), + delegator_shares: "340282366920938463463".to_string(), + description: None, + unbonding_height: 0, + unbonding_time: None, + commission: None, + min_self_delegation: "".to_string(), + }], + expected_result: Ok(Delegations { + delegations: vec![StdDelegation { + delegator: Addr::unchecked("osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs"), + validator: "osmovaloper1r2u5q6t6w0wssrk6l66n3t2q3dw2uqny4gj2e3".to_string(), + amount: StdCoin::new(340282366920938463463u128, "stake"), + }], + }), + }]; + + for ts in &test_cases { + // prepare storage values + let mut st_values: Vec = vec![StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_params_store_key(STAKING_STORE_KEY, KEY_BOND_DENOM), + value: { + if ts.staking_params.bond_denom.is_empty() { + return Default::default(); + } + ts.staking_params.encode_to_vec() + }, + proof: None, + }]; + + for (i, d) in ts.delegations.iter().enumerate() { + let delegator_addr = decode_and_convert(&d.delegator_address).unwrap(); + let val_addr = decode_and_convert(&d.validator_address).unwrap(); + + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_delegation_key(&delegator_addr, &val_addr).unwrap(), + value: d.encode_to_vec(), + proof: None, + }); + + if let Some(v) = ts.validators.get(i) { + st_values.push(StorageValue { + storage_prefix: STAKING_STORE_KEY.to_string(), + key: create_validator_key(&val_addr).unwrap(), + value: v.encode_to_vec(), + proof: None, + }); + } + } + + // test reconstruction + let delegations = Delegations::reconstruct(&st_values); + + assert_eq!(delegations, ts.expected_result) + } +} + +#[test] +fn test_staking_validators_reconstruct_from_hex() { + let bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let staking_validator = StakingValidator::reconstruct(&[s]).unwrap(); + assert_eq!( + staking_validator, + StakingValidator { + validators: vec![ContractValidator { + operator_address: String::from( + "cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a" // mutating + ), + consensus_pubkey: Some(vec![ + 10, 32, 218, 63, 141, 144, 164, 7, 3, 27, 183, 234, 247, 110, 203, 91, 3, 28, + 150, 72, 121, 152, 226, 238, 124, 103, 153, 82, 34, 206, 253, 59, 50, 145, + ]), + jailed: false, + status: 3, + tokens: String::from("250028274052364"), + delegator_shares: String::from("250028274052364000000000000000000"), + moniker: Some(String::from("earth 🌎")), + identity: Some(String::from("Coinbase Custody")), + website: Some(String::from("hypha.coop")), + security_contact: Some(String::from("")), + details: Some(String::from("A testnet validator")), + unbonding_height: 1841908u64, + unbonding_time: Some(1590982547u64), + rate: Some(Decimal::from_str("0.200000000000000000").unwrap()), + max_rate: Some(Decimal::from_str("1.00000000000000000").unwrap()), + max_change_rate: Some(Decimal::from_str("1.000000000000000000").unwrap()), + update_time: Some(1580862591u64), // mutating + min_self_delegation: Decimal::from_str("1000000").unwrap(), + }] + } + ); +} + +#[test] +fn test_validators_signing_infos_reconstruct_from_hex() { + let bytes = hex::decode(VALIDATOR_SIGNING_INFO_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let signing_info = SigningInfo::reconstruct(&[s]).unwrap(); + assert_eq!( + signing_info, + SigningInfo { + signing_infos: vec![ValidatorSigningInfo { + address: "cosmosvalcons19f53fqq28v6pmz877dne75d4d7l0r65d2750pw".to_string(), + start_height: 0, + index_offset: 16, + jailed_until: Some(0), + tombstoned: false, + missed_blocks_counter: 0, + }] + } + ); +} + +#[test] +fn test_government_proposals_reconstruct_from_hex() { + let bytes = hex::decode(GOV_PROPOSAL_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let proposals = GovernmentProposal::reconstruct(&[s]).unwrap(); + assert_eq!( + proposals, + GovernmentProposal { + proposals: vec![Proposal { + proposal_id: 1u64, + proposal_type: Some(String::from("/cosmos.gov.v1.MsgExecLegacyContent")), + total_deposit: vec![StdCoin { + denom: String::from("uatom"), + amount: Uint128::from(512100000u64), + }], + status: 3i32, + submit_time: Some(1553064087u64), // mutating + deposit_end_time: Some(1554273687u64), // mutating + voting_start_time: Some(1553114639u64), // 0001-01-01T00:00:00Z + voting_end_time: Some(1554324239u64), // 0001-01-01T00:00:00Z + final_tally_result: Some(TallyResult { + yes: Uint128::from(97118903526799u128), + no: Uint128::from(320545400000u128), + abstain: Uint128::from(402380577234u128), + no_with_veto: Uint128::zero(), + }), + }] + } + ); +} + +#[test] +fn test_fee_pool_reconstruct_from_hex() { + let bytes = hex::decode(FEE_POOL_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let base64_input = BASE64_STANDARD.encode(bytes); // encode bytes to base64 string + + let s = StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), + proof: None, + }; + let fee_pool = FeePool::reconstruct(&[s]).unwrap(); + assert_eq!( + fee_pool, + FeePool { + coins: vec![ + StdCoin { + denom: String::from( + "ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66" + ), + amount: Uint128::from(444252217u64), // mutating + }, + StdCoin { + denom: String::from( + "ibc/14F9BC3E44B8A9C1BE1FB08980FAB87034C9905EF17CF2F5008FC085218811CC" + ), + amount: Uint128::from(189753432u64), // mutating + }, + StdCoin { + denom: String::from( + "ibc/1FBDD58D438B4D04D26CBFB2E722C18984A0F1A52468C4F42F37D102F3D3F399" + ), + amount: Uint128::from(25455348u64), // mutating + }, + StdCoin { + denom: String::from( + "ibc/2181AAB0218EAC24BC9F86BD1364FBBFA3E6E3FCC25E88E3E68C15DC6E752D86" + ), + amount: Uint128::from(89764472u64), // mutating + }, + StdCoin { + denom: String::from( + "ibc/2717109A95559F3A17EFC0C897B7691E22A227B30FC3C5CE7A7CE88481629704" + ), + amount: Uint128::from(9000u64), // mutating + }, + StdCoin { + denom: String::from( + "ibc/42E47A5BA708EBE6E0C227006254F2784E209F4DBD3C6BB77EDC4B29EF875E8E" + ), + amount: Uint128::from(2325668920u64), // mutating + }, + StdCoin { + denom: String::from( + "ibc/81D08BC39FB520EBD948CF017910DD69702D34BF5AC160F76D3B5CFC444EBCE0" + ), + amount: Uint128::from(33639955u64), // mutating + }, + StdCoin { + denom: String::from("theta"), + amount: Uint128::from(1u64), // mutating + }, + StdCoin { + denom: String::from("uatom"), + amount: Uint128::from(13538430938055u64), // mutating + }, + ] + } + ); +} + +#[test] +fn test_delegations_reconstruct_from_hex() { + let staking_params_bytes = hex::decode(STAKING_PARAMS_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let staking_params_base64_input = BASE64_STANDARD.encode(staking_params_bytes); // encode bytes to base64 string + let staking_validator_bytes = hex::decode(STAKING_VALIDATOR_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let staking_validator_base64_input = BASE64_STANDARD.encode(staking_validator_bytes); // encode bytes to base64 string + let delegation_bytes = hex::decode(DELEGATOR_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let delegation_base64_input = BASE64_STANDARD.encode(delegation_bytes); // encode bytes to base64 string + + let mut st_values: Vec = vec![StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_params_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }]; + st_values.push(StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(delegation_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }); + st_values.push(StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }); + + let delegations = Delegations::reconstruct(&st_values).unwrap(); + assert_eq!( + delegations, + Delegations { + delegations: vec![StdDelegation { + delegator: Addr::unchecked("cosmos1pmjwm0a8pvs2m8pauyg2ruldy8ney4qn8zgd96"), // mutating + validator: String::from("cosmosvaloper10v6wvdenee8r9l6wlsphcgur2ltl8ztkfrvj9a"), // mutating + amount: StdCoin { + denom: String::from("uatom"), + amount: Uint128::from(5000u64), + }, + }], + } + ); +} + +#[test] +fn test_unbonding_delegations_reconstruct_from_hex() { + let unbonding_delegations_bytes = + hex::decode(DELEGATOR_UNBONDING_DELEGATIONS_HEX_RESPONSE).unwrap(); // decode hex string to bytes + let unbonding_delegations_base64_input = BASE64_STANDARD.encode(unbonding_delegations_bytes); // encode bytes to base64 string + + let st_values: Vec = vec![StorageValue { + storage_prefix: String::default(), // not used in reconstruct + key: vec![], // not used in reconstruct + value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap().to_vec(), + proof: None, + }]; + + let unbonding_delegations = UnbondingDelegations::reconstruct(&st_values).unwrap(); + assert_eq!( + unbonding_delegations, + UnbondingDelegations { + unbonding_responses: vec![UnbondingResponse { + delegator_address: Addr::unchecked("cosmos1m9l358xunhhwds0568za49mzhvuxx9uxre5tud"), + validator_address: String::from( + "cosmosvaloper18hl5c9xn5dze2g50uaw0l2mr02ew57zk0auktn" + ), + entries: vec![ + UnbondingEntry { + balance: Uint128::new(10_000), + completion_time: Some(Timestamp::from_nanos(1704872890570185206)), + creation_height: 365, + initial_balance: Uint128::new(10_000), + }, + UnbondingEntry { + balance: Uint128::new(20_000), + completion_time: Some(Timestamp::from_nanos(1704872903002248037)), + creation_height: 377, + initial_balance: Uint128::new(20_000), + }, + ], + }] + } + ); +} From 599d9ad8186c596ce7daf1ea590647ac32faac97 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 16 Oct 2024 17:25:17 +0400 Subject: [PATCH 23/35] cargo fmt --- .../src/testing/mock_querier.rs | 4 +-- .../src/testing/tests.rs | 22 +++--------- .../src/interchain_queries/v045/testing.rs | 36 +++++++++++-------- .../src/interchain_queries/v047/testing.rs | 34 +++++++++++------- 4 files changed, 49 insertions(+), 47 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs index d73b8bcc..df7e36a3 100644 --- a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs +++ b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs @@ -1,7 +1,7 @@ use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage}; use cosmwasm_std::{ - from_json, Binary, Coin, ContractResult, CustomQuery, GrpcQuery, OwnedDeps, - Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, + from_json, Binary, Coin, ContractResult, CustomQuery, GrpcQuery, OwnedDeps, Querier, + QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, }; use neutron_std::types::neutron::interchainqueries::{ QueryRegisteredQueryRequest, QueryRegisteredQueryResultRequest, diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 7ad0536e..b03579f8 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -17,8 +17,7 @@ use cosmos_sdk_proto::traits::Message; use cosmos_sdk_proto::Any; use cosmwasm_std::testing::{message_info, mock_env, MockApi, MockStorage}; use cosmwasm_std::{ - from_json, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, - Uint128, + from_json, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, Uint128, }; use neutron_sdk::interchain_queries::helpers::{decode_and_convert, kv_key_from_string}; use neutron_sdk::interchain_queries::types::{ @@ -127,7 +126,7 @@ fn build_interchain_query_distribution_fee_pool_response(denom: String, amount: height: 123456, revision: 2, allow_kv_callbacks: false, - }) + }), }); Binary::from(res.as_slice()) } @@ -1097,13 +1096,7 @@ fn test_sudo_tx_query_result_min_height_callback() { // simulate neutron's SudoTxQueryResult call with the following payload: // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to another addr of 10000 stake let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xNHV4dnUyMmxocmF6eXhhZGFxdjVkNmxzd3UwcDI3NmxsN2hya2waDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkBEv2CW/0gIrankNl4aGs9LXy2BKA6kAWyl4MUxmXnbnjRpgaNbQIyo4i7nUgVsuOpqzAdudM2M53OSU0Dmo5tF").unwrap()); - let res = sudo_tx_query_result( - deps.as_mut(), - env.clone(), - query_id, - height.clone(), - data, - ); + let res = sudo_tx_query_result(deps.as_mut(), env.clone(), query_id, height.clone(), data); // ensure the callback has returned an error and contract's state hasn't changed assert_eq!( @@ -1126,14 +1119,7 @@ fn test_sudo_tx_query_result_min_height_callback() { // simulate neutron's SudoTxQueryResult call with the following payload: // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); - sudo_tx_query_result( - deps.as_mut(), - env, - query_id, - height, - data, - ) - .unwrap(); + sudo_tx_query_result(deps.as_mut(), env, query_id, height, data).unwrap(); // ensure the callback has worked and contract's state has changed again let txs = RECIPIENT_TXS.load(&deps.storage, &watched_addr).unwrap(); diff --git a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs index 847c26df..b7458c10 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/testing.rs @@ -29,9 +29,9 @@ use cosmos_sdk_proto::cosmos::staking::v1beta1::{ use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{to_json_binary, Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; use hex; +use neutron_std::types::neutron::interchainqueries::StorageValue; use std::ops::Mul; use std::str::FromStr; -use neutron_std::types::neutron::interchainqueries::StorageValue; // raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. pub const BALANCES_HEX_RESPONSE: &str = "0a057374616b6512083939393939303030"; @@ -1088,7 +1088,7 @@ fn test_staking_validators_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1132,7 +1132,7 @@ fn test_validators_signing_infos_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1159,7 +1159,7 @@ fn test_government_proposals_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1197,7 +1197,7 @@ fn test_proposal_votes_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1224,7 +1224,7 @@ fn test_fee_pool_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1251,20 +1251,26 @@ fn test_delegations_reconstruct_from_hex() { let mut st_values: Vec = vec![StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(staking_denom_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_denom_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }]; st_values.push(StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(delegation_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(delegation_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }); st_values.push(StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_validator_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }); @@ -1292,8 +1298,10 @@ fn test_unbonding_delegations_reconstruct_from_hex() { let st_values: Vec = vec![StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(unbonding_delegations_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }]; diff --git a/packages/neutron-sdk/src/interchain_queries/v047/testing.rs b/packages/neutron-sdk/src/interchain_queries/v047/testing.rs index dd99f20c..ac49f264 100644 --- a/packages/neutron-sdk/src/interchain_queries/v047/testing.rs +++ b/packages/neutron-sdk/src/interchain_queries/v047/testing.rs @@ -28,9 +28,9 @@ use cosmos_sdk_proto::cosmos::staking::v1beta1::{ use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{Addr, Binary, Coin as StdCoin, Decimal, Timestamp, Uint128}; use hex; +use neutron_std::types::neutron::interchainqueries::StorageValue; use std::ops::Mul; use std::str::FromStr; -use neutron_std::types::neutron::interchainqueries::StorageValue; // raw hex data from KV storage created using https://github.com/neutron-org/icq-compliance-officer. pub const BALANCES_HEX_RESPONSE: &str = "343934323133353631"; @@ -1088,7 +1088,7 @@ fn test_staking_validators_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1132,7 +1132,7 @@ fn test_validators_signing_infos_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1159,7 +1159,7 @@ fn test_government_proposals_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1197,7 +1197,7 @@ fn test_fee_pool_reconstruct_from_hex() { let s = StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct + key: vec![], // not used in reconstruct value: Binary::from_base64(base64_input.as_str()).unwrap().to_vec(), proof: None, }; @@ -1272,20 +1272,26 @@ fn test_delegations_reconstruct_from_hex() { let mut st_values: Vec = vec![StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(staking_params_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_params_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }]; st_values.push(StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(delegation_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(delegation_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }); st_values.push(StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(staking_validator_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(staking_validator_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }); @@ -1313,8 +1319,10 @@ fn test_unbonding_delegations_reconstruct_from_hex() { let st_values: Vec = vec![StorageValue { storage_prefix: String::default(), // not used in reconstruct - key: vec![], // not used in reconstruct - value: Binary::from_base64(unbonding_delegations_base64_input.as_str()).unwrap().to_vec(), + key: vec![], // not used in reconstruct + value: Binary::from_base64(unbonding_delegations_base64_input.as_str()) + .unwrap() + .to_vec(), proof: None, }]; From 741b9784c9b8e7e40300fc9af91403f8caca3f7c Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 16 Oct 2024 17:29:02 +0400 Subject: [PATCH 24/35] fix make schema --- .../schema/execute_msg.json | 36 +- .../schema/execute_msg.json | 40 +- ...y_interchain_account_address_response.json | 15 - .../schema/sudo_msg.json | 9 +- packages/neutron-sdk/.cargo/config | 2 +- packages/neutron-sdk/schema/neutron_msg.json | 572 ++++++++++++++++++ .../neutron-sdk/src/bin/neutron_sdk_schema.rs | 15 + 7 files changed, 636 insertions(+), 53 deletions(-) delete mode 100644 contracts/neutron_interchain_txs/schema/query_interchain_account_address_response.json create mode 100644 packages/neutron-sdk/schema/neutron_msg.json create mode 100644 packages/neutron-sdk/src/bin/neutron_sdk_schema.rs diff --git a/contracts/neutron_interchain_queries/schema/execute_msg.json b/contracts/neutron_interchain_queries/schema/execute_msg.json index 79bf097d..ddfbb1e8 100644 --- a/contracts/neutron_interchain_queries/schema/execute_msg.json +++ b/contracts/neutron_interchain_queries/schema/execute_msg.json @@ -364,16 +364,15 @@ "update_interchain_query": { "type": "object", "required": [ + "new_keys", + "new_update_period", "query_id" ], "properties": { "new_keys": { - "type": [ - "array", - "null" - ], + "type": "array", "items": { - "$ref": "#/definitions/KVKey" + "$ref": "#/definitions/KvKey" } }, "new_recipient": { @@ -383,10 +382,7 @@ ] }, "new_update_period": { - "type": [ - "integer", - "null" - ], + "type": "integer", "format": "uint64", "minimum": 0.0 }, @@ -426,12 +422,7 @@ } ], "definitions": { - "Binary": { - "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", - "type": "string" - }, - "KVKey": { - "description": "Describes a KV key for which you want to get value from the storage on remote chain", + "KvKey": { "type": "object", "required": [ "key", @@ -439,15 +430,16 @@ ], "properties": { "key": { - "description": "*key** is a key you want to read from the storage", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] + "description": "Key you want to read from the storage", + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } }, "path": { - "description": "*path** is a path to the storage (storage prefix) where you want to read value by key (usually name of cosmos-packages module: 'staking', 'bank', etc.)", + "description": "Path (storage prefix) to the storage where you want to read value by key (usually name of cosmos-sdk module: 'staking', 'bank', etc.)", "type": "string" } }, diff --git a/contracts/neutron_interchain_txs/schema/execute_msg.json b/contracts/neutron_interchain_txs/schema/execute_msg.json index 62b9e3f1..4deb3bec 100644 --- a/contracts/neutron_interchain_txs/schema/execute_msg.json +++ b/contracts/neutron_interchain_txs/schema/execute_msg.json @@ -25,7 +25,7 @@ "ordering": { "anyOf": [ { - "$ref": "#/definitions/ChannelOrdering" + "$ref": "#/definitions/Order" }, { "type": "null" @@ -132,14 +132,8 @@ } ], "definitions": { - "ChannelOrdering": { - "type": "string", - "enum": [ - "ORDER_ORDERED", - "ORDER_UNORDERED" - ] - }, "Coin": { + "description": "Coin defines a token with a denomination and an amount.\n\nNOTE: The amount field is an Int which implements the custom method signatures required by gogoproto.", "type": "object", "required": [ "amount", @@ -147,7 +141,7 @@ ], "properties": { "amount": { - "$ref": "#/definitions/Uint128" + "type": "string" }, "denom": { "type": "string" @@ -155,9 +149,31 @@ }, "additionalProperties": false }, - "Uint128": { - "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", - "type": "string" + "Order": { + "description": "Order defines if a channel is ORDERED or UNORDERED", + "oneOf": [ + { + "description": "zero-value for channel ordering", + "type": "string", + "enum": [ + "NoneUnspecified" + ] + }, + { + "description": "packets can be delivered in any order, which may differ from the order in which they were sent.", + "type": "string", + "enum": [ + "Unordered" + ] + }, + { + "description": "packets are delivered exactly in the order which they were sent", + "type": "string", + "enum": [ + "Ordered" + ] + } + ] } } } diff --git a/contracts/neutron_interchain_txs/schema/query_interchain_account_address_response.json b/contracts/neutron_interchain_txs/schema/query_interchain_account_address_response.json deleted file mode 100644 index d1314a50..00000000 --- a/contracts/neutron_interchain_txs/schema/query_interchain_account_address_response.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "QueryInterchainAccountAddressResponse", - "type": "object", - "required": [ - "interchain_account_address" - ], - "properties": { - "interchain_account_address": { - "description": "*interchain_account_address** is a interchain account address on the remote chain", - "type": "string" - } - }, - "additionalProperties": false -} diff --git a/contracts/neutron_interchain_txs/schema/sudo_msg.json b/contracts/neutron_interchain_txs/schema/sudo_msg.json index de8ad101..da97da08 100644 --- a/contracts/neutron_interchain_txs/schema/sudo_msg.json +++ b/contracts/neutron_interchain_txs/schema/sudo_msg.json @@ -167,18 +167,21 @@ "type": "string" }, "Height": { + "description": "Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients\n\nNormally the RevisionHeight is incremented at each height while keeping RevisionNumber the same. However some consensus algorithms may choose to reset the height in certain conditions e.g. hard forks, state-machine breaking changes In these cases, the RevisionNumber is incremented so that height continues to be monitonically increasing even as the RevisionHeight gets reset", "type": "object", + "required": [ + "revision_height", + "revision_number" + ], "properties": { "revision_height": { - "description": "*height** is a height of remote chain", - "default": 0, + "description": "the height within the given revision", "type": "integer", "format": "uint64", "minimum": 0.0 }, "revision_number": { "description": "the revision that the client is currently on", - "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 diff --git a/packages/neutron-sdk/.cargo/config b/packages/neutron-sdk/.cargo/config index 7900d0f6..84337708 100644 --- a/packages/neutron-sdk/.cargo/config +++ b/packages/neutron-sdk/.cargo/config @@ -2,4 +2,4 @@ wasm = "build --release --target wasm32-unknown-unknown" wasm-debug = "build --target wasm32-unknown-unknown" unit-test = "test --lib" -schema = "run --bin neutron-sdk-schema" \ No newline at end of file +schema = "run --bin neutron_sdk_schema" \ No newline at end of file diff --git a/packages/neutron-sdk/schema/neutron_msg.json b/packages/neutron-sdk/schema/neutron_msg.json new file mode 100644 index 00000000..c505d8f6 --- /dev/null +++ b/packages/neutron-sdk/schema/neutron_msg.json @@ -0,0 +1,572 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NeutronMsg", + "description": "A number of Custom messages that can call into the Neutron bindings.", + "deprecated": true, + "oneOf": [ + { + "description": "SubmitAdminProposal sends a proposal to neutron's Admin module. This type of messages can be only executed by Neutron DAO.", + "type": "object", + "required": [ + "submit_admin_proposal" + ], + "properties": { + "submit_admin_proposal": { + "type": "object", + "required": [ + "admin_proposal" + ], + "properties": { + "admin_proposal": { + "$ref": "#/definitions/AdminProposal" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ], + "definitions": { + "AdminProposal": { + "description": "AdminProposal defines the struct for various proposals which Neutron's Admin Module may accept.", + "oneOf": [ + { + "description": "Proposal to change params. Note that this works for old params. New params has their own `MsgUpdateParams` msgs that can be supplied to `ProposalExecuteMessage`", + "type": "object", + "required": [ + "param_change_proposal" + ], + "properties": { + "param_change_proposal": { + "$ref": "#/definitions/ParamChangeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to upgrade IBC client", + "deprecated": true, + "type": "object", + "required": [ + "upgrade_proposal" + ], + "properties": { + "upgrade_proposal": { + "$ref": "#/definitions/UpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to update IBC client", + "deprecated": true, + "type": "object", + "required": [ + "client_update_proposal" + ], + "properties": { + "client_update_proposal": { + "$ref": "#/definitions/ClientUpdateProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Proposal to execute CosmosMsg.", + "type": "object", + "required": [ + "proposal_execute_message" + ], + "properties": { + "proposal_execute_message": { + "$ref": "#/definitions/ProposalExecuteMessage" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to upgrade network", + "deprecated": true, + "type": "object", + "required": [ + "software_upgrade_proposal" + ], + "properties": { + "software_upgrade_proposal": { + "$ref": "#/definitions/SoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to cancel existing software upgrade", + "deprecated": true, + "type": "object", + "required": [ + "cancel_software_upgrade_proposal" + ], + "properties": { + "cancel_software_upgrade_proposal": { + "$ref": "#/definitions/CancelSoftwareUpgradeProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Will fail to execute if you use it. Deprecated. Proposal to pin wasm contract codes", + "deprecated": true, + "type": "object", + "required": [ + "pin_codes_proposal" + ], + "properties": { + "pin_codes_proposal": { + "$ref": "#/definitions/PinCodesProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Deprecated. Proposal to unpin wasm contract codes.", + "deprecated": true, + "type": "object", + "required": [ + "unpin_codes_proposal" + ], + "properties": { + "unpin_codes_proposal": { + "$ref": "#/definitions/UnpinCodesProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to call sudo on contract.", + "deprecated": true, + "type": "object", + "required": [ + "sudo_contract_proposal" + ], + "properties": { + "sudo_contract_proposal": { + "$ref": "#/definitions/SudoContractProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to update contract admin.", + "deprecated": true, + "type": "object", + "required": [ + "update_admin_proposal" + ], + "properties": { + "update_admin_proposal": { + "$ref": "#/definitions/UpdateAdminProposal" + } + }, + "additionalProperties": false + }, + { + "description": "Deprecated. Proposal to clear contract admin.", + "deprecated": true, + "type": "object", + "required": [ + "clear_admin_proposal" + ], + "properties": { + "clear_admin_proposal": { + "$ref": "#/definitions/ClearAdminProposal" + } + }, + "additionalProperties": false + } + ] + }, + "Any": { + "type": "object", + "required": [ + "type_url", + "value" + ], + "properties": { + "type_url": { + "description": "A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a \\[google.protobuf.Type][\\] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.)\n\nNote: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com.\n\nSchemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.", + "type": "string" + }, + "value": { + "description": "Must be a valid serialized protocol buffer of the above specified type.", + "type": "array", + "items": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "additionalProperties": false + }, + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec. See also .", + "type": "string" + }, + "CancelSoftwareUpgradeProposal": { + "description": "Deprecated. CancelSoftwareUpgradeProposal defines the struct for cancel software upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + }, + "additionalProperties": false + }, + "ClearAdminProposal": { + "description": "Deprecated. SudoContractProposal defines the struct for clear admin proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract admin will be removed.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + }, + "additionalProperties": false + }, + "ClientUpdateProposal": { + "description": "ClientUpdateProposal defines the struct for client update proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "subject_client_id", + "substitute_client_id", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "subject_client_id": { + "description": "*subject_client_id** is a subject client id.", + "type": "string" + }, + "substitute_client_id": { + "description": "*substitute_client_id** is a substitute client id.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + }, + "additionalProperties": false + }, + "ParamChange": { + "description": "ParamChange defines the struct for parameter change request.", + "type": "object", + "required": [ + "key", + "subspace", + "value" + ], + "properties": { + "key": { + "description": "*key** is a name of parameter. Unique for subspace.", + "type": "string" + }, + "subspace": { + "description": "*subspace** is a key of module to which the parameter to change belongs. Unique for each module.", + "type": "string" + }, + "value": { + "description": "*value** is a new value for given parameter. Non unique.", + "type": "string" + } + }, + "additionalProperties": false + }, + "ParamChangeProposal": { + "description": "ParamChangeProposal defines the struct for single parameter change proposal.", + "type": "object", + "required": [ + "description", + "param_changes", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "param_changes": { + "description": "*param_changes** is a vector of params to be changed. Non unique.", + "type": "array", + "items": { + "$ref": "#/definitions/ParamChange" + } + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + }, + "additionalProperties": false + }, + "PinCodesProposal": { + "description": "Deprecated. PinCodesProposal defines the struct for pin contract codes proposal.", + "deprecated": true, + "type": "object", + "required": [ + "code_ids", + "description", + "title" + ], + "properties": { + "code_ids": { + "description": "*code_ids** is an array of codes to be pined.", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + }, + "additionalProperties": false + }, + "Plan": { + "description": "Plan defines the struct for planned upgrade.", + "type": "object", + "required": [ + "height", + "info", + "name" + ], + "properties": { + "height": { + "description": "*height** is a height at which the upgrade must be performed", + "type": "integer", + "format": "int64" + }, + "info": { + "description": "*info** is any application specific upgrade info to be included on-chain", + "type": "string" + }, + "name": { + "description": "*name** is a name for the upgrade", + "type": "string" + } + }, + "additionalProperties": false + }, + "ProposalExecuteMessage": { + "description": "ProposalExecuteMessage defines the struct for sdk47 compatible admin proposal.", + "type": "object", + "required": [ + "message" + ], + "properties": { + "message": { + "description": "*message** is a json representing an sdk message passed to admin module to execute.", + "type": "string" + } + }, + "additionalProperties": false + }, + "SoftwareUpgradeProposal": { + "description": "Deprecated. SoftwareUpgradeProposal defines the struct for software upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "plan", + "title" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal. Non unique.", + "type": "string" + }, + "plan": { + "description": "*plan** is a plan of upgrade.", + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal. Non unique.", + "type": "string" + } + }, + "additionalProperties": false + }, + "SudoContractProposal": { + "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "msg", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract to be executed.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "msg": { + "description": "**msg*** is a sudo message.", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + }, + "additionalProperties": false + }, + "UnpinCodesProposal": { + "description": "Deprecated. UnpinCodesProposal defines the struct for unpin contract codes proposal.", + "deprecated": true, + "type": "object", + "required": [ + "code_ids", + "description", + "title" + ], + "properties": { + "code_ids": { + "description": "*code_ids** is an array of codes to be unpined.", + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + }, + "additionalProperties": false + }, + "UpdateAdminProposal": { + "description": "Deprecated. UpdateAdminProposal defines the struct for update admin proposal.", + "deprecated": true, + "type": "object", + "required": [ + "contract", + "description", + "new_admin", + "title" + ], + "properties": { + "contract": { + "description": "*contract** is an address of contract to update admin.", + "type": "string" + }, + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "new_admin": { + "description": "**new_admin*** is an address of new admin", + "type": "string" + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + } + }, + "additionalProperties": false + }, + "UpgradeProposal": { + "description": "UpgradeProposal defines the struct for IBC upgrade proposal.", + "deprecated": true, + "type": "object", + "required": [ + "description", + "plan", + "title", + "upgraded_client_state" + ], + "properties": { + "description": { + "description": "*description** is a text description of proposal.", + "type": "string" + }, + "plan": { + "description": "*plan** is a plan of upgrade.", + "allOf": [ + { + "$ref": "#/definitions/Plan" + } + ] + }, + "title": { + "description": "*title** is a text title of proposal.", + "type": "string" + }, + "upgraded_client_state": { + "description": "*upgraded_client_state** is an upgraded client state.", + "allOf": [ + { + "$ref": "#/definitions/Any" + } + ] + } + }, + "additionalProperties": false + } + } +} diff --git a/packages/neutron-sdk/src/bin/neutron_sdk_schema.rs b/packages/neutron-sdk/src/bin/neutron_sdk_schema.rs new file mode 100644 index 00000000..97d80670 --- /dev/null +++ b/packages/neutron-sdk/src/bin/neutron_sdk_schema.rs @@ -0,0 +1,15 @@ +use std::env::current_dir; +use std::fs::create_dir_all; + +use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; +#[allow(deprecated)] +use neutron_sdk::bindings::msg::NeutronMsg; + +fn main() { + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); + #[allow(deprecated)] + export_schema(&schema_for!(NeutronMsg), &out_dir); +} From 08b4e767a8147edf1f80d00d7d49067fae538103 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 16 Oct 2024 17:46:09 +0400 Subject: [PATCH 25/35] fix build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 533cadb0..759e3f27 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,6 @@ compile: check_contracts: @cargo install cosmwasm-check - @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron artifacts/*.wasm + @cosmwasm-check --available-capabilities iterator,staking,stargate,neutron,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4,cosmwasm_2_0 artifacts/*.wasm build: schema clippy test fmt doc compile check_contracts From b3095f3719c05268ca796bdcf7b77d3589bab394 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 17 Oct 2024 18:05:23 +0400 Subject: [PATCH 26/35] fix Height deps --- .../neutron_interchain_queries/src/contract.rs | 2 +- packages/neutron-sdk/src/interchain_queries/mod.rs | 1 + packages/neutron-sdk/src/interchain_queries/sudo.rs | 13 +++++++++++++ packages/neutron-sdk/src/sudo/msg.rs | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 packages/neutron-sdk/src/interchain_queries/sudo.rs diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 4805923f..a3c32bbe 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -7,7 +7,6 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; -use neutron_std::types::ibc::core::client::v1::Height; use neutron_std::types::neutron::interchainqueries::{KvKey, RegisteredQuery}; use crate::msg::{ @@ -40,6 +39,7 @@ use neutron_sdk::interchain_queries::{ use neutron_sdk::sudo::msg::SudoMsg; use neutron_sdk::{NeutronError, NeutronResult}; +use neutron_sdk::interchain_queries::sudo::Height; use neutron_sdk::interchain_queries::types::{ QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; diff --git a/packages/neutron-sdk/src/interchain_queries/mod.rs b/packages/neutron-sdk/src/interchain_queries/mod.rs index 1bda93e4..47bf3ce9 100644 --- a/packages/neutron-sdk/src/interchain_queries/mod.rs +++ b/packages/neutron-sdk/src/interchain_queries/mod.rs @@ -1,6 +1,7 @@ pub mod helpers; pub mod hex; pub mod queries; +pub mod sudo; pub mod types; pub mod v045; pub mod v047; diff --git a/packages/neutron-sdk/src/interchain_queries/sudo.rs b/packages/neutron-sdk/src/interchain_queries/sudo.rs new file mode 100644 index 00000000..bc2bf054 --- /dev/null +++ b/packages/neutron-sdk/src/interchain_queries/sudo.rs @@ -0,0 +1,13 @@ +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct Height { + /// the revision that the client is currently on + #[serde(default)] + pub revision_number: u64, + /// **height** is a height of remote chain + #[serde(default)] + pub revision_height: u64, +} diff --git a/packages/neutron-sdk/src/sudo/msg.rs b/packages/neutron-sdk/src/sudo/msg.rs index 03301146..10da2da6 100644 --- a/packages/neutron-sdk/src/sudo/msg.rs +++ b/packages/neutron-sdk/src/sudo/msg.rs @@ -1,5 +1,5 @@ +use crate::interchain_queries::sudo::Height; use cosmwasm_std::Binary; -use neutron_std::types::ibc::core::client::v1::Height; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; From a50c739681a7f1b5bd019e90209c370b4d9b3046 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 18 Oct 2024 14:20:17 +0400 Subject: [PATCH 27/35] fix tests --- .../neutron_interchain_queries/src/testing/tests.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index b03579f8..24d8e34d 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -27,6 +27,7 @@ use neutron_sdk::interchain_queries::v047::helpers::{ create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, create_total_denom_key, create_validator_key, }; +use neutron_sdk::interchain_queries::sudo::Height as SudoHeight; use neutron_sdk::interchain_queries::v047::types::{ Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, @@ -948,7 +949,7 @@ fn test_sudo_tx_query_result_callback() { deps.as_mut(), env.clone(), query_id, - Height { + SudoHeight { revision_number: 0, revision_height: height, }, @@ -975,7 +976,7 @@ fn test_sudo_tx_query_result_callback() { deps.as_mut(), env.clone(), query_id, - Height { + SudoHeight { revision_number: 0, revision_height: height, }, @@ -1007,7 +1008,7 @@ fn test_sudo_tx_query_result_callback() { deps.as_mut(), env, query_id, - Height { + SudoHeight { revision_number: 0, revision_height: height, }, @@ -1042,7 +1043,7 @@ fn test_sudo_tx_query_result_min_height_callback() { let env = mock_env(); let watched_addr: String = "neutron1fj6yqrkpw6fmp7f7jhj57dujfpwal4m25dafzx".to_string(); let query_id: u64 = 1u64; - let height = Height { + let height = SudoHeight { revision_number: 0u64, revision_height: 1u64, }; From b5fa043719e0beb70203808d4019ec6e6a3940ac Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 18 Oct 2024 14:20:45 +0400 Subject: [PATCH 28/35] fmt --- contracts/neutron_interchain_queries/src/testing/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 24d8e34d..75e04054 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -20,6 +20,7 @@ use cosmwasm_std::{ from_json, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, Uint128, }; use neutron_sdk::interchain_queries::helpers::{decode_and_convert, kv_key_from_string}; +use neutron_sdk::interchain_queries::sudo::Height as SudoHeight; use neutron_sdk::interchain_queries::types::{ QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; @@ -27,7 +28,6 @@ use neutron_sdk::interchain_queries::v047::helpers::{ create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, create_total_denom_key, create_validator_key, }; -use neutron_sdk::interchain_queries::sudo::Height as SudoHeight; use neutron_sdk::interchain_queries::v047::types::{ Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, From c0fdaa1dbe82e28d738bf106f2c9acb1e4bd3e71 Mon Sep 17 00:00:00 2001 From: nhpd Date: Fri, 18 Oct 2024 14:49:10 +0400 Subject: [PATCH 29/35] move sudo msg Height to proper location --- .../src/contract.rs | 3 +- .../src/testing/tests.rs | 2 +- .../schema/sudo_msg.json | 10 +- packages/neutron-sdk/Cargo.toml | 1 - packages/neutron-sdk/src/bindings/msg.rs | 2 +- .../neutron-sdk/src/interchain_queries/mod.rs | 1 - .../src/interchain_queries/sudo.rs | 13 - packages/neutron-sdk/src/sudo/msg.rs | 13 +- packages/neutron-std-derive/Cargo.toml | 24 -- packages/neutron-std-derive/src/lib.rs | 227 ------------------ packages/neutron-std-derive/tests/main.rs | 6 - packages/neutron-std-derive/tests/query.rs | 37 --- packages/neutron-std-derive/tests/struct.rs | 32 --- 13 files changed, 19 insertions(+), 352 deletions(-) delete mode 100644 packages/neutron-sdk/src/interchain_queries/sudo.rs delete mode 100644 packages/neutron-std-derive/Cargo.toml delete mode 100644 packages/neutron-std-derive/src/lib.rs delete mode 100644 packages/neutron-std-derive/tests/main.rs delete mode 100644 packages/neutron-std-derive/tests/query.rs delete mode 100644 packages/neutron-std-derive/tests/struct.rs diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index a3c32bbe..ed028e8f 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -36,10 +36,9 @@ use neutron_sdk::interchain_queries::{ types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}, }, }; -use neutron_sdk::sudo::msg::SudoMsg; +use neutron_sdk::sudo::msg::{Height, SudoMsg}; use neutron_sdk::{NeutronError, NeutronResult}; -use neutron_sdk::interchain_queries::sudo::Height; use neutron_sdk::interchain_queries::types::{ QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 75e04054..bc7f348e 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -20,7 +20,6 @@ use cosmwasm_std::{ from_json, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, Uint128, }; use neutron_sdk::interchain_queries::helpers::{decode_and_convert, kv_key_from_string}; -use neutron_sdk::interchain_queries::sudo::Height as SudoHeight; use neutron_sdk::interchain_queries::types::{ QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; @@ -32,6 +31,7 @@ use neutron_sdk::interchain_queries::v047::types::{ Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, StdDelegation, TallyResult, TotalSupply, Validator, ValidatorSigningInfo, RECIPIENT_FIELD, STAKING_PARAMS_KEY, }; +use neutron_sdk::sudo::msg::Height as SudoHeight; use neutron_std::types::cosmos::base::v1beta1::Coin as StdCoin; use neutron_std::types::ibc::core::client::v1::Height; use neutron_std::types::neutron::interchainqueries::{ diff --git a/contracts/neutron_interchain_txs/schema/sudo_msg.json b/contracts/neutron_interchain_txs/schema/sudo_msg.json index da97da08..9c5fab7e 100644 --- a/contracts/neutron_interchain_txs/schema/sudo_msg.json +++ b/contracts/neutron_interchain_txs/schema/sudo_msg.json @@ -167,21 +167,19 @@ "type": "string" }, "Height": { - "description": "Height is a monotonically increasing data type that can be compared against another Height for the purposes of updating and freezing clients\n\nNormally the RevisionHeight is incremented at each height while keeping RevisionNumber the same. However some consensus algorithms may choose to reset the height in certain conditions e.g. hard forks, state-machine breaking changes In these cases, the RevisionNumber is incremented so that height continues to be monitonically increasing even as the RevisionHeight gets reset", + "description": "Height is used for sudo call for `TxQueryResult` enum variant type", "type": "object", - "required": [ - "revision_height", - "revision_number" - ], "properties": { "revision_height": { - "description": "the height within the given revision", + "description": "*height** is a height of remote chain", + "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 }, "revision_number": { "description": "the revision that the client is currently on", + "default": 0, "type": "integer", "format": "uint64", "minimum": 0.0 diff --git a/packages/neutron-sdk/Cargo.toml b/packages/neutron-sdk/Cargo.toml index dc620d12..689f65d7 100644 --- a/packages/neutron-sdk/Cargo.toml +++ b/packages/neutron-sdk/Cargo.toml @@ -26,7 +26,6 @@ tendermint-proto = { workspace = true } speedate = { workspace = true } chrono = { version = "0.4.22", default-features = false } neutron-std = { workspace = true } -neutron-std-derive = { version = "0.20.1", path = "../neutron-std-derive" } [dev-dependencies] base64 = { workspace = true } diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 09297cc2..a92607ab 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -4,7 +4,7 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[deprecated( - note = "Please use neutron-std autogenerated messages instead of wasmbindings", + note = "Please use neutron-std grpc messages instead of wasmbindings", since = "0.12.0" )] #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] diff --git a/packages/neutron-sdk/src/interchain_queries/mod.rs b/packages/neutron-sdk/src/interchain_queries/mod.rs index 47bf3ce9..1bda93e4 100644 --- a/packages/neutron-sdk/src/interchain_queries/mod.rs +++ b/packages/neutron-sdk/src/interchain_queries/mod.rs @@ -1,7 +1,6 @@ pub mod helpers; pub mod hex; pub mod queries; -pub mod sudo; pub mod types; pub mod v045; pub mod v047; diff --git a/packages/neutron-sdk/src/interchain_queries/sudo.rs b/packages/neutron-sdk/src/interchain_queries/sudo.rs deleted file mode 100644 index bc2bf054..00000000 --- a/packages/neutron-sdk/src/interchain_queries/sudo.rs +++ /dev/null @@ -1,13 +0,0 @@ -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub struct Height { - /// the revision that the client is currently on - #[serde(default)] - pub revision_number: u64, - /// **height** is a height of remote chain - #[serde(default)] - pub revision_height: u64, -} diff --git a/packages/neutron-sdk/src/sudo/msg.rs b/packages/neutron-sdk/src/sudo/msg.rs index 10da2da6..073e8dbc 100644 --- a/packages/neutron-sdk/src/sudo/msg.rs +++ b/packages/neutron-sdk/src/sudo/msg.rs @@ -1,4 +1,3 @@ -use crate::interchain_queries::sudo::Height; use cosmwasm_std::Binary; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -70,3 +69,15 @@ pub enum TransferSudoMsg { request: RequestPacket, }, } + +/// Height is used for sudo call for `TxQueryResult` enum variant type +#[derive(Default, Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub struct Height { + /// the revision that the client is currently on + #[serde(default)] + pub revision_number: u64, + /// **height** is a height of remote chain + #[serde(default)] + pub revision_height: u64, +} diff --git a/packages/neutron-std-derive/Cargo.toml b/packages/neutron-std-derive/Cargo.toml deleted file mode 100644 index 081779f1..00000000 --- a/packages/neutron-std-derive/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -description = "Procedural macro for `neutron-std`. This package is a modified copy of the osmosis package - https://github.com/osmosis-labs/osmosis-rust/tree/main/packages/osmosis-std-derive" -edition = "2021" -license = "MIT OR Apache-2.0" -name = "neutron-std-derive" -version = "0.20.1" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -proc-macro = true - -[dependencies] -itertools = "0.10.3" -proc-macro2 = "1.0.40" -prost-types = { workspace = true } -quote = "1.0.20" -syn = "1.0.98" - -[dev-dependencies] -cosmwasm-std = { workspace = true, features = ["cosmwasm_2_0"] } -prost = { workspace = true } -serde = "1.0.142" -trybuild = {version = "1.0.63", features = ["diff"]} diff --git a/packages/neutron-std-derive/src/lib.rs b/packages/neutron-std-derive/src/lib.rs deleted file mode 100644 index 85ab7e26..00000000 --- a/packages/neutron-std-derive/src/lib.rs +++ /dev/null @@ -1,227 +0,0 @@ -use itertools::Itertools; -use proc_macro::TokenStream; -use proc_macro2::TokenTree; -use quote::quote; -use syn::{parse_macro_input, DeriveInput}; - -macro_rules! match_kv_attr { - ($key:expr, $value_type:tt) => { - |tt| { - if let [TokenTree::Ident(key), TokenTree::Punct(eq), TokenTree::$value_type(value)] = - &tt[..] - { - if (key == $key) && (eq.as_char() == '=') { - Some(quote!(#value)) - } else { - None - } - } else { - None - } - } - }; -} - -#[proc_macro_derive(CosmwasmExt, attributes(proto_message, proto_query))] -pub fn derive_cosmwasm_ext(input: TokenStream) -> TokenStream { - let input = parse_macro_input!(input as DeriveInput); - let ident = input.ident; - - let type_url = get_type_url(&input.attrs); - - // `EncodeError` always indicates that a message failed to encode because the - // provided buffer had insufficient capacity. Message encoding is otherwise - // infallible. - - let (query_request_conversion, cosmwasm_query) = if get_attr("proto_query", &input.attrs) - .is_some() - { - let path = get_query_attrs(&input.attrs, match_kv_attr!("path", Literal)); - let res = get_query_attrs(&input.attrs, match_kv_attr!("response_type", Ident)); - - let query_request_conversion = quote! { - impl From<#ident> for cosmwasm_std::QueryRequest { - fn from(msg: #ident) -> Self { - cosmwasm_std::QueryRequest::::Grpc(cosmwasm_std::GrpcQuery { - path: #path.to_string(), - data: msg.into(), - }) - } - } - }; - - let cosmwasm_query = quote! { - pub fn query(self, querier: &cosmwasm_std::QuerierWrapper) -> cosmwasm_std::StdResult<#res> { - use prost::Message; - let resp = #res::decode( - querier.query_grpc( - #path.to_string(), - self.to_proto_bytes().into(), - )? - .as_slice(), - ); - match resp { - Err(e) => Err(cosmwasm_std::StdError::generic_err(format!( - "Can't decode item: {}", - e - ))), - Ok(data) => Ok(data), - } - } - }; - - (query_request_conversion, cosmwasm_query) - } else { - (quote!(), quote!()) - }; - - (quote! { - impl #ident { - pub const TYPE_URL: &'static str = #type_url; - #cosmwasm_query - - pub fn to_proto_bytes(&self) -> Vec { - let mut bytes = Vec::new(); - prost::Message::encode(self, &mut bytes) - .expect("Message encoding must be infallible"); - bytes - } - pub fn to_any(&self) -> crate::shim::Any { - crate::shim::Any { - type_url: Self::TYPE_URL.to_string(), - value: self.to_proto_bytes(), - } - } - } - - #query_request_conversion - - impl From<#ident> for cosmwasm_std::Binary { - fn from(msg: #ident) -> Self { - cosmwasm_std::Binary::new(msg.to_proto_bytes()) - } - } - - impl From<#ident> for cosmwasm_std::CosmosMsg { - fn from(msg: #ident) -> Self { - cosmwasm_std::CosmosMsg::::Any(cosmwasm_std::AnyMsg { - type_url: #type_url.to_string(), - value: msg.into(), - }) - } - } - - impl TryFrom for #ident { - type Error = cosmwasm_std::StdError; - - fn try_from(binary: cosmwasm_std::Binary) -> ::std::result::Result { - use ::prost::Message; - Self::decode(&binary[..]).map_err(|e| { - cosmwasm_std::StdError::parse_err( - stringify!(#ident), - format!( - "Unable to decode binary: \n - base64: {}\n - bytes array: {:?}\n\n{:?}", - binary, - binary.to_vec(), - e - ) - ) - }) - } - } - - impl TryFrom for #ident { - type Error = cosmwasm_std::StdError; - - fn try_from(result: cosmwasm_std::SubMsgResult) -> ::std::result::Result { - result - .into_result() - .map_err(|e| cosmwasm_std::StdError::generic_err(e))? - .data - .ok_or_else(|| cosmwasm_std::StdError::not_found("cosmwasm_std::SubMsgResult::"))? - .try_into() - } - } - }) - .into() -} - -fn get_type_url(attrs: &[syn::Attribute]) -> proc_macro2::TokenStream { - let proto_message = get_attr("proto_message", attrs).and_then(|a| a.parse_meta().ok()); - - if let Some(syn::Meta::List(meta)) = proto_message.clone() { - match meta.nested[0].clone() { - syn::NestedMeta::Meta(syn::Meta::NameValue(meta)) => { - if meta.path.is_ident("type_url") { - match meta.lit { - syn::Lit::Str(s) => quote!(#s), - _ => proto_message_attr_error(meta.lit), - } - } else { - proto_message_attr_error(meta.path) - } - } - t => proto_message_attr_error(t), - } - } else { - proto_message_attr_error(proto_message) - } -} - -fn get_query_attrs(attrs: &[syn::Attribute], f: F) -> proc_macro2::TokenStream -where - F: FnMut(&Vec) -> Option, -{ - let proto_query = get_attr("proto_query", attrs); - - if let Some(attr) = proto_query { - if attr.tokens.clone().into_iter().count() != 1 { - return proto_query_attr_error(proto_query); - } - - if let Some(TokenTree::Group(group)) = attr.tokens.clone().into_iter().next() { - let kv_groups = group.stream().into_iter().group_by(|t| { - if let TokenTree::Punct(punct) = t { - punct.as_char() != ',' - } else { - true - } - }); - let mut key_values: Vec> = vec![]; - - for (non_sep, g) in &kv_groups { - if non_sep { - key_values.push(g.collect()); - } - } - - return key_values - .iter() - .find_map(f) - .unwrap_or_else(|| proto_query_attr_error(proto_query)); - } - - proto_query_attr_error(proto_query) - } else { - proto_query_attr_error(proto_query) - } -} - -fn get_attr<'a>(attr_ident: &str, attrs: &'a [syn::Attribute]) -> Option<&'a syn::Attribute> { - attrs - .iter() - .find(|&attr| attr.path.segments.len() == 1 && attr.path.segments[0].ident == attr_ident) -} - -fn proto_message_attr_error(tokens: T) -> proc_macro2::TokenStream { - syn::Error::new_spanned(tokens, "expected `proto_message(type_url = \"...\")`") - .to_compile_error() -} - -fn proto_query_attr_error(tokens: T) -> proc_macro2::TokenStream { - syn::Error::new_spanned( - tokens, - "expected `proto_query(path = \"...\", response_type = ...)`", - ) - .to_compile_error() -} diff --git a/packages/neutron-std-derive/tests/main.rs b/packages/neutron-std-derive/tests/main.rs deleted file mode 100644 index f9257487..00000000 --- a/packages/neutron-std-derive/tests/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[test] -fn tests() { - let t = trybuild::TestCases::new(); - t.pass("tests/struct.rs"); - t.pass("tests/query.rs"); -} diff --git a/packages/neutron-std-derive/tests/query.rs b/packages/neutron-std-derive/tests/query.rs deleted file mode 100644 index 7a76eb1d..00000000 --- a/packages/neutron-std-derive/tests/query.rs +++ /dev/null @@ -1,37 +0,0 @@ -use cosmwasm_std::{Empty, QueryRequest}; -use neutron_std_derive::CosmwasmExt; - -#[derive( - Clone, PartialEq, Eq, ::prost::Message, serde::Serialize, serde::Deserialize, CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest")] -#[proto_query( - path = "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator", - response_type = QueryDenomsFromCreatorResponse -)] -pub struct QueryDenomsFromCreatorRequest { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, -} -#[derive( - Clone, PartialEq, Eq, ::prost::Message, serde::Serialize, serde::Deserialize, CosmwasmExt, -)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse")] -pub struct QueryDenomsFromCreatorResponse { - #[prost(string, repeated, tag = "1")] - pub denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} - -fn main() { - let _: QueryRequest = QueryDenomsFromCreatorRequest { - creator: "neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2".to_string(), - } - .into(); -} - -mod shim { - pub struct Any { - pub type_url: String, - pub value: Vec, - } -} diff --git a/packages/neutron-std-derive/tests/struct.rs b/packages/neutron-std-derive/tests/struct.rs deleted file mode 100644 index 6600d59c..00000000 --- a/packages/neutron-std-derive/tests/struct.rs +++ /dev/null @@ -1,32 +0,0 @@ -use cosmwasm_std::CosmosMsg; -use neutron_std_derive::CosmwasmExt; - -#[derive(Clone, PartialEq, Eq, ::prost::Message, CosmwasmExt)] -#[proto_message(type_url = "/osmosis.tokenfactory.v1beta1.MsgCreateDenom")] -pub struct MsgCreateDenom { - #[prost(string, tag = "1")] - pub sender: ::prost::alloc::string::String, - /// subdenom can be up to 44 "alphanumeric" characters long. - #[prost(string, tag = "2")] - pub subdenom: ::prost::alloc::string::String, -} - -fn main() { - assert_eq!( - MsgCreateDenom::TYPE_URL, - "/osmosis.tokenfactory.v1beta1.MsgCreateDenom" - ); - let msg = MsgCreateDenom { - sender: "neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2".to_string(), - subdenom: "uxxx".to_string(), - }; - - let _: CosmosMsg = msg.into(); -} - -mod shim { - pub struct Any { - pub type_url: String, - pub value: Vec, - } -} From bc49eaeda3692ecf5b867721c8083bfdb3fa8c46 Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 28 Oct 2024 19:18:06 +0400 Subject: [PATCH 30/35] remove neutrond_version --- contracts/neutron_interchain_queries/src/testing/tests.rs | 2 -- contracts/neutron_interchain_txs/src/contract.rs | 1 - packages/neutron-sdk/src/lib.rs | 4 ---- packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT | 1 - 4 files changed, 8 deletions(-) delete mode 100644 packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index bc7f348e..66909321 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -1075,8 +1075,6 @@ fn test_sudo_tx_query_result_min_height_callback() { ); deps.querier.add_registered_queries(1, registered_query); - // simulate neutron's SudoTxQueryResult call with the following payload: - // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake // simulate neutron's SudoTxQueryResult call with the following payload: // a sending from neutron10h9stc5v6ntgeygf5xf945njqq5h32r54rf7kf to watched_addr of 10000 stake let data: Binary = Binary::from(BASE64_STANDARD.decode("CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLm5ldXRyb24xMGg5c3RjNXY2bnRnZXlnZjV4Zjk0NW5qcXE1aDMycjU0cmY3a2YSLm5ldXRyb24xZmo2eXFya3B3NmZtcDdmN2poajU3ZHVqZnB3YWw0bTI1ZGFmengaDgoFc3Rha2USBTEwMDAwEmcKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJPYibh+Zef13ZkulPqI27rV5xswZ0H/vh1Tnymp1RHPhIECgIIARgAEhMKDQoFc3Rha2USBDEwMDAQwJoMGkAIiXNJXmA57KhyaWpKcLLr3602A5+hlvv/b4PgcDDm9y0qikC+biNZXin1dEMpHOvX9DwOWJ9utv6EKljiSyfT").unwrap()); diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 469be41f..55b3cc6d 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -5,7 +5,6 @@ use cosmwasm_std::{ }; use cw2::set_contract_version; use neutron_std::shim::Timestamp; -// TODO: rename use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use crate::storage::{ add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload, diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index c7ba23e0..e984f128 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -3,10 +3,6 @@ // #![forbid(unsafe_code)] #![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)] -// TODO: can we get it from other place? or move NEUTRON_COMMIT to other place -// TODO: do we need NEUTROND_VERSION? -/// The version (commit hash) of the Cosmos SDK used when generating this library. -pub const NEUTROND_VERSION: &str = include_str!("proto_types/NEUTRON_COMMIT"); pub mod bindings; mod errors; diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT deleted file mode 100644 index 85515d2d..00000000 --- a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT +++ /dev/null @@ -1 +0,0 @@ -6bef62c6d9182b51fd5facc41088689c809b96d5 From 94567bba4a80a77abb37eeafc3d3e0de9ddf3b9b Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 28 Oct 2024 20:21:17 +0400 Subject: [PATCH 31/35] remove unnecessary trim from mock_querier --- .../src/testing/mock_querier.rs | 6 ++---- contracts/neutron_interchain_txs/src/contract.rs | 14 +++++++------- packages/neutron-sdk/src/lib.rs | 1 - 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs index df7e36a3..d006342a 100644 --- a/contracts/neutron_interchain_queries/src/testing/mock_querier.rs +++ b/contracts/neutron_interchain_queries/src/testing/mock_querier.rs @@ -60,21 +60,19 @@ impl WasmMockQuerier { pub fn handle_query(&self, request: &QueryRequest) -> QuerierResult { match &request { QueryRequest::Grpc(GrpcQuery { path, data }) => { - let quoted_path = path.trim_matches('"').to_string(); - if "ed_path == "/neutron.interchainqueries.Query/QueryResult" { + if path == "/neutron.interchainqueries.Query/QueryResult" { let request: QueryRegisteredQueryResultRequest = ::prost::Message::decode(&data[..]).unwrap(); SystemResult::Ok(ContractResult::Ok( (*self.query_responses.get(&request.query_id).unwrap()).clone(), )) - } else if "ed_path == "/neutron.interchainqueries.Query/RegisteredQuery" { + } else if path == "/neutron.interchainqueries.Query/RegisteredQuery" { let request: QueryRegisteredQueryRequest = ::prost::Message::decode(&data[..]).unwrap(); SystemResult::Ok(ContractResult::Ok( (*self.registered_queries.get(&request.query_id).unwrap()).clone(), )) } else { - println!("PATH: {}", quoted_path); self.base.handle_query(request) } } diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 55b3cc6d..1548f76e 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -1,16 +1,15 @@ -use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{ - to_json_binary, Addr, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, - Response, StdError, StdResult, SubMsg, -}; -use cw2::set_contract_version; -use neutron_std::shim::Timestamp; use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; use crate::storage::{ add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload, save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload, ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, }; +use cosmos_sdk_proto::traits::Message; +use cosmwasm_std::{ + to_json_binary, Addr, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, + Response, StdError, StdResult, SubMsg, +}; +use cw2::set_contract_version; use neutron_sdk::interchain_txs::helpers::register_interchain_account; use neutron_sdk::{ interchain_txs::helpers::{decode_message_response, get_port_id}, @@ -18,6 +17,7 @@ use neutron_sdk::{ sudo::msg::{RequestPacket, SudoMsg}, NeutronError, NeutronResult, }; +use neutron_std::shim::Timestamp; use neutron_std::types::cosmos::base::v1beta1::Coin as SDKCoin; use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_std::types::cosmos::staking::v1beta1::{ diff --git a/packages/neutron-sdk/src/lib.rs b/packages/neutron-sdk/src/lib.rs index e984f128..1aeb6f03 100644 --- a/packages/neutron-sdk/src/lib.rs +++ b/packages/neutron-sdk/src/lib.rs @@ -3,7 +3,6 @@ // #![forbid(unsafe_code)] #![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)] - pub mod bindings; mod errors; pub mod interchain_queries; From 7d44584622c25cab655350a938e97550e98256a7 Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 28 Oct 2024 20:36:28 +0400 Subject: [PATCH 32/35] remove duplicated submit_tx; move hex functions to helpers; add and cleanup comments --- .../src/testing/tests.rs | 5 ++-- .../neutron_interchain_txs/src/contract.rs | 29 ++----------------- .../src/interchain_queries/helpers.rs | 26 +++++++++++++++-- .../neutron-sdk/src/interchain_queries/hex.rs | 18 ------------ .../neutron-sdk/src/interchain_queries/mod.rs | 1 - .../neutron-sdk/src/interchain_txs/helpers.rs | 5 ++++ 6 files changed, 35 insertions(+), 49 deletions(-) delete mode 100644 packages/neutron-sdk/src/interchain_queries/hex.rs diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 66909321..ef04ab9d 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -19,7 +19,9 @@ use cosmwasm_std::testing::{message_info, mock_env, MockApi, MockStorage}; use cosmwasm_std::{ from_json, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError, Uint128, }; -use neutron_sdk::interchain_queries::helpers::{decode_and_convert, kv_key_from_string}; +use neutron_sdk::interchain_queries::helpers::{ + decode_and_convert, decode_hex, kv_key_from_string, +}; use neutron_sdk::interchain_queries::types::{ QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; @@ -39,7 +41,6 @@ use neutron_std::types::neutron::interchainqueries::{ RegisteredQuery, StorageValue, }; -use neutron_sdk::interchain_queries::hex::decode_hex; use neutron_sdk::interchain_queries::v047::queries::{ BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse, TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 1548f76e..9a55abe7 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -6,11 +6,11 @@ use crate::storage::{ }; use cosmos_sdk_proto::traits::Message; use cosmwasm_std::{ - to_json_binary, Addr, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, + to_json_binary, Binary, CosmosMsg, CustomQuery, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; -use neutron_sdk::interchain_txs::helpers::register_interchain_account; +use neutron_sdk::interchain_txs::helpers::{register_interchain_account, submit_tx}; use neutron_sdk::{ interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, @@ -25,9 +25,7 @@ use neutron_std::types::cosmos::staking::v1beta1::{ }; use neutron_std::types::ibc::core::channel::v1::Order; use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; -use neutron_std::types::neutron::interchaintxs::v1::{ - InterchaintxsQuerier, MsgSubmitTx, MsgSubmitTxResponse, -}; +use neutron_std::types::neutron::interchaintxs::v1::{InterchaintxsQuerier, MsgSubmitTxResponse}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -272,27 +270,6 @@ fn execute_delegate( Ok(Response::default().add_submessages(vec![submsg])) } -fn submit_tx( - contract: Addr, - connection_id: String, - interchain_account_id: String, - msgs: Vec, - memo: String, - timeout: u64, - fee: Fee, -) -> CosmosMsg { - MsgSubmitTx { - from_address: contract.to_string(), - interchain_account_id, - connection_id, - msgs, - memo, - timeout, - fee: Some(fee), - } - .into() -} - fn execute_undelegate( mut deps: DepsMut, env: Env, diff --git a/packages/neutron-sdk/src/interchain_queries/helpers.rs b/packages/neutron-sdk/src/interchain_queries/helpers.rs index 41bd1d2a..b26c97c0 100644 --- a/packages/neutron-sdk/src/interchain_queries/helpers.rs +++ b/packages/neutron-sdk/src/interchain_queries/helpers.rs @@ -1,5 +1,4 @@ use crate::errors::error::{NeutronError, NeutronResult}; -use crate::interchain_queries::hex::decode_hex; use crate::interchain_queries::types::{ AddressBytes, QueryPayload, QueryType, TransactionFilterItem, MAX_ADDR_LEN, }; @@ -9,6 +8,7 @@ use neutron_std::types::neutron::interchainqueries::{ MsgUpdateInterchainQueryRequest, }; use serde_json_wasm::to_string; +use std::fmt::Write as _; /// Decodes a bech32 encoded string and converts to base64 encoded bytes /// @@ -47,6 +47,8 @@ pub fn uint256_to_u128(value: Uint256) -> Result { } /// Basic helper to define a register interchain query message: +/// * **contract** is a contract address that registers the interchain query. +/// Must be equal to the contract that sends the message. /// * **query** is a query type identifier ('tx' or 'kv' for now) with a payload: /// - when the query enum is 'kv' then payload is the KV-storage keys for which we want to get /// values from remote chain; @@ -83,6 +85,8 @@ pub fn register_interchain_query( } /// Basic helper to define a update interchain query message: +/// * **contract** is a contract address that updates the interchain query. +/// Must be equal to the contract that sends the message. /// * **query_id** is ID of the query we want to update; /// * **new_keys** is encoded keys to query; /// * **new_update_period** is used to say how often (in neutron blocks) the query must be updated. @@ -102,7 +106,6 @@ pub fn update_interchain_query( Some(filters) => { to_string(&filters).map_err(|e| StdError::generic_err(e.to_string()))? } - // TODO: check if passing empty string is correct None => "".to_string(), }, } @@ -110,6 +113,8 @@ pub fn update_interchain_query( } /// Basic helper to define a remove interchain query message: +/// * **contract** is a contract address that removes the interchain query. +/// Must be equal to the contract that sends the message. /// * **query_id** is ID of the query we want to remove. pub fn remove_interchain_query(contract: Addr, query_id: u64) -> NeutronResult { Ok(MsgRemoveInterchainQueryRequest { @@ -132,3 +137,20 @@ pub fn kv_key_from_string>(s: S) -> Option { key: decode_hex(split[1])?, }) } + +/// Encodes bytes slice into hex string +pub fn encode_hex(bytes: &[u8]) -> String { + let mut s = String::with_capacity(bytes.len() * 2); + for &b in bytes { + let _ = write!(s, "{:02x}", b); + } + s +} + +/// Decodes hex string into bytes vec +pub fn decode_hex(s: &str) -> Option> { + (0..s.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&s[i..i + 2], 16).ok()) + .collect() +} diff --git a/packages/neutron-sdk/src/interchain_queries/hex.rs b/packages/neutron-sdk/src/interchain_queries/hex.rs deleted file mode 100644 index 11de7aeb..00000000 --- a/packages/neutron-sdk/src/interchain_queries/hex.rs +++ /dev/null @@ -1,18 +0,0 @@ -use std::fmt::Write as _; - -/// Encodes bytes slice into hex string -pub fn encode_hex(bytes: &[u8]) -> String { - let mut s = String::with_capacity(bytes.len() * 2); - for &b in bytes { - let _ = write!(s, "{:02x}", b); - } - s -} - -/// Decodes hex string into bytes vec -pub fn decode_hex(s: &str) -> Option> { - (0..s.len()) - .step_by(2) - .map(|i| u8::from_str_radix(&s[i..i + 2], 16).ok()) - .collect() -} diff --git a/packages/neutron-sdk/src/interchain_queries/mod.rs b/packages/neutron-sdk/src/interchain_queries/mod.rs index 1bda93e4..507603ea 100644 --- a/packages/neutron-sdk/src/interchain_queries/mod.rs +++ b/packages/neutron-sdk/src/interchain_queries/mod.rs @@ -1,5 +1,4 @@ pub mod helpers; -pub mod hex; pub mod queries; pub mod types; pub mod v045; diff --git a/packages/neutron-sdk/src/interchain_txs/helpers.rs b/packages/neutron-sdk/src/interchain_txs/helpers.rs index 67e0e867..de07ad53 100644 --- a/packages/neutron-sdk/src/interchain_txs/helpers.rs +++ b/packages/neutron-sdk/src/interchain_txs/helpers.rs @@ -27,6 +27,11 @@ pub fn get_port_id>(contract_address: R, interchain_account_id: R) + interchain_account_id.as_ref() } +/// Basic helper to define a register interchain account message: +/// * **contract** is a contract that registers ICA. Must be the contract address that sends this 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( contract: Addr, connection_id: String, From 67f20b6c7cf3521a2aad01fea94b324d71f556a7 Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 28 Oct 2024 21:08:02 +0400 Subject: [PATCH 33/35] refactor query min ibc fee helper. improve comments --- contracts/ibc_transfer/src/contract.rs | 49 +---------------- .../neutron_interchain_txs/src/contract.rs | 54 ++----------------- .../v045/register_queries.rs | 13 +++++ .../neutron-sdk/src/interchain_txs/helpers.rs | 52 ++++++++++++++++-- 4 files changed, 68 insertions(+), 100 deletions(-) diff --git a/contracts/ibc_transfer/src/contract.rs b/contracts/ibc_transfer/src/contract.rs index a8858cbf..f690a089 100644 --- a/contracts/ibc_transfer/src/contract.rs +++ b/contracts/ibc_transfer/src/contract.rs @@ -10,10 +10,9 @@ use cosmwasm_std::{ StdResult, SubMsg, }; use cw2::set_contract_version; -use neutron_sdk::interchain_txs::helpers::decode_message_response; +use neutron_sdk::interchain_txs::helpers::{decode_message_response, query_denom_min_ibc_fee}; use neutron_sdk::sudo::msg::{RequestPacket, TransferSudoMsg}; use neutron_std::types::cosmos::base::v1beta1::Coin as SDKCoin; -use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use neutron_std::types::neutron::transfer::{MsgTransfer, MsgTransferResponse}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -141,7 +140,7 @@ fn execute_send( ) -> StdResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); + let fee = query_denom_min_ibc_fee(deps.as_ref(), FEE_DENOM)?; let msg1 = MsgTransfer { source_port: "transfer".to_string(), source_channel: channel.clone(), @@ -270,47 +269,3 @@ pub fn migrate(deps: DepsMut, _env: Env, _msg: MigrateMsg) -> StdResult StdResult { - let querier = FeerefunderQuerier::new(&deps.querier); - let params = querier.params()?; - let params_inner = params - .params - .ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; - let min_fee = params_inner - .min_fee - .ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; - - Ok(min_fee) -} - -fn min_ntrn_ibc_fee(fee: Fee) -> Fee { - Fee { - recv_fee: fee - .recv_fee - .iter() - .map(|r| SDKCoin { - denom: r.denom.to_string(), - amount: r.amount.clone(), - }) - .collect(), - ack_fee: fee - .ack_fee - .iter() - .map(|r| SDKCoin { - denom: r.denom.to_string(), - amount: r.amount.clone(), - }) - .filter(|a| a.denom == FEE_DENOM) - .collect(), - timeout_fee: fee - .timeout_fee - .iter() - .map(|r| SDKCoin { - denom: r.denom.to_string(), - amount: r.amount.clone(), - }) - .filter(|a| a.denom == FEE_DENOM) - .collect(), - } -} diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 9a55abe7..27d9fa07 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -10,7 +10,9 @@ use cosmwasm_std::{ Response, StdError, StdResult, SubMsg, }; use cw2::set_contract_version; -use neutron_sdk::interchain_txs::helpers::{register_interchain_account, submit_tx}; +use neutron_sdk::interchain_txs::helpers::{ + query_denom_min_ibc_fee, register_interchain_account, submit_tx, +}; use neutron_sdk::{ interchain_txs::helpers::{decode_message_response, get_port_id}, interchain_txs::v047::helpers::decode_acknowledgement_response, @@ -18,13 +20,11 @@ use neutron_sdk::{ NeutronError, NeutronResult, }; use neutron_std::shim::Timestamp; -use neutron_std::types::cosmos::base::v1beta1::Coin as SDKCoin; use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_std::types::cosmos::staking::v1beta1::{ MsgDelegate, MsgDelegateResponse, MsgUndelegate, MsgUndelegateResponse, }; use neutron_std::types::ibc::core::channel::v1::Order; -use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use neutron_std::types::neutron::interchaintxs::v1::{InterchaintxsQuerier, MsgSubmitTxResponse}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -222,7 +222,7 @@ fn execute_delegate( ) -> NeutronResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); + let fee = query_denom_min_ibc_fee(deps.as_ref(), FEE_DENOM)?; let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgDelegate { delegator_address: delegator, @@ -281,7 +281,7 @@ fn execute_undelegate( ) -> NeutronResult { // contract must pay for relaying of acknowledgements // See more info here: https://docs.neutron.org/neutron/feerefunder/overview - let fee = min_ntrn_ibc_fee(query_min_fee(deps.as_ref())?); + let fee = query_denom_min_ibc_fee(deps.as_ref(), FEE_DENOM)?; let (delegator, connection_id) = get_ica(deps.as_ref(), &env, &interchain_account_id)?; let delegate_msg = MsgUndelegate { delegator_address: delegator, @@ -629,47 +629,3 @@ pub fn reply(deps: DepsMut, env: Env, msg: Reply) -> StdResult { ))), } } - -fn min_ntrn_ibc_fee(fee: Fee) -> Fee { - Fee { - recv_fee: fee - .recv_fee - .iter() - .map(|r| SDKCoin { - denom: r.denom.to_string(), - amount: r.amount.clone(), - }) - .collect(), - ack_fee: fee - .ack_fee - .iter() - .map(|r| SDKCoin { - denom: r.denom.to_string(), - amount: r.amount.clone(), - }) - .filter(|a| a.denom == FEE_DENOM) - .collect(), - timeout_fee: fee - .timeout_fee - .iter() - .map(|r| SDKCoin { - denom: r.denom.to_string(), - amount: r.amount.clone(), - }) - .filter(|a| a.denom == FEE_DENOM) - .collect(), - } -} - -fn query_min_fee(deps: Deps) -> StdResult { - let querier = FeerefunderQuerier::new(&deps.querier); - let params = querier.params()?; - let params_inner = params - .params - .ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; - let min_fee = params_inner - .min_fee - .ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; - - Ok(min_fee) -} diff --git a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs index 043d0c72..22668c77 100644 --- a/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs +++ b/packages/neutron-sdk/src/interchain_queries/v045/register_queries.rs @@ -43,6 +43,7 @@ pub fn new_register_balances_query_msg( /// Creates a message to register an Interchain Query to get balance of account on remote chain for a particular denom /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **addr** address of an account on remote chain for which you want to get balances; /// * **denom** denomination of the coin for which you want to get balance; @@ -60,6 +61,7 @@ pub fn new_register_balance_query_msg( /// Creates a message to register an Interchain Query to get total supply on remote chain for particular denom /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **denom** denomination of the coin for which you want to get total supply; /// * **update_period** is used to say how often the query must be updated. @@ -92,6 +94,7 @@ pub fn new_register_bank_total_supply_query_msg( /// Creates a message to register an Interchain Query to get fee pool on remote chain from distribution module /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **update_period** is used to say how often the query must be updated. pub fn new_register_distribution_fee_pool_query_msg( @@ -114,6 +117,7 @@ pub fn new_register_distribution_fee_pool_query_msg( /// Creates a message to register an Interchain Query to get governance proposals on remote chain /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **proposals_ids** is a list of proposals ids from remote chain. /// * **update_period** is used to say how often the query must be updated. @@ -135,6 +139,7 @@ pub fn new_register_gov_proposals_query_msg( /// Creates a message to update an Interchain Query to get governance proposals on remote chain /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **query_id** is an IBC connection identifier between Neutron and remote chain; /// * **proposals_ids** is a list of proposals ids from remote chain. /// * **new_update_period** is used to update period of how often the query must be updated. @@ -151,6 +156,7 @@ pub fn update_gov_proposals_query_msg( /// Creates a message to register an Interchain Query to get governance proposals votes on the remote chain /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **proposals_ids** is a list of proposals ids from remote chain. /// * **voters** is a list of voter to get voting info from remote chain. @@ -174,6 +180,7 @@ pub fn new_register_gov_proposals_voters_votes_query_msg( /// Creates a message to update an Interchain Query to get governance proposals votes on the remote chain /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **query_id** is an IBC connection identifier between Neutron and remote chain; /// * **proposals_ids** is a list of proposals ids from remote chain. /// * **voters** is a list of voter to get voting info from remote chain. @@ -192,6 +199,7 @@ pub fn update_gov_proposals_votes_query_msg( /// Creates a message to register an Interchain Query to get validator info on remote chain /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **validator** is an validator operator address of an account on remote chain for which you want to get rewards ; /// * **update_period** is used to say how often the query must be updated. @@ -224,6 +232,7 @@ pub fn new_register_staking_validators_query_msg( /// Creates a message to register an Interchain Query to get validators signing infos on remote chain /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **validators** is an list of validators valcons addresses of an account on remote chain for which you want to get rewards ; /// * **update_period** is used to say how often the query must be updated. @@ -256,6 +265,7 @@ pub fn new_register_validators_signing_infos_query_msg( /// Creates a message to register an Interchain Query to get delegations of particular delegator on remote chain. /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **delegator** is an address of an account on remote chain for which you want to get list of delegations; /// * **validators** is a list of validators addresses for which you want to get delegations from particular **delegator**; @@ -307,6 +317,7 @@ pub fn new_register_delegator_delegations_query_msg( /// Creates a message to register an Interchain Query to get unbonding delegations of particular delegator on remote chain. /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **delegator** is an address of an account on remote chain for which you want to get list of unbonding delegations; /// * **validators** is a list of validators addresses for which you want to get unbonding delegations from particular **delegator**; @@ -344,6 +355,7 @@ pub fn new_register_delegator_unbonding_delegations_query_msg( /// Creates a message to register an Interchain Query to get wasm contract store on remote chain /// from **wasm** module /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **contract_address** is an address of a contract on a remote chain; /// * **key** is a wasm contract store key; @@ -379,6 +391,7 @@ pub fn new_register_wasm_contract_store_query_msg( /// Creates a message to register an Interchain Query to get transfer events to a recipient on a remote chain. /// +/// * **contract** is an address of the contract that registers the query. Must be contract that sends this message. /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **recipient** is an address of an account on remote chain for which you want to get list of transfer transactions; /// * **update_period** is used to say how often the query must be updated. diff --git a/packages/neutron-sdk/src/interchain_txs/helpers.rs b/packages/neutron-sdk/src/interchain_txs/helpers.rs index de07ad53..f24f4f5c 100644 --- a/packages/neutron-sdk/src/interchain_txs/helpers.rs +++ b/packages/neutron-sdk/src/interchain_txs/helpers.rs @@ -1,9 +1,9 @@ use cosmos_sdk_proto::traits::Message; -use cosmwasm_std::{Addr, CosmosMsg, StdError, StdResult}; +use cosmwasm_std::{Addr, CosmosMsg, Deps, StdError, StdResult}; use neutron_std::shim::Any; use neutron_std::types::cosmos::base::v1beta1::Coin; use neutron_std::types::ibc::core::channel::v1::Order; -use neutron_std::types::neutron::feerefunder::Fee; +use neutron_std::types::neutron::feerefunder::{Fee, FeerefunderQuerier}; use neutron_std::types::neutron::interchaintxs::v1::{MsgRegisterInterchainAccount, MsgSubmitTx}; /// Decodes protobuf any item into T structure @@ -27,7 +27,8 @@ pub fn get_port_id>(contract_address: R, interchain_account_id: R) + interchain_account_id.as_ref() } -/// Basic helper to define a register interchain account message: +/// Basic helper to define a register interchain account message. +/// /// * **contract** is a contract that registers ICA. Must be the contract address that sends this 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. @@ -49,7 +50,8 @@ pub fn register_interchain_account( .into() } -/// Basic helper to define a submit tx message: +/// Basic helper to define a submit tx message. +/// /// * **contract** is a contract that is sending the message /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **interchain_account_id** is an identifier of your interchain account from which you want to execute msgs; @@ -77,3 +79,45 @@ pub fn submit_tx( } .into() } + +/// Queries chain for minimum fee for given denom. Returns Err if not found. +/// +/// * **deps** is contract `Deps` +/// * **denom** is a denom which can be used. Function will return Err if denom is not in a list of fee denoms. +pub fn query_denom_min_ibc_fee(deps: Deps, denom: &str) -> StdResult { + let fee = query_min_fee(deps)?; + Ok(Fee { + recv_fee: fee_with_denom(fee.recv_fee, denom)?, + ack_fee: fee_with_denom(fee.ack_fee, denom)?, + timeout_fee: fee_with_denom(fee.timeout_fee, denom)?, + }) +} + +/// Queries chain for all possible minimal fee. Each fee in Vec is a different denom. +/// +/// * **deps** is contract `Deps` +pub fn query_min_fee(deps: Deps) -> StdResult { + let querier = FeerefunderQuerier::new(&deps.querier); + let params = querier.params()?; + let params_inner = params + .params + .ok_or_else(|| StdError::generic_err("no params found for feerefunder"))?; + let min_fee = params_inner + .min_fee + .ok_or_else(|| StdError::generic_err("no minimum fee param for feerefunder"))?; + + Ok(min_fee) +} + +fn fee_with_denom(fee: Vec, denom: &str) -> StdResult> { + Ok(vec![fee + .iter() + .find(|a| a.denom == denom) + .map(|r| Coin { + denom: r.denom.to_string(), + amount: r.amount.clone(), + }) + .ok_or_else(|| { + StdError::not_found(format!("cannot find fee for denom {}", denom)) + })?]) +} From 4353f650827964661bac61d66f597b52a2af5fe2 Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 29 Oct 2024 16:40:01 +0400 Subject: [PATCH 34/35] remove unnecessary TODO's --- contracts/neutron_interchain_queries/src/contract.rs | 1 - packages/neutron-sdk/src/bindings/msg.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index ed028e8f..02cbfedb 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -487,7 +487,6 @@ pub fn sudo_tx_query_result( // all submitted results will be treated as valid. // // TODO: come up with solution to determine transactions filter type - // TODO: fix this? match registered_query.query_type { _ => { // For transfer queries, query data looks like `[{"field:"transfer.recipient", "op":"eq", "value":"some_address"}]` diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index a92607ab..5d71042b 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -151,7 +151,6 @@ pub struct UpgradeProposal { /// **plan** is a plan of upgrade. pub plan: Plan, /// **upgraded_client_state** is an upgraded client state. - // TODO: correct? pub upgraded_client_state: Any, } From 5935e3f9c82689920aa1f77cf8a79b865d454ac1 Mon Sep 17 00:00:00 2001 From: nhpd Date: Thu, 31 Oct 2024 14:35:51 +0400 Subject: [PATCH 35/35] set std branch to main --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c6a1089e..ae1997c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ overflow-checks = true [workspace.dependencies] cosmwasm-std = "2.1.0" -neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "feat/clean-bindings" } +neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "main" } cosmwasm-schema = { version = "2.1.0", default-features = false } cw2 = "2.0.0" cw-storage-plus = "2.0.0"