#[non_exhaustive]
pub struct Event { pub ty: String, pub attributes: Vec<Attribute>, }
Expand description

A full Cosmos SDK event.

This version uses string attributes (similar to Cosmos SDK StringEvent), which then get magically converted to bytes for Tendermint somewhere between the Rust-Go interface, JSON deserialization and the NewEvent call in Cosmos SDK.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§ty: String

The event type. This is renamed to “ty” because “type” is reserved in Rust. This sucks, we know.

§attributes: Vec<Attribute>

The attributes to be included in the event.

You can learn more about these from Cosmos SDK docs.

Implementations§

§

impl Event

pub fn new(ty: impl Into<String>) -> Event

Create a new event with the given type and an empty list of attributes.

pub fn add_attribute( self, key: impl Into<String>, value: impl Into<String> ) -> Event

Add an attribute to the event.

pub fn add_attributes<A>(self, attrs: impl IntoIterator<Item = A>) -> Eventwhere A: Into<Attribute>,

Bulk add attributes to the event.

Anything that can be turned into an iterator and yields something that can be converted into an Attribute is accepted.

Trait Implementations§

§

impl Clone for Event

§

fn clone(&self) -> Event

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl CosmwasmEventExt for Event

§

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
§

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
§

impl Debug for Event

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for Event

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Event, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&FundingPaymentEvent> for Event

source§

fn from(src: &FundingPaymentEvent) -> Self

Converts to this type from the input type.
source§

impl From<&InsufficientMarginEvent> for Event

source§

fn from(_: &InsufficientMarginEvent) -> Self

Converts to this type from the input type.
source§

impl From<AllowanceChangeEvent> for Event

source§

fn from(src: AllowanceChangeEvent) -> Self

Converts to this type from the input type.
source§

impl From<ApprovalEvent> for Event

source§

fn from(src: ApprovalEvent) -> Self

Converts to this type from the input type.
source§

impl From<ApproveAllEvent> for Event

source§

fn from(src: ApproveAllEvent) -> Self

Converts to this type from the input type.
source§

impl From<BorrowFeeChangeEvent> for Event

source§

fn from(_: BorrowFeeChangeEvent) -> Self

Converts to this type from the input type.
source§

impl From<BurnEvent> for Event

source§

fn from(src: BurnEvent) -> Self

Converts to this type from the input type.
source§

impl From<BurnEvent> for Event

source§

fn from(src: BurnEvent) -> Self

Converts to this type from the input type.
source§

impl From<CancelLimitOrderEvent> for Event

source§

fn from(src: CancelLimitOrderEvent) -> Self

Converts to this type from the input type.
source§

impl From<CrankExecBatchEvent> for Event

source§

fn from(_: CrankExecBatchEvent) -> Self

Converts to this type from the input type.
source§

impl From<CrankFeeEarnedEvent> for Event

source§

fn from(_: CrankFeeEarnedEvent) -> Self

Converts to this type from the input type.
source§

impl From<CrankFeeEvent> for Event

source§

fn from(_: CrankFeeEvent) -> Self

Converts to this type from the input type.
source§

impl From<CrankWorkInfoEvent> for Event

source§

fn from(_: CrankWorkInfoEvent) -> Self

Converts to this type from the input type.
source§

impl From<DeferredExecExecutedEvent> for Event

source§

fn from(_: DeferredExecExecutedEvent) -> Self

Converts to this type from the input type.
source§

impl From<DeferredExecQueuedEvent> for Event

source§

fn from(_: DeferredExecQueuedEvent) -> Self

Converts to this type from the input type.
source§

impl From<DeltaNeutralityFeeEvent> for Event

source§

fn from(src: DeltaNeutralityFeeEvent) -> Self

Converts to this type from the input type.
source§

impl From<DeltaNeutralityRatioEvent> for Event

source§

fn from(_: DeltaNeutralityRatioEvent) -> Self

Converts to this type from the input type.
source§

impl From<DepositEvent> for Event

source§

fn from(src: DepositEvent) -> Self

Converts to this type from the input type.
source§

impl From<ExecuteLimitOrderEvent> for Event

source§

fn from(src: ExecuteLimitOrderEvent) -> Self

Converts to this type from the input type.
source§

impl From<FeeEvent> for Event

source§

fn from(_: FeeEvent) -> Self

Converts to this type from the input type.
source§

impl From<FeesReturnedEvent> for Event

source§

fn from(_: FeesReturnedEvent) -> Self

Converts to this type from the input type.
source§

impl From<FundingPaymentEvent> for Event

source§

fn from(src: FundingPaymentEvent) -> Self

Converts to this type from the input type.
source§

impl From<FundingRateChangeEvent> for Event

source§

fn from(_: FundingRateChangeEvent) -> Self

Converts to this type from the input type.
§

impl<'a> From<IbcChannelCloseEvent<'a>> for Event

§

fn from(src: IbcChannelCloseEvent<'_>) -> Event

Converts to this type from the input type.
§

impl<'a> From<IbcChannelConnectEvent<'a>> for Event

§

fn from(src: IbcChannelConnectEvent<'_>) -> Event

Converts to this type from the input type.
source§

impl From<InstantiateEvent> for Event

source§

fn from(_: InstantiateEvent) -> Self

Converts to this type from the input type.
source§

impl From<InstantiateEvent> for Event

source§

fn from(_: InstantiateEvent) -> Self

Converts to this type from the input type.
source§

impl From<InsufficientMarginEvent> for Event

source§

fn from(event: InsufficientMarginEvent) -> Self

Converts to this type from the input type.
source§

impl From<LiquidityPoolSizeEvent> for Event

source§

fn from(src: LiquidityPoolSizeEvent) -> Self

Converts to this type from the input type.
source§

impl From<LockEvent> for Event

source§

fn from(src: LockEvent) -> Self

Converts to this type from the input type.
source§

impl From<LockUpdateEvent> for Event

source§

fn from(src: LockUpdateEvent) -> Self

Converts to this type from the input type.
source§

impl<'a> From<LogoChangeEvent<'a>> for Event

source§

fn from(src: LogoChangeEvent<'_>) -> Self

Converts to this type from the input type.
source§

impl From<LpActionEvent> for Event

source§

fn from(src: LpActionEvent) -> Self

Converts to this type from the input type.
source§

impl From<LpDepositEvent> for Event

source§

fn from(src: LpDepositEvent) -> Self

Converts to this type from the input type.
source§

impl From<LpYieldEvent> for Event

source§

fn from(_: LpYieldEvent) -> Self

Converts to this type from the input type.
source§

impl From<MarketingChangeEvent> for Event

source§

fn from(src: MarketingChangeEvent) -> Self

Converts to this type from the input type.
source§

impl From<MigrateEvent> for Event

source§

fn from(_: MigrateEvent) -> Self

Converts to this type from the input type.
source§

impl From<MintEvent> for Event

source§

fn from(src: MintEvent) -> Self

Converts to this type from the input type.
source§

impl From<MintEvent> for Event

source§

fn from(src: MintEvent) -> Self

Converts to this type from the input type.
source§

impl From<MinterChangeEvent> for Event

source§

fn from(src: MinterChangeEvent) -> Self

Converts to this type from the input type.
source§

impl From<NewCodeIdEvent> for Event

source§

fn from(_: NewCodeIdEvent) -> Self

Converts to this type from the input type.
source§

impl From<NewTracker> for Event

source§

fn from(_: NewTracker) -> Self

Converts to this type from the input type.
source§

impl From<PlaceLimitOrderEvent> for Event

source§

fn from(src: PlaceLimitOrderEvent) -> Self

Converts to this type from the input type.
source§

impl From<PnlEvent> for Event

source§

fn from(src: PnlEvent) -> Self

Converts to this type from the input type.
source§

impl From<PositionActionEvent> for Event

source§

fn from(src: PositionActionEvent) -> Self

Converts to this type from the input type.
source§

impl From<PositionOpenEvent> for Event

source§

fn from(src: PositionOpenEvent) -> Self

Converts to this type from the input type.
source§

impl From<PositionSaveEvent> for Event

source§

fn from(_: PositionSaveEvent) -> Self

Converts to this type from the input type.
source§

impl From<PositionUpdateEvent> for Event

source§

fn from(_: PositionUpdateEvent) -> Self

Converts to this type from the input type.
source§

impl From<RevokeAllEvent> for Event

source§

fn from(src: RevokeAllEvent) -> Self

Converts to this type from the input type.
source§

impl From<RevokeEvent> for Event

source§

fn from(src: RevokeEvent) -> Self

Converts to this type from the input type.
source§

impl From<SendEvent> for Event

source§

fn from(src: SendEvent) -> Self

Converts to this type from the input type.
source§

impl From<SpotPriceEvent> for Event

source§

fn from(src: SpotPriceEvent) -> Self

Converts to this type from the input type.
source§

impl From<TapEvent> for Event

source§

fn from(src: TapEvent) -> Self

Converts to this type from the input type.
source§

impl From<TradeVolumeEvent> for Event

source§

fn from(src: TradeVolumeEvent) -> Self

Converts to this type from the input type.
source§

impl From<TransferEvent> for Event

source§

fn from(src: TransferEvent) -> Self

Converts to this type from the input type.
source§

impl From<TransferEvent> for Event

source§

fn from(src: TransferEvent) -> Self

Converts to this type from the input type.
source§

impl From<UnlockEvent> for Event

source§

fn from(src: UnlockEvent) -> Self

Converts to this type from the input type.
source§

impl From<WithdrawEvent> for Event

source§

fn from(src: WithdrawEvent) -> Self

Converts to this type from the input type.
§

impl JsonSchema for Event

§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
§

fn json_schema(gen: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
§

impl PartialEq<&Event> for Event

§

fn eq(&self, rhs: &&Event) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<'a> PartialEq<Event> for &'a Event

§

fn eq(&self, rhs: &Event) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for Event

§

fn eq(&self, other: &Event) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl Serialize for Event

§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl TryFrom<Event> for BorrowFeeChangeEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Event> for BurnEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for CancelLimitOrderEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Event> for CrankFeeEarnedEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for CrankFeeEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for CrankWorkInfo

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for CrankWorkInfoEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for DeferredExecExecutedEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for DeferredExecQueuedEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for DeltaNeutralityRatioEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for ExecuteLimitOrderEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Event> for FeeEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for FundingPaymentEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for FundingRateChangeEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for InstantiateEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for LiquidityPoolSizeEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for LpActionEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for LpDepositEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for LpYieldEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for MintEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
§

impl TryFrom<Event> for PerpError

§

type Error = Error

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

fn try_from(evt: Event) -> Result<PerpError, Error>

Performs the conversion.
source§

impl TryFrom<Event> for PlaceLimitOrderEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Event> for PnlEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for PositionActionEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for PositionAttributes

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for PositionCloseEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for PositionOpenEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for PositionUpdateEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for SpotPriceEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Event> for TradeVolumeEvent

§

type Error = Error

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

fn try_from(evt: Event) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<PositionCloseEvent> for Event

§

type Error = Error

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

fn try_from(_: PositionCloseEvent) -> Result<Self>

Performs the conversion.
§

impl Eq for Event

§

impl StructuralEq for Event

§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> Twhere 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 Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> QueryResultExt for Twhere T: Serialize,

§

fn query_result(&self) -> Result<Binary, Error>

Convert the value to its JSON representation
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,