Struct alloy_json_abi::Event
source · pub struct Event {
pub name: String,
pub inputs: Vec<EventParam>,
pub anonymous: bool,
}
Expand description
A JSON ABI event.
Fields§
§name: String
The name of the event.
inputs: Vec<EventParam>
A list of the event’s inputs, in order.
anonymous: bool
Whether 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.