pub struct CwMockApi { /* private fields */ }
Implementations§
Source§impl MockApi
impl MockApi
Sourcepub fn with_prefix(self, prefix: &'static str) -> MockApi
pub fn with_prefix(self, prefix: &'static str) -> MockApi
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) -> Result<Addr, StdError>
fn addr_validate(&self, input: &str) -> Result<Addr, StdError>
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) -> Result<CanonicalAddr, StdError>
fn addr_canonicalize(&self, input: &str) -> Result<CanonicalAddr, StdError>
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) -> Result<Addr, StdError>
fn addr_humanize(&self, canonical: &CanonicalAddr) -> Result<Addr, StdError>
Takes a canonical address and returns a human readable address.
This is the inverse of
addr_canonicalize
.fn bls12_381_aggregate_g1( &self, g1s: &[u8], ) -> Result<[u8; 48], VerificationError>
fn bls12_381_aggregate_g2( &self, g2s: &[u8], ) -> Result<[u8; 96], VerificationError>
Source§fn bls12_381_pairing_equality(
&self,
ps: &[u8],
qs: &[u8],
r: &[u8],
s: &[u8],
) -> Result<bool, VerificationError>
fn bls12_381_pairing_equality( &self, ps: &[u8], qs: &[u8], r: &[u8], s: &[u8], ) -> Result<bool, VerificationError>
Checks the following pairing equality: Read more
fn bls12_381_hash_to_g1( &self, hash_function: HashFunction, msg: &[u8], dst: &[u8], ) -> Result<[u8; 48], VerificationError>
fn bls12_381_hash_to_g2( &self, hash_function: HashFunction, msg: &[u8], dst: &[u8], ) -> Result<[u8; 96], VerificationError>
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 secp256r1_verify( &self, message_hash: &[u8], signature: &[u8], public_key: &[u8], ) -> Result<bool, VerificationError>
fn secp256r1_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
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>
Converts
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>
Converts
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