{"id":15642071,"url":"https://github.com/iamdefinitelyahuman/eth-event","last_synced_at":"2025-04-09T22:12:30.441Z","repository":{"id":51154021,"uuid":"164251510","full_name":"iamdefinitelyahuman/eth-event","owner":"iamdefinitelyahuman","description":"Tools for Ethereum event decoding and topic generation.","archived":false,"fork":false,"pushed_at":"2024-05-21T07:31:05.000Z","size":129,"stargazers_count":66,"open_issues_count":6,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T22:12:24.694Z","etag":null,"topics":["ethereum","web3py"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamdefinitelyahuman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-05T21:11:37.000Z","updated_at":"2024-12-05T17:35:11.000Z","dependencies_parsed_at":"2024-06-18T18:51:30.404Z","dependency_job_id":null,"html_url":"https://github.com/iamdefinitelyahuman/eth-event","commit_stats":{"total_commits":89,"total_committers":7,"mean_commits":"12.714285714285714","dds":0.651685393258427,"last_synced_commit":"ee4558eb47eb6f946ac1c9506e0ffb54ef3455d1"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamdefinitelyahuman%2Feth-event","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamdefinitelyahuman%2Feth-event/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamdefinitelyahuman%2Feth-event/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamdefinitelyahuman%2Feth-event/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamdefinitelyahuman","download_url":"https://codeload.github.com/iamdefinitelyahuman/eth-event/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119294,"owners_count":21050755,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","web3py"],"created_at":"2024-10-03T11:54:09.061Z","updated_at":"2025-04-09T22:12:30.427Z","avatar_url":"https://github.com/iamdefinitelyahuman.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eth-event\n\n[![Pypi Status](https://img.shields.io/pypi/v/eth-event.svg)](https://pypi.org/project/eth-event/) [![Build Status](https://img.shields.io/github/actions/workflow/status/iamdefinitelyahuman/eth-event/main.yaml?branch=master)](https://github.com/iamdefinitelyahuman/eth-event/actions) [![Coverage Status](https://img.shields.io/codecov/c/github/iamdefinitelyahuman/eth-event)](https://codecov.io/gh/iamdefinitelyahuman/eth-event)\n\nTools for Ethereum event decoding and topic generation.\n\n## Installation\n\nYou can install the latest release via `pip`:\n\n```bash\npip install eth-event\n```\n\nOr clone the repository and use `setuptools` for the most up-to-date version:\n\n```bash\ngit clone https://github.com/iamdefinitelyahuman/eth-event.git\ncd eth-event\npython3 setup.py install\n```\n\n## Usage\n\nThe public API is well documented within the docstrings. The following example may also help:\n\n```python\n\u003e\u003e\u003e from eth_event import get_topic_map\n\n# generating a topic map\n\u003e\u003e\u003e abi = open('abi.json').read()\n\u003e\u003e\u003e topic_map = get_topic_map(abi)\n\u003e\u003e\u003e topic_map\n{\n    '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef': {\n        'name': 'Transfer',\n        'inputs': [\n            {'name': 'from', 'type': 'address', 'indexed': True},\n            {'name': 'to', 'type': 'address', 'indexed': True},\n            {'name': 'value', 'type': 'uint256', 'indexed': False}\n        ]\n    }\n}\n\n# decoding event logs from a transaction receipt\n\u003e\u003e\u003e tx = token.transfer(account[1], 100, {'from': account[0]})\n\u003cTransaction object '0x615a157e84715d5f960a38fe2a3ddb566c8393cfc71f15b06170a0eff74dfdde'\u003e\n\u003e\u003e\u003e eth_event.decode_logs(tx.logs, topic_map)\n[{\n    'name': 'Transfer',\n    'address': \"0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87\",\n    'data': [\n        {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True},\n        {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True},\n        {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True}\n    ],\n    'logIndex': 0,\n    'blockNumber': 0,\n    'transactionIndex': 0\n}]\n\n# decoding a structLog from Geth's debug_traceTransaction endpoint\n\u003e\u003e\u003e trace = web3.provider.make_request(\n    \"debug_traceTransaction\",\n    ['0x615a157e84715d5f960a38fe2a3ddb566c8393cfc71f15b06170a0eff74dfdde', {}]\n)\n\u003e\u003e\u003e struct_log = trace['result']['structLogs']\n\n\u003e\u003e\u003e eth_event.decode_trace(struct_log, topic_map, initial_address=\"0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87\")\n[{\n    'name': 'Transfer',\n    'address': \"0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87\",\n    'data': [\n        {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True},\n        {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True},\n        {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True}\n    ],\n}]\n```\n\n## Limitations\n\n* If an array is indexed in an event, the topic is generated as a sha3 hash and so cannot be decoded. In this case, the undecoded topic is returned and `decoded` is set to `False`.\n\n* Anonymous events cannot be decoded. Use the `allow_undecoded` kwarg when calling `decode_logs` and `decode_trace` to receive the undecoded log without raising an exception.\n\n* When decoding a trace, the initial address for the call cannot be determined. To include addresses where decoded events were emitted you must supply the initial address with the `initial_address` keyword argument.\n\n## Tests\n\nTo run the test suite:\n\n```bash\n$ tox\n```\n\n## Development\n\nThis project is still in development. Comments, questions, criticisms and pull requests are welcomed.\n\n## License\n\nThis project is licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamdefinitelyahuman%2Feth-event","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamdefinitelyahuman%2Feth-event","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamdefinitelyahuman%2Feth-event/lists"}