pub struct Event {
pub name: String,
pub inputs: Vec<EventParam>,
pub anonymous: bool,
}Expand description
A JSON ABI event.
Fields§
§name: StringThe name of the event.
inputs: Vec<EventParam>A list of the event’s inputs, in order.
anonymous: boolWhether the event is anonymous. Anonymous events do not have their signature included in the topic 0. Instead, the indexed arguments are 0-indexed.
Implementations§
Source§impl Event
impl Event
Sourcepub fn parse(s: &str) -> Result<Self>
pub fn parse(s: &str) -> Result<Self>
Parses a Solidity event signature string: $(event)? $name($($inputs),*) $(anonymous)?
If you want to parse a generic Human-Readable ABI string, use AbiItem::parse.
§Examples
assert_eq!(
Event::parse("event foo(bool bar, uint indexed baz)"),
Ok(Event {
name: "foo".to_string(),
inputs: vec![
EventParam::parse("bool bar").unwrap(),
EventParam::parse("uint indexed baz").unwrap()
],
anonymous: false,
}),
);Sourcepub fn signature(&self) -> String
pub fn signature(&self) -> String
Returns this event’s signature: $name($($inputs),*).
This is the preimage input used to compute the selector.
Sourcepub fn full_signature(&self) -> String
pub fn full_signature(&self) -> String
Returns this event’s full signature
event $name($($inputs indexed $names),*).
This is a full human-readable string, including all parameter names, any optional modifiers (e.g. indexed) and white-space to aid in human readability. This is useful for storing a string which can still fully reconstruct the original Fragment
Sourcepub fn num_topics(&self) -> usize
pub fn num_topics(&self) -> usize
Computes the number of this event’s indexed topics.