faster-eth-abi 5.2.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. faster_eth_abi-5.2.22/MANIFEST.in +14 -0
  2. faster_eth_abi-5.2.22/PKG-INFO +136 -0
  3. faster_eth_abi-5.2.22/README.md +37 -0
  4. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/__init__.pyi +9 -0
  5. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/_codec.pyi +42 -0
  6. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/_decoding.pyi +57 -0
  7. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/_encoding.pyi +41 -0
  8. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/_grammar.pyi +139 -0
  9. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/abi.pyi +10 -0
  10. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/base.pyi +16 -0
  11. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/codec.pyi +2077 -0
  12. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/constants.pyi +6 -0
  13. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/decoding.pyi +223 -0
  14. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/encoding.pyi +271 -0
  15. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/exceptions.pyi +98 -0
  16. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/from_type_str.pyi +33 -0
  17. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/grammar.pyi +49 -0
  18. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/io.pyi +66 -0
  19. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/packed.pyi +8 -0
  20. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/registry.pyi +218 -0
  21. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/tools/__init__.pyi +1 -0
  22. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/tools/_strategies.pyi +77 -0
  23. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/typing.pyi +4626 -0
  24. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/utils/__init__.pyi +0 -0
  25. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/utils/numeric.pyi +25 -0
  26. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/utils/padding.pyi +6 -0
  27. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/utils/string.pyi +7 -0
  28. faster_eth_abi-5.2.22/eth-abi-stubs/faster_eth_abi/utils/validation.pyi +4 -0
  29. faster_eth_abi-5.2.22/faster_eth_abi/__init__.py +12 -0
  30. faster_eth_abi-5.2.22/faster_eth_abi/_codec.py +83 -0
  31. faster_eth_abi-5.2.22/faster_eth_abi/_decoding.py +299 -0
  32. faster_eth_abi-5.2.22/faster_eth_abi/_encoding.py +354 -0
  33. faster_eth_abi-5.2.22/faster_eth_abi/_grammar.py +375 -0
  34. faster_eth_abi-5.2.22/faster_eth_abi/abi.py +17 -0
  35. faster_eth_abi-5.2.22/faster_eth_abi/base.py +45 -0
  36. faster_eth_abi-5.2.22/faster_eth_abi/codec.py +2809 -0
  37. faster_eth_abi-5.2.22/faster_eth_abi/constants.py +7 -0
  38. faster_eth_abi-5.2.22/faster_eth_abi/decoding.py +584 -0
  39. faster_eth_abi-5.2.22/faster_eth_abi/encoding.py +746 -0
  40. faster_eth_abi-5.2.22/faster_eth_abi/exceptions.py +127 -0
  41. faster_eth_abi-5.2.22/faster_eth_abi/from_type_str.py +141 -0
  42. faster_eth_abi-5.2.22/faster_eth_abi/grammar.py +172 -0
  43. faster_eth_abi-5.2.22/faster_eth_abi/io.py +107 -0
  44. faster_eth_abi-5.2.22/faster_eth_abi/packed.py +19 -0
  45. faster_eth_abi-5.2.22/faster_eth_abi/py.typed +0 -0
  46. faster_eth_abi-5.2.22/faster_eth_abi/registry.py +758 -0
  47. faster_eth_abi-5.2.22/faster_eth_abi/tools/__init__.py +3 -0
  48. faster_eth_abi-5.2.22/faster_eth_abi/tools/_strategies.py +243 -0
  49. faster_eth_abi-5.2.22/faster_eth_abi/typing.py +4627 -0
  50. faster_eth_abi-5.2.22/faster_eth_abi/utils/__init__.py +0 -0
  51. faster_eth_abi-5.2.22/faster_eth_abi/utils/numeric.py +117 -0
  52. faster_eth_abi-5.2.22/faster_eth_abi/utils/padding.py +22 -0
  53. faster_eth_abi-5.2.22/faster_eth_abi/utils/string.py +19 -0
  54. faster_eth_abi-5.2.22/faster_eth_abi/utils/validation.py +18 -0
  55. faster_eth_abi-5.2.22/faster_eth_abi.egg-info/PKG-INFO +136 -0
  56. faster_eth_abi-5.2.22/faster_eth_abi.egg-info/SOURCES.txt +70 -0
  57. faster_eth_abi-5.2.22/faster_eth_abi.egg-info/dependency_links.txt +1 -0
  58. faster_eth_abi-5.2.22/faster_eth_abi.egg-info/not-zip-safe +1 -0
  59. faster_eth_abi-5.2.22/faster_eth_abi.egg-info/requires.txt +59 -0
  60. faster_eth_abi-5.2.22/faster_eth_abi.egg-info/top_level.txt +1 -0
  61. faster_eth_abi-5.2.22/pyproject.toml +187 -0
  62. faster_eth_abi-5.2.22/requirements-benchmark.txt +4 -0
  63. faster_eth_abi-5.2.22/requirements-codspeed.txt +4 -0
  64. faster_eth_abi-5.2.22/requirements-dev.txt +11 -0
  65. faster_eth_abi-5.2.22/requirements-mypy.txt +4 -0
  66. faster_eth_abi-5.2.22/requirements-pytest.txt +1 -0
  67. faster_eth_abi-5.2.22/requirements-test.txt +7 -0
  68. faster_eth_abi-5.2.22/requirements-tools.txt +1 -0
  69. faster_eth_abi-5.2.22/requirements.txt +6 -0
  70. faster_eth_abi-5.2.22/setup.cfg +4 -0
  71. faster_eth_abi-5.2.22/setup.py +163 -0
  72. faster_eth_abi-5.2.22/tests/typecheck/README.md +52 -0
