jk_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, JsonSchema)]
8#[serde(rename_all = "snake_case")]
9pub enum BankQuery {
10    /// This calls into the native bank module for one denomination
11    /// Return value is BalanceResponse
12    Balance { address: String, denom: String },
13    /// This calls into the native bank module for all denominations.
14    /// Note that this may be much more expensive than Balance and should be avoided if possible.
15    /// Return value is AllBalanceResponse.
16    AllBalances { address: String },
17}
18
19#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
20#[serde(rename_all = "snake_case")]
21pub struct BalanceResponse {
22    /// Always returns a Coin with the requested denom.
23    /// This may be of 0 amount if no such funds.
24    pub amount: Coin,
25}
26
27#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
28#[serde(rename_all = "snake_case")]
29pub struct AllBalanceResponse {
30    /// Returns all non-zero coins held by this account.
31    pub amount: Vec<Coin>,
32}