Trait levana_perpswap_cosmos::event::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

Object Safety§

This trait is not object safe.

Implementors§