Struct cosmwasm_std::testing::MockApi
source · pub struct MockApi { /* private fields */ }
Implementations§
source§impl MockApi
impl MockApi
sourcepub fn with_prefix(self, prefix: &'static str) -> Self
pub fn with_prefix(self, prefix: &'static str) -> Self
sourcepub fn addr_make(&self, input: &str) -> Addr
pub fn addr_make(&self, input: &str) -> Addr
Returns an address built from provided input string.
§Example
let mock_api = MockApi::default();
let addr = mock_api.addr_make("creator");
assert_eq!(addr.to_string(), "cosmwasm1h34lmpywh4upnjdg90cjf4j70aee6z8qqfspugamjp42e4q28kqs8s7vcp");
§Panics
This function panics when generating a valid address is not possible, especially when Bech32 prefix set in function with_prefix is empty.
Trait Implementations§
source§impl Api for MockApi
impl Api for MockApi
source§fn addr_validate(&self, input: &str) -> StdResult<Addr>
fn addr_validate(&self, input: &str) -> StdResult<Addr>
Takes a human readable address and validates if it is valid.
If it the validation succeeds, a
Addr
containing the same data as the input is returned. Read moresource§fn addr_canonicalize(&self, input: &str) -> StdResult<CanonicalAddr>
fn addr_canonicalize(&self, input: &str) -> StdResult<CanonicalAddr>
Takes a human readable address and returns a canonical binary representation of it.
This can be used when a compact representation is needed. Read more
source§fn addr_humanize(&self, canonical: &CanonicalAddr) -> StdResult<Addr>
fn addr_humanize(&self, canonical: &CanonicalAddr) -> StdResult<Addr>
Takes a canonical address and returns a human readble address.
This is the inverse of
addr_canonicalize
.fn secp256k1_verify( &self, message_hash: &[u8], signature: &[u8], public_key: &[u8] ) -> Result<bool, VerificationError>
fn secp256k1_recover_pubkey( &self, message_hash: &[u8], signature: &[u8], recovery_param: u8 ) -> Result<Vec<u8>, RecoverPubkeyError>
fn ed25519_verify( &self, message: &[u8], signature: &[u8], public_key: &[u8] ) -> Result<bool, VerificationError>
fn ed25519_batch_verify( &self, messages: &[&[u8]], signatures: &[&[u8]], public_keys: &[&[u8]] ) -> Result<bool, VerificationError>
impl Copy for MockApi
Auto Trait Implementations§
impl Freeze for MockApi
impl RefUnwindSafe for MockApi
impl Send for MockApi
impl Sync for MockApi
impl Unpin for MockApi
impl UnwindSafe for MockApi
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