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

Subscribe to events with callback #1423

Merged
merged 20 commits into from
May 15, 2022

Conversation

YerimB
Copy link
Contributor

@YerimB YerimB commented Feb 6, 2022

What I did

Made able to subscribe to a contract's event and setting a callback on it.
Also created a way to retrieve events from previously mined blocks.

Related issue: #1162 #327

How I did it

Using the network.alert.Alert class and the web3.py ContractEvents & ContractEvent class.
Created a ContractEvents class inheririting from the web3.py class of the same name.
This class adds two "public" functions to the web3.py one :

How to verify it

I created some tests but should probably write more (taking any test idea if you got some).
If you notice anything please tell me, I would very much like to improve the way it works.

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation
  • I have added an entry to the changelog

@YerimB YerimB closed this Feb 18, 2022
@YerimB YerimB deleted the events_1 branch February 18, 2022 09:42
@YerimB YerimB restored the events_1 branch February 18, 2022 09:43
@YerimB
Copy link
Contributor Author

YerimB commented Feb 18, 2022

Accidentally closed branch

@YerimB YerimB reopened this Feb 18, 2022
@YerimB YerimB marked this pull request as draft February 18, 2022 15:14
Reducing lines at the same time
@YerimB
Copy link
Contributor Author

YerimB commented Feb 24, 2022

Another version that I find better than this one : here

@iamdefinitelyahuman iamdefinitelyahuman merged commit 4ff9846 into eth-brownie:master May 15, 2022
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

Successfully merging this pull request may close these issues.

2 participants