@@ -0,0 +1,14 @@
1
+ include requirements.txt
2
+ include requirements-*.txt
3
+ include LICENSE
4
+ include README.md
5
+
6
+ recursive-include scripts *
7
+ recursive-include tests *
8
+
9
+ global-include *.pyi
10
+
11
+ recursive-exclude * __pycache__
12
+ recursive-exclude * *.py[co]
13
+ prune .tox
14
+ prune venv*
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: faster_eth_abi
3
+ Version: 5.2.22
4
+ Summary: A ~2-6x faster fork of eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding. Implemented in C.
5
+ Home-page: https://github.com/BobTheBuidler/faster-eth-abi
6
+ Author: The Ethereum Foundation
7
+ Author-email: snakecharmers@ethereum.org
8
+ License: MIT
9
+ Project-URL: Documentation, https://eth-abi.readthedocs.io/en/stable/
10
+ Project-URL: Release Notes, https://github.com/BobTheBuidler/faster-eth-abi/releases
11
+ Project-URL: Issues, https://github.com/BobTheBuidler/faster-eth-abi/issues
12
+ Project-URL: Source - Precompiled (.py), https://github.com/BobTheBuidler/faster-eth-utils/tree/master/faster_eth_utils
13
+ Project-URL: Source - Compiled (.c), https://github.com/BobTheBuidler/faster-eth-utils/tree/master/build
14
+ Project-URL: Benchmarks, https://github.com/BobTheBuidler/faster-eth-utils/tree/master/benchmarks
15
+ Project-URL: Benchmarks - Results, https://github.com/BobTheBuidler/faster-eth-utils/tree/master/benchmarks/results
16
+ Project-URL: Original, https://github.com/ethereum/eth-abi
17
+ Keywords: ethereum
18
+ Classifier: Development Status :: 5 - Production/Stable
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: License :: OSI Approved :: MIT License
21
+ Classifier: Natural Language :: English
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.8
24
+ Classifier: Programming Language :: Python :: 3.9
25
+ Classifier: Programming Language :: Python :: 3.10
26
+ Classifier: Programming Language :: Python :: 3.11
27
+ Classifier: Programming Language :: Python :: 3.12
28
+ Classifier: Programming Language :: Python :: 3.13
29
+ Classifier: Programming Language :: Python :: 3.14
30
+ Classifier: Programming Language :: Python :: Implementation :: CPython
31
+ Requires-Python: >=3.8, <4
32
+ Description-Content-Type: text/markdown
33
+ Requires-Dist: cchecksum<0.4,>=0.3.7.dev0
34
+ Requires-Dist: faster-eth-utils==5.3.20
35
+ Requires-Dist: eth-abi==5.2.0
36
+ Requires-Dist: eth-typing==5.2.1
37
+ Requires-Dist: mypy_extensions
38
+ Requires-Dist: parsimonious<0.11.0,>=0.10.0
39
+ Provides-Extra: dev
40
+ Requires-Dist: mypy<1.18.3,>=1.14.1; extra == "dev"
41
+ Requires-Dist: tqdm; extra == "dev"
42
+ Requires-Dist: build>=0.9.0; extra == "dev"
43
+ Requires-Dist: bump_my_version>=0.19.0; extra == "dev"
44
+ Requires-Dist: ipython; extra == "dev"
45
+ Requires-Dist: mypy<1.18.3,>=1.14.1; extra == "dev"
46
+ Requires-Dist: pre-commit>=3.4.0; extra == "dev"
47
+ Requires-Dist: tox>=4.0.0; extra == "dev"
48
+ Requires-Dist: twine; extra == "dev"
49
+ Requires-Dist: wheel; extra == "dev"
50
+ Requires-Dist: pytest-benchmark; extra == "dev"
51
+ Requires-Dist: sphinx>=6.0.0; extra == "dev"
52
+ Requires-Dist: sphinx-autobuild>=2021.3.14; extra == "dev"
53
+ Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "dev"
54
+ Requires-Dist: towncrier<26,>=24; extra == "dev"
55
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
56
+ Requires-Dist: hypothesis<6.108.7,>=6.22.0; extra == "dev"
57
+ Requires-Dist: pytest-timeout>=2.0.0; extra == "dev"
58
+ Requires-Dist: pytest-xdist>=2.4.0; extra == "dev"
59
+ Requires-Dist: pytest-pythonpath>=0.7.1; extra == "dev"
60
+ Requires-Dist: eth-hash[pycryptodome]; extra == "dev"
61
+ Provides-Extra: docs
62
+ Requires-Dist: sphinx>=6.0.0; extra == "docs"
63
+ Requires-Dist: sphinx-autobuild>=2021.3.14; extra == "docs"
64
+ Requires-Dist: sphinx_rtd_theme>=1.0.0; extra == "docs"
65
+ Requires-Dist: towncrier<26,>=24; extra == "docs"
66
+ Provides-Extra: test
67
+ Requires-Dist: pytest>=7.0.0; extra == "test"
68
+ Requires-Dist: hypothesis<6.108.7,>=6.22.0; extra == "test"
69
+ Requires-Dist: pytest-timeout>=2.0.0; extra == "test"
70
+ Requires-Dist: pytest-xdist>=2.4.0; extra == "test"
71
+ Requires-Dist: pytest-pythonpath>=0.7.1; extra == "test"
72
+ Requires-Dist: eth-hash[pycryptodome]; extra == "test"
73
+ Provides-Extra: tools
74
+ Requires-Dist: hypothesis<6.108.7,>=6.22.0; extra == "tools"
75
+ Provides-Extra: codspeed
76
+ Requires-Dist: pytest>=7.0.0; extra == "codspeed"
77
+ Requires-Dist: pytest-codspeed<4.3,>=4.2; extra == "codspeed"
78
+ Requires-Dist: pytest-test-groups; extra == "codspeed"
79
+ Provides-Extra: benchmark
80
+ Requires-Dist: pytest>=7.0.0; extra == "benchmark"
81
+ Requires-Dist: pytest-codspeed<4.3,>=4.2; extra == "benchmark"
82
+ Requires-Dist: pytest-test-groups; extra == "benchmark"
83
+ Provides-Extra: mypy
84
+ Requires-Dist: mypy<1.18.3,>=1.14.1; extra == "mypy"
85
+ Requires-Dist: tqdm; extra == "mypy"
86
+ Dynamic: author
87
+ Dynamic: author-email
88
+ Dynamic: classifier
89
+ Dynamic: description
90
+ Dynamic: description-content-type
91
+ Dynamic: home-page
92
+ Dynamic: keywords
93
+ Dynamic: license
94
+ Dynamic: project-url
95
+ Dynamic: provides-extra
96
+ Dynamic: requires-dist
97
+ Dynamic: requires-python
98
+ Dynamic: summary
99
+
100
+ ### I forked eth-abi, added comprehensive type annotations, and compiled it to C. It does the same stuff, now ~2-6x faster.
101
+
102
+ [![PyPI](https://img.shields.io/pypi/v/faster-eth-abi.svg?logo=Python&logoColor=white)](https://pypi.org/project/faster-eth-abi/)
103
+ [![Monthly Downloads](https://img.shields.io/pypi/dm/faster-eth-abi)](https://pypistats.org/packages/faster-eth-abi)
104
+ [![Codspeed.io Status](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/BobTheBuidler/faster-eth-abi)
105
+
106
+ ##### This fork will be kept up-to-date with [eth-abi](https://github.com/ethereum/eth-abi). I will pull updates as they are released and push new [faster-eth-abi](https://github.com/BobTheBuidler/faster-eth-abi) releases to [PyPI](https://pypi.org/project/faster-eth-abi/).
107
+
108
+ ##### Starting in [v5.2.12](https://github.com/BobTheBuidler/faster-eth-abi/releases/tag/v5.2.12), all `faster-eth-abi` Exception classes inherit from the matching Exception class in `eth-abi`, so porting to `faster-eth-abi` does not require any change to your existing exception handlers. All existing exception handling in your codebase will continue to work as it did when originaly implemented.
109
+
110
+ ##### We benchmark `faster-eth-abi` against the original `eth-abi` for your convenience. [See results](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/benchmarks/results).
111
+
112
+ ##### You can find the compiled C code and header files in the [build](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/build) directory.
113
+
114
+ ###### You may also be interested in: [faster-web3.py](https://github.com/BobTheBuidler/faster-web3.py/), [faster-hexbytes](https://github.com/BobTheBuidler/faster-hexbytes/), and [faster-eth-utils](https://github.com/BobTheBuidler/faster-eth-utils/)
115
+
116
+ ##### The original eth-abi readme is below:
117
+
118
+ # Ethereum Contract Interface (ABI) Utility
119
+
120
+ [![Join the conversation on Discord](https://img.shields.io/discord/809793915578089484?color=blue&label=chat&logo=discord&logoColor=white)](https://discord.gg/GHryRvPB84)
121
+ [![Build Status](https://circleci.com/gh/ethereum/faster-eth-abi.svg?style=shield)](https://circleci.com/gh/ethereum/faster-eth-abi)
122
+ [![PyPI version](https://badge.fury.io/py/faster-eth-abi.svg)](https://badge.fury.io/py/faster-eth-abi)
123
+ [![Python versions](https://img.shields.io/pypi/pyversions/faster-eth-abi.svg)](https://pypi.python.org/pypi/faster-eth-abi)
124
+ [![Docs build](https://readthedocs.org/projects/faster-eth-abi/badge/?version=latest)](https://faster-eth-abi.readthedocs.io/en/latest/?badge=latest)
125
+
126
+ Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
127
+
128
+ Read the [documentation](https://faster-eth-abi.readthedocs.io/).
129
+
130
+ View the [change log](https://faster-eth-abi.readthedocs.io/en/latest/release_notes.html).
131
+
132
+ ## Installation
133
+
134
+ ```sh
135
+ python -m pip install faster-eth-abi
136
+ ```
@@ -0,0 +1,37 @@
1
+ ### I forked eth-abi, added comprehensive type annotations, and compiled it to C. It does the same stuff, now ~2-6x faster.
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/faster-eth-abi.svg?logo=Python&logoColor=white)](https://pypi.org/project/faster-eth-abi/)
4
+ [![Monthly Downloads](https://img.shields.io/pypi/dm/faster-eth-abi)](https://pypistats.org/packages/faster-eth-abi)
5
+ [![Codspeed.io Status](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/BobTheBuidler/faster-eth-abi)
6
+
7
+ ##### This fork will be kept up-to-date with [eth-abi](https://github.com/ethereum/eth-abi). I will pull updates as they are released and push new [faster-eth-abi](https://github.com/BobTheBuidler/faster-eth-abi) releases to [PyPI](https://pypi.org/project/faster-eth-abi/).
8
+
9
+ ##### Starting in [v5.2.12](https://github.com/BobTheBuidler/faster-eth-abi/releases/tag/v5.2.12), all `faster-eth-abi` Exception classes inherit from the matching Exception class in `eth-abi`, so porting to `faster-eth-abi` does not require any change to your existing exception handlers. All existing exception handling in your codebase will continue to work as it did when originaly implemented.
10
+
11
+ ##### We benchmark `faster-eth-abi` against the original `eth-abi` for your convenience. [See results](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/benchmarks/results).
12
+
13
+ ##### You can find the compiled C code and header files in the [build](https://github.com/BobTheBuidler/faster-eth-abi/tree/master/build) directory.
14
+
15
+ ###### You may also be interested in: [faster-web3.py](https://github.com/BobTheBuidler/faster-web3.py/), [faster-hexbytes](https://github.com/BobTheBuidler/faster-hexbytes/), and [faster-eth-utils](https://github.com/BobTheBuidler/faster-eth-utils/)
16
+
17
+ ##### The original eth-abi readme is below:
18
+
19
+ # Ethereum Contract Interface (ABI) Utility
20
+
21
+ [![Join the conversation on Discord](https://img.shields.io/discord/809793915578089484?color=blue&label=chat&logo=discord&logoColor=white)](https://discord.gg/GHryRvPB84)
22
+ [![Build Status](https://circleci.com/gh/ethereum/faster-eth-abi.svg?style=shield)](https://circleci.com/gh/ethereum/faster-eth-abi)
23
+ [![PyPI version](https://badge.fury.io/py/faster-eth-abi.svg)](https://badge.fury.io/py/faster-eth-abi)
24
+ [![Python versions](https://img.shields.io/pypi/pyversions/faster-eth-abi.svg)](https://pypi.python.org/pypi/faster-eth-abi)
25
+ [![Docs build](https://readthedocs.org/projects/faster-eth-abi/badge/?version=latest)](https://faster-eth-abi.readthedocs.io/en/latest/?badge=latest)
26
+
27
+ Python utilities for working with Ethereum ABI definitions, especially encoding and decoding
28
+
29
+ Read the [documentation](https://faster-eth-abi.readthedocs.io/).
30
+
31
+ View the [change log](https://faster-eth-abi.readthedocs.io/en/latest/release_notes.html).
32
+
33
+ ## Installation
34
+
35
+ ```sh
36
+ python -m pip install faster-eth-abi
37
+ ```
@@ -0,0 +1,9 @@
1
+ from _typeshed import Incomplete
2
+ from faster_eth_abi.abi import (
3
+ decode as decode,
4
+ encode as encode,
5
+ is_encodable as is_encodable,
6
+ is_encodable_type as is_encodable_type,
7
+ )
8
+
9
+ __version__: Incomplete
@@ -0,0 +1,42 @@
1
+ from eth_typing import Decodable as Decodable, TypeStr as TypeStr
2
+ from faster_eth_abi.codec import ABIDecoder as ABIDecoder, ABIEncoder as ABIEncoder
3
+ from faster_eth_abi.utils.validation import (
4
+ validate_bytes_param as validate_bytes_param,
5
+ validate_list_like_param as validate_list_like_param,
6
+ )
7
+ from typing import Any, Iterable
8
+
9
+ def encode_c(self, types: Iterable[TypeStr], args: Iterable[Any]) -> bytes:
10
+ """
11
+ Encodes the python values in ``args`` as a sequence of binary values of
12
+ the ABI types in ``types`` via the head-tail mechanism.
13
+
14
+ :param types: A list or tuple of string representations of the ABI types
15
+ that will be used for encoding e.g. ``('uint256', 'bytes[]',
16
+ '(int,int)')``
17
+ :param args: A list or tuple of python values to be encoded.
18
+
19
+ :returns: The head-tail encoded binary representation of the python
20
+ values in ``args`` as values of the ABI types in ``types``.
21
+ """
22
+
23
+ def decode_c(
24
+ self, types: Iterable[TypeStr], data: Decodable, strict: bool = True
25
+ ) -> tuple[Any, ...]:
26
+ """
27
+ Decodes the binary value ``data`` as a sequence of values of the ABI types
28
+ in ``types`` via the head-tail mechanism into a tuple of equivalent python
29
+ values.
30
+
31
+ :param types: A list or tuple of string representations of the ABI types that
32
+ will be used for decoding e.g. ``('uint256', 'bytes[]', '(int,int)')``
33
+ :param data: The binary value to be decoded.
34
+ :param strict: If ``False``, dynamic-type decoders will ignore validations such
35
+ as making sure the data is padded to a multiple of 32 bytes or checking that
36
+ padding bytes are zero / empty. ``False`` is how the Solidity ABI decoder
37
+ currently works. However, ``True`` is the default for the faster-eth-abi
38
+ library.
39
+
40
+ :returns: A tuple of equivalent python values for the ABI values
41
+ represented in ``data``.
42
+ """
@@ -0,0 +1,57 @@
1
+ from .decoding import (
2
+ BaseArrayDecoder as BaseArrayDecoder,
3
+ DynamicArrayDecoder as DynamicArrayDecoder,
4
+ FixedByteSizeDecoder as FixedByteSizeDecoder,
5
+ HeadTailDecoder as HeadTailDecoder,
6
+ SignedIntegerDecoder as SignedIntegerDecoder,
7
+ SizedArrayDecoder as SizedArrayDecoder,
8
+ TupleDecoder as TupleDecoder,
9
+ )
10
+ from faster_eth_abi.exceptions import (
11
+ InsufficientDataBytes as InsufficientDataBytes,
12
+ InvalidPointer as InvalidPointer,
13
+ NonEmptyPaddingBytes as NonEmptyPaddingBytes,
14
+ )
15
+ from faster_eth_abi.io import (
16
+ BytesIO as BytesIO,
17
+ ContextFramesBytesIO as ContextFramesBytesIO,
18
+ )
19
+ from faster_eth_abi.typing import T as T
20
+
21
+ def decode_uint_256(stream: ContextFramesBytesIO) -> int:
22
+ """
23
+ A faster version of :func:`~decoding.decode_uint_256` in decoding.py.
24
+
25
+ It recreates the logic from the UnsignedIntegerDecoder, but we can
26
+ skip a lot because we know the value of many vars.
27
+ """
28
+
29
+ def get_value_byte_size(decoder: FixedByteSizeDecoder) -> int: ...
30
+ def decode_head_tail(self, stream: ContextFramesBytesIO) -> T: ...
31
+ def decode_tuple(self, stream: ContextFramesBytesIO) -> tuple[T, ...]: ...
32
+ def validate_pointers_tuple(self, stream: ContextFramesBytesIO) -> None:
33
+ """
34
+ Verify that all pointers point to a valid location in the stream.
35
+ """
36
+
37
+ def validate_pointers_array(
38
+ self, stream: ContextFramesBytesIO, array_size: int
39
+ ) -> None:
40
+ """
41
+ Verify that all pointers point to a valid location in the stream.
42
+ """
43
+
44
+ def decode_sized_array(self, stream: ContextFramesBytesIO) -> tuple[T, ...]: ...
45
+ def decode_dynamic_array(self, stream: ContextFramesBytesIO) -> tuple[T, ...]: ...
46
+ def read_fixed_byte_size_data_from_stream(self, stream: BytesIO) -> bytes: ...
47
+ def split_data_and_padding_fixed_byte_size(
48
+ self, raw_data: bytes
49
+ ) -> tuple[bytes, bytes]: ...
50
+ def validate_padding_bytes_fixed_byte_size(
51
+ self, value: T, padding_bytes: bytes
52
+ ) -> None: ...
53
+ def get_expected_padding_bytes(self, chunk: bytes) -> bytes: ...
54
+ def validate_padding_bytes_signed_integer(
55
+ self, value: int, padding_bytes: bytes
56
+ ) -> None: ...
57
+ def decoder_fn_boolean(data: bytes) -> bool: ...
@@ -0,0 +1,41 @@
1
+ from faster_eth_abi.encoding import (
2
+ BaseEncoder as BaseEncoder,
3
+ TupleEncoder as TupleEncoder,
4
+ )
5
+ from faster_eth_abi.exceptions import ValueOutOfBounds as ValueOutOfBounds
6
+ from typing import Any, Callable, Sequence, TypeVar
7
+
8
+ T = TypeVar("T")
9
+
10
+ def validate_tuple(self, value: Sequence[Any]) -> None: ...
11
+ def encode_tuple(self, values: Sequence[Any]) -> bytes: ...
12
+ def encode_tuple_all_dynamic(self, values: Sequence[Any]) -> bytes: ...
13
+ def encode_tuple_no_dynamic(self, values: Sequence[Any]) -> bytes: ...
14
+ def encode_tuple_no_dynamic1(self, values: Sequence[Any]) -> bytes: ...
15
+ def encode_tuple_no_dynamic2(self, values: Sequence[Any]) -> bytes: ...
16
+ def encode_tuple_no_dynamic3(self, values: Sequence[Any]) -> bytes: ...
17
+ def encode_tuple_no_dynamic4(self, values: Sequence[Any]) -> bytes: ...
18
+ def encode_tuple_no_dynamic5(self, values: Sequence[Any]) -> bytes: ...
19
+ def encode_tuple_no_dynamic6(self, values: Sequence[Any]) -> bytes: ...
20
+ def encode_tuple_no_dynamic7(self, values: Sequence[Any]) -> bytes: ...
21
+ def encode_tuple_no_dynamic8(self, values: Sequence[Any]) -> bytes: ...
22
+ def encode_tuple_no_dynamic9(self, values: Sequence[Any]) -> bytes: ...
23
+ def encode_tuple_no_dynamic10(self, values: Sequence[Any]) -> bytes: ...
24
+
25
+ encode_tuple_no_dynamic_funcs: dict[int, Callable[[TupleEncoder, Sequence[Any]], bytes]]
26
+
27
+ def encode_fixed(
28
+ value: Any,
29
+ encode_fn: Callable[[Any], bytes],
30
+ is_big_endian: bool,
31
+ data_byte_size: int,
32
+ ) -> bytes: ...
33
+ def encode_signed(
34
+ value: T, encode_fn: Callable[[T], bytes], data_byte_size: int
35
+ ) -> bytes: ...
36
+ def encode_elements(item_encoder: BaseEncoder, value: Sequence[Any]) -> bytes: ...
37
+ def encode_elements_dynamic(
38
+ item_encoder: BaseEncoder, value: Sequence[Any]
39
+ ) -> bytes: ...
40
+ def encode_uint_256(i: int) -> bytes: ...
41
+ def int_to_big_endian(value: int) -> bytes: ...
@@ -0,0 +1,139 @@
1
+ from _typeshed import Incomplete
2
+ from eth_typing.abi import TypeStr as TypeStr
3
+ from faster_eth_abi.exceptions import ABITypeError as ABITypeError
4
+ from parsimonious.nodes import Node as Node
5
+ from typing import Any, Final, Generic, Literal, NoReturn, TypeVar, final
6
+ from typing_extensions import Self
7
+
8
+ TYPE_ALIASES: Final[Incomplete]
9
+ TYPE_ALIAS_RE: Final[Incomplete]
10
+ Arrlist = tuple[int | tuple[int, ...], ...]
11
+ IntSubtype: Incomplete
12
+ FixedSubtype: Incomplete
13
+ Subtype = IntSubtype | FixedSubtype
14
+ TSub = TypeVar("TSub", IntSubtype, FixedSubtype, Literal[None])
15
+
16
+ class ABIType:
17
+ """
18
+ Base class for results of type string parsing operations.
19
+
20
+ Notes
21
+ -----
22
+ Users are unable to subclass this class. If your use case requires subclassing,
23
+ you will need to stick to the original `eth-abi`.
24
+
25
+ """
26
+
27
+ arrlist: Final[Arrlist | None]
28
+ node: Final[Node | None]
29
+ def __init__(
30
+ self, arrlist: Arrlist | None = None, node: Node | None = None
31
+ ) -> None: ...
32
+ def __eq__(self, other: Any) -> bool: ...
33
+ def to_type_str(self) -> TypeStr:
34
+ """
35
+ Returns the string representation of an ABI type. This will be equal to
36
+ the type string from which it was created.
37
+ """
38
+
39
+ @property
40
+ def item_type(self) -> Self:
41
+ """
42
+ If this type is an array type, equal to an appropriate
43
+ :class:`~faster_eth_abi.grammar.ABIType` instance for the array's items.
44
+ """
45
+
46
+ def validate(self) -> None:
47
+ """
48
+ Validates the properties of an ABI type against the solidity ABI spec:
49
+
50
+ https://solidity.readthedocs.io/en/develop/abi-spec.html
51
+
52
+ Raises :class:`~faster_eth_abi.exceptions.ABITypeError` if validation fails.
53
+ """
54
+
55
+ @final
56
+ def invalidate(self, error_msg: str) -> NoReturn: ...
57
+ @final
58
+ @property
59
+ def is_array(self) -> bool:
60
+ """
61
+ Equal to ``True`` if a type is an array type (i.e. if it has an array
62
+ dimension list). Otherwise, equal to ``False``.
63
+ """
64
+
65
+ @property
66
+ def is_dynamic(self) -> bool:
67
+ """
68
+ Equal to ``True`` if a type has a dynamically sized encoding.
69
+ Otherwise, equal to ``False``.
70
+ """
71
+
72
+ TComp = TypeVar("TComp", bound=ABIType)
73
+
74
+ class TupleType(ABIType):
75
+ """
76
+ Represents the result of parsing a tuple type string e.g. "(int,bool)".
77
+
78
+ Notes
79
+ -----
80
+ Users are unable to subclass this class. If your use case requires subclassing,
81
+ you will need to stick to the original `eth-abi`.
82
+
83
+ """
84
+
85
+ components: Final[Incomplete]
86
+ def __init__(
87
+ self,
88
+ components: tuple[TComp, ...],
89
+ arrlist: Arrlist | None = None,
90
+ *,
91
+ node: Node | None = None
92
+ ) -> None: ...
93
+ def to_type_str(self) -> TypeStr: ...
94
+ @property
95
+ def item_type(self) -> Self: ...
96
+ def validate(self) -> None: ...
97
+ @property
98
+ def is_dynamic(self) -> bool: ...
99
+
100
+ class BasicType(ABIType, Generic[TSub]):
101
+ """
102
+ Represents the result of parsing a basic type string e.g. "uint", "address",
103
+ "ufixed128x19[][2]".
104
+
105
+ Notes
106
+ -----
107
+ Users are unable to subclass this class. If your use case requires subclassing,
108
+ you will need to stick to the original `eth-abi`.
109
+
110
+ """
111
+
112
+ base: Final[Incomplete]
113
+ sub: Final[Incomplete]
114
+ def __init__(
115
+ self,
116
+ base: str,
117
+ sub: TSub | None = None,
118
+ arrlist: Arrlist | None = None,
119
+ *,
120
+ node: Node | None = None
121
+ ) -> None: ...
122
+ def to_type_str(self) -> TypeStr: ...
123
+ @property
124
+ def item_type(self) -> Self: ...
125
+ @property
126
+ def is_dynamic(self) -> bool: ...
127
+ def validate(self) -> None: ...
128
+
129
+ BytesType = BasicType[IntSubtype]
130
+ FixedType = BasicType[FixedSubtype]
131
+
132
+ def normalize(type_str: TypeStr) -> TypeStr:
133
+ """
134
+ Normalizes a type string into its canonical version e.g. the type string
135
+ 'int' becomes 'int256', etc.
136
+
137
+ :param type_str: The type string to be normalized.
138
+ :returns: The canonical version of the input type string.
139
+ """
@@ -0,0 +1,10 @@
1
+ from _typeshed import Incomplete
2
+ from faster_eth_abi.codec import ABICodec as ABICodec
3
+ from faster_eth_abi.registry import registry as registry
4
+ from typing import Final
5
+
6
+ default_codec: Final[Incomplete]
7
+ encode: Final[Incomplete]
8
+ decode: Final[Incomplete]
9
+ is_encodable: Final[Incomplete]
10
+ is_encodable_type: Final[Incomplete]
@@ -0,0 +1,16 @@
1
+ from typing import Any
2
+
3
+ class BaseCoder:
4
+ """
5
+ Base class for all encoder and decoder classes.
6
+ """
7
+
8
+ is_dynamic: bool
9
+ def __init__(self, **kwargs: Any) -> None: ...
10
+ def validate(self) -> None: ...
11
+ @classmethod
12
+ def from_type_str(cls, type_str, registry) -> None:
13
+ """
14
+ Used by :any:`ABIRegistry` to get an appropriate encoder or decoder
15
+ instance for the given type string and type registry.
16
+ """