Struct cosmwasm_std::QuerierWrapper

source ·
pub struct QuerierWrapper<'a, C: CustomQuery = Empty> { /* private fields */ }

Implementations§

source§

impl<'a, C: CustomQuery> QuerierWrapper<'a, C>

source

pub fn new(querier: &'a dyn Querier) -> Self

source

pub fn into_empty(self) -> QuerierWrapper<'a, Empty>

This allows to convert any QuerierWrapper into a QuerierWrapper generic over Empty custom query type.

source

pub fn query<U: DeserializeOwned>( &self, request: &QueryRequest<C> ) -> StdResult<U>

Makes the query and parses the response.

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

source

pub fn query_supply(&self, denom: impl Into<String>) -> StdResult<Coin>

source

pub fn query_balance( &self, address: impl Into<String>, denom: impl Into<String> ) -> StdResult<Coin>

source

pub fn query_all_balances( &self, address: impl Into<String> ) -> StdResult<Vec<Coin>>

source

pub fn query_delegator_withdraw_address( &self, delegator: impl Into<String> ) -> StdResult<Addr>

source

pub fn query_denom_metadata( &self, denom: impl Into<String> ) -> StdResult<DenomMetadata>

source

pub fn query_all_denom_metadata( &self, pagination: PageRequest ) -> StdResult<AllDenomMetadataResponse>

source

pub fn query_delegation_rewards( &self, delegator: impl Into<String>, validator: impl Into<String> ) -> StdResult<Vec<DecCoin>>

source

pub fn query_delegation_total_rewards( &self, delegator: impl Into<String> ) -> StdResult<DelegationTotalRewardsResponse>

source

pub fn query_delegator_validators( &self, delegator: impl Into<String> ) -> StdResult<Vec<String>>

source

pub fn query_wasm_smart<T: DeserializeOwned>( &self, contract_addr: impl Into<String>, msg: &impl Serialize ) -> StdResult<T>

Queries another wasm contract. You should know a priori the proper types for T and U (response and request) based on the contract API

source

pub fn query_wasm_raw( &self, contract_addr: impl Into<String>, key: impl Into<Binary> ) -> StdResult<Option<Vec<u8>>>

Queries the raw storage from another wasm contract.

You must know the exact layout and are implementation dependent (not tied to an interface like query_wasm_smart). That said, if you are building a few contracts together, this is a much cheaper approach

Similar return value to Storage::get. Returns Some(val) or None if the data is there. It only returns error on some runtime issue, not on any data cases.

source

pub fn query_wasm_contract_info( &self, contract_addr: impl Into<String> ) -> StdResult<ContractInfoResponse>

Given a contract address, query information about that contract.

source

pub fn query_wasm_code_info(&self, code_id: u64) -> StdResult<CodeInfoResponse>

Given a code ID, query information about that code.

source

pub fn query_all_validators(&self) -> StdResult<Vec<Validator>>

source

pub fn query_validator( &self, address: impl Into<String> ) -> StdResult<Option<Validator>>

source

pub fn query_bonded_denom(&self) -> StdResult<String>

source

pub fn query_all_delegations( &self, delegator: impl Into<String> ) -> StdResult<Vec<Delegation>>

source

pub fn query_delegation( &self, delegator: impl Into<String>, validator: impl Into<String> ) -> StdResult<Option<FullDelegation>>

Trait Implementations§

source§

impl<'a, C: Clone + CustomQuery> Clone for QuerierWrapper<'a, C>

source§

fn clone(&self) -> QuerierWrapper<'a, C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, C: CustomQuery> Deref for QuerierWrapper<'a, C>

This allows us to use self.raw_query to access the querier. It also allows external callers to access the querier easily.

§

type Target = dyn Querier + 'a

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a, C: CustomQuery> Copy for QuerierWrapper<'a, C>

Auto Trait Implementations§

§

impl<'a, C> Freeze for QuerierWrapper<'a, C>

§

impl<'a, C = Empty> !RefUnwindSafe for QuerierWrapper<'a, C>

§

impl<'a, C = Empty> !Send for QuerierWrapper<'a, C>

§

impl<'a, C = Empty> !Sync for QuerierWrapper<'a, C>

§

impl<'a, C> Unpin for QuerierWrapper<'a, C>
where C: Unpin,

§

impl<'a, C = Empty> !UnwindSafe for QuerierWrapper<'a, C>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<U> As for U

source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.