Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

query_app

Run an app-level query against the node at a given height.

Signature

impl QueryClient for HttpClient {
    type Error = anyhow::Error;
    type Proof = grug::Proof;
 
    async fn query_app(
        &self,
        query: Query,
        height: Option<u64>,
    ) -> Result<QueryResponse, Self::Error>;
}

Query and QueryResponse are re-exported by the SDK.

Example

use {
    anyhow::Result,
    dango_sdk::HttpClient,
    grug::{Query, QueryClient, QueryConfigRequest},
};
 
#[tokio::main]
async fn main() -> Result<()> {
    let client   = HttpClient::new("https://api-mainnet.dango.zone")?;
    let response = client.query_app(Query::Config(QueryConfigRequest {}), None).await?;
    println!("{response:?}");
    Ok(())
}

For most app-level fetches, prefer the typed QueryClientExt helpers — query_app_config, query_balance, query_wasm_smart, … — that build on top of query_app.

Parameters

queryQuery. The typed query enum (Config, WasmSmart, Balance, …).

heightOption<u64>. Block height to query at, or None for the latest committed state.

Returns

QueryResponse — the variant that matches the input Query. Callers usually pattern-match or unwrap into the expected variant.

Notes

  • Hits the GraphQL queryApp resolver. Errors bubble through anyhow::Error.
  • Use a fixed height for snapshot consistency across multiple reads.

See also