Query

Trait Query 

Source
pub trait Query: Serialize {
    const BLOCK_SIZE: usize;

    // Provided method
    fn query<C: CustomQuery, T: DeserializeOwned>(
        &self,
        querier: QuerierWrapper<'_, C>,
        code_hash: String,
        contract_addr: String,
    ) -> StdResult<T> { ... }
}
Expand description

A trait marking types that define the query message(s) of a contract

This trait requires specifying a padding block size and provides a method to query a contract

Required Associated Constants§

Source

const BLOCK_SIZE: usize

pad the message to blocks of this size

Provided Methods§

Source

fn query<C: CustomQuery, T: DeserializeOwned>( &self, querier: QuerierWrapper<'_, C>, code_hash: String, contract_addr: String, ) -> StdResult<T>

Returns StdResult, where T is the type defining the query response

Tries to query a contract and deserialize the query response. The BLOCK_SIZE specified in the implementation is used when padding the message

§Arguments
  • querier - a reference to the Querier dependency of the querying contract
  • callback_code_hash - String holding the code hash of the contract to be queried
  • contract_addr - address of the contract being queried

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§