[][src]Trait cosmwasm_std::Querier

pub trait Querier {
    fn raw_query(&self, bin_request: &[u8]) -> QuerierResult;

    fn query<T: DeserializeOwned>(
        &self,
        request: &QueryRequest<Empty>
    ) -> StdResult<T> { ... }
fn custom_query<T: Serialize, U: DeserializeOwned>(
        &self,
        request: &QueryRequest<T>
    ) -> StdResult<U> { ... }
fn query_balance<U: Into<HumanAddr>>(
        &self,
        address: U,
        denom: &str
    ) -> StdResult<Coin> { ... }
fn query_all_balances<U: Into<HumanAddr>>(
        &self,
        address: U
    ) -> StdResult<Vec<Coin>> { ... } }

Required methods

fn raw_query(&self, bin_request: &[u8]) -> QuerierResult

raw_query is all that must be implemented for the Querier. This allows us to pass through binary queries from one level to another without knowing the custom format, or we can decode it, with the knowledge of the allowed types. People using the querier probably want one of the simpler auto-generated helper methods

Loading content...

Provided methods

fn query<T: DeserializeOwned>(
    &self,
    request: &QueryRequest<Empty>
) -> StdResult<T>

query is a shorthand for custom_query when we are not using a custom type, this allows us to avoid specifying "Empty" in all the type definitions.

fn custom_query<T: Serialize, U: DeserializeOwned>(
    &self,
    request: &QueryRequest<T>
) -> StdResult<U>

Makes the query and parses the response. Also handles custom queries, so you need to specify the custom query type in the function parameters. If you are no using a custom query, just use query for easier interface.

Any error (System Error, Error or called contract, or Parse Error) are flattened into one level. Only use this if you don't need to check the SystemError eg. If you don't differentiate between contract missing and contract returned error

fn query_balance<U: Into<HumanAddr>>(
    &self,
    address: U,
    denom: &str
) -> StdResult<Coin>

fn query_all_balances<U: Into<HumanAddr>>(
    &self,
    address: U
) -> StdResult<Vec<Coin>>

Loading content...

Implementors

impl<C: DeserializeOwned> Querier for MockQuerier<C>[src]

Loading content...