Skip to main content

core.classes.contract_events

ContractEvents Objects

class ContractEvents(Generic[TContractABI])

add_transaction_listener

def add_transaction_listener(listener: Callable[[TxEvent], Any])

Add a listener for transaction events to this contract. This will be called

whenever a transaction event is executed from the SDK interface.

Arguments:

  • listener: The listener function to be called on transaction events.

remove_transaction_listener

def remove_transaction_listener(listener: Callable[[TxEvent], Any])

Remove a listener from transaction events.

Arguments:

  • listener: The listener function to be removed.

add_event_listener

def add_event_listener(event_name: str, listener: Callable[[Dict[str, Any]],
None])

Add an event listener to this contract to listen for a specific event type.

Arguments:

  • event_name: The name of the event to listen for.
  • listener: The listener function to be called on the event.

remove_event_listener

def remove_event_listener(event_name: str, listener)

Remove an event listener listening to a specific event type.

Arguments:

  • event_name: The name of the event to stop listening for.
  • listener: The listener function to be removed.

remove_all_listeners

def remove_all_listeners()

Remove all event listeners from this contract.

get_events

def get_events(
event_name: str, options: EventQueryOptions = EventQueryOptions()
) -> Tuple[AttributeDict]

Query past events of a specific type on the contract.

Arguments:

  • event_name: The name of the event to query.
  • options: The options to use when querying for events, including block range specifications and filters

Returns:

A list of events.