Struct clone_cw_multi_test::addons::MockApiBech32m

source ·
pub struct MockApiBech32m(/* private fields */);
Expand description

Implementation of the Api trait that uses Bech32m format for humanizing canonical addresses.

Implementations§

source§

impl MockApiBech32m

source

pub fn new(prefix: &'static str) -> Self

Returns Api implementation that uses specified prefix to generate addresses in Bech32m format.

§Example
use cw_multi_test::addons::MockApiBech32m;

let api = MockApiBech32m::new("osmosis");
let addr = api.addr_make("sender");
assert_eq!(addr.as_str(),
           "osmosis1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qgv9940");
source§

impl MockApiBech32m

source

pub fn addr_make(&self, input: &str) -> Addr

Returns an address in Bech32m format, built from provided input string.

§Example
use cw_multi_test::addons::MockApiBech32m;

let api = MockApiBech32m::new("osmosis");
let addr = api.addr_make("sender");
assert_eq!(addr.as_str(),
           "osmosis1pgm8hyk0pvphmlvfjc8wsvk4daluz5tgrw6pu5mfpemk74uxnx9qgv9940");
§Panics

This function panics when generating a valid address in Bech32 format is not possible, especially when prefix is too long or empty.

Trait Implementations§

source§

impl Api for MockApiBech32m

source§

fn addr_validate(&self, input: &str) -> StdResult<Addr>

Takes a human readable address in Bech32m format and checks if it is valid.

If the validation succeeds, an Addr containing the same string as the input is returned.

§Example
use cosmwasm_std::Api;
use cw_multi_test::addons::MockApiBech32m;

let api = MockApiBech32m::new("osmosis");
let addr = api.addr_make("sender");
assert_eq!(api.addr_validate(addr.as_str()).unwrap().as_str(),
           addr.as_str());
source§

fn addr_canonicalize(&self, input: &str) -> StdResult<CanonicalAddr>

Takes a human readable address in Bech32m format and returns a canonical binary representation of it.

§Example
use cosmwasm_std::Api;
use cw_multi_test::addons::MockApiBech32;

let api = MockApiBech32::new("osmosis");
let addr = api.addr_make("sender");
assert_eq!(api.addr_canonicalize(addr.as_str()).unwrap().to_string(),
           "0A367B92CF0B037DFD89960EE832D56F7FC151681BB41E53690E776F5786998A");
source§

fn addr_humanize(&self, canonical: &CanonicalAddr) -> StdResult<Addr>

Takes a canonical address and returns a human readable address in Bech32m format.

This is the inverse operation of addr_canonicalize.

§Example
use cosmwasm_std::Api;
use cw_multi_test::addons::MockApiBech32m;

let api = MockApiBech32m::new("osmosis");
let addr = api.addr_make("sender");
let canonical_addr = api.addr_canonicalize(addr.as_str()).unwrap();
assert_eq!(api.addr_humanize(&canonical_addr).unwrap().as_str(),
           addr.as_str());
source§

fn secp256k1_verify( &self, message_hash: &[u8], signature: &[u8], public_key: &[u8], ) -> Result<bool, VerificationError>

source§

fn secp256k1_recover_pubkey( &self, message_hash: &[u8], signature: &[u8], recovery_param: u8, ) -> Result<Vec<u8>, RecoverPubkeyError>

source§

fn ed25519_verify( &self, message: &[u8], signature: &[u8], public_key: &[u8], ) -> Result<bool, VerificationError>

source§

fn ed25519_batch_verify( &self, messages: &[&[u8]], signatures: &[&[u8]], public_keys: &[&[u8]], ) -> Result<bool, VerificationError>

source§

fn debug(&self, message: &str)

Emits a debugging message that is handled depending on the environment (typically printed to console or ignored). Those messages are not persisted to chain.
source§

fn bls12_381_aggregate_g1( &self, g1s: &[u8], ) -> Result<[u8; 48], VerificationError>

source§

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>

Checks the following pairing equality: Read more
source§

fn bls12_381_hash_to_g1( &self, hash_function: HashFunction, msg: &[u8], dst: &[u8], ) -> Result<[u8; 48], VerificationError>

source§

fn bls12_381_hash_to_g2( &self, hash_function: HashFunction, msg: &[u8], dst: &[u8], ) -> Result<[u8; 96], VerificationError>

source§

fn secp256r1_verify( &self, message_hash: &[u8], signature: &[u8], public_key: &[u8], ) -> Result<bool, VerificationError>

source§

fn secp256r1_recover_pubkey( &self, message_hash: &[u8], signature: &[u8], recovery_param: u8, ) -> Result<Vec<u8>, RecoverPubkeyError>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<U> As for U

source§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Pointee for T

source§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

source§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
source§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
source§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more