@@ -462,14 +462,14 @@ pub type MockQuerierCustomHandlerResult = SystemResult<ContractResult<Binary>>;
462462/// MockQuerier holds an immutable table of bank balances
463463/// and configurable handlers for Wasm queries and custom queries.
464464pub struct MockQuerier < C : DeserializeOwned = Empty > {
465- bank : BankQuerier ,
465+ pub bank : BankQuerier ,
466466 #[ cfg( feature = "staking" ) ]
467- staking : StakingQuerier ,
467+ pub staking : StakingQuerier ,
468468 #[ cfg( feature = "cosmwasm_1_3" ) ]
469- distribution : DistributionQuerier ,
469+ pub distribution : DistributionQuerier ,
470470 wasm : WasmQuerier ,
471471 #[ cfg( feature = "stargate" ) ]
472- ibc : IbcQuerier ,
472+ pub ibc : IbcQuerier ,
473473 /// A handler to handle custom queries. This is set to a dummy handler that
474474 /// always errors by default. Update it via `with_custom_handler`.
475475 ///
@@ -497,61 +497,6 @@ impl<C: DeserializeOwned> MockQuerier<C> {
497497 }
498498 }
499499
500- // set a new balance for the given address and return the old balance
501- pub fn update_balance (
502- & mut self ,
503- addr : impl Into < String > ,
504- balance : Vec < Coin > ,
505- ) -> Option < Vec < Coin > > {
506- self . bank . update_balance ( addr, balance)
507- }
508-
509- pub fn set_denom_metadata ( & mut self , denom_metadata : & [ DenomMetadata ] ) {
510- self . bank . set_denom_metadata ( denom_metadata) ;
511- }
512-
513- #[ cfg( feature = "cosmwasm_1_3" ) ]
514- pub fn set_withdraw_address (
515- & mut self ,
516- delegator_address : impl Into < String > ,
517- withdraw_address : impl Into < String > ,
518- ) {
519- self . distribution
520- . set_withdraw_address ( delegator_address, withdraw_address) ;
521- }
522-
523- /// Sets multiple withdraw addresses.
524- ///
525- /// This allows passing multiple tuples of `(delegator_address, withdraw_address)`.
526- /// It does not overwrite existing entries.
527- #[ cfg( feature = "cosmwasm_1_3" ) ]
528- pub fn set_withdraw_addresses (
529- & mut self ,
530- withdraw_addresses : impl IntoIterator < Item = ( impl Into < String > , impl Into < String > ) > ,
531- ) {
532- self . distribution . set_withdraw_addresses ( withdraw_addresses) ;
533- }
534-
535- #[ cfg( feature = "cosmwasm_1_3" ) ]
536- pub fn clear_withdraw_addresses ( & mut self ) {
537- self . distribution . clear_withdraw_addresses ( ) ;
538- }
539-
540- #[ cfg( feature = "staking" ) ]
541- pub fn update_staking (
542- & mut self ,
543- denom : & str ,
544- validators : & [ crate :: query:: Validator ] ,
545- delegations : & [ crate :: query:: FullDelegation ] ,
546- ) {
547- self . staking = StakingQuerier :: new ( denom, validators, delegations) ;
548- }
549-
550- #[ cfg( feature = "stargate" ) ]
551- pub fn update_ibc ( & mut self , port_id : & str , channels : & [ IbcChannel ] ) {
552- self . ibc = IbcQuerier :: new ( port_id, channels) ;
553- }
554-
555500 pub fn update_wasm < WH : ' static > ( & mut self , handler : WH )
556501 where
557502 WH : Fn ( & WasmQuery ) -> QuerierResult ,
@@ -690,6 +635,7 @@ impl BankQuerier {
690635 }
691636 }
692637
638+ /// set a new balance for the given address and return the old balance
693639 pub fn update_balance (
694640 & mut self ,
695641 addr : impl Into < String > ,
@@ -839,6 +785,12 @@ impl IbcQuerier {
839785 }
840786 }
841787
788+ /// Update the querier's configuration
789+ pub fn update ( & mut self , port_id : impl Into < String > , channels : & [ IbcChannel ] ) {
790+ self . port_id = port_id. into ( ) ;
791+ self . channels = channels. to_vec ( ) ;
792+ }
793+
842794 pub fn query ( & self , request : & IbcQuery ) -> QuerierResult {
843795 let contract_result: ContractResult < Binary > = match request {
844796 IbcQuery :: Channel {
@@ -902,6 +854,18 @@ impl StakingQuerier {
902854 }
903855 }
904856
857+ /// Update the querier's configuration
858+ pub fn update (
859+ & mut self ,
860+ denom : impl Into < String > ,
861+ validators : & [ Validator ] ,
862+ delegations : & [ FullDelegation ] ,
863+ ) {
864+ self . denom = denom. into ( ) ;
865+ self . validators = validators. to_vec ( ) ;
866+ self . delegations = delegations. to_vec ( ) ;
867+ }
868+
905869 pub fn query ( & self , request : & StakingQuery ) -> QuerierResult {
906870 let contract_result: ContractResult < Binary > = match request {
907871 StakingQuery :: BondedDenom { } => {
0 commit comments