pub struct QuerierWrapper<'a, C: CustomQuery = Empty> { /* private fields */ }
Implementations§
Source§impl<'a, C: CustomQuery> QuerierWrapper<'a, C>
impl<'a, C: CustomQuery> QuerierWrapper<'a, C>
pub fn new(querier: &'a dyn Querier) -> Self
Sourcepub fn into_empty(self) -> QuerierWrapper<'a, Empty>
pub fn into_empty(self) -> QuerierWrapper<'a, Empty>
This allows to convert any QuerierWrapper
into a QuerierWrapper
generic
over Empty
custom query type.
Sourcepub fn query<U: DeserializeOwned>(
&self,
request: &QueryRequest<C>,
) -> StdResult<U>
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
pub fn query_supply(&self, denom: impl Into<String>) -> StdResult<Coin>
pub fn query_balance( &self, address: impl Into<String>, denom: impl Into<String>, ) -> StdResult<Coin>
pub fn query_all_balances( &self, address: impl Into<String>, ) -> StdResult<Vec<Coin>>
pub fn query_delegator_withdraw_address( &self, delegator: impl Into<String>, ) -> StdResult<Addr>
pub fn query_denom_metadata( &self, denom: impl Into<String>, ) -> StdResult<DenomMetadata>
pub fn query_all_denom_metadata( &self, pagination: PageRequest, ) -> StdResult<AllDenomMetadataResponse>
pub fn query_delegation_rewards( &self, delegator: impl Into<String>, validator: impl Into<String>, ) -> StdResult<Vec<DecCoin>>
pub fn query_delegation_total_rewards( &self, delegator: impl Into<String>, ) -> StdResult<DelegationTotalRewardsResponse>
pub fn query_delegator_validators( &self, delegator: impl Into<String>, ) -> StdResult<Vec<String>>
Sourcepub fn query_grpc(&self, path: String, data: Binary) -> StdResult<Binary>
pub fn query_grpc(&self, path: String, data: Binary) -> StdResult<Binary>
See GrpcQuery
for more information.
Sourcepub fn query_wasm_smart<T: DeserializeOwned>(
&self,
contract_addr: impl Into<String>,
msg: &impl Serialize,
) -> StdResult<T>
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
Sourcepub fn query_wasm_raw(
&self,
contract_addr: impl Into<String>,
key: impl Into<Binary>,
) -> StdResult<Option<Vec<u8>>>
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.
Sourcepub fn query_wasm_contract_info(
&self,
contract_addr: impl Into<String>,
) -> StdResult<ContractInfoResponse>
pub fn query_wasm_contract_info( &self, contract_addr: impl Into<String>, ) -> StdResult<ContractInfoResponse>
Given a contract address, query information about that contract.
Sourcepub fn query_wasm_code_info(&self, code_id: u64) -> StdResult<CodeInfoResponse>
pub fn query_wasm_code_info(&self, code_id: u64) -> StdResult<CodeInfoResponse>
Given a code ID, query information about that code.
pub fn query_all_validators(&self) -> StdResult<Vec<Validator>>
pub fn query_validator( &self, address: impl Into<String>, ) -> StdResult<Option<Validator>>
pub fn query_bonded_denom(&self) -> StdResult<String>
pub fn query_all_delegations( &self, delegator: impl Into<String>, ) -> StdResult<Vec<Delegation>>
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>
impl<'a, C: Clone + CustomQuery> Clone for QuerierWrapper<'a, C>
Source§fn clone(&self) -> QuerierWrapper<'a, C>
fn clone(&self) -> QuerierWrapper<'a, C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§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.
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.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more