tg_bindings/
query.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{Addr, CustomQuery};
5
6use crate::hooks::Privilege;
7use crate::validator::ValidatorVote;
8
9#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
10#[serde(rename_all = "snake_case")]
11pub enum TgradeQuery {
12    /// Returns the current tendermint validator set, along with their voting status from last block
13    ValidatorVotes {},
14    /// Lists all contracts registered with the given privilege
15    /// Returns ListPrivilegedResponse
16    ListPrivileged(Privilege),
17}
18
19impl CustomQuery for TgradeQuery {}
20
21#[derive(Serialize, Deserialize, Default, Clone, PartialEq, Eq, JsonSchema, Debug)]
22pub struct ValidatorVoteResponse {
23    pub votes: Vec<ValidatorVote>,
24}
25
26#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, JsonSchema, Debug)]
27pub struct ListPrivilegedResponse {
28    // we can guarantee correctly formatted addresses from the Go runtime, use Addr here
29    pub privileged: Vec<Addr>,
30}