Skip to content

Commit

Permalink
remove proto_types
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Oct 11, 2024
1 parent 302b8b6 commit 09deffe
Show file tree
Hide file tree
Showing 256 changed files with 27 additions and 46,785 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["contracts/*", "packages/*", "proto-build"]
members = ["contracts/*", "packages/*"]

[profile.release]
opt-level = 3
Expand Down
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
71 changes: 26 additions & 45 deletions packages/neutron-sdk/src/interchain_queries/v045/queries.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::{
bindings::query::NeutronQuery,
interchain_queries::{
queries::{check_query_type, get_registered_query, query_kv_result},
types::QueryType,
Expand Down Expand Up @@ -86,182 +85,164 @@ pub fn query_balance(
) -> NeutronResult<BalanceResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<TotalSupplyResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<FeePoolResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<ValidatorResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<ValidatorSigningInfoResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<ProposalResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<ProposalVotesResponse> {
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,
})
}

/// 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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<DelegatorDelegationsResponse> {
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<NeutronQuery>,
deps: Deps,
_env: Env,
registered_query_id: u64,
) -> NeutronResult<DelegatorUnbondingDelegationsResponse> {
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,
})
}
1 change: 0 additions & 1 deletion packages/neutron-sdk/src/proto_types/capability/mod.rs

This file was deleted.

112 changes: 0 additions & 112 deletions packages/neutron-sdk/src/proto_types/capability/v1.rs

This file was deleted.

2 changes: 0 additions & 2 deletions packages/neutron-sdk/src/proto_types/cosmos/app/mod.rs

This file was deleted.

This file was deleted.

Loading

0 comments on commit 09deffe

Please sign in to comment.