%global _empty_manifest_terminate_build 0 Name: python-eth-event Version: 1.2.3 Release: 1 Summary: Ethereum event decoder and topic generator License: MIT URL: https://github.com/iamdefinitelyahuman/eth-event Source0: https://mirrors.nju.edu.cn/pypi/web/packages/36/97/e67f6a0dd0b2b0563868c084005a553ce6ee0626766af8a33ed259579027/eth-event-1.2.3.tar.gz BuildArch: noarch Requires: python3-eth-abi Requires: python3-eth-hash[pycryptodome] Requires: python3-eth-utils Requires: python3-hexbytes %description # eth-event [![Pypi Status](https://img.shields.io/pypi/v/eth-event.svg)](https://pypi.org/project/eth-event/) [![Build Status](https://img.shields.io/github/workflow/status/iamdefinitelyahuman/eth-event/main%20workflow)](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) Tools for Ethereum event decoding and topic generation. ## Installation You can install the latest release via `pip`: ```bash pip install eth-event ``` Or clone the repository and use `setuptools` for the most up-to-date version: ```bash git clone https://github.com/iamdefinitelyahuman/eth-event.git cd eth-event python3 setup.py install ``` ## Usage The public API is well documented within the docstrings. The following example may also help: ```python >>> from eth_event import get_topics # generating a topic map >>> abi = open('abi.json').read() >>> topic_map = get_topic_map(abi) >>> topic_map { '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef': { 'name': 'Transfer', 'inputs': [ {'name': 'from', 'type': 'address', 'indexed': True}, {'name': 'to', 'type': 'address', 'indexed': True}, {'name': 'value', 'type': 'uint256', 'indexed': False} ] } } # decoding event logs from a transaction receipt >>> tx = token.transfer(account[1], 100, {'from': account[0]}) >>> eth_event.decode_logs(tx.logs, topic_map) [{ 'name': 'Transfer', 'address': "0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87", 'data': [ {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True} ], }] # decoding a structLog from Geth's debug_traceTransaction endpoint >>> trace = web3.provider.make_request( "debug_traceTransaction", ['0x615a157e84715d5f960a38fe2a3ddb566c8393cfc71f15b06170a0eff74dfdde', {}] ) >>> struct_log = trace['result']['structLogs'] >>> eth_event.decode_trace(struct_log, topic_map, initial_address="0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87") [{ 'name': 'Transfer', 'address': "0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87", 'data': [ {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True} ], }] ``` ## Limitations * If an array is indexed in an event, the topic is generated as a sha3 hash and so cannot be decrypted. In this case, the unencrypted topic is returned and `decoded` is set to `False`. * 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. * 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. ## Tests To run the test suite: ```bash $ tox ``` ## Development This project is still in development. Comments, questions, criticisms and pull requests are welcomed. ## License This project is licensed under the [MIT license](LICENSE). %package -n python3-eth-event Summary: Ethereum event decoder and topic generator Provides: python-eth-event BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-eth-event # eth-event [![Pypi Status](https://img.shields.io/pypi/v/eth-event.svg)](https://pypi.org/project/eth-event/) [![Build Status](https://img.shields.io/github/workflow/status/iamdefinitelyahuman/eth-event/main%20workflow)](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) Tools for Ethereum event decoding and topic generation. ## Installation You can install the latest release via `pip`: ```bash pip install eth-event ``` Or clone the repository and use `setuptools` for the most up-to-date version: ```bash git clone https://github.com/iamdefinitelyahuman/eth-event.git cd eth-event python3 setup.py install ``` ## Usage The public API is well documented within the docstrings. The following example may also help: ```python >>> from eth_event import get_topics # generating a topic map >>> abi = open('abi.json').read() >>> topic_map = get_topic_map(abi) >>> topic_map { '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef': { 'name': 'Transfer', 'inputs': [ {'name': 'from', 'type': 'address', 'indexed': True}, {'name': 'to', 'type': 'address', 'indexed': True}, {'name': 'value', 'type': 'uint256', 'indexed': False} ] } } # decoding event logs from a transaction receipt >>> tx = token.transfer(account[1], 100, {'from': account[0]}) >>> eth_event.decode_logs(tx.logs, topic_map) [{ 'name': 'Transfer', 'address': "0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87", 'data': [ {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True} ], }] # decoding a structLog from Geth's debug_traceTransaction endpoint >>> trace = web3.provider.make_request( "debug_traceTransaction", ['0x615a157e84715d5f960a38fe2a3ddb566c8393cfc71f15b06170a0eff74dfdde', {}] ) >>> struct_log = trace['result']['structLogs'] >>> eth_event.decode_trace(struct_log, topic_map, initial_address="0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87") [{ 'name': 'Transfer', 'address': "0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87", 'data': [ {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True} ], }] ``` ## Limitations * If an array is indexed in an event, the topic is generated as a sha3 hash and so cannot be decrypted. In this case, the unencrypted topic is returned and `decoded` is set to `False`. * 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. * 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. ## Tests To run the test suite: ```bash $ tox ``` ## Development This project is still in development. Comments, questions, criticisms and pull requests are welcomed. ## License This project is licensed under the [MIT license](LICENSE). %package help Summary: Development documents and examples for eth-event Provides: python3-eth-event-doc %description help # eth-event [![Pypi Status](https://img.shields.io/pypi/v/eth-event.svg)](https://pypi.org/project/eth-event/) [![Build Status](https://img.shields.io/github/workflow/status/iamdefinitelyahuman/eth-event/main%20workflow)](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) Tools for Ethereum event decoding and topic generation. ## Installation You can install the latest release via `pip`: ```bash pip install eth-event ``` Or clone the repository and use `setuptools` for the most up-to-date version: ```bash git clone https://github.com/iamdefinitelyahuman/eth-event.git cd eth-event python3 setup.py install ``` ## Usage The public API is well documented within the docstrings. The following example may also help: ```python >>> from eth_event import get_topics # generating a topic map >>> abi = open('abi.json').read() >>> topic_map = get_topic_map(abi) >>> topic_map { '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef': { 'name': 'Transfer', 'inputs': [ {'name': 'from', 'type': 'address', 'indexed': True}, {'name': 'to', 'type': 'address', 'indexed': True}, {'name': 'value', 'type': 'uint256', 'indexed': False} ] } } # decoding event logs from a transaction receipt >>> tx = token.transfer(account[1], 100, {'from': account[0]}) >>> eth_event.decode_logs(tx.logs, topic_map) [{ 'name': 'Transfer', 'address': "0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87", 'data': [ {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True} ], }] # decoding a structLog from Geth's debug_traceTransaction endpoint >>> trace = web3.provider.make_request( "debug_traceTransaction", ['0x615a157e84715d5f960a38fe2a3ddb566c8393cfc71f15b06170a0eff74dfdde', {}] ) >>> struct_log = trace['result']['structLogs'] >>> eth_event.decode_trace(struct_log, topic_map, initial_address="0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87") [{ 'name': 'Transfer', 'address': "0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87", 'data': [ {'name': 'from', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'to', 'type': 'address', 'value': '0xbd4940951bfa463f8fb6db762e55686f6cfdb73a', 'decoded': True}, {'name': 'tokens', 'type': 'uint256', 'value': 100, 'decoded': True} ], }] ``` ## Limitations * If an array is indexed in an event, the topic is generated as a sha3 hash and so cannot be decrypted. In this case, the unencrypted topic is returned and `decoded` is set to `False`. * 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. * 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. ## Tests To run the test suite: ```bash $ tox ``` ## Development This project is still in development. Comments, questions, criticisms and pull requests are welcomed. ## License This project is licensed under the [MIT license](LICENSE). %prep %autosetup -n eth-event-1.2.3 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-eth-event -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Tue Apr 25 2023 Python_Bot - 1.2.3-1 - Package Spec generated