CosmwasmEventExt

Trait CosmwasmEventExt 

Source
pub trait CosmwasmEventExt {
Show 24 methods // Required methods fn has_attr(&self, key: &str) -> bool; fn try_map_attr<B>(&self, key: &str, f: impl Fn(&str) -> B) -> Option<B>; // Provided methods fn try_json_attr<B: DeserializeOwned>(&self, key: &str) -> Result<Option<B>> { ... } fn json_attr<B: DeserializeOwned>(&self, key: &str) -> Result<B> { ... } fn u64_attr(&self, key: &str) -> Result<u64> { ... } fn try_u64_attr(&self, key: &str) -> Result<Option<u64>> { ... } fn timestamp_attr(&self, key: &str) -> Result<Timestamp> { ... } fn try_timestamp_attr(&self, key: &str) -> Result<Option<Timestamp>> { ... } fn decimal_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<T> { ... } fn non_zero_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<NonZero<T>> { ... } fn signed_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<Signed<T>> { ... } fn number_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<Signed<T>> { ... } fn try_number_attr<T: UnsignedDecimal>( &self, key: &str, ) -> Result<Option<Signed<T>>> { ... } fn try_decimal_attr<T: UnsignedDecimal>( &self, key: &str, ) -> Result<Option<T>> { ... } fn try_price_base_in_quote( &self, key: &str, ) -> Result<Option<PriceBaseInQuote>> { ... } fn string_attr(&self, key: &str) -> Result<String> { ... } fn bool_attr(&self, key: &str) -> Result<bool> { ... } fn direction_attr(&self, key: &str) -> Result<DirectionToBase> { ... } fn leverage_to_base_attr(&self, key: &str) -> Result<LeverageToBase> { ... } fn try_leverage_to_base_attr( &self, key: &str, ) -> Result<Option<LeverageToBase>> { ... } fn unchecked_addr_attr(&self, key: &str) -> Result<Addr> { ... } fn try_unchecked_addr_attr(&self, key: &str) -> Result<Option<Addr>> { ... } fn map_attr_ok<B>(&self, key: &str, f: impl Fn(&str) -> B) -> Result<B> { ... } fn map_attr_result<B>( &self, key: &str, f: impl Fn(&str) -> Result<B>, ) -> Result<B> { ... }
}
Expand description

Extension trait to add methods to native cosmwasm events

Required Methods§

Source

fn has_attr(&self, key: &str) -> bool

Does the event have the given attribute?

Source

fn try_map_attr<B>(&self, key: &str, f: impl Fn(&str) -> B) -> Option<B>

Parse the value associated with the key, if it exists

Provided Methods§

Source

fn try_json_attr<B: DeserializeOwned>(&self, key: &str) -> Result<Option<B>>

Parse the value associated with the key as JSON, if it exists

Source

fn json_attr<B: DeserializeOwned>(&self, key: &str) -> Result<B>

Parse the value associated with the key as JSON

Source

fn u64_attr(&self, key: &str) -> Result<u64>

Parse the value associated with the key as a u64

Source

fn try_u64_attr(&self, key: &str) -> Result<Option<u64>>

Parse the value associated with the key as a u64, if it exists

Source

fn timestamp_attr(&self, key: &str) -> Result<Timestamp>

Parse a timestamp attribute

Source

fn try_timestamp_attr(&self, key: &str) -> Result<Option<Timestamp>>

Parse a timestamp attribute, if it exists

Source

fn decimal_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<T>

Parse an unsigned decimal attribute

Source

fn non_zero_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<NonZero<T>>

Parse a non-zero (strictly positive) decimal attribute

Source

fn signed_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<Signed<T>>

Parse a signed decimal attribute

Source

fn number_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<Signed<T>>

Parse a signed decimal attribute

Source

fn try_number_attr<T: UnsignedDecimal>( &self, key: &str, ) -> Result<Option<Signed<T>>>

Parse an optional signed decimal attribute

Source

fn try_decimal_attr<T: UnsignedDecimal>(&self, key: &str) -> Result<Option<T>>

Parse an optional unsigned decimal attribute

Source

fn try_price_base_in_quote(&self, key: &str) -> Result<Option<PriceBaseInQuote>>

Parse an optional price

Source

fn string_attr(&self, key: &str) -> Result<String>

Parse a string attribute

Source

fn bool_attr(&self, key: &str) -> Result<bool>

Parse a bool-as-string attribute

Source

fn direction_attr(&self, key: &str) -> Result<DirectionToBase>

Parse an attribute with a position direction (to base)

Source

fn leverage_to_base_attr(&self, key: &str) -> Result<LeverageToBase>

Parse an attribute with the absolute leverage (to base)

Source

fn try_leverage_to_base_attr(&self, key: &str) -> Result<Option<LeverageToBase>>

Parse an optional attribute with the absolute leverage (to base)

Source

fn unchecked_addr_attr(&self, key: &str) -> Result<Addr>

Parse an address attribute without checking validity

Source

fn try_unchecked_addr_attr(&self, key: &str) -> Result<Option<Addr>>

Parse an optional address attribute without checking validity

Source

fn map_attr_ok<B>(&self, key: &str, f: impl Fn(&str) -> B) -> Result<B>

Require an attribute and apply a function to the raw string value

Source

fn map_attr_result<B>( &self, key: &str, f: impl Fn(&str) -> Result<B>, ) -> Result<B>

Require an attribute and try to parse its value with the given function

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§