Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an event handlers interface in the worker #129

Open
smallyunet opened this issue Jan 9, 2025 · 0 comments
Open

Add an event handlers interface in the worker #129

smallyunet opened this issue Jan 9, 2025 · 0 comments

Comments

@smallyunet
Copy link

Feature description

In our use case, we need to use different modules to handle tx.Events and distribute code logic based on different events, like this:

// in module A
func (m *Module) HandleTx(tx *juno.Transaction) error {
	for _, event := range tx.Events {
		if event.Type != "tx_log" {
			continue
		}

// in module B
func (m *Module) HandleTx(tx *juno.Transaction) error {
	for _, event := range tx.Events {
		if event.Type != "evm_tx_log" {
			continue
		}

So I think there needs to be an event handler in the Module interface?

Implementation proposal

After handle tx: https://github.com/forbole/juno/blob/cosmos/v0.50.x/parser/worker.go#L342

// call the event handlers
for i, event := range tx.Events {
	w.handEvnet(i, event)
}

Add a handleEvents method to allow the module to control the process based on events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant