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>(&self, key: &str) -> Result<Option<B>, Error> where B: DeserializeOwned { ... } fn json_attr<B>(&self, key: &str) -> Result<B, Error> where B: DeserializeOwned { ... } fn u64_attr(&self, key: &str) -> Result<u64, Error> { ... } fn try_u64_attr(&self, key: &str) -> Result<Option<u64>, Error> { ... } fn timestamp_attr(&self, key: &str) -> Result<Timestamp, Error> { ... } fn try_timestamp_attr(&self, key: &str) -> Result<Option<Timestamp>, Error> { ... } fn decimal_attr<T>(&self, key: &str) -> Result<T, Error> where T: UnsignedDecimal { ... } fn non_zero_attr<T>(&self, key: &str) -> Result<NonZero<T>, Error> where T: UnsignedDecimal { ... } fn signed_attr<T>(&self, key: &str) -> Result<Signed<T>, Error> where T: UnsignedDecimal { ... } fn number_attr<T>(&self, key: &str) -> Result<Signed<T>, Error> where T: UnsignedDecimal { ... } fn try_number_attr<T>(&self, key: &str) -> Result<Option<Signed<T>>, Error> where T: UnsignedDecimal { ... } fn try_decimal_attr<T>(&self, key: &str) -> Result<Option<T>, Error> where T: UnsignedDecimal { ... } fn try_price_base_in_quote( &self, key: &str ) -> Result<Option<PriceBaseInQuote>, Error> { ... } fn string_attr(&self, key: &str) -> Result<String, Error> { ... } fn bool_attr(&self, key: &str) -> Result<bool, Error> { ... } fn direction_attr(&self, key: &str) -> Result<DirectionToBase, Error> { ... } fn leverage_to_base_attr(&self, key: &str) -> Result<LeverageToBase, Error> { ... } fn try_leverage_to_base_attr( &self, key: &str ) -> Result<Option<LeverageToBase>, Error> { ... } fn unchecked_addr_attr(&self, key: &str) -> Result<Addr, Error> { ... } fn try_unchecked_addr_attr(&self, key: &str) -> Result<Option<Addr>, Error> { ... } fn map_attr_ok<B>( &self, key: &str, f: impl Fn(&str) -> B ) -> Result<B, Error> { ... } fn map_attr_result<B>( &self, key: &str, f: impl Fn(&str) -> Result<B, Error> ) -> Result<B, Error> { ... }
}
Expand description

Extension trait to add methods to native cosmwasm events

Required Methods§

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

Does the event have the given attribute?

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§

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

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

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

Parse the value associated with the key as JSON

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

Parse the value associated with the key as a u64

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

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

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

Parse a timestamp attribute

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

Parse a timestamp attribute, if it exists

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

Parse an unsigned decimal attribute

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

Parse a non-zero (strictly positive) decimal attribute

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

Parse a signed decimal attribute

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

Parse a signed decimal attribute

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

Parse an optional signed decimal attribute

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

Parse an optional unsigned decimal attribute

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

Parse an optional price

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

Parse a string attribute

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

Parse a bool-as-string attribute

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

Parse an attribute with a position direction (to base)

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

Parse an attribute with the absolute leverage (to base)

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

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

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

Parse an address attribute without checking validity

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

Parse an optional address attribute without checking validity

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

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

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

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

Object Safety§

This trait is not object safe.

Implementors§