secret_cosmwasm_std/query/
bank.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use crate::Coin;
5
6#[non_exhaustive]
7#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
8#[serde(rename_all = "snake_case")]
9pub enum BankQuery {
10    /// This calls into the native bank module for querying the total supply of one denomination.
11    /// It does the same as the SupplyOf call in Cosmos SDK's RPC API.
12    /// Return value is of type SupplyResponse.
13    #[cfg(feature = "cosmwasm_1_1")]
14    Supply { denom: String },
15    /// This calls into the native bank module for one denomination
16    /// Return value is BalanceResponse
17    Balance { address: String, denom: String },
18    /// This calls into the native bank module for all denominations.
19    /// Note that this may be much more expensive than Balance and should be avoided if possible.
20    /// Return value is AllBalanceResponse.
21    AllBalances { address: String },
22}
23
24#[cfg(feature = "cosmwasm_1_1")]
25#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
26#[serde(rename_all = "snake_case")]
27#[non_exhaustive]
28pub struct SupplyResponse {
29    /// Always returns a Coin with the requested denom.
30    /// This will be of zero amount if the denom does not exist.
31    pub amount: Coin,
32}
33
34#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
35#[serde(rename_all = "snake_case")]
36pub struct BalanceResponse {
37    /// Always returns a Coin with the requested denom.
38    /// This may be of 0 amount if no such funds.
39    pub amount: Coin,
40}
41
42#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
43#[serde(rename_all = "snake_case")]
44pub struct AllBalanceResponse {
45    /// Returns all non-zero coins held by this account.
46    pub amount: Vec<Coin>,
47}