Struct provwasm_mocks::MockProvenanceQuerier
source · pub struct MockProvenanceQuerier<C: DeserializeOwned = Empty> {
pub mock_querier: MockQuerier<C>,
pub registered_custom_queries: HashMap<String, Box<dyn Fn(&Binary) -> QuerierResult>>,
}Fields§
§mock_querier: MockQuerier<C>Default CosmWASM mock querier.
registered_custom_queries: HashMap<String, Box<dyn Fn(&Binary) -> QuerierResult>>Registered custom queries using proto request for testing.
Implementations§
source§impl MockProvenanceQuerier
impl MockProvenanceQuerier
sourcepub fn new(balances: &[(&str, &[Coin])]) -> Self
pub fn new(balances: &[(&str, &[Coin])]) -> Self
Initialize a new MockProvenanceQuerier.
balances- Slice of balances passed to thebankmodule, where the first element is the user address and the second element is the user’s balance.
sourcepub fn handle_query(&self, request: &QueryRequest<Empty>) -> QuerierResult
pub fn handle_query(&self, request: &QueryRequest<Empty>) -> QuerierResult
Handle the query request.
Trait Implementations§
source§impl Default for MockProvenanceQuerier
impl Default for MockProvenanceQuerier
source§impl MockableQuerier for MockProvenanceQuerier
impl MockableQuerier for MockProvenanceQuerier
fn register_custom_query( &mut self, path: String, response_fn: Box<dyn Fn(&Binary) -> QuerierResult> )
source§impl Querier for MockProvenanceQuerier
impl Querier for MockProvenanceQuerier
source§fn raw_query(&self, bin_request: &[u8]) -> QuerierResult
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
Auto Trait Implementations§
impl<C> Freeze for MockProvenanceQuerier<C>
impl<C = Empty> !RefUnwindSafe for MockProvenanceQuerier<C>
impl<C = Empty> !Send for MockProvenanceQuerier<C>
impl<C = Empty> !Sync for MockProvenanceQuerier<C>
impl<C> Unpin for MockProvenanceQuerier<C>
impl<C = Empty> !UnwindSafe for MockProvenanceQuerier<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
Mutably borrows from an owned value. Read more