diff --git a/_build/html_zh_CN/.buildinfo b/_build/html_zh_CN/.buildinfo new file mode 100644 index 0000000000..90abf92cd3 --- /dev/null +++ b/_build/html_zh_CN/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. +config: a017a6bee2951a2fd7f360bc661d6569 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/_build/html_zh_CN/.doctrees/code_of_conduct.doctree b/_build/html_zh_CN/.doctrees/code_of_conduct.doctree new file mode 100644 index 0000000000..8adefe45ea Binary files /dev/null and b/_build/html_zh_CN/.doctrees/code_of_conduct.doctree differ diff --git a/_build/html_zh_CN/.doctrees/constants.doctree b/_build/html_zh_CN/.doctrees/constants.doctree new file mode 100644 index 0000000000..1425f52b65 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/constants.doctree differ diff --git a/_build/html_zh_CN/.doctrees/contributing.doctree b/_build/html_zh_CN/.doctrees/contributing.doctree new file mode 100644 index 0000000000..5aa059513c Binary files /dev/null and b/_build/html_zh_CN/.doctrees/contributing.doctree differ diff --git a/_build/html_zh_CN/.doctrees/ens.doctree b/_build/html_zh_CN/.doctrees/ens.doctree new file mode 100644 index 0000000000..90ed057bec Binary files /dev/null and b/_build/html_zh_CN/.doctrees/ens.doctree differ diff --git a/_build/html_zh_CN/.doctrees/ens_overview.doctree b/_build/html_zh_CN/.doctrees/ens_overview.doctree new file mode 100644 index 0000000000..85235e5d55 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/ens_overview.doctree differ diff --git a/_build/html_zh_CN/.doctrees/environment.pickle b/_build/html_zh_CN/.doctrees/environment.pickle new file mode 100644 index 0000000000..a30fbd80ab Binary files /dev/null and b/_build/html_zh_CN/.doctrees/environment.pickle differ diff --git a/_build/html_zh_CN/.doctrees/filters.doctree b/_build/html_zh_CN/.doctrees/filters.doctree new file mode 100644 index 0000000000..ba91b6d2cf Binary files /dev/null and b/_build/html_zh_CN/.doctrees/filters.doctree differ diff --git a/_build/html_zh_CN/.doctrees/gas_price.doctree b/_build/html_zh_CN/.doctrees/gas_price.doctree new file mode 100644 index 0000000000..1e83beea06 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/gas_price.doctree differ diff --git a/_build/html_zh_CN/.doctrees/index.doctree b/_build/html_zh_CN/.doctrees/index.doctree new file mode 100644 index 0000000000..6eb256ce63 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/index.doctree differ diff --git a/_build/html_zh_CN/.doctrees/internals.doctree b/_build/html_zh_CN/.doctrees/internals.doctree new file mode 100644 index 0000000000..d8c6f3aef4 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/internals.doctree differ diff --git a/_build/html_zh_CN/.doctrees/middleware.doctree b/_build/html_zh_CN/.doctrees/middleware.doctree new file mode 100644 index 0000000000..b6ed42a7ec Binary files /dev/null and b/_build/html_zh_CN/.doctrees/middleware.doctree differ diff --git a/_build/html_zh_CN/.doctrees/migration.doctree b/_build/html_zh_CN/.doctrees/migration.doctree new file mode 100644 index 0000000000..1fcd48e8a9 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/migration.doctree differ diff --git a/_build/html_zh_CN/.doctrees/overview.doctree b/_build/html_zh_CN/.doctrees/overview.doctree new file mode 100644 index 0000000000..0076dd62a8 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/overview.doctree differ diff --git a/_build/html_zh_CN/.doctrees/providers.doctree b/_build/html_zh_CN/.doctrees/providers.doctree new file mode 100644 index 0000000000..3694200aa9 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/providers.doctree differ diff --git a/_build/html_zh_CN/.doctrees/quickstart.doctree b/_build/html_zh_CN/.doctrees/quickstart.doctree new file mode 100644 index 0000000000..e0bcd34ca4 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/quickstart.doctree differ diff --git a/_build/html_zh_CN/.doctrees/release_notes.doctree b/_build/html_zh_CN/.doctrees/release_notes.doctree new file mode 100644 index 0000000000..67a8973a0d Binary files /dev/null and b/_build/html_zh_CN/.doctrees/release_notes.doctree differ diff --git a/_build/html_zh_CN/.doctrees/resources.doctree b/_build/html_zh_CN/.doctrees/resources.doctree new file mode 100644 index 0000000000..6030f9dd7b Binary files /dev/null and b/_build/html_zh_CN/.doctrees/resources.doctree differ diff --git a/_build/html_zh_CN/.doctrees/subscriptions.doctree b/_build/html_zh_CN/.doctrees/subscriptions.doctree new file mode 100644 index 0000000000..adff8a7b8f Binary files /dev/null and b/_build/html_zh_CN/.doctrees/subscriptions.doctree differ diff --git a/_build/html_zh_CN/.doctrees/toc.doctree b/_build/html_zh_CN/.doctrees/toc.doctree new file mode 100644 index 0000000000..d7c2ef60bd Binary files /dev/null and b/_build/html_zh_CN/.doctrees/toc.doctree differ diff --git a/_build/html_zh_CN/.doctrees/transactions.doctree b/_build/html_zh_CN/.doctrees/transactions.doctree new file mode 100644 index 0000000000..32aad91bdb Binary files /dev/null and b/_build/html_zh_CN/.doctrees/transactions.doctree differ diff --git a/_build/html_zh_CN/.doctrees/troubleshooting.doctree b/_build/html_zh_CN/.doctrees/troubleshooting.doctree new file mode 100644 index 0000000000..0070429d59 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/troubleshooting.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.beacon.doctree b/_build/html_zh_CN/.doctrees/web3.beacon.doctree new file mode 100644 index 0000000000..c3463d428b Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.beacon.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.contract.doctree b/_build/html_zh_CN/.doctrees/web3.contract.doctree new file mode 100644 index 0000000000..63213e0c65 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.contract.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.eth.account.doctree b/_build/html_zh_CN/.doctrees/web3.eth.account.doctree new file mode 100644 index 0000000000..1b691cd978 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.eth.account.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.eth.doctree b/_build/html_zh_CN/.doctrees/web3.eth.doctree new file mode 100644 index 0000000000..679391da7d Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.eth.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.geth.doctree b/_build/html_zh_CN/.doctrees/web3.geth.doctree new file mode 100644 index 0000000000..2bf5e30719 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.geth.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.main.doctree b/_build/html_zh_CN/.doctrees/web3.main.doctree new file mode 100644 index 0000000000..cfa8e81f27 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.main.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.net.doctree b/_build/html_zh_CN/.doctrees/web3.net.doctree new file mode 100644 index 0000000000..7d36b9c26c Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.net.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.tracing.doctree b/_build/html_zh_CN/.doctrees/web3.tracing.doctree new file mode 100644 index 0000000000..eb3c7088b5 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.tracing.doctree differ diff --git a/_build/html_zh_CN/.doctrees/web3.utils.doctree b/_build/html_zh_CN/.doctrees/web3.utils.doctree new file mode 100644 index 0000000000..c83d73c1e5 Binary files /dev/null and b/_build/html_zh_CN/.doctrees/web3.utils.doctree differ diff --git a/_build/html_zh_CN/_images/banner-snek.jpg b/_build/html_zh_CN/_images/banner-snek.jpg new file mode 100644 index 0000000000..f49a07dd8c Binary files /dev/null and b/_build/html_zh_CN/_images/banner-snek.jpg differ diff --git a/_build/html_zh_CN/_sources/code_of_conduct.rst.txt b/_build/html_zh_CN/_sources/code_of_conduct.rst.txt new file mode 100644 index 0000000000..a5f842ef33 --- /dev/null +++ b/_build/html_zh_CN/_sources/code_of_conduct.rst.txt @@ -0,0 +1,78 @@ +Code of Conduct +--------------- + +Our Pledge +~~~~~~~~~~ + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +Our Standards +~~~~~~~~~~~~~ + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Our Responsibilities +~~~~~~~~~~~~~~~~~~~~ + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +Scope +~~~~~ + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +Enforcement +~~~~~~~~~~~ + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at snakecharmers@ethereum.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +Attribution +~~~~~~~~~~~ + +This Code of Conduct is adapted from the `Contributor Covenant `_, version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html diff --git a/_build/html_zh_CN/_sources/constants.rst.txt b/_build/html_zh_CN/_sources/constants.rst.txt new file mode 100644 index 0000000000..ca6ad7456f --- /dev/null +++ b/_build/html_zh_CN/_sources/constants.rst.txt @@ -0,0 +1,28 @@ +.. _constants: + +Constants +========= + +The web3.constants module contains commonly used values. + +Strings +******* + +.. code-block:: python + + #The Address Zero, which is 20 bytes (40 nibbles) of zero. + web3.constants.ADDRESS_ZERO + + #The hexadecimal version of Max uint256. + web3.constants.MAX_INT + + #The Hash Zero, which is 32 bytes (64 nibbles) of zero. + web3.constants.HASH_ZERO + +Int +*** + +.. code-block:: python + + #The amount of Wei in one Ether + web3.constants.WEI_PER_ETHER diff --git a/_build/html_zh_CN/_sources/contributing.rst.txt b/_build/html_zh_CN/_sources/contributing.rst.txt new file mode 100644 index 0000000000..e08589a89e --- /dev/null +++ b/_build/html_zh_CN/_sources/contributing.rst.txt @@ -0,0 +1,514 @@ +.. _contributing: + +Contributing +------------ + +Thanks for your interest in contributing to web3.py! Read on to learn what +would be helpful and how to go about it. If you get stuck along the way, reach +for help in the `Python Discord server`_. + + +How to Help +~~~~~~~~~~~ + +Without code: + +* Answer user questions within GitHub issues, Stack Overflow, or the `Python Discord server`_. +* Write or record tutorial content. +* Improve our documentation (including typo fixes). +* `Open an issue `_ on GitHub to document a bug. Include as much detail as possible, e.g., how to reproduce the issue and any exception messages. + +With code: + +* Fix a bug that has been reported in an issue. +* Add a feature that has been documented in an issue. +* Add a missing test case. + +.. warning:: + + **Before you start:** always ask if a change would be desirable or let us know that + you plan to work on something! We don't want to waste your time on changes we can't + accept or duplicated effort. + + +Your Development Environment +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. note:: + + Use of a virtual environment is strongly advised for minimizing dependency issues. See + `this article `_ + for usage patterns. + +All pull requests are made from a fork of the repository; use the GitHub UI to create a fork. +web3.py depends on `submodules `_, so when you clone +your fork to your local machine, include the ``--recursive`` flag: + +.. code:: sh + + $ git clone --recursive https://github.com//web3.py.git + $ cd web3.py + + +Finally, install all development dependencies: + +.. code:: sh + + $ python -m pip install -e ".[dev]" + $ pre-commit install + + +Using Docker +^^^^^^^^^^^^ + +Developing within Docker is not required, but if you prefer that workflow, use +the *sandbox* container provided in the **docker-compose.yml** file. + +To start up the test environment, run: + +.. code:: sh + + $ docker compose up -d + + +This will build a Docker container set up with an environment to run the +Python test code. + +To run the core tests from your local machine: + +.. code:: sh + + $ docker compose exec sandbox bash -c 'pytest tests/core' + + +The container does not have ``go-ethereum`` installed, so you can exclude those tests +by using the ``-k "not goethereum"`` flag. + +.. code:: sh + + $ docker compose exec sandbox bash -c 'pytest tests/integration -k "not goethereum"' + + +You can run arbitrary commands inside the Docker container by using the +``bash -c`` prefix. + +.. code:: sh + + $ docker compose exec sandbox bash -c 'pwd && ls' + + +Or, if you would like to open a session to the container, run: + +.. code:: sh + + $ docker compose exec sandbox bash + + +Running The Tests +~~~~~~~~~~~~~~~~~ + +A great way to explore the code base is to run the tests. + + +First, install the test dependencies: + +.. code:: sh + + $ python -m pip install -e ".[test]" + + +You can run all tests with: + +.. code:: sh + + $ pytest + + +However, running the entire test suite takes a very long time and is generally impractical. +Typically, you'll just want to run a subset instead, like: + +.. code:: sh + + $ pytest tests/core/eth-module/test_accounts.py + + +Linting is also performed by the CI and locally with each commit. You can save yourself +some time by checking for linting errors manually: + +.. code:: sh + + $ make lint + + +It is important to understand that each pull request must pass the full test +suite as part of the CI check. This test suite will run in the CI anytime a +pull request is opened or updated. + + +Writing Tests +~~~~~~~~~~~~~ + +We strongly encourage contributors to write good tests for their code as +part of the code review process. This helps ensure that your code is doing +what it should be doing. + +We strongly encourage you to use our existing tests for both guidance and +homogeneity / consistency across our tests. We use ``pytest`` for our tests. +For more specific pytest guidance, please refer to the `pytest documentation`_. + +Within the ``pytest`` scope, :file:`conftest.py` files are used for common code +shared between modules that exist within the same directory as that particular +:file:`conftest.py` file. + + +Unit Testing and eth-tester Tests +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Our unit tests are grouped together with tests against the ``eth-tester`` library, +using the ``py-evm`` library as a backend, via the ``EthereumTesterProvider``. + +These tests live under appropriately named child directories within the +``/tests`` directory. The core of these tests live under ``/tests/core``. +Do your best to follow the existing structure when adding a test and make sure +that its location makes sense. + +Integration Testing +^^^^^^^^^^^^^^^^^^^ + +Our integration test suite setup lives under the ``/tests/integration`` directory. +The integration test suite is dependent on what we call "fixtures" (not to be +confused with pytest fixtures). These zip file fixtures, which also live in the +``/tests/integration`` directory, are configured to run the specific client we are +testing against along with a genesis configuration that gives our tests some +pre-determined useful objects (like unlocked, pre-loaded accounts) to be able to +interact with the client when we run our tests. + +The parent ``/integration`` directory houses some common configuration shared across +all client tests, whereas the ``/go_ethereum`` directory houses common code to be +shared across geth-specific provider tests. Though the setup and run configurations +exist across the different files within ``/tests/integration``, our integration module +tests are written across different files within ``/web3/_utils/module_testing``. + +* :file:`common.py` files within the client directories contain code that is shared across + all provider tests (http, ipc, and ws). This is mostly used to override tests that span + across all providers. +* :file:`conftest.py` files within each of these directories contain mostly code that + can be *used* by all test files that exist within the same directory or subdirectories + of the :file:`conftest.py` file. This is mostly used to house pytest fixtures to be + shared among our tests. Refer to the `pytest documentation on fixtures`_ for more + information. +* ``test_{client}_{provider}.py`` files (e.g. :file:`test_goethereum_http.py`) are where + client-and-provider-specific test configurations exist. This is mostly used to + override tests specific to the provider type for the respective client. + +The integration tests are each run in insolation to prevent muddied contexts. Because +they are run in isolation, they can be parallelized with ``pytest-xdist`` in order to +speed up the test suite. To run the tests in parallel, you can use the ``-n`` flag +with ``pytest``. For example, to run the tests in parallel with 4 workers, you can +use the following command: + +.. code:: sh + + $ pytest tests/integration/go_ethereum/path/to/module/or/test -n 4 + + +Working With Test Contracts +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Contracts used for testing exist under ``web3/_utils/contract_sources``. These contracts +get compiled via the ``compile_contracts.py`` script in the same directory. To use +this script, simply pass the Solidity version to be used to compile the contracts as an +argument at the command line. + +Arguments for the script are: + -v or --version Solidity version to be used to compile the contracts. If + blank, the script uses the latest available version from + solcx. + + -f or --filename If left blank, all .sol files will be compiled and the + respective contract data will be generated. Pass in a + specific ``.sol`` filename here to compile just one file. + + +To run the script, you will need the ``py-solc-x`` library for compiling the files +as well as ``black`` for code formatting. You can install those with: + +.. code:: sh + + $ python -m pip install py-solc-x black + +The following example compiles all the contracts and generates their respective +contract data that is used across our test files for the test suites. This data gets +generated within the ``contract_data`` subdirectory within the ``contract_sources`` +folder. + +.. code-block:: bash + + $ cd ../web3.py/web3/_utils/contract_sources + $ python compile_contracts.py -v 0.8.17 + Compiling OffchainLookup + ... + ... + reformatted ... + +To compile and generate contract data for only one ``.sol`` file, specify using the +filename with the ``-f`` (or ``--filename``) argument flag. + +.. code-block:: bash + + $ cd ../web3.py/web3/_utils/contract_sources + $ python compile_contracts.py -v 0.8.17 -f OffchainLookup.sol + Compiling OffchainLookup.sol + reformatted ... + +If there is any contract data that is not generated via the script but is important +to pass on to the integration tests, the ``_custom_contract_data.py`` file within the +``contract_data`` subdirectory can be used to store that information when appropriate. + +Be sure to re-generate the integration test fixture after running the script to update +the contract bytecodes for the integration test suite - see the +:ref:`generating_fixtures` section below. + + +Manual Testing +~~~~~~~~~~~~~~ + +To import and test an unreleased version of web3.py in another context, +you can install it from your development directory: + +.. code:: sh + + $ python -m pip install -e ../path/to/web3py + + +Code Style +~~~~~~~~~~ + +We use `pre-commit `_ to enforce a consistent code style across +the library. This tool runs automatically with every commit, but you can also run it +manually with: + +.. code:: sh + + $ make lint + + +If you need to make a commit that skips the ``pre-commit`` checks, you can do so with +``git commit --no-verify``. + +We use Black as part of our linting. To ignore the commits that introduced Black in +git history, you can configure your git environment like so: + +.. code:: sh + + $ git config blame.ignoreRevsFile .git-blame-ignore-revs + + +This library uses `type hints`_, which are enforced by the ``mypy`` tool (part of the +``pre-commit`` checks). All new code is required to land with type hints, with the +exception of code within the ``tests`` directory. + + +Documentation +~~~~~~~~~~~~~ + +Good documentation will lead to quicker adoption and happier users. Please +check out our guide on `how to create documentation`_ for the Python Ethereum +ecosystem. + +Pull requests generate their own preview of the latest documentation at +``https://web3py--.org.readthedocs.build/en//``. + + +Pull Requests +~~~~~~~~~~~~~ + +It's a good idea to make pull requests early on. A pull request represents the +start of a discussion, and doesn't necessarily need to be the final, finished +submission. + +See GitHub's documentation for `working on pull requests`_. + +Once you've made a pull request take a look at the Circle CI build status in +the GitHub interface and make sure all tests are passing. In general, pull +requests that do not pass the CI build yet won't get reviewed unless explicitly +requested. + +If the pull request introduces changes that should be reflected in the release +notes, please add a **newsfragment** file as explained +`here `_. + +If possible, the change to the release notes file should be included in the +commit that introduces the feature or bugfix. + +.. _generating_fixtures: + +Generating New Fixtures +~~~~~~~~~~~~~~~~~~~~~~~ + +Our integration tests make use of Geth private networks. +When new versions of the client software are introduced, new fixtures should be +generated. + +Before generating new fixtures, make sure you have the test dependencies installed: + +.. code:: sh + + $ python -m pip install -e ".[test]" + +.. note:: + + A "fixture" is a pre-synced network. It's the result of configuring and running + a client, deploying the test contracts, and saving the resulting state for + testing web3.py functionality against. + + +Geth Fixtures +^^^^^^^^^^^^^ + +1. Install the desired Geth version on your machine locally. We recommend `py-geth`_ for + this purpose, because it enables you to easily manage multiple versions of Geth. + + Note that ``py-geth`` will need updating to support each new Geth version as well. + Adding newer Geth versions to py-geth is straightforward; see past commits for a template. + + If py-geth has the Geth version you need, install that version locally. For example: + + .. code:: sh + + $ python -m geth.install v1.16.2 + +2. Specify the Geth binary and run the fixture creation script (from within the web3.py directory): + + .. code:: sh + + $ GETH_BINARY=~/.py-geth/geth-v1.16.2/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py + +3. The output of this script is your fixture, a zip file, which is now stored in ``/tests/integration/``. + The ``/tests/integration/go_ethereum/conftest.py`` and + ``/web3/tools/benchmark/node.py`` files should be updated automatically to point to this new fixture. + Delete the old fixture. + +4. Run the tests. To ensure that the tests run with the correct Geth version locally, + you may again include the ``GETH_BINARY`` environment variable. + +5. The ``geth_version`` and ``pygeth_version`` parameter defaults in + ``/.circleci/config.yml`` should be automatically updated to match the + ``go-ethereum`` version used to generate the test fixture and the ``py-geth`` + version that supports installing it. + + +CI Testing With a Nightly Geth Build +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Occasionally you'll want to have CI run the test suite against an unreleased version of +Geth - e.g. to test upcoming hard fork changes. The workflow described below is for +testing only, as updates will only be merged into main once the Geth release is +published and the test runs are updated to use the new stable version. + +1. Configure ``tests/integration/generate_fixtures/go_ethereum/common.py`` as needed. + +2. Geth automagically compiles new builds for every commit that gets merged into the codebase. + Download the desired build from the `develop builds `_. + +3. Build your test fixture, passing in the binary you just downloaded via ``GETH_BINARY``. Don't forget + to update the ``/tests/integration/go_ethereum/conftest.py`` file to point to your new fixture. + +4. Our CI runs on Ubuntu, so download the corresponding 64-bit Linux + `develop build `_, then + add it to the root of your web3.py directory. Rename the binary ``custom_geth``. + +5. In ``.circleci/config.yml``, update the ``geth_version`` pipeline parameter to + "custom". This will trigger the custom Geth build to be used in the CI test suite. + +6. Create a PR and let CI do its thing. + + +Releasing +~~~~~~~~~ + +Releases are typically done from the ``main`` branch, except when releasing a beta (in +which case the beta is released from ``main``, and the previous stable branch is +released from said branch). + +Final test before each release +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Before releasing a new version, build and test the package that will be released: + +.. code:: sh + + $ git checkout main && git pull + $ make package-test + +This will build the package and install it in a temporary virtual environment. Follow +the instructions to activate the venv and test whatever you think is important. + +Review the documentation that will get published: + +.. code:: sh + + $ make docs + +Validate and preview the release notes: + +.. code:: sh + + $ make validate-newsfragments + +Build the release notes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Before bumping the version number, build the release notes. You must include the part of +the version to bump (see below), which changes how the version number will show in the +release notes. + +.. code:: sh + + $ make notes bump=$$VERSION_PART_TO_BUMP$$ + +If there are any errors, be sure to re-run make notes until it works. + +Push the release to github & pypi +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After confirming that the release package looks okay, release a new version: + +.. code:: sh + + $ make release bump=$$VERSION_PART_TO_BUMP$$ + +This command will: + +- Bump the version number as specified in ``.pyproject.toml`` and ``setup.py``. +- Create a git commit and tag for the new version. +- Build the package. +- Push the commit and tag to github. +- Push the new package files to pypi. + +Which version part to bump +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``$$VERSION_PART_TO_BUMP$$`` must be one of: ``major``, ``minor``, ``patch``, ``stage``, +or ``devnum``. + +The version format for this repo is ``{major}.{minor}.{patch}`` for stable, and +``{major}.{minor}.{patch}-{stage}.{devnum}`` for unstable (``stage`` can be alpha or +beta). + +If you are in a beta version, ``make release bump=stage`` will switch to a stable. + +To issue an unstable version when the current version is stable, specify the new version +explicitly, like ``make release bump="--new-version 4.0.0-alpha.1"``. + +You can see what the result of bumping any particular version part would be with +``bump-my-version show-bump``. + +.. _Python Discord server: https://discord.gg/GHryRvPB84 +.. _style guide: https://github.com/ethereum/snake-charmers-tactical-manual/blob/main/style-guide.md +.. _type hints: https://www.python.org/dev/peps/pep-0484/ +.. _how to create documentation: https://github.com/ethereum/snake-charmers-tactical-manual/blob/main/documentation.md +.. _working on pull requests: https://help.github.com/articles/about-pull-requests/ +.. _py-geth: https://github.com/ethereum/py-geth +.. _pytest documentation: https://docs.pytest.org/en/latest +.. _pytest documentation on fixtures: https://docs.pytest.org/en/latest/how-to/fixtures.html diff --git a/_build/html_zh_CN/_sources/ens.rst.txt b/_build/html_zh_CN/_sources/ens.rst.txt new file mode 100644 index 0000000000..372326a838 --- /dev/null +++ b/_build/html_zh_CN/_sources/ens.rst.txt @@ -0,0 +1,27 @@ +.. py:module:: ens + +ENS API +=========== + +:doc:`ens_overview` has a friendly overview. + +Continue below for the detailed specs on each method and class in the ens module. + +ens\.ens module +---------------- + +.. automodule:: ens.ens + :members: + +ens\.async_ens module +--------------------- + +.. automodule:: ens.async_ens + :members: + +ens\.exceptions module +---------------------- + +.. automodule:: ens.exceptions + :members: + :show-inheritance: diff --git a/_build/html_zh_CN/_sources/ens_overview.rst.txt b/_build/html_zh_CN/_sources/ens_overview.rst.txt new file mode 100644 index 0000000000..5a9dcd0fae --- /dev/null +++ b/_build/html_zh_CN/_sources/ens_overview.rst.txt @@ -0,0 +1,343 @@ +.. _ens_overview: + +Ethereum Name Service (ENS) +=========================== + +The Ethereum Name Service (ENS) is analogous to the Domain Name Service. It +enables users and developers to use human-friendly names in place of error-prone +hexadecimal addresses, content hashes, and more. + +The :mod:`ens` module is included with web3.py. It provides an interface to look up +domains and addresses, add resolver records, or get and set metadata. + + +Setup +----- + +Create an :class:`~ens.ENS` object (named ``ns`` below) in one of three ways: + +1. Automatic detection +2. Specify an instance of a :ref:`provider ` +3. From an existing :class:`web3.Web3` object + +.. code-block:: python + + # automatic detection + from ens.auto import ns + + # or, with a provider + from web3 import IPCProvider + from ens import ENS + + provider = IPCProvider(...) + ns = ENS(provider) + + # or, with a w3 instance + # Note: This inherits the w3 middleware from the w3 instance and adds a stalecheck middleware to the middleware onion. + # It also inherits the provider and codec from the w3 instance, as well as the ``strict_bytes_type_checking`` flag value. + from ens import ENS + w3 = Web3(...) + ns = ENS.from_web3(w3) + + +Asynchronous support is available via the ``AsyncENS`` module: + +.. code-block:: python + + from ens import AsyncENS + + ns = AsyncENS(provider) + + +Note that an ``ens`` module instance is also available on the ``w3`` instance. +The first time it's used, web3.py will create the ``ens`` instance using +``ENS.from_web3(w3)`` or ``AsyncENS.from_web3(w3)`` as appropriate. + +.. code-block:: python + + # instantiate w3 instance + from web3 import Web3, IPCProvider + w3 = Web3(IPCProvider(...)) + + # use the module + w3.ens.address('ethereum.eth') + + +.. py:attribute:: ens.strict_bytes_type_checking + + The ``ENS`` instance has a ``strict_bytes_type_checking`` flag that toggles the flag + with the same name on the ``Web3`` instance attached to the ``ENS`` instance. + You may disable the stricter bytes type checking that is loaded by default using + this flag. For more examples, see :ref:`disable-strict-byte-check` + + If instantiating a standalone ENS instance using ``ENS.from_web3()``, the ENS + instance will inherit the value of the flag on the Web3 instance at time of + instantiation. + + .. doctest:: + + >>> from web3 import Web3, EthereumTesterProvider + >>> from ens import ENS + >>> w3 = Web3(EthereumTesterProvider()) + + >>> assert w3.strict_bytes_type_checking # assert strict by default + >>> w3.is_encodable('bytes2', b'1') + False + + >>> w3.strict_bytes_type_checking = False + >>> w3.is_encodable('bytes2', b'1') # zero-padded, so encoded to: b'1\x00' + True + + >>> ns = ENS.from_web3(w3) + >>> # assert inherited from w3 at time of instantiation via ENS.from_web3() + >>> assert ns.strict_bytes_type_checking is False + >>> ns.w3.is_encodable('bytes2', b'1') + True + + >>> # assert these are now separate instances + >>> ns.strict_bytes_type_checking = True + >>> ns.w3.is_encodable('bytes2', b'1') + False + + >>> # assert w3 flag value remains + >>> assert w3.strict_bytes_type_checking is False + >>> w3.is_encodable('bytes2', b'1') + True + + However, if accessing the ``ENS`` class via the ``Web3`` instance as a module + (``w3.ens``), since all modules use the same ``Web3`` object reference + under the hood (the parent ``w3`` object), changing the + ``strict_bytes_type_checking`` flag value on ``w3`` also changes the flag state + for ``w3.ens.w3`` and all modules. + + .. doctest:: + + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider()) + + >>> assert w3.strict_bytes_type_checking # assert strict by default + >>> w3.is_encodable('bytes2', b'1') + False + + >>> w3.strict_bytes_type_checking = False + >>> w3.is_encodable('bytes2', b'1') # zero-padded, so encoded to: b'1\x00' + True + + >>> assert w3 == w3.ens.w3 # assert same object + >>> assert not w3.ens.w3.strict_bytes_type_checking + >>> w3.ens.w3.is_encodable('bytes2', b'1') + True + + >>> # sanity check on eth module as well + >>> assert not w3.eth.w3.strict_bytes_type_checking + >>> w3.eth.w3.is_encodable('bytes2', b'1') + True + + +Usage +----- + +Name Info +~~~~~~~~~ + +.. _ens_get_address: + +Get the Address for an ENS Name +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + from ens.auto import ns + eth_address = ns.address('ens.eth') + assert eth_address == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' + +The ``ENS`` module has no opinion as to which **TLD (Top Level Domain)** you can use, +but will not infer a TLD if it is not provided with the name. + +Multichain Address Resolution ++++++++++++++++++++++++++++++ + +`ENSIP-9 `_ +introduced multichain address resolution, allowing users to resolve addresses from +different chains, specified by the coin type index from +`SLIP44 `_. The +``address()`` method on the ``ENS`` class supports multichain address resolution via +the ``coin_type`` keyword argument. + +.. code-block:: python + + from ens.auto import ns + eth_address = ns.address('ens.eth', coin_type=60) # ETH is coin_type 60 + assert eth_address == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' + + +Get the ENS Name for an Address +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + domain = ns.name('0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7') + + # name() also accepts the bytes version of the address + assert ns.name(b'\xfe\x89\xccz\xbb,A\x83h:\xb7\x16S\xc4\xcd\xc9\xb0-D\xb7') == domain + + # confirm that the name resolves back to the address that you looked up: + assert ns.address(domain) == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' + +.. note:: For accuracy, and as a recommendation from the ENS documentation on + `reverse resolution `_, + the ``ENS`` module now verifies that the forward resolution matches the address with every call to get the + ``name()`` for an address. This is the only sure way to know whether the reverse resolution is correct. Anyone can + claim any name, only forward resolution implies that the owner of the name gave their stamp of approval. + +Get the Owner of a Name +^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + eth_address = ns.owner('exchange.eth') + +.... + +Set Up Your Name and Address +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Link a Name to an Address +^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can set up your name so that :meth:`~ens.ENS.address` will show the address it points to. In order to do so, +you must already be the owner of the domain (or its parent). + +.. code-block:: python + + ns.setup_address('ens.eth', '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7') + +In the common case where you want to point the name to the owning address, you can skip the address. + +.. code-block:: python + + ns.setup_address('ens.eth') + +You can claim arbitrarily deep subdomains. + +.. code-block:: python + + ns.setup_address('supreme.executive.power.derives.from.a.mandate.from.the.masses.ens.eth') + + # wait for the transaction to be mined, then: + assert ( + ns.address('supreme.executive.power.derives.from.a.mandate.from.the.masses.ens.eth') + == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' + ) + +.. warning:: Gas costs scale up with the number of subdomains! + +Multichain Address Support +++++++++++++++++++++++++++ + +`ENSIP-9 `_ +introduced multichain address resolution, allowing users to resolve addresses from +different chains, specified by the coin type index from +`SLIP44 `_. The +``setup_address()`` method on the ``ENS`` class supports multichain address setup +via the ``coin_type`` keyword argument. + +.. code-block:: python + + from ens.auto import ns + ns.setup_address('ens.eth', coin_type=60) # ETH is coin_type 60 + assert ns.address('ens.eth', coin_type=60) == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' + +Link an Address to a Name +^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can set up your address so that :meth:`~ens.ENS.name` will show the name that points to it. + +This is like Caller ID. It enables you and others to take an account and determine what name points to it. Sometimes +this is referred to as "reverse" resolution. The ENS Reverse Resolver is used for this functionality. + +.. code-block:: python + + ns.setup_name('ens.eth', '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7') + +If you don't supply the address, :meth:`~ens.ENS.setup_name` will assume you want the +address returned by :meth:`~ens.ENS.address`. + +.. code-block:: python + + ns.setup_name('ens.eth') + +If the name doesn't already point to an address, :meth:`~ens.ENS.setup_name` will +call :meth:`~ens.ENS.setup_address` for you. + +Wait for the transaction to be mined, then: + +.. code-block:: python + + assert ns.name('0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7') == 'ens.eth' + +.... + +Text Records +~~~~~~~~~~~~ + +Set Text Metadata for an ENS Record +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +As the owner of an ENS record, you can add text metadata. +A list of supported fields can be found in the +`ENS documentation `_. +You'll need to setup the address first, and then the text can be set: + +.. code-block:: python + + ns.setup_address('ens.eth', '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7') + ns.set_text('ens.eth', 'url', 'https://example.com') + +A transaction dictionary can be passed as the last argument if desired: + +.. code-block:: python + + transaction_dict = {'from': '0x123...'} + ns.set_text('ens.eth', 'url', 'https://example.com', transaction_dict) + +If the transaction dictionary is not passed, sensible defaults will be used, and if +a transaction dictionary is passed but does not have a ``from`` value, +the default will be the ``owner``. + +Read Text Metadata for an ENS Record +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Anyone can read the data from an ENS Record: + +.. code-block:: python + + url = ns.get_text('ens.eth', 'url') + assert url == 'https://example.com' + +.... + +Working With Resolvers +~~~~~~~~~~~~~~~~~~~~~~ + +Get the Resolver for an ENS Record +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +You can get the resolver for an ENS name via the :meth:`~ens.ENS.resolver` method. + +.. code-block:: python + + >>> resolver = ns.resolver('ens.eth') + >>> resolver.address + '0x5B2063246F2191f18F2675ceDB8b28102e957458' + +.... + +Wildcard Resolution Support +--------------------------- + +The ``ENS`` module supports Wildcard Resolution for resolvers that implement the ``ExtendedResolver`` interface +as described in `ENSIP-10 `_. +Resolvers that implement the extended resolver interface should return ``True`` when calling the +``supportsInterface()`` function with the extended resolver interface id ``"0x9061b923"`` and should resolve subdomains +to a unique address. diff --git a/_build/html_zh_CN/_sources/filters.rst.txt b/_build/html_zh_CN/_sources/filters.rst.txt new file mode 100644 index 0000000000..1ccebc98a8 --- /dev/null +++ b/_build/html_zh_CN/_sources/filters.rst.txt @@ -0,0 +1,1083 @@ +.. _filtering: + +Events and Logs +=============== + +If you're on this page, you're likely looking for an answer to this question: +**How do I know when a specific contract is used?** You have several options: + +1. Query blocks for transactions that include the contract address in the ``"to"`` field. + This contrived example is searching the latest block for any transactions sent to the + WETH_ contract. + +.. code-block:: python + + WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' + + block = w3.eth.get_block('latest') + for tx_hash in block.transactions: + tx = w3.eth.get_transaction(tx_hash) + if tx['to'] == WETH_ADDRESS: + print(f'Found interaction with WETH contract! {tx}') + +2. Query for logs emitted by a contract. After instantiating a web3.py Contract object, + you can :ref:`fetch logs ` for any event listed in the ABI. In this + example, we query for ``Transfer`` events in the latest block and log out the results. + +.. code-block:: python + + WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' + WETH_ABI = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"},{"name":"wad","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"src","type":"address"},{"name":"dst","type":"address"},{"name":"wad","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"dst","type":"address"},{"name":"wad","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":true,"name":"guy","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":true,"name":"dst","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"dst","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Withdrawal","type":"event"}]' + + weth_contract = w3.eth.contract(address=WETH_ADDRESS, abi=WETH_ABI) + + # fetch transfer events in the last block + logs = weth_contract.events.Transfer().get_logs(from_block=w3.eth.block_number) + + for log in logs: + print(f"Transfer of {w3.from_wei(log.args.wad, 'ether')} WETH from {log.args.src} to {log.args.dst}") + +See an advanced example of fetching log history :ref:`here `. + +3. Subscribe to events for real-time updates. When using a persistent connection provider + (:class:`~web3.providers.persistent.WebSocketProvider` or + :class:`~web3.providers.persistent.AsyncIPCProvider`), the + :meth:`subscribe() ` method can be used to establish a new + event subscription. This example subscribes to ``Transfer`` events of the WETH contract. + + .. code-block:: python + + import asyncio + from web3 import AsyncWeb3, WebSocketProvider + from eth_abi.abi import decode + + WETH_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + + + async def subscribe_to_transfer_events(): + async with AsyncWeb3(WebSocketProvider("...")) as w3: + transfer_event_topic = w3.keccak(text="Transfer(address,address,uint256)") + filter_params = { + "address": WETH_ADDRESS, + "topics": [transfer_event_topic], + } + subscription_id = await w3.eth.subscribe("logs", filter_params) + print(f"Subscribing to transfer events for WETH at {subscription_id}") + + async for payload in w3.socket.process_subscriptions(): + result = payload["result"] + + from_addr = decode(["address"], result["topics"][1])[0] + to_addr = decode(["address"], result["topics"][2])[0] + amount = decode(["uint256"], result["data"])[0] + print(f"{w3.from_wei(amount, 'ether')} WETH from {from_addr} to {to_addr}") + + asyncio.run(subscribe_to_transfer_events()) + + + For more usage examples see the docs on :ref:`subscription-examples`. + +4. Use a filter. + +.. warning :: + + While filters can be a very convenient way to monitor for blocks, transactions, or + events, they are notoriously unreliable. Both remote and locally hosted nodes have + a reputation for occasionally dropping filters, and some remote node providers don't + support filter-related RPC calls at all. + +.. py:module:: web3.utils.filters + +The :meth:`web3.eth.Eth.filter` method can be used to set up filters for: + +* Pending Transactions: ``w3.eth.filter("pending")`` + +* New Blocks ``w3.eth.filter("latest")`` + +* Event Logs + + Through the contract instance api: + + .. code-block:: python + + event_filter = my_contract.events.myEvent.create_filter(from_block='latest', argument_filters={'arg1':10}) + + Or built manually by supplying `valid filter params `_: + + .. code-block:: python + + event_filter = w3.eth.filter({"address": contract_address}) + +* Attaching to an existing filter + + .. code-block:: python + + existing_filter = w3.eth.filter(filter_id="0x0") + +.. note :: + + Creating event filters requires that your Ethereum node has an API support enabled for filters. + Note that Infura support for filters does not offer access to `pending` filters. + To get event logs on other stateless nodes please see :class:`web3.contract.ContractEvents`. + + + +Filter Class +------------ + +.. py:class:: Filter(web3, filter_id) + +.. py:attribute:: Filter.filter_id + + The ``filter_id`` for this filter as returned by the ``eth_newFilter`` RPC + method when this filter was created. + + +.. py:method:: Filter.get_new_entries() + + Retrieve new entries for this filter. + + Logs will be retrieved using the + :func:`web3.eth.Eth.get_filter_changes` which returns only new entries since the last + poll. + + +.. py:method:: Filter.get_all_entries() + + Retrieve all entries for this filter. + + Logs will be retrieved using the + :func:`web3.eth.Eth.get_filter_logs` which returns all entries that match the given + filter. + + +.. py:method:: Filter.format_entry(entry) + + Hook for subclasses to modify the format of the log entries this filter + returns, or passes to its callback functions. + + By default this returns the ``entry`` parameter unmodified. + + +.. py:method:: Filter.is_valid_entry(entry) + + Hook for subclasses to add additional programmatic filtering. The default + implementation always returns ``True``. + + +Block and Transaction Filter Classes +------------------------------------ + +.. py:class:: BlockFilter(...) + +``BlockFilter`` is a subclass of :class:`Filter`. + +You can setup a filter for new blocks using ``web3.eth.filter('latest')`` which +will return a new :class:`BlockFilter` object. + + .. code-block:: python + + new_block_filter = w3.eth.filter('latest') + new_block_filter.get_new_entries() + + .. note:: + + ``"safe"`` and ``"finalized"`` block identifiers are not yet supported for + ``eth_newBlockFilter``. + +.. py:class:: TransactionFilter(...) + +``TransactionFilter`` is a subclass of :class:`Filter`. + +You can setup a filter for new blocks using ``web3.eth.filter('pending')`` which +will return a new :class:`TransactionFilter` object. + + .. code-block:: python + + new_transaction_filter = w3.eth.filter('pending') + new_transaction_filter.get_new_entries() + + +Event Log Filters +----------------- + +You can set up a filter for event logs using the web3.py contract api: +:meth:`web3.contract.Contract.events.your_event_name.create_filter`, which provides some conveniences for +creating event log filters. Refer to the following example: + + .. code-block:: python + + event_filter = my_contract.events..create_filter(from_block="latest", argument_filters={'arg1':10}) + event_filter.get_new_entries() + +See :meth:`web3.contract.Contract.events.your_event_name.create_filter()` documentation for more information. + +You can set up an event log filter like the one above with ``web3.eth.filter`` by supplying a +dictionary containing the standard filter parameters. Assuming that ``arg1`` is indexed, the +equivalent filter creation would look like: + + .. code-block:: python + + event_signature_hash = web3.keccak(text="eventName(uint32)").hex() + event_filter = web3.eth.filter({ + "address": myContract_address, + "topics": [event_signature_hash, + "0x000000000000000000000000000000000000000000000000000000000000000a"], + }) + +The ``topics`` argument is order-dependent. For non-anonymous events, the first item in the topic list is always the keccack hash of the event signature. Subsequent topic items are the hex encoded values for indexed event arguments. In the above example, the second item is the ``arg1`` value ``10`` encoded to its hex string representation. + +In addition to being order-dependent, there are a few more points to recognize when specifying topic filters: + + Given a transaction log with topics [A, B], the following topic filters will yield a match: + + - [] "anything" + - [A] "A in first position (and anything after)" + - [None, B] "anything in first position AND B in second position (and anything after)" + - [A, B] "A in first position AND B in second position (and anything after)" + - [[A, B], [A, B]] "(A OR B) in first position AND (A OR B) in second position (and anything after)" + +See the JSON-RPC documentation for `eth_newFilter `_ more information on the standard filter parameters. + + .. note:: + + Though ``"finalized"`` and ``"safe"`` block identifiers are not yet part of the + specifications for ``eth_newFilter``, they are supported by web3.py and may or + may not yield expected results depending on the node being accessed. + +Creating a log filter by either of the above methods will return a :class:`LogFilter` instance. + +.. py:class:: LogFilter(web3, filter_id, log_entry_formatter=None, data_filter_set=None) + +The :py:class:`LogFilter` class is a subclass of :class:`Filter`. See the :class:`Filter` +documentation for inherited methods. + +:class:`LogFilter` provides the following additional +methods: + +.. py:method:: LogFilter.set_data_filters(data_filter_set) + +Provides a means to filter on the log data, in other words the ability to filter on values from +un-indexed event arguments. The parameter ``data_filter_set`` should be a list or set of 32-byte hex encoded values. + +Examples: Listening For Events +------------------------------ + +Synchronous +~~~~~~~~~~~ + + .. code-block:: python + + from web3 import Web3, IPCProvider + import time + + # instantiate Web3 instance + w3 = Web3(IPCProvider(...)) + + def handle_event(event): + print(event) + + def log_loop(event_filter, poll_interval): + while True: + for event in event_filter.get_new_entries(): + handle_event(event) + time.sleep(poll_interval) + + def main(): + block_filter = w3.eth.filter('latest') + log_loop(block_filter, 2) + + if __name__ == '__main__': + main() + +.. _asynchronous_filters: + +Asynchronous Filter Polling +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting with web3 version 4, the ``watch`` method was taken out of the web3 filter objects. +There are many decisions to be made when designing a system regarding threading and concurrency. +Rather than force a decision, web3 leaves these choices up to the user. Below are some example +implementations of asynchronous filter-event handling that can serve as starting points. + +Single threaded concurrency with ``async`` and ``await`` +```````````````````````````````````````````````````````` + +Beginning in python 3.5, the ``async`` and ``await`` built-in keywords were added. These provide a +shared api for coroutines that can be utilized by modules such as the built-in asyncio_. Below is +an example event loop using asyncio_, that polls multiple web3 filter object, and passes new +entries to a handler. + + .. code-block:: python + + from web3 import Web3, IPCProvider + import asyncio + + # instantiate Web3 instance + w3 = Web3(IPCProvider(...)) + + def handle_event(event): + print(event) + # and whatever + + async def log_loop(event_filter, poll_interval): + while True: + for event in event_filter.get_new_entries(): + handle_event(event) + await asyncio.sleep(poll_interval) + + def main(): + block_filter = w3.eth.filter('latest') + tx_filter = w3.eth.filter('pending') + loop = asyncio.get_event_loop() + try: + loop.run_until_complete( + asyncio.gather( + log_loop(block_filter, 2), + log_loop(tx_filter, 2))) + finally: + loop.close() + + if __name__ == '__main__': + main() + + Read the asyncio_ documentation for more information. + +Running the event loop in a separate thread +``````````````````````````````````````````` + +Here is an extended version of above example, where the event loop is run in a separate thread, +releasing the ``main`` function for other tasks. + + .. code-block:: python + + from web3 import Web3, IPCProvider + from threading import Thread + import time + + # instantiate Web3 instance + w3 = Web3(IPCProvider(...)) + + def handle_event(event): + print(event) + # and whatever + + + def log_loop(event_filter, poll_interval): + while True: + for event in event_filter.get_new_entries(): + handle_event(event) + time.sleep(poll_interval) + + + def main(): + block_filter = w3.eth.filter('latest') + worker = Thread(target=log_loop, args=(block_filter, 5), daemon=True) + worker.start() + # .. do some other stuff + + if __name__ == '__main__': + main() + +Here are some other libraries that provide frameworks for writing asynchronous python: + + * gevent_ + * twisted_ + * celery_ + + +Examples +-------- + +.. _advanced_token_fetch: + +Advanced example: Fetching all token transfer events +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In this example, we show how to fetch all events of a certain event type from the Ethereum blockchain. There are three challenges when working with a large set of events: + +* How to incrementally update an existing database of fetched events + +* How to deal with interruptions in long running processes + +* How to deal with `eth_getLogs` JSON-RPC call query limitations + +* How to handle Ethereum minor chain reorganisations in (near) real-time data + + +eth_getLogs limitations +``````````````````````` + +Ethereum JSON-RPC API servers, like Geth, do not provide an easy way to paginate over events, only over blocks. There's no request that can find the first block with an event or how many events occur within a range of blocks. The only feedback the JSON-RPC service will give you is whether the ``eth_getLogs`` call failed. + +In this example script, we provide two kinds of heuristics to deal with this issue. The script scans events in a chunk of blocks (start block number - end block number). Then it uses two methods to find how many events there are likely to be in a block window: + +* Dynamically set the block range window size, while never exceeding a threshold (e.g., 10,000 blocks). + +* In the case of ``eth_getLogs``, the JSON-RPC call gives a timeout error, decrease the end block number and tries again with a smaller block range window. + + +Example code +```````````` + +The following example code is divided into a reusable ``EventScanner`` class and then a demo script that: + +* fetches all transfer events for `RCC token `_, + +* can incrementally run again to check if there are new events, + +* handles interruptions (e.g., CTRL+C abort) gracefully, + +* writes all ``Transfer`` events in a single file JSON database, so that other process can consume them, + +* uses the `tqdm `_ library for progress bar output in a console, + +* only supports ``HTTPS`` providers, because JSON-RPC retry logic depends on the implementation details of the underlying protocol, + +* disables the default exception retry configuration because it does not know how to handle the shrinking block range window for ``eth_getLogs``, and + +* consumes around 20k JSON-RPC API calls. + +The script can be run with: ``python ./eventscanner.py ``. + +.. code-block:: python + + """A stateful event scanner for Ethereum-based blockchains using web3.py. + + With the stateful mechanism, you can do one batch scan or incremental scans, + where events are added wherever the scanner left off. + """ + + import datetime + import time + import logging + from abc import ABC, abstractmethod + from typing import Tuple, Optional, Callable, List, Iterable, Dict, Any + + from web3 import Web3 + from web3.contract import Contract + from web3.datastructures import AttributeDict + from web3.exceptions import BlockNotFound + from eth_abi.codec import ABICodec + + # Currently this method is not exposed over official web3 API, + # but we need it to construct eth_getLogs parameters + from web3._utils.filters import construct_event_filter_params + from web3._utils.events import get_event_data + + + logger = logging.getLogger(__name__) + + + class EventScannerState(ABC): + """Application state that remembers what blocks we have scanned in the case of crash. + """ + + @abstractmethod + def get_last_scanned_block(self) -> int: + """Number of the last block we have scanned on the previous cycle. + + :return: 0 if no blocks scanned yet + """ + + @abstractmethod + def start_chunk(self, block_number: int): + """Scanner is about to ask data of multiple blocks over JSON-RPC. + + Start a database session if needed. + """ + + @abstractmethod + def end_chunk(self, block_number: int): + """Scanner finished a number of blocks. + + Persistent any data in your state now. + """ + + @abstractmethod + def process_event(self, block_when: datetime.datetime, event: AttributeDict) -> object: + """Process incoming events. + + This function takes raw events from Web3, transforms them to your application internal + format, then saves them in a database or some other state. + + :param block_when: When this block was mined + + :param event: Symbolic dictionary of the event data + + :return: Internal state structure that is the result of event transformation. + """ + + @abstractmethod + def delete_data(self, since_block: int) -> int: + """Delete any data since this block was scanned. + + Purges any potential minor reorg data. + """ + + + class EventScanner: + """Scan blockchain for events and try not to abuse JSON-RPC API too much. + + Can be used for real-time scans, as it detects minor chain reorganisation and rescans. + Unlike the easy web3.contract.Contract, this scanner can scan events from multiple contracts at once. + For example, you can get all transfers from all tokens in the same scan. + + You *should* disable the default ``exception_retry_configuration`` on your provider for Web3, + because it cannot correctly throttle and decrease the `eth_getLogs` block number range. + """ + + def __init__(self, w3: Web3, contract: Contract, state: EventScannerState, events: List, filters: Dict[str, Any], + max_chunk_scan_size: int = 10000, max_request_retries: int = 30, request_retry_seconds: float = 3.0): + """ + :param contract: Contract + :param events: List of web3 Event we scan + :param filters: Filters passed to get_logs + :param max_chunk_scan_size: JSON-RPC API limit in the number of blocks we query. (Recommendation: 10,000 for mainnet, 500,000 for testnets) + :param max_request_retries: How many times we try to reattempt a failed JSON-RPC call + :param request_retry_seconds: Delay between failed requests to let JSON-RPC server to recover + """ + + self.logger = logger + self.contract = contract + self.w3 = w3 + self.state = state + self.events = events + self.filters = filters + + # Our JSON-RPC throttling parameters + self.min_scan_chunk_size = 10 # 12 s/block = 120 seconds period + self.max_scan_chunk_size = max_chunk_scan_size + self.max_request_retries = max_request_retries + self.request_retry_seconds = request_retry_seconds + + # Factor how fast we increase the chunk size if results are found + # # (slow down scan after starting to get hits) + self.chunk_size_decrease = 0.5 + + # Factor how fast we increase chunk size if no results are found + self.chunk_size_increase = 2.0 + + @property + def address(self): + return self.token_address + + def get_block_timestamp(self, block_num) -> datetime.datetime: + """Get Ethereum block timestamp""" + try: + block_info = self.w3.eth.get_block(block_num) + except BlockNotFound: + # Block was not mined yet, + # minor chain reorganisation? + return None + last_time = block_info["timestamp"] + return datetime.datetime.utcfromtimestamp(last_time) + + def get_suggested_scan_start_block(self): + """Get where we should start to scan for new token events. + + If there are no prior scans, start from block 1. + Otherwise, start from the last end block minus ten blocks. + We rescan the last ten scanned blocks in the case there were forks to avoid + misaccounting due to minor single block works (happens once in an hour in Ethereum). + These heuristics could be made more robust, but this is for the sake of simple reference implementation. + """ + + end_block = self.get_last_scanned_block() + if end_block: + return max(1, end_block - self.NUM_BLOCKS_RESCAN_FOR_FORKS) + return 1 + + def get_suggested_scan_end_block(self): + """Get the last mined block on Ethereum chain we are following.""" + + # Do not scan all the way to the final block, as this + # block might not be mined yet + return self.w3.eth.block_number - 1 + + def get_last_scanned_block(self) -> int: + return self.state.get_last_scanned_block() + + def delete_potentially_forked_block_data(self, after_block: int): + """Purge old data in the case of blockchain reorganisation.""" + self.state.delete_data(after_block) + + def scan_chunk(self, start_block, end_block) -> Tuple[int, datetime.datetime, list]: + """Read and process events between to block numbers. + + Dynamically decrease the size of the chunk if the case JSON-RPC server pukes out. + + :return: tuple(actual end block number, when this block was mined, processed events) + """ + + block_timestamps = {} + get_block_timestamp = self.get_block_timestamp + + # Cache block timestamps to reduce some RPC overhead + # Real solution might include smarter models around block + def get_block_when(block_num): + if block_num not in block_timestamps: + block_timestamps[block_num] = get_block_timestamp(block_num) + return block_timestamps[block_num] + + all_processed = [] + + for event_type in self.events: + + # Callable that takes care of the underlying web3 call + def _fetch_events(_start_block, _end_block): + return _fetch_events_for_all_contracts(self.w3, + event_type, + self.filters, + from_block=_start_block, + to_block=_end_block) + + # Do `n` retries on `eth_getLogs`, + # throttle down block range if needed + end_block, events = _retry_web3_call( + _fetch_events, + start_block=start_block, + end_block=end_block, + retries=self.max_request_retries, + delay=self.request_retry_seconds) + + for evt in events: + idx = evt["logIndex"] # Integer of the log index position in the block, null when its pending + + # We cannot avoid minor chain reorganisations, but + # at least we must avoid blocks that are not mined yet + assert idx is not None, "Somehow tried to scan a pending block" + + block_number = evt["blockNumber"] + + # Get UTC time when this event happened (block mined timestamp) + # from our in-memory cache + block_when = get_block_when(block_number) + + logger.debug("Processing event %s, block: %s count: %s", evt['event'], block_number, block_number) + processed = self.state.process_event(block_when, evt) + all_processed.append(processed) + + end_block_timestamp = get_block_when(end_block) + return end_block, end_block_timestamp, all_processed + + def estimate_next_chunk_size(self, current_chuck_size: int, event_found_count: int): + """Try to figure out optimal chunk size + + Our scanner might need to scan the whole blockchain for all events + + * We want to minimize API calls over empty blocks + + * We want to make sure that one scan chunk does not try to process too many entries once, as we try to control commit buffer size and potentially asynchronous busy loop + + * Do not overload node serving JSON-RPC API by asking data for too many events at a time + + Currently Ethereum JSON-API does not have an API to tell when a first event occurred in a blockchain + and our heuristics try to accelerate block fetching (chunk size) until we see the first event. + + These heuristics exponentially increase the scan chunk size depending on if we are seeing events or not. + When any transfers are encountered, we are back to scanning only a few blocks at a time. + It does not make sense to do a full chain scan starting from block 1, doing one JSON-RPC call per 20 blocks. + """ + + if event_found_count > 0: + # When we encounter first events, reset the chunk size window + current_chuck_size = self.min_scan_chunk_size + else: + current_chuck_size *= self.chunk_size_increase + + current_chuck_size = max(self.min_scan_chunk_size, current_chuck_size) + current_chuck_size = min(self.max_scan_chunk_size, current_chuck_size) + return int(current_chuck_size) + + def scan(self, start_block, end_block, start_chunk_size=20, progress_callback=Optional[Callable]) -> Tuple[ + list, int]: + """Perform a token balances scan. + + Assumes all balances in the database are valid before start_block (no forks sneaked in). + + :param start_block: The first block included in the scan + + :param end_block: The last block included in the scan + + :param start_chunk_size: How many blocks we try to fetch over JSON-RPC on the first attempt + + :param progress_callback: If this is an UI application, update the progress of the scan + + :return: [All processed events, number of chunks used] + """ + + assert start_block <= end_block + + current_block = start_block + + # Scan in chunks, commit between + chunk_size = start_chunk_size + last_scan_duration = last_logs_found = 0 + total_chunks_scanned = 0 + + # All processed entries we got on this scan cycle + all_processed = [] + + while current_block <= end_block: + + self.state.start_chunk(current_block, chunk_size) + + # Print some diagnostics to logs to try to fiddle with real world JSON-RPC API performance + estimated_end_block = min(current_block + chunk_size, end_block) + logger.debug( + "Scanning token transfers for blocks: %s - %s, chunk size %s, last chunk scan took %s, last logs found %s", + current_block, estimated_end_block, chunk_size, last_scan_duration, last_logs_found, + ) + + start = time.time() + actual_end_block, end_block_timestamp, new_entries = self.scan_chunk(current_block, estimated_end_block) + + # Where does our current chunk scan ends - are we out of chain yet? + current_end = actual_end_block + + last_scan_duration = time.time() - start + all_processed += new_entries + + # Print progress bar + if progress_callback: + progress_callback(start_block, end_block, current_block, end_block_timestamp, chunk_size, len(new_entries)) + + # Try to guess how many blocks to fetch over `eth_getLogs` API next time + chunk_size = self.estimate_next_chunk_size(chunk_size, len(new_entries)) + + # Set where the next chunk starts + current_block = current_end + 1 + total_chunks_scanned += 1 + self.state.end_chunk(current_end) + + return all_processed, total_chunks_scanned + + + def _retry_web3_call(func, start_block, end_block, retries, delay) -> Tuple[int, list]: + """A custom retry loop to throttle down block range. + + If our JSON-RPC server cannot serve all incoming `eth_getLogs` in a single request, + we retry and throttle down block range for every retry. + + For example, Go Ethereum does not indicate what is an acceptable response size. + It just fails on the server-side with a "context was cancelled" warning. + + :param func: A callable that triggers Ethereum JSON-RPC, as func(start_block, end_block) + :param start_block: The initial start block of the block range + :param end_block: The initial start block of the block range + :param retries: How many times we retry + :param delay: Time to sleep between retries + """ + for i in range(retries): + try: + return end_block, func(start_block, end_block) + except Exception as e: + # Assume this is HTTPConnectionPool(host='localhost', port=8545): Read timed out. (read timeout=10) + # from Go Ethereum. This translates to the error "context was cancelled" on the server side: + # https://github.com/ethereum/go-ethereum/issues/20426 + if i < retries - 1: + # Give some more verbose info than the default middleware + logger.warning( + "Retrying events for block range %s - %s (%s) failed with %s , retrying in %s seconds", + start_block, end_block, end_block-start_block, e, delay, + ) + # Decrease the `eth_getBlocks` range + end_block = start_block + ((end_block - start_block) // 2) + # Let the JSON-RPC to recover e.g. from restart + time.sleep(delay) + continue + else: + logger.warning("Out of retries") + raise + + + def _fetch_events_for_all_contracts( + w3, + event, + argument_filters: Dict[str, Any], + from_block: int, + to_block: int) -> Iterable: + """Get events using eth_getLogs API. + + This method is detached from any contract instance. + + This is a stateless method, as opposed to create_filter. + It can be safely called against nodes which do not provide `eth_newFilter` API, like Infura. + """ + + if from_block is None: + raise Web3TypeError("Missing mandatory keyword argument to get_logs: from_block") + + # Currently no way to poke this using a public web3.py API. + # This will return raw underlying ABI JSON object for the event + abi = event._get_event_abi() + + # Depending on the Solidity version used to compile + # the contract that uses the ABI, + # it might have Solidity ABI encoding v1 or v2. + # We just assume the default that you set on Web3 object here. + # More information here https://eth-abi.readthedocs.io/en/latest/index.html + codec: ABICodec = w3.codec + + # Here we need to poke a bit into Web3 internals, as this + # functionality is not exposed by default. + # Construct JSON-RPC raw filter presentation based on human readable Python descriptions + # Namely, convert event names to their keccak signatures + # More information here: + # https://github.com/ethereum/web3.py/blob/e176ce0793dafdd0573acc8d4b76425b6eb604ca/web3/_utils/filters.py#L71 + data_filter_set, event_filter_params = construct_event_filter_params( + abi, + codec, + address=argument_filters.get("address"), + argument_filters=argument_filters, + from_block=from_block, + to_block=to_block + ) + + logger.debug("Querying eth_getLogs with the following parameters: %s", event_filter_params) + + # Call JSON-RPC API on your Ethereum node. + # get_logs() returns raw AttributedDict entries + logs = w3.eth.get_logs(event_filter_params) + + # Convert raw binary data to Python proxy objects as described by ABI + all_events = [] + for log in logs: + # Convert raw JSON-RPC log result to human readable event by using ABI data + # More information how process_log works here + # https://github.com/ethereum/web3.py/blob/fbaf1ad11b0c7fac09ba34baff2c256cffe0a148/web3/_utils/events.py#L200 + evt = get_event_data(codec, abi, log) + # Note: This was originally yield, + # but deferring the timeout exception caused the throttle logic not to work + all_events.append(evt) + return all_events + + + if __name__ == "__main__": + # Simple demo that scans all the token transfers of RCC token (11k). + # The demo supports persistent state by using a JSON file. + # You will need an Ethereum node for this. + # Running this script will consume around 20k JSON-RPC calls. + # With locally running Geth, the script takes 10 minutes. + # The resulting JSON state file is 2.9 MB. + import sys + import json + from web3.providers.rpc import HTTPProvider + + # We use tqdm library to render a nice progress bar in the console + # https://pypi.org/project/tqdm/ + from tqdm import tqdm + + # RCC has around 11k Transfer events + # https://etherscan.io/token/0x9b6443b0fb9c241a7fdac375595cea13e6b7807a + RCC_ADDRESS = "0x9b6443b0fb9c241a7fdac375595cea13e6b7807a" + + # Reduced ERC-20 ABI, only Transfer event + ABI = """[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } + ] + """ + + class JSONifiedState(EventScannerState): + """Store the state of scanned blocks and all events. + + All state is an in-memory dict. + Simple load/store massive JSON on start up. + """ + + def __init__(self): + self.state = None + self.fname = "test-state.json" + # How many second ago we saved the JSON file + self.last_save = 0 + + def reset(self): + """Create initial state of nothing scanned.""" + self.state = { + "last_scanned_block": 0, + "blocks": {}, + } + + def restore(self): + """Restore the last scan state from a file.""" + try: + self.state = json.load(open(self.fname, "rt")) + print(f"Restored the state, previously {self.state['last_scanned_block']} blocks have been scanned") + except (IOError, json.decoder.JSONDecodeError): + print("State starting from scratch") + self.reset() + + def save(self): + """Save everything we have scanned so far in a file.""" + with open(self.fname, "wt") as f: + json.dump(self.state, f) + self.last_save = time.time() + + # + # EventScannerState methods implemented below + # + + def get_last_scanned_block(self): + """The number of the last block we have stored.""" + return self.state["last_scanned_block"] + + def delete_data(self, since_block): + """Remove potentially reorganised blocks from the scan data.""" + for block_num in range(since_block, self.get_last_scanned_block()): + if block_num in self.state["blocks"]: + del self.state["blocks"][block_num] + + def start_chunk(self, block_number, chunk_size): + pass + + def end_chunk(self, block_number): + """Save at the end of each block, so we can resume in the case of a crash or CTRL+C""" + # Next time the scanner is started we will resume from this block + self.state["last_scanned_block"] = block_number + + # Save the database file for every minute + if time.time() - self.last_save > 60: + self.save() + + def process_event(self, block_when: datetime.datetime, event: AttributeDict) -> str: + """Record a ERC-20 transfer in our database.""" + # Events are keyed by their transaction hash and log index + # One transaction may contain multiple events + # and each one of those gets their own log index + + # event_name = event.event # "Transfer" + log_index = event.logIndex # Log index within the block + # transaction_index = event.transactionIndex # Transaction index within the block + txhash = event.transactionHash.hex() # Transaction hash + block_number = event.blockNumber + + # Convert ERC-20 Transfer event to our internal format + args = event["args"] + transfer = { + "from": args["from"], + "to": args.to, + "value": args.value, + "timestamp": block_when.isoformat(), + } + + # Create empty dict as the block that contains all transactions by txhash + if block_number not in self.state["blocks"]: + self.state["blocks"][block_number] = {} + + block = self.state["blocks"][block_number] + if txhash not in block: + # We have not yet recorded any transfers in this transaction + # (One transaction may contain multiple events if executed by a smart contract). + # Create a tx entry that contains all events by a log index + self.state["blocks"][block_number][txhash] = {} + + # Record ERC-20 transfer in our database + self.state["blocks"][block_number][txhash][log_index] = transfer + + # Return a pointer that allows us to look up this event later if needed + return f"{block_number}-{txhash}-{log_index}" + + def run(): + + if len(sys.argv) < 2: + print("Usage: eventscanner.py http://your-node-url") + sys.exit(1) + + api_url = sys.argv[1] + + # Enable logs to the stdout. + # DEBUG is very verbose level + logging.basicConfig(level=logging.INFO) + + provider = HTTPProvider(api_url) + + # Disable the default JSON-RPC retry configuration + # as it correctly cannot handle eth_getLogs block range + provider.exception_retry_configuration = None + + w3 = Web3(provider) + + # Prepare stub ERC-20 contract object + abi = json.loads(ABI) + ERC20 = w3.eth.contract(abi=abi) + + # Restore/create our persistent state + state = JSONifiedState() + state.restore() + + # chain_id: int, w3: Web3, abi: Dict, state: EventScannerState, events: List, filters: Dict, max_chunk_scan_size: int=10000 + scanner = EventScanner( + w3=w3, + contract=ERC20, + state=state, + events=[ERC20.events.Transfer], + filters={"address": RCC_ADDRESS}, + # How many maximum blocks at the time we request from JSON-RPC + # and we are unlikely to exceed the response size limit of the JSON-RPC server + max_chunk_scan_size=10000 + ) + + # Assume we might have scanned the blocks all the way to the last Ethereum block + # that mined a few seconds before the previous scan run ended. + # Because there might have been a minor Ethereum chain reorganisations + # since the last scan ended, we need to discard + # the last few blocks from the previous scan results. + chain_reorg_safety_blocks = 10 + scanner.delete_potentially_forked_block_data(state.get_last_scanned_block() - chain_reorg_safety_blocks) + + # Scan from [last block scanned] - [latest ethereum block] + # Note that our chain reorg safety blocks cannot go negative + start_block = max(state.get_last_scanned_block() - chain_reorg_safety_blocks, 0) + end_block = scanner.get_suggested_scan_end_block() + blocks_to_scan = end_block - start_block + + print(f"Scanning events from blocks {start_block} - {end_block}") + + # Render a progress bar in the console + start = time.time() + with tqdm(total=blocks_to_scan) as progress_bar: + def _update_progress(start, end, current, current_block_timestamp, chunk_size, events_count): + if current_block_timestamp: + formatted_time = current_block_timestamp.strftime("%d-%m-%Y") + else: + formatted_time = "no block time available" + progress_bar.set_description(f"Current block: {current} ({formatted_time}), blocks in a scan batch: {chunk_size}, events processed in a batch {events_count}") + progress_bar.update(chunk_size) + + # Run the scan + result, total_chunks_scanned = scanner.scan(start_block, end_block, progress_callback=_update_progress) + + state.save() + duration = time.time() - start + print(f"Scanned total {len(result)} Transfer events, in {duration} seconds, total {total_chunks_scanned} chunk scans performed") + + run() + + +.. _WETH: https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2#code +.. _asyncio: https://docs.python.org/3/library/asyncio.html +.. _gevent: https://www.gevent.org/ +.. _twisted: https://twistedmatrix.com/ +.. _celery: https://www.celeryproject.org/ diff --git a/_build/html_zh_CN/_sources/gas_price.rst.txt b/_build/html_zh_CN/_sources/gas_price.rst.txt new file mode 100644 index 0000000000..62fbb9379b --- /dev/null +++ b/_build/html_zh_CN/_sources/gas_price.rst.txt @@ -0,0 +1,119 @@ +.. _Gas_Price: + +Gas Price API +=============== + +.. warning:: + Gas price strategy is only supported for legacy transactions. The London fork + introduced ``maxFeePerGas`` and ``maxPriorityFeePerGas`` transaction parameters + which should be used over ``gasPrice`` whenever possible. + +For Ethereum (legacy) transactions, gas price is a delicate property. For this reason, +Web3 includes an API for configuring it. + +The Gas Price API allows you to define Web3's behaviour for populating the gas price. +This is done using a "Gas Price Strategy" - a method which takes the Web3 object and a +transaction dictionary and returns a gas price (denominated in wei). + +Retrieving gas price +-------------------- + +To retrieve the gas price using the selected strategy simply call +:meth:`~web3.eth.Eth.generate_gas_price` + +.. code-block:: python + + >>> web3.eth.generate_gas_price() + 20000000000 + +Creating a gas price strategy +------------------------------- + +A gas price strategy is implemented as a python method with the following +signature: + +.. code-block:: python + + def gas_price_strategy(web3, transaction_params=None): + ... + +The method must return a positive integer representing the gas price in wei. + +To demonstrate, here is a rudimentary example of a gas price strategy that +returns a higher gas price when the value of the transaction is higher than +1 Ether. + +.. code-block:: python + + from web3 import Web3 + + def value_based_gas_price_strategy(web3, transaction_params): + if transaction_params['value'] > Web3.to_wei(1, 'ether'): + return Web3.to_wei(20, 'gwei') + else: + return Web3.to_wei(5, 'gwei') + +Selecting the gas price strategy +-------------------------------- + +The gas price strategy can be set by calling :meth:`~web3.eth.Eth.set_gas_price_strategy`. + +.. code-block:: python + + from web3 import Web3 + + def value_based_gas_price_strategy(web3, transaction_params): + ... + + w3 = Web3(...) + w3.eth.set_gas_price_strategy(value_based_gas_price_strategy) + +Available gas price strategies +------------------------------ + +.. py:module:: web3.gas_strategies.rpc + +.. py:method:: rpc_gas_price_strategy(web3, transaction_params=None) + + Makes a call to the `JSON-RPC eth_gasPrice + method `_ which returns + the gas price configured by the connected Ethereum node. + +.. py:module:: web3.gas_strategies.time_based + +.. py:method:: construct_time_based_gas_price_strategy(max_wait_seconds, sample_size=120, probability=98, weighted=False) + + Constructs a strategy which will compute a gas price such that the + transaction will be mined within a number of seconds defined by + ``max_wait_seconds`` with a probability defined by ``probability``. The + gas price is computed by sampling ``sample_size`` of the most recently + mined blocks. If ``weighted=True``, the block time will be weighted towards + more recently mined blocks. + + * ``max_wait_seconds`` The desired maximum number of seconds the + transaction should take to mine. + * ``sample_size`` The number of recent blocks to sample + * ``probability`` An integer representation of the desired probability that + the transaction will be mined within ``max_wait_seconds``. 0 means 0% + and 100 means 100%. + + The following ready to use versions of this strategy are available. + + * ``web3.gas_strategies.time_based.fast_gas_price_strategy``: Transaction mined within 60 seconds. + * ``web3.gas_strategies.time_based.medium_gas_price_strategy``: Transaction mined within 5 minutes. + * ``web3.gas_strategies.time_based.slow_gas_price_strategy``: Transaction mined within 1 hour. + * ``web3.gas_strategies.time_based.glacial_gas_price_strategy``: Transaction mined within 24 hours. + + .. warning:: Due to the overhead of sampling the recent blocks it is + recommended that a caching solution be used to reduce the amount of chain + data that needs to be re-fetched for each request. + + .. code-block:: python + + from web3 import Web3 + from web3.gas_strategies.time_based import medium_gas_price_strategy + + w3 = Web3(...) + w3.eth.set_gas_price_strategy(medium_gas_price_strategy) + + w3.provider.cache_allowed_requests = True diff --git a/_build/html_zh_CN/_sources/index.rst.txt b/_build/html_zh_CN/_sources/index.rst.txt new file mode 100644 index 0000000000..a6dafc28e2 --- /dev/null +++ b/_build/html_zh_CN/_sources/index.rst.txt @@ -0,0 +1,48 @@ +.. meta:: + :description: Python Web3 SDK for Ethereum and EVM blockchains + +gm +== + +.. image:: _static/banner/banner-snek.jpg + :alt: Banner Image + +**web3.py** is a Python library for interacting with Ethereum. + +It's commonly found in `decentralized apps (dapps)`_ to help with +sending transactions, interacting with smart contracts, reading +block data, and a variety of other use cases. + +For project updates, follow `@EthereumPython`_ and sign up +for new post notifications on the `blog`_. + + +Getting Started +--------------- + +.. NOTE:: + 👋 Brand new to Ethereum? + + 0. Don't travel alone! Join the Ethereum Python Community `Discord`_. + 1. Read this `blog post series`_ for a gentle introduction to Ethereum blockchain concepts. + 2. The :ref:`Overview` page will give you a quick idea of what else web3.py can do. + 3. Try building a little something! + +- Ready to code? → :ref:`quickstart` +- Quick tour? → :ref:`overview` +- Synchronous help? → `Discord`_ +- Asynchronous help? → `StackExchange`_ +- Report a bug? → `Github`_ +- Want to help us? → :ref:`Contribute ` +- Looking for inspiration? → :ref:`resources` + +.. include:: toc.rst + + +.. _decentralized apps (dapps): https://ethereum.org/en/dapps/ +.. _@EthereumPython: https://twitter.com/EthereumPython +.. _blog: https://snakecharmers.ethereum.org/ +.. _blog post series: https://snakecharmers.ethereum.org/a-developers-guide-to-ethereum-pt-1 +.. _StackExchange: https://ethereum.stackexchange.com/questions/tagged/web3.py +.. _Discord: https://discord.gg/GHryRvPB84 +.. _Github: https://github.com/ethereum/web3.py/issues diff --git a/_build/html_zh_CN/_sources/internals.rst.txt b/_build/html_zh_CN/_sources/internals.rst.txt new file mode 100644 index 0000000000..58b1b56a85 --- /dev/null +++ b/_build/html_zh_CN/_sources/internals.rst.txt @@ -0,0 +1,622 @@ +Web3 Internals +============== + + +.. warning:: This section of the documentation is for advanced users. You should probably stay away from these APIs if you don't know what you are doing. + +The Web3 library has multiple layers of abstraction between the public api +exposed by the web3 object and the backend or node that web3 is connecting to. + +* **Providers** are responsible for the actual communication with the + blockchain such as sending JSON-RPC requests over HTTP or an IPC socket. +* **Middleware** provide hooks for monitoring and modifying requests and + responses to and from the provider. +* **Managers** provide thread safety and primitives to allow for asynchronous usage of web3. + +Here are some common things you might want to do with these APIs. + +* Redirect certain RPC requests to different providers such as sending all + *read* operations to a provider backed by a remote node and all *write* operations + to a local node that you control. +* Transparently intercept transactions sent over ``eth_sendTransaction``, sign + them locally, and then send them through ``eth_sendRawTransaction``. +* Modify the response from an RPC request so that it is returned in different + format such as converting all integer values to their hexadecimal + representation. +* Validate the inputs to RPC requests + + +Request Lifecycle +----------------- + +Each web3 RPC call passes through these layers in the following manner. + +.. code-block:: none + + *********** ************ + | Request | | Response | + *********** ************ + | ^ + v | + +-----------------------------+ + | Manager | + +-----------------------------+ + | ^ + v | + +-----------------------------+ + | Middleware | + +-----------------------------+ + | ^ + v | + +-----------------------------+ + | Provider | + +-----------------------------+ + + +You can visualize this relationship like an onion, with the Provider at the +center. The request originates from the ``Manager``, outside of the onion, passing +down through each layer of the onion until it reaches the ``Provider`` at the +center. The ``Provider`` then handles the request, producing a response which will +then pass back out from the center of the onion, through each layer until it is +finally returned by the ``Manager``. + + +Providers +--------- + +A provider is responsible for all direct blockchain interactions. In most +cases this means interacting with the JSON-RPC server for an ethereum node over +HTTP or an IPC socket. There is however nothing which requires providers to be +RPC based, allowing for providers designed for testing purposes which use an +in-memory EVM to fulfill requests. + + +Writing your own Provider +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Writing your own provider requires implementing two required methods as well as +setting the middleware the provider should use. + + +.. py:method:: BaseProvider.make_request(method, params) + + Each provider class **must** implement this method. This method **should** + return a JSON object with either a ``'result'`` key in the case of success, + or an ``'error'`` key in the case of failure. + + + * ``method`` This will be a string representing the JSON-RPC method that + is being called such as ``'eth_sendTransaction'``. + * ``params`` This will be a list or other iterable of the parameters for + the JSON-RPC method being called. + + +.. py:method:: BaseProvider.is_connected(show_traceback=False) + + This function should return ``True`` or ``False`` depending on whether the + provider should be considered *connected*. For example, an IPC socket + based provider should return ``True`` if the socket is open and ``False`` + if the socket is closed. + + If set to ``True``, the optional ``show_traceback`` boolean will raise a + ``ProviderConnectionError`` and provide information on why the provider should + not be considered *connected*. + + +.. py:attribute:: BaseProvider.middleware + + This should be an iterable of middleware. + +You can set a new list of middleware by assigning to ``provider.middleware``, +with the first middleware that processes the request at the beginning of the list. + + +Provider Configurations +~~~~~~~~~~~~~~~~~~~~~~~ + +.. _request_caching: + +Request Caching +``````````````` + +.. important:: + Familiarize yourself with the validation logic for request caching before + enabling it. Since this feature often requires making additional requests under the + hood to try to guarantee the validity of the data, it may create unnecessary + overhead for your use case. Validation can be turned off by setting the + ``request_cache_validation_threshold`` option to ``None``, caching all allowed + requests, or configured for adjusting performance to your needs. + + +Request caching can be configured at the provider level via the following configuration +options on the provider instance: + +- ``cache_allowed_requests: bool = False`` +- ``cacheable_requests: Optional[Set[RPCEndpoint]]`` +- ``request_cache_validation_threshold: Optional[Union[RequestCacheValidationThreshold, int]]`` + +For requests that don't rely on block data (e.g., ``eth_chainId``), enabling request +caching by setting the ``cache_allowed_requests`` option to ``True`` will cache all +responses. This is safe to do. + +However, for requests that rely on block data (e.g., ``eth_getBlockByNumber``), it is +not safe to always cache their responses because block data can change - during a +chain reorganization or while finality has not been reached, for example. The +``request_cache_validation_threshold`` option allows configuring a safe threshold for +caching responses that depend on block data. By default, this option is configured +to internal values deemed "safe" for the chain id you are connected to. If you are +connected to mainnet Ethereum, this value is set to the ``finalized`` block number. +If you are connected to another chain, this value is set to a time interval in seconds, +from the current time, that is deemed "safe" for that chain's finality mechanism. + +**It's important to understand that, in order to perform these validations, extra +requests are sometimes made to the node to get the appropriate information. For a +transaction request, for example, it is necessary to get the block information to +validate the transaction is beyond the safe threshold. This can create overhead, +especially for high-frequency requests. For this reason, it is important to understand +when to turn on caching and how to configure the validation appropriately for your +use case in order to avoid unnecessary overhead.** + +We keep a list of some reasonable values for bigger chains and +use the time interval of 1 hour for everything else. Below is a list of the default +values for internally configured chains: + + - ETH: RequestCacheValidationThreshold.FINALIZED ("finalized" block) + - ARB1: 7 days + - ZKSYNC: 1 hour + - OETH: 3 minutes + - MATIC: 30 minutes + - ZKEVM: 1 hour + - BASE: 7 days + - SCR: 1 hour + - GNO: 5 minutes + - AVAX: 2 minutes + - BNB: 2 minutes + - FTM: 1 minute + +For Ethereum mainnet, for example, this means that a request's response will be cached +if the block number the request relies on is less than or equal to the ``finalized`` +block number. If the block number exceeds the ``finalized`` block number, the response +won't be cached. For all others, the response will be cached if the block timestamp +related to the data that is being requested is older than or equal to the time interval +configured for that chain. For any chain not on this list, the default value is set to +1 hour (this includes all testnets). + +This behavior can be modified by setting the ``request_cache_validation_threshold`` +option to ``RequestCacheValidationThreshold.SAFE``, which uses the ``safe`` block as +the threshold (Ethereum mainnet only), to your own time interval in seconds (for any +chain, including mainnet Ethereum), or to ``None``, which disables any validation and +caches all requests (this is not recommended for non testnet chains). The +``RequestCacheValidationThreshold`` enum, for mainnet ``finalized`` and ``safe`` values, +is imported from the ``web3.utils`` module. + +Note that the ``cacheable_requests`` option can be used to specify a set of RPC +endpoints that are allowed to be cached. By default, this option is set to an internal +list of deemed-safe-to-cache endpoints, excluding endpoints such as ``eth_call``, whose +responses can vary and are not safe to cache. The default list of cacheable requests is +below, with requests validated by the ``request_cache_validation_threshold`` option in +bold: + + - eth_chainId + - web3_clientVersion + - net_version + - **eth_getBlockByNumber** + - **eth_getRawTransactionByBlockNumberAndIndex** + - **eth_getBlockTransactionCountByNumber** + - **eth_getUncleByBlockNumberAndIndex** + - **eth_getUncleCountByBlockNumber** + - **eth_getBlockByHash** + - **eth_getTransactionByHash** + - **eth_getTransactionByBlockNumberAndIndex** + - **eth_getTransactionByBlockHashAndIndex** + - **eth_getBlockTransactionCountByHash** + - **eth_getRawTransactionByBlockHashAndIndex** + - **eth_getUncleByBlockHashAndIndex** + - **eth_getUncleCountByBlockHash** + +.. code-block:: python + + from web3 import Web3, HTTPProvider + from web3.utils import RequestCacheValidationThreshold + + w3 = Web3(HTTPProvider( + endpoint_uri="...", + + # optional flag to turn on cached requests, defaults to ``False`` + cache_allowed_requests=True, + + # optional, defaults to an internal list of deemed-safe-to-cache endpoints (see above) + cacheable_requests={"eth_chainId", "eth_getBlockByNumber"}, + + # optional, defaults to a value that is based on the chain id (see above) + request_cache_validation_threshold=60 * 60, # 1 hour + # request_cache_validation_threshold=RequestCacheValidationThreshold.SAFE, # Ethereum mainnet only + )) + +.. _http_retry_requests: + +Retry Requests for HTTP Providers +````````````````````````````````` + +``HTTPProvider`` and ``AsyncHTTPProvider`` instances retry certain requests by default +on exceptions. This can be configured via the ``exception_retry_configuration`` +property on the provider instance, which takes a +:class:`~web3.providers.rpc.utils.ExceptionRetryConfiguration` class as its value. The +retry mechanism employs an exponential backoff strategy, starting from the initial +value determined by the ``backoff_factor``, and doubling the delay with each attempt, +up to the ``retries`` value. Below is an example showing the default options for the +retry configuration and how to override them. + + +.. py:class:: web3.providers.rpc.utils.ExceptionRetryConfiguration + + .. py:attribute:: errors + + A tuple of exceptions that the provider should retry on. The default is + ``HTTPProvider``: ``(ConnectionError, requests.HTTPError, requests.Timeout)`` + and ``AsyncHTTPProvider``: ``(aiohttp.ClientError, asyncio.TimeoutError)``. + + .. py:attribute:: retries + + The number of retries to attempt. The default is 5. + + .. py:attribute:: backoff_factor + + The initial delay multiplier, which doubles with each retry attempt. The default + is 0.125. + + .. py:attribute:: method_allowlist + + A list of retryable methods. The default is an in-house list of deemed-safe-to- + retry methods. + +.. code-block:: python + + from web3 import Web3, HTTPProvider + from web3.providers.rpc.utils import ( + REQUEST_RETRY_ALLOWLIST, + ExceptionRetryConfiguration, + ) + + w3 = Web3(HTTPProvider( + endpoint_uri="...", + exception_retry_configuration=ExceptionRetryConfiguration( + errors=DEFAULT_EXCEPTIONS, + + # number of retries to attempt + retries=5, + + # initial delay multiplier, doubles with each retry attempt + backoff_factor=0.125, + + # an in-house default list of retryable methods + method_allowlist=REQUEST_RETRY_ALLOWLIST, + ), + )) + +For the different http providers, ``DEFAULT_EXCEPTIONS`` is defined as: + +- ``HTTPProvider``: ``(ConnectionError, requests.HTTPError, requests.Timeout)`` +- ``AsyncHTTPProvider``: ``(ConnectionError, aiohttp.ClientError, asyncio.TimeoutError)`` + +Setting ``retry_configuration`` to ``None`` will disable retries on exceptions for the +provider instance. + +.. code-block:: python + + from web3 import Web3, HTTPProvider + + w3 = Web3(HTTPProvider(endpoint_uri="...", retry_configuration=None) + + + +Managers +-------- + +The Manager acts as a gatekeeper for the request/response lifecycle. It is +unlikely that you will need to change the Manager as most functionality can be +implemented in the Middleware layer. + +.. _internals__persistent_connection_providers: + +Request Processing for Persistent Connection Providers +------------------------------------------------------ + +.. py:class:: web3.providers.persistent.request_processor.RequestProcessor + +The ``RequestProcessor`` class is responsible for the storing and syncing up of +asynchronous requests to responses for a ``PersistentConnectionProvider``. The +:class:`~web3.providers.persistent.WebSocketProvider` and the +:class:`~web3.providers.persistent.AsyncIPCProvider` are two persistent connection +providers. In order to send a request and receive a response to that same request, +``PersistentConnectionProvider`` instances have to match request *id* values to +response *id* values coming back from the socket connection. Any provider that does +not adhere to the `JSON-RPC 2.0 specification `_ +in this way will not work with ``PersistentConnectionProvider`` instances. The specifics +of how the request processor handles this are outlined below. + +Listening for Responses +~~~~~~~~~~~~~~~~~~~~~~~ + +Implementations of the ``PersistentConnectionProvider`` class have a message listener +background task that is called when the socket connection is established. This task +is responsible for listening for any and all messages coming in over the socket +connection and storing them in the ``RequestProcessor`` instance internal to the +``PersistentConnectionProvider`` instance. The ``RequestProcessor`` instance is +responsible for storing the messages in the correct cache, either the one-to-one cache +or the one-to-many (subscriptions) queue, depending on whether the message has a +JSON-RPC *id* value or not. + + +One-To-One Requests +~~~~~~~~~~~~~~~~~~~ + +One-to-one requests can be summarized as any request that expects only one response +back. An example is using the ``eth`` module API to request the latest block number. + +.. code-block:: python + + >>> async def ws_one_to_one_example(): + ... async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3: + ... # make a request and expect a single response returned on the same line + ... latest_block_num = await w3.eth.block_number + + >>> asyncio.run(ws_one_to_one_example()) + +With persistent socket connections, we have to call ``send()`` and asynchronously +receive responses via another means, generally by calling ``recv()`` or by iterating +on the socket connection for messages. As outlined above, the +``PersistentConnectionProvider`` class has a message listener background task that +handles the receiving of messages. + +Due to this asynchronous nature of sending and receiving, in order to make one-to-one +request-to-response calls work, we have to save the request information somewhere so +that, when the response is received, we can match it to the original request that was +made (i.e. the request with a matching *id* to the response that was received). The +stored request information is then used to process the response when it is received, +piping it through the response formatters and middleware internal to the *web3.py* +library. + +In order to store the request information, the ``RequestProcessor`` class has an +internal ``RequestInformation`` cache. The ``RequestInformation`` class saves important +information about a request. + +.. py:class:: web3._utils.caching.RequestInformation + + .. py:attribute:: method + + The name of the method - e.g. "eth_subscribe". + + .. py:attribute:: params + + The params used when the call was made - e.g. ("newPendingTransactions", True). + + .. py:attribute:: response_formatters + + The formatters that will be used to process the response. + + .. py:attribute:: middleware_response_processors + + Any middleware that processes responses that is present on the instance at the + time of the request is appended here, in order, so the response may be piped + through that logic when it comes in. + + .. py:attribute:: subscription_id + + If the request is an ``eth_subscribe`` request, rather than + popping this information from the cache when the response to the subscription call + comes in (i.e. the subscription *id*), we save the subscription id with the + request information so that we can correctly process all subscription messages + that come in with that subscription *id*. For one-to-one request-to-response + calls, this value is always ``None``. + +One-to-one responses, those that include a JSON-RPC *id* in the response object, are +stored in an internal ``SimpleCache`` class, isolated from any one-to-many responses. +When the ``PersistentConnectionProvider`` is looking for a response internally, it will +expect the message listener task to store the response in this cache. Since the request +*id* is used in the cache key generation, it will then look for a cache key that matches +the response *id* with that of the request *id*. If the cache key is found, the response +is processed and returned to the user. If the cache key is not found, the operation will +time out and raise a ``TimeExhausted`` exception. This timeout can be configured by the +user when instantiating the ``PersistentConnectionProvider`` instance via the +``response_timeout`` keyword argument. + +One-To-Many Requests +~~~~~~~~~~~~~~~~~~~~ + +One-to-many requests can be summarized by any request that expects many responses as a +result of the initial request. The only current example is the ``eth_subscribe`` +request. The initial ``eth_subscribe`` request expects only one response, the +subscription *id* value, but it also expects to receive many ``eth_subscription`` +messages if and when the request is successful. For this reason, the original request +is considered a one-to-one request so that a subscription *id* can be returned to the +user on the same line. The many responses this call will produce can be handled in one +of a few ways. + +The recommended way to handle one-to-many responses is to use the subscription manager +API. The subscription manager API is a public API on the ``AsyncWeb3`` class, when +connected to a ``PersistentConnectionProvider`` instance, that allows the user to +subscribe to a subscription and handle the many responses asynchronously. The +``subscription_manager`` instance is responsible for handling the many responses that +come in over the socket connection, as long as handlers are passed to each subscription +call. The subscription manager can also be used to unsubscribe from a subscription when +the user is done with it. + +.. code-block:: python + + >>> async def new_heads_handler( + ... handler_context: NewHeadsSubscriptionContext, + ... ) -> None: + ... result = handler_context.result + ... print(f"New block header: {result}\n") + ... if result["number"] > 1234567: + ... await handler_context.subscription.unsubscribe() + + >>> async def ws_subscription_example(): + ... async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3: + ... # Subscribe to new block headers and receive the subscription_id. + ... # A one-to-one call with a trigger for many responses + ... subscription_id = await w3.eth.subscribe("newHeads", handler=new_heads_handler) + ... + ... # Handle the subscription messages asynchronously using the subscription + ... # manager. This will continue until no more subscriptions are present in + ... # the subscription manager, or indefinitely if the `run_forever` flag + ... # is set to `True`. + ... await w3.subscription_manager.handle_subscriptions(run_forever=False) + >>> asyncio.run(ws_subscription_example()) + +The manager can also subscribe to many subscriptions at one time. The +``EthSubscription`` classes, available via ``web3.utils.subscriptions``, provide a +friendly API for managing subscriptions. Since each connection and provider instance +has its own message listener task and subscription manager instance, you can subscribe +to many subscriptions at once and handle the many responses that come in over the socket +connections via handlers. The handlers contain: + +- ``async_w3``: The ``AsyncWeb3`` instance that the subscription was made on. +- ``subscription``: The subscription instance that the handler is attached to. +- ``result``: The response that came in over the socket connection for the subscription. + +Subscriptions also accept a ``handler_context`` argument that can be used to pass +additional information to the handler when subscribing to a subscription. This can be +used to pass in an event object, for example, that can be used to parse a log event +when it comes in. + + +.. code-block:: python + + >>> from web3 import ( + ... AsyncWeb3, + ... WebSocketProvider, + ... AsyncIPCProvider, + ... ) + >>> from web3.utils.subscriptions import ( + ... EthSubscription, + ... NewHeadsSubscription, + ... NewHeadsSubscriptionContext, + ... PendingTxSubscription, + ... PendingTxSubscriptionContext, + ... LogsSubscription, + ... LogsSubscriptionContext, + ... ) + + >>> async def new_heads_handler( + ... handler_context: NewHeadsSubscriptionContext, + ... ) -> None: + ... header = handler_context.result + ... print(f"New block header: {header}\n") + ... if header["number"] > 1234567: + ... await handler_context.subscription.unsubscribe() + + >>> async def pending_txs_handler( + ... handler_context: PendingTxSubscriptionContext, + ... ) -> None: + ... ... + + >>> async def log_handler( + ... handler_context: LogsSubscriptionContext, + ... ) -> None: + ... log_receipt = handler_context.result + ... # event is now available in the handler context, because we pass it to in the + ... # ``handler_context`` when subscribing to the log + ... event_data = handler_context.transfer_event.process_log(log_receipt) + ... print(f"Log event data: {event_data}\n") + + >>> async def sub_manager(): + ... local_w3 = await AsyncWeb3(AsyncIPCProvider(LOCAL_IPC)) + ... + ... # subscribe to many subscriptions via the subscription manager with handlers + ... weth_contract = local_w3.eth.contract( + ... address=local_w3.to_checksum_address("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + ... abi=WETH_ABI, + ... ) + ... transfer_event = weth_contract.events.Transfer() + ... await local_w3.subscription_manager.subscribe( + ... [ + ... NewHeadsSubscription(label="new-heads-mainnet", handler=new_heads_handler), + ... PendingTxSubscription( + ... label="pending-tx-mainnet", # optional label + ... full_transactions=True, + ... handler=pending_tx_handler, + ... ), + ... LogsSubscription( + ... label="WETH transfers", # optional label + ... address=weth_contract.address, + ... topics=[transfer_event.topic], + ... handler=log_handler, + ... # optional ``handler_context`` args to help parse a response + ... handler_context={"transfer_event": transfer_event}, + ... ), + ... ] + ... ) + ... + ... public_w3 = await AsyncWeb3(WebSocketProvider(PUBLIC_PROVIDER_WS)) + ... # subscribe via eth_subscribe, with handler and label (optional) + ... await public_w3.eth.subscribe("public_newHeads", handler=pending_tx_handler, label="new-heads-public-ws") + + >>> # This will handle all subscriptions until no more subscriptions are present + ... # in either subscription manager instance. If the `run_forever` flag is set + ... # to `True` on any manager instance, this will run indefinitely. + >>> await asyncio.gather( + ... public_w3.subscription_manager.handle_subscriptions(), + ... local_w3.subscription_manager.handle_subscriptions(), + ... ) + ... + ... # close the connections + ... await local_w3.provider.disconnect() + ... await public_w3.provider.disconnect() + + >>> asyncio.run(sub_manager()) + + +The ``process_subscriptions()`` method on the +:class:`~web3.providers.persistent.PersistentConnection` class, the public API for +interacting with the active persistent socket connection, is also set up to receive +``eth_subscription`` responses over an asynchronous iterator pattern. You can use this +method to listen for raw messages and process them as they come in. + +.. code-block:: python + + >>> async def ws_subscription_example(): + ... async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3: + ... # Subscribe to new block headers and receive the subscription_id. + ... # A one-to-one call with a trigger for many responses + ... subscription_id = await w3.eth.subscribe("newHeads") + ... + ... # Listen to the socket for the many responses utilizing the + ... # ``w3.socket`` ``PersistentConnection`` public API method + ... # ``process_subscriptions()`` + ... async for response in w3.socket.process_subscriptions(): + ... # Receive only one-to-many responses here so that we don't + ... # accidentally return the response for a one-to-one request in this + ... # block + ... + ... print(f"{response}\n") + ... + ... if some_condition: + ... # unsubscribe from new block headers, another one-to-one request + ... is_unsubscribed = await w3.eth.unsubscribe(subscription_id) + ... if is_unsubscribed: + ... break + + >>> asyncio.run(ws_subscription_example()) + +One-to-many responses, those that do not include a JSON-RPC *id* in the response object, +are stored in an internal ``asyncio.Queue`` instance, isolated from any one-to-one +responses. When the ``PersistentConnectionProvider`` is looking for one-to-many +responses internally, it will expect the message listener task to store these messages +in this queue. Since the order of the messages is important, the queue is a FIFO queue. +The ``process_subscriptions()`` method on the ``PersistentConnection`` class is set up +to pop messages from this queue as FIFO over an asynchronous iterator pattern. + +If the stream of messages from the socket is not being interrupted by any other +tasks, the queue will generally be in sync with the messages coming in over the +socket. That is, the message listener will put a message in the queue and the +``process_subscriptions()`` method will pop that message from the queue and yield +control of the loop back to the listener. This will continue until the socket +connection is closed or the user unsubscribes from the subscription. If the stream of +messages lags a bit, or the provider is not consuming messages but has subscribed to +a subscription, this internal queue may fill up with messages until it reaches its max +size and then trigger a waiting ``asyncio.Event`` until the provider begins consuming +messages from the queue again. For this reason, it's important to begin consuming +messages from the queue, via the ``process_subscriptions()`` method, as soon as a +subscription is made. diff --git a/_build/html_zh_CN/_sources/middleware.rst.txt b/_build/html_zh_CN/_sources/middleware.rst.txt new file mode 100644 index 0000000000..c1fb43f38a --- /dev/null +++ b/_build/html_zh_CN/_sources/middleware.rst.txt @@ -0,0 +1,613 @@ +.. _middleware_internals: + +Middleware +========== + +``Web3`` is instantiated with layers of middleware by default. They sit between the public +``Web3`` methods and the :doc:`providers`, and are used to perform sanity checks, convert data +types, enable ENS support, and more. Each layer can modify the request and/or response. +While several middleware are enabled by default, others are available for optional use, +and you're free to create your own! + +Each middleware layer gets invoked before the request reaches the provider, and then +processes the result after the provider returns, in reverse order. However, it is +possible for a middleware to return early from a call without the request ever getting +to the provider (or even reaching the middleware that are in deeper layers). + + +.. _Modifying_Middleware: + +Configuring Middleware +----------------------- + +Middleware can be added, removed, replaced, and cleared at runtime. To make that easier, you +can name the middleware for later reference. + +Middleware Order +~~~~~~~~~~~~~~~~ + +Think of the middleware as being layered in an onion, where you initiate a web3.py request at +the outermost layer of the onion, and the Ethereum node (like geth) receives and responds +to the request inside the innermost layer of the onion. Here is a (simplified) diagram: + +.. code-block:: none + + New request from web3.py + + | + | + v + + `````Layer 2`````` + ``````` ``````` + ````` | ```` + ```` v ```` + ``` ``` + `. ````````Layer 1``````` `.` + `` ```` ````` .` + `. ``` | ``` `.` + .` ``` v ``` `. + `. `.` ``` .` + `` .` `Layer 0` `` .` + `` `. ````` `````` . .` + `. `` ``` | ``` .` . + . `` `.` | `` . . + . `. `` JSON-RPC call .` . .` + . . `` | . `` . + `` . . v . . . + . .` . . . `` + . . . Ethereum node .` . . + . . . . . . + . `` `. | . . . + . . .` | .` . . + `. .` .` Response .` .` . + . . `.` | `.` `. . + `. . ``` | ```` `. . + . `. ````` v ```` `. `` + . .` ```Layer 0`` `` `. + . `. `.` `. + . `. | `.` `. + .` ``` | ``` .` + `. ``` v ```` `.` + `` `````` ````` .` + `` `````Layer 1````` `.` + ``` ``` + ```` | ``` + ````` v ```` + `````` ````` + `````````Layer 2`````````` + + | + v + + Returned value in web3.py + + +The middleware are maintained in ``Web3.middleware_onion``. See below for the API. + +When specifying middleware in a list, or retrieving the list of middleware, they will +be returned in the order of outermost layer first and innermost layer last. In the above +example, that means that ``w3.middleware_onion.middleware`` would return the middleware +in the order of: ``[2, 1, 0]``. + + +.. _middleware_stack_api: + +Middleware Stack API +~~~~~~~~~~~~~~~~~~~~ + +To add or remove items in different layers, use the following API: + +.. py:method:: Web3.middleware_onion.add(middleware, name=None) + + Middleware will be added to the outermost layer. That means the new middleware will modify the + request first, and the response last. You can optionally name it with any hashable object, + typically a string. + + .. code-block:: python + + >>> w3 = Web3(...) + >>> w3.middleware_onion.add(web3.middleware.GasPriceStrategyMiddleware) + # or + >>> w3.middleware_onion.add(web3.middleware.GasPriceStrategyMiddleware, 'gas_price_strategy') + +.. py:method:: Web3.middleware_onion.inject(middleware, name=None, layer=None) + + Inject a named middleware to an arbitrary layer. + + The current implementation only supports injection at the innermost or + outermost layers. Note that injecting to the outermost layer is equivalent to calling + :meth:`Web3.middleware_onion.add` . + + .. code-block:: python + + # Either of these will put the gas_price_strategy middleware at the innermost layer + >>> w3 = Web3(...) + >>> w3.middleware_onion.inject(web3.middleware.GasPriceStrategyMiddleware, layer=0) + # or + >>> w3.middleware_onion.inject(web3.middleware.GasPriceStrategyMiddleware, 'gas_price_strategy', layer=0) + +.. py:method:: Web3.middleware_onion.remove(middleware) + + Middleware will be removed from whatever layer it was in. If you added the middleware with + a name, use the name to remove it. If you added the middleware as an object, use the object + again later to remove it: + + .. code-block:: python + + >>> w3 = Web3(...) + >>> w3.middleware_onion.remove(web3.middleware.GasPriceStrategyMiddleware) + # or + >>> w3.middleware_onion.remove('gas_price_strategy') + +.. py:method:: Web3.middleware_onion.replace(old_middleware, new_middleware) + + Middleware will be replaced from whatever layer it was in. If the middleware was named, it will + continue to have the same name. If it was un-named, then you will now reference it with the new + middleware object. + + .. code-block:: python + + >>> from web3.middleware import GasPriceStrategyMiddleware, AttributeDictMiddleware + >>> w3 = Web3(provider, middleware=[GasPriceStrategyMiddleware, AttributeDictMiddleware]) + + >>> w3.middleware_onion.replace(GasPriceStrategyMiddleware, AttributeDictMiddleware) + # this is now referenced by the new middleware object, so to remove it: + >>> w3.middleware_onion.remove(AttributeDictMiddleware) + + # or, if it was named + + >>> w3.middleware_onion.replace('gas_price_strategy', AttributeDictMiddleware) + # this is still referenced by the original name, so to remove it: + >>> w3.middleware_onion.remove('gas_price_strategy') + +.. py:method:: Web3.middleware_onion.clear() + + Empty all the middleware, including the default ones. + + .. code-block:: python + + >>> w3 = Web3(...) + >>> w3.middleware_onion.clear() + >>> assert len(w3.middleware_onion) == 0 + +.. py:attribute:: Web3.middleware_onion.middleware + + Return all the current middleware for the ``Web3`` instance in the appropriate order for importing into a new + ``Web3`` instance. + + .. code-block:: python + + >>> w3_1 = Web3(...) + # add uniquely named middleware: + >>> w3_1.middleware_onion.add(web3.middleware.GasPriceStrategyMiddleware, 'test_middleware') + # export middleware from first w3 instance + >>> middleware = w3_1.middleware_onion.middleware + + # import into second instance + >>> w3_2 = Web3(..., middleware=middleware) + >>> assert w3_1.middleware_onion.middleware == w3_2.middleware_onion.middleware + >>> assert w3_2.middleware_onion.get('test_middleware') + + +Instantiate with Custom Middleware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Instead of working from the default list, you can specify a custom list of +middleware when initializing Web3: + +.. code-block:: python + + Web3(middleware=[my_middleware1, my_middleware2]) + +.. warning:: + This will *replace* the default middleware. To keep the default functionality, + either use ``middleware_onion.add()`` from above, or add the default middleware to + your list of new middleware. + + +.. _default_middleware: + +Default Middleware +------------------ + +The following middleware are included by default: + +* ``gas_price_strategy`` +* ``ens_name_to_address`` +* ``attrdict`` +* ``validation`` +* ``gas_estimate`` + +The defaults are defined in the ``get_default_middleware()`` method in ``web3/manager.py``. + +AttributeDict +~~~~~~~~~~~~~ + +.. py:class:: web3.middleware.AttributeDictMiddleware + + This middleware recursively converts any dictionary type in the result of a call + to an ``AttributeDict``. This enables dot-syntax access, like + ``eth.get_block('latest').number`` in addition to + ``eth.get_block('latest')['number']``. + + .. note:: + Accessing a property via attribute breaks type hinting. For this reason, this + feature is available as a middleware, which may be removed if desired. + +ENS Name to Address Resolution +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. py:class:: web3.middleware.ENSNameToAddressMiddleware + + This middleware converts Ethereum Name Service (ENS) names into the + address that the name points to. For example :meth:`w3.eth.send_transaction ` will + accept .eth names in the 'from' and 'to' fields. + + .. note:: + This middleware only converts ENS names on chains where the proper ENS + contracts are deployed to support this functionality. All other cases will + result in a ``NameNotFound`` error. + +Gas Price Strategy +~~~~~~~~~~~~~~~~~~ + +.. py:class:: web3.middleware.GasPriceStrategyMiddleware + + .. warning:: + + Gas price strategy is only supported for legacy transactions. The London fork + introduced ``maxFeePerGas`` and ``maxPriorityFeePerGas`` transaction parameters + which should be used over ``gasPrice`` whenever possible. + + This adds a ``gasPrice`` to transactions if applicable and when a gas price strategy has + been set. See :ref:`Gas_Price` for information about how gas price is derived. + +Buffered Gas Estimate +~~~~~~~~~~~~~~~~~~~~~ + +.. py:class:: web3.middleware.BufferedGasEstimateMiddleware + + This adds a gas estimate to transactions if ``gas`` is not present in the transaction + parameters. Sets gas to: + ``min(w3.eth.estimate_gas + gas_buffer, gas_limit)`` + where the gas_buffer default is 100,000 + +Validation +~~~~~~~~~~ + +.. py:class:: web3.middleware.ValidationMiddleware + + This middleware includes block and transaction validators which perform validations + for transaction parameters. + + +Optional Middleware +------------------- + +``Web3`` includes optional middleware for common use cases. Below is a list of available +middleware which are not enabled by default. + +Stalecheck +~~~~~~~~~~~~ + +.. py:method:: web3.middleware.StalecheckMiddlewareBuilder + + This middleware checks how stale the blockchain is, and interrupts calls with a failure + if the blockchain is too old. + + * ``allowable_delay`` is the length in seconds that the blockchain is allowed to be + behind of ``time.time()`` + + Because this middleware takes an argument, you must create the middleware + with a method call. + + .. code-block:: python + + two_day_stalecheck = StalecheckMiddlewareBuilder.build(60 * 60 * 24 * 2) + web3.middleware_onion.add(two_day_stalecheck) + + If the latest block in the blockchain is older than 2 days in this example, then the + middleware will raise a ``StaleBlockchain`` exception on every call except + ``web3.eth.get_block()``. + + +.. _geth-poa: + +Proof of Authority +~~~~~~~~~~~~~~~~~~ + +.. py:class:: web3.middleware.ExtraDataToPOAMiddleware + +.. important:: + It is **crucial** that this middleware is injected at the 0th layer of the + middleware onion, using + ``w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)``, to guarantee + it is the *first* middleware to process the response and modify the ``extraData`` + field. This ensures it processes the field before any other middleware attempts + to validate it. + +``ExtraDataToPOAMiddleware`` is required to connect to ``geth --dev`` and may +also be needed for other EVM compatible blockchains like Polygon or BNB Chain +(Binance Smart Chain). + +If the middleware is not injected at the 0th layer of the middleware onion, you may get +errors like the example below when interacting with your EVM node. + +.. code-block:: shell + + web3.exceptions.ExtraDataLengthError: The field extraData is 97 bytes, but should be + 32. It is quite likely that you are connected to a POA chain. Refer to + http://web3py.readthedocs.io/en/stable/middleware.html#proof-of-authority + for more details. The full extraData is: HexBytes('...') + +The easiest way to connect to a default ``geth --dev`` instance which loads the +middleware is: + +.. code-block:: python + + >>> from web3.auto.gethdev import w3 + + # confirm that the connection succeeded + >>> w3.client_version + 'Geth/v1.14.12-stable-4bb3c89d/linux-amd64/go1.22.4' + +This example connects to a local ``geth --dev`` instance on Linux with a +unique IPC location and loads the middleware: + +.. code-block:: python + + >>> from web3 import Web3, IPCProvider + + # connect to the IPC location started with 'geth --dev --datadir ~/mynode' + >>> w3 = Web3(IPCProvider('~/mynode/geth.ipc')) + + >>> from web3.middleware import ExtraDataToPOAMiddleware + + # inject the poa compatibility middleware to the innermost layer (0th layer) + >>> w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0) + + # confirm that the connection succeeded + >>> w3.client_version + 'Geth/v1.14.12-stable-4bb3c89d/linux-amd64/go1.22.4' + +Why is ``ExtraDataToPOAMiddleware`` necessary? +'''''''''''''''''''''''''''''''''''''''''''''' + +There is no strong community consensus on a single Proof-of-Authority (PoA) standard yet. +Some nodes have successful experiments running though. One is go-ethereum (geth), +which uses a prototype PoA for its development mode and the Goerli test network. + +Unfortunately, it does deviate from the yellow paper specification, which constrains the +``extraData`` field in each block to a maximum of 32-bytes. Geth is one such example +where PoA uses more than 32 bytes, so this middleware modifies the block data a bit +before returning it. + +.. _local-filter: + +Locally Managed Log and Block Filters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. py:method:: web3.middleware.LocalFilterMiddleware + +This middleware provides an alternative to ethereum node managed filters. When used, Log and +Block filter logic are handled locally while using the same web3 filter api. Filter results are +retrieved using JSON-RPC endpoints that don't rely on server state. + +.. doctest:: + + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider()) + >>> from web3.middleware import LocalFilterMiddleware + >>> w3.middleware_onion.add(LocalFilterMiddleware) + +.. code-block:: python + + # Normal block and log filter apis behave as before. + >>> block_filter = w3.eth.filter("latest") + + >>> log_filter = myContract.events.myEvent.build_filter().deploy() + +Signing +~~~~~~~ + +.. py:method:: web3.middleware.SignAndSendRawMiddlewareBuilder + +This middleware automatically captures transactions, signs them, and sends them as raw transactions. +The ``from`` field on the transaction, or ``w3.eth.default_account`` must be set to the address of the private key for +this middleware to have any effect. + +The ``build`` method for this middleware builder takes a single argument: + + * ``private_key_or_account`` A single private key or a tuple, list or set of private keys. + + Keys can be in any of the following formats: + + * An ``eth_account.LocalAccount`` object + * An ``eth_keys.PrivateKey`` object + * A raw private key as a hex string or byte string + +.. important:: + Since this middleware signs transactions, it must always run after any middleware + that modifies the transaction. Therefore, it is recommended to inject the signing + middleware at the 0th layer of the middleware onion using + ``w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(...), layer=0)``. + Ensure that any transaction-modifying middleware exists in a higher layer within the + onion so that it runs before the signing middleware. + +.. note:: + If used with ``ExtraDataToPOAMiddleware``, the injection order doesn't matter, as + the ``extraData`` field isn't involved in transaction signing. The key is ensuring + ``SignAndSendRawMiddlewareBuilder`` runs after any middleware that modifies the + transaction. + + +.. code-block:: python + + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider) + >>> from web3.middleware import SignAndSendRawMiddlewareBuilder + >>> from eth_account import Account + >>> acct = Account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530') + >>> w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct), layer=0) + >>> w3.eth.default_account = acct.address + +:ref:`Hosted nodes` (like Infura or Alchemy) only support signed +transactions. This often results in ``send_raw_transaction`` being used repeatedly. +Instead, we can automate this process with +``SignAndSendRawMiddlewareBuilder.build(private_key_or_account)``. + +.. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.HTTPProvider('HTTP_ENDPOINT')) + >>> from web3.middleware import SignAndSendRawMiddlewareBuilder + >>> from eth_account import Account + >>> import os + >>> acct = w3.eth.account.from_key(os.environ.get('PRIVATE_KEY')) + >>> w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct), layer=0) + >>> w3.eth.default_account = acct.address + + >>> # use `eth_sendTransaction` to automatically sign and send the raw transaction + >>> w3.eth.send_transaction(tx_dict) + HexBytes('0x09511acf75918fd03de58141d2fd409af4fd6d3dce48eb3aa1656c8f3c2c5c21') + +Similarly, with AsyncWeb3: + +.. code-block:: python + + >>> from web3 import AsyncWeb3 + >>> async_w3 = AsyncWeb3(AsyncHTTPProvider('HTTP_ENDPOINT')) + >>> from web3.middleware import SignAndSendRawMiddlewareBuilder + >>> from eth_account import Account + >>> import os + >>> acct = async_w3.eth.account.from_key(os.environ.get('PRIVATE_KEY')) + >>> async_w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct), layer=0) + >>> async_w3.eth.default_account = acct.address + + >>> # use `eth_sendTransaction` to automatically sign and send the raw transaction + >>> await async_w3.eth.send_transaction(tx_dict) + HexBytes('0x09511acf75918fd03de58141d2fd409af4fd6d3dce48eb3aa1656c8f3c2c5c21') + +Now you can send a transaction from acct.address without having to build and sign each raw transaction. + +When making use of this signing middleware, when sending dynamic fee transactions (recommended over legacy transactions), +the transaction ``type`` of ``2`` (or ``'0x2'``) is necessary. This is because transaction signing is validated based +on the transaction ``type`` parameter. This value defaults to ``'0x2'`` when ``maxFeePerGas`` and / or +``maxPriorityFeePerGas`` are present as parameters in the transaction as these params imply a dynamic fee transaction. +Since these values effectively replace the legacy ``gasPrice`` value, do not set a ``gasPrice`` for dynamic fee transactions. +Doing so will lead to validation issues. + +.. code-block:: python + + # dynamic fee transaction, introduced by EIP-1559: + >>> dynamic_fee_transaction = { + ... 'type': '0x2', # optional - defaults to '0x2' when dynamic fee transaction params are present + ... 'from': acct.address, # optional if w3.eth.default_account was set with acct.address + ... 'to': receiving_account_address, + ... 'value': 22, + ... 'maxFeePerGas': 2000000000, # required for dynamic fee transactions + ... 'maxPriorityFeePerGas': 1000000000, # required for dynamic fee transactions + ... } + >>> w3.eth.send_transaction(dynamic_fee_transaction) + +A legacy transaction still works in the same way as it did before EIP-1559 was introduced: + +.. code-block:: python + + >>> legacy_transaction = { + ... 'to': receiving_account_address, + ... 'value': 22, + ... 'gasPrice': 123456, # optional - if not provided, gas_price_strategy (if exists) or eth_gasPrice is used + ... } + >>> w3.eth.send_transaction(legacy_transaction) + + +Creating Custom Middleware +-------------------------- + +To write your own middleware, create a class and extend from the base ``Web3Middleware`` +class, then override only the parts of the middleware that make sense for your use case. + +.. note:: The Middleware API borrows from the Django middleware API introduced + in version 1.10.0. + +If all you need is to modify the params before a request is made, you can override +the ``request_processor`` method, make the necessary tweaks to the params, and pass the +arguments to the next element in the middleware stack. Need to do some processing on the +response? Override the ``response_processor`` method and return the modified response. + +The pattern: + +.. code-block:: python + + from web3.middleware import Web3Middleware + + class CustomMiddleware(Web3Middleware): + + def request_processor(self, method, params): + # Pre-request processing goes here before passing to the next middleware. + return (method, params) + + def response_processor(self, method, response): + # Response processing goes here before passing to the next middleware. + return response + + # If your provider is asynchronous, override the async methods instead: + + async def async_request_processor(self, method, params): + # Pre-request processing goes here before passing to the next middleware. + return (method, params) + + async def async_response_processor(self, method, response): + # Response processing goes here before passing to the next middleware. + return response + + +If you wish to prevent making a call under certain conditions, you can override the +``wrap_make_request`` method. This allows for defining pre-request processing, +skipping or making the request under certain conditions, as well as response +processing before passing it to the next middleware. + + +.. code-block:: python + + from web3.middleware import Web3Middleware + + class CustomMiddleware(Web3Middleware): + + def wrap_make_request(self, make_request): + def middleware(method, params): + # pre-request processing goes here + response = make_request(method, params) # make the request + # response processing goes here + return response + + return middleware + + # If your provider is asynchronous, override the async method instead: + + async def async_wrap_make_request(self, make_request): + async def middleware(method, params): + # pre-request processing goes here + response = await make_request(method, params) + # response processing goes here + return response + + return middleware + + +Custom middleware can be added to the stack via the class itself, using the +:ref:`middleware_stack_api`. The ``name`` kwarg is optional. For example: + +.. code-block:: python + + from web3 import Web3 + from my_module import ( + CustomMiddleware, + ) + + w3 = Web3(HTTPProvider(endpoint_uri="...")) + + # add the middleware to the stack as the class + w3.middleware_onion.add(CustomMiddleware, name="custom_middleware") diff --git a/_build/html_zh_CN/_sources/migration.rst.txt b/_build/html_zh_CN/_sources/migration.rst.txt new file mode 100644 index 0000000000..b9d5a68947 --- /dev/null +++ b/_build/html_zh_CN/_sources/migration.rst.txt @@ -0,0 +1,779 @@ +Migration Guide +=============== + +.. _migrating_v6_to_v7: + +Migrating from v6 to v7 +----------------------- + +web3.py follows `Semantic Versioning `_, which means that +version 7 introduced backwards-incompatible changes. If you're upgrading from +web3.py ``v6`` or earlier, you can expect to need to make some changes. Refer +to this guide for a summary of breaking changes when updating from ``v6`` to +``v7``. If you are more than one major version behind, you should also review +the migration guides for the versions in between. + + +Provider Updates +~~~~~~~~~~~~~~~~ + + +WebSocketProvider +````````````````` + +``WebsocketProviderV2``, introduced in web3.py ``v6``, has taken priority over the +legacy ``WebsocketProvider``. The ``LegacyWebSocketProvider`` has been deprecated in +``v7`` and is slated for removal in the next major version of the library. In summary: + +- ``WebsocketProvider`` -> ``LegacyWebSocketProvider`` (and deprecated) +- ``WebsocketProviderV2`` -> ``WebSocketProvider`` + +If migrating from ``WebSocketProviderV2`` to ``WebSocketProvider``, you can expect the +following changes: + +- Instantiation no longer requires the ``persistent_websocket`` method: + + .. code-block:: python + + # WebsocketsProviderV2: + AsyncWeb3.persistent_websocket(WebsocketProviderV2('...')) + + # WebSocketProvider: + AsyncWeb3(WebSocketProvider('...')) + +- Handling incoming subscription messages now occurs under a more flexible namespace: + ``socket``. The ``AsyncIPCProvider`` uses the same API to listen for messages via + an IPC socket. + + .. code-block:: python + + # WebsocketsProviderV2: + async for message in w3.ws.process_subscriptions(): + ... + + # WebSocketProvider: + async for message in w3.socket.process_subscriptions(): + ... + + +AsyncIPCProvider (non-breaking feature) +``````````````````````````````````````` + +An asynchronous IPC provider, ``AsyncIPCProvider``, is newly available in ``v7``. +This provider makes use of some of the same internals that the new ``WebSocketProvider`` +introduced, allowing it to also support ``eth_subscription``. + + +EthereumTesterProvider +`````````````````````` + +``EthereumTesterProvider`` now returns ``input`` instead of ``data`` for ``eth_getTransaction*`` +calls, as expected. + + +Middlewares -> Middleware +~~~~~~~~~~~~~~~~~~~~~~~~~ + +All references to ``middlewares`` have been replaced with the more grammatically +correct ``middleware``. Notably, this includes when a provider needs to be +instantiated with custom middleware. + + +Class-Based Middleware Model +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The middleware model has been changed to a class-based model. + +.. code-block:: python + + # v6 (no longer supported) + from web3.middleware import pythonic_middleware + w3.middleware_onion.add(pythonic_middleware) + + # v7 + from web3.middleware import PythonicMiddleware + w3.middleware_onion.add(PythonicMiddleware) + +Previously, middleware were defined as functions that tightly wrapped the provider's +``make_request`` function, where transformations could be conditionally applied before +and after the request was made. + +Now, middleware logic can be separated into ``request_processor`` and ``response_processor`` +functions that enable pre-request and post-response logic, respectively. This change offers +a simpler, clearer interface for defining middleware, gives more flexibility for +asynchronous operations and also paved the way for supporting :ref:`batch_requests`. + +Major changes for migration are highlighted in this section. Consult the +:ref:`middleware_internals` section of the documentation for specifics and examples on +the new class-based design. + + +Middleware Builder Classes +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In ``v6``, certain middleware needed to be constructed with parameters. This was done +by passing the parameters to a constructor method. + +.. code-block:: python + + # v6 (no longer supported) + from web3.middleware import construct_sign_and_send_raw_middleware + w3.middleware_onion.add(construct_sign_and_send_raw_middleware(private_key)) + +In the class-based ``v7`` middleware model, a middleware builder class is instantiated +with the necessary parameters via the ``build()`` method. + +.. code-block:: python + + # v7 + from web3.middleware import SignAndSendRawMiddlewareBuilder + w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(private_key), layer=0) + + +Middleware Renaming and Removals +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following middleware have been renamed for generalization or clarity: + +- ``name_to_address_middleware`` -> ``ENSNameToAddressMiddleware`` +- ``geth_poa_middleware`` -> ``ExtraDataToPOAMiddleware`` + +The following middleware have been removed: + + +ABI Middleware +`````````````` + +``abi_middleware`` is no longer necessary and has been removed. All of the functionality +of the ``abi_middleware`` was already handled by web3.py's ABI formatters. For additional +context: a bug in the ENS name-to-address middleware would override the formatters. Fixing +this bug has removed the need for the ``abi_middleware``. + + +Caching Middleware +`````````````````` + +The following middleware have been removed: + +- ``simple_cache_middleware`` +- ``latest_block_based_cache_middleware`` +- ``time_based_cache_middleware`` + +All caching middleware has been removed in favor of a decorator/wrapper around the +``make_request`` methods of providers with configuration options on the provider class. +The configuration options are outlined in the documentation in the +:ref:`request_caching` section. + +If desired, the previous caching middleware can be re-created using the new class-based +middleware model overriding the ``wrap_make_request`` (or ``async_wrap_make_request``) +method in the middleware class. + + +Result Generating Middleware +```````````````````````````` +The following middleware have been removed: + +- ``fixture_middleware`` +- ``result_generator_middleware`` + +The ``fixture_middleware`` and ``result_generator_middleware`` which were used for +testing/mocking purposes have been removed. These have been replaced internally by the +``RequestMocker`` class, utilized for testing via a ``request_mocker`` pytest fixture. + + +HTTP Retry Request Middleware +````````````````````````````` + +The ``http_retry_request_middleware`` has been removed in favor of a configuration +option on the ``HTTPProvider`` and ``AsyncHTTPProvider`` classes. The configuration +options are outlined in the documentation in the :ref:`http_retry_requests` section. + + +Normalize Request Parameters Middleware +``````````````````````````````````````` + +The ``normalize_request_parameters`` middleware was not used anywhere internally and +has been removed. + + +Remaining camelCase -> snake_case Updates +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following arguments have been renamed across the library from camelCase to +snake_case in all methods where they are passed in as a kwarg. + +- ``fromBlock`` -> ``from_block`` +- ``toBlock`` -> ``to_block`` +- ``blockHash`` -> ``block_hash`` + +Note that if a dictionary is used instead, say to a call such as `eth_getLogs`, the +keys in the dictionary should be camelCase. This is because the dictionary is passed +directly to the JSON-RPC request, where the keys are expected to be in camelCase. + + +Changes to Exception Handling +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +All Python standard library exceptions that were raised from within web3.py have +been replaced with custom ``Web3Exception`` classes. This change allows for better +control over exception handling, being able to distinguish between exceptions raised +by web3.py and those raised from elsewhere in a codebase. The following exceptions +have been replaced: + +- ``AssertionError`` -> ``Web3AssertionError`` +- ``ValueError`` -> ``Web3ValueError`` +- ``TypeError`` -> ``Web3TypeError`` +- ``AttributeError`` -> ``Web3AttributeError`` + +A new ``MethodNotSupported`` exception is now raised when a method is not supported by +web3.py. This allows a user to distinguish between when a method is not available on +the current provider, ``MethodUnavailable``, and when a method is not supported by +web3.py under certain conditions, ``MethodNotSupported``. + +A ``MismatchedABI`` exception is now raised instead of a ``Web3ValidationError`` in +cases where an ABI is not compatible with the data being passed to it. This change +allows for more specific error handling when using certain ABI types. + + +JSON-RPC Error Handling +``````````````````````` + +Rather than a ``ValueError`` being replaced with a ``Web3ValueError`` when a JSON-RPC +response comes back with an ``error`` object, a new ``Web3RPCError`` exception is +now raised to provide more distinction for JSON-RPC error responses. Some previously +existing exceptions now extend from this class since they too are related to JSON-RPC +errors: + +- ``MethodUnavailable`` +- ``BlockNotFound`` +- ``TransactionNotFound`` +- ``TransactionIndexingInProgress`` + + +End of Support and Feature Removals +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Python 3.7 Support Dropped +`````````````````````````` + +Python 3.7 support has been dropped in favor of Python 3.8+. Python 3.7 is no longer +supported by the Python core team, and we want to focus our efforts on supporting +the latest versions of Python. + + +EthPM Module Removed +```````````````````` + +The EthPM module has been removed from the library. It was not widely used and has not +been functional since around October 2022. It was deprecated in ``v6`` and has been +completely removed in ``v7``. + +Types in the +`eth_typing.ethpm `_ +module have been deprecated and will be removed from ``eth-typing`` in the next major +release. + + +Geth Miner Namespace Removed +```````````````````````````` + +The ``geth.miner`` namespace, deprecated in ``v6``, has been removed in ``v7``. +The ``miner`` namespace was used for managing the concept of a miner in geth. This is +no longer a feature in geth and is planned for complete removal in the future, with +Ethereum having transitioned to proof-of-stake. + + +Geth Personal Namespace Removed +``````````````````````````````` + +The ``geth.personal`` namespace, deprecated in ``v6``, has been removed in ``v7``. +The ``personal`` namespace was used for managing accounts and keys and was deprecated +in geth in ``v1.11.0``. Geth has moved to using ``clef`` for account and key management. + + +ABI Types Removed +````````````````` + +The type definitions for ABIs, deprecated in ``v6``, have been removed in ``v7``. New +types have been introduced in the ``eth_typing`` ``v5`` package for ABIs. Improvements have +been made to make required types more explicit and to offer better semantics. + +The following types from ``web3.types`` have been removed: +- ``ABIEventParams`` is no longer available. Use ``ABIComponentIndexed`` from +``eth_typing`` to represent event input components. +- ``ABIEvent`` now resides in ``eth_typing``. ``ABIEvent.type`` and ``ABIEvent.name`` +are now required fields. +- ``ABIFunctionComponents`` and ``ABIFunctionParams`` are no longer available. Use +``ABIComponent`` from ``eth_typing`` to represent function input components. +- ``ABIFunction`` now resides in ``eth_typing``. ``ABIFunction.type`` and +``ABIFunction.name`` are now required fields. +- ``ABIElement`` now resides in ``eth_typing`` and represents a ``Union`` of all valid +ABI element types, ``ABICallable``, ``ABIEvent`` and ``ABIError``. + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- ``LRU`` has been removed from the library and dependency on ``lru-dict`` library was + dropped. +- ``CallOverride`` type was changed to ``StateOverride`` since more methods than + ``eth_call`` utilize the state override params. +- ``User-Agent`` header was changed to a more readable format. +- ``BaseContractFunctions`` iterator now returns instances of ``ContractFunction`` rather + than the function names. +- ``BaseContractFunction`` class attribute ``function_identifier`` has been removed in + favor of the ``abi_element_identifier`` attribute. +- ``web3.contract.utils.call_contract_function()`` no longer uses ``fn_abi`` as a + parameter. Instead, the ``abi_callable`` parameter of type ``ABICallable`` is used. +- Beacon API filename change: ``beacon/main.py`` -> ``beacon/beacon.py``. +- The asynchronous version of ``w3.eth.wait_for_transaction_receipt()`` changes its + signature to use ``Optional[float]`` instead of ``float`` since it may be ``None``. +- ``get_default_ipc_path()`` and ``get_dev_ipc_path()`` now return the path value + without checking if the ``geth.ipc`` file exists. +- ``Web3.is_address()`` returns ``True`` for non-checksummed addresses. +- ``Contract.encodeABI()`` has been renamed to ``Contract.encode_abi()``. The ``fn_name`` + argument has been changed to ``abi_element_identifier``. +- JSON-RPC responses are now more strictly validated against the JSON-RPC 2.0 + specification while providing more informative error messages for invalid responses. + + +.. _migrating_v5_to_v6: + +Migrating from v5 to v6 +----------------------- + +web3.py follows `Semantic Versioning `_, which means +that version 6 introduced backwards-incompatible changes. If your +project depends on web3.py v6, then you'll probably need to make some changes. + +Breaking Changes: + +Strict Bytes Checking by Default +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +web3.py v6 moved to requiring strict bytes checking by default. This means that if an +ABI specifies a ``bytes4`` argument, web3.py will invalidate any entry that is not +encodable as a bytes type with length of 4. This means only 0x-prefixed hex strings with +a length of 4 and bytes types with a length of 4 will be considered valid. This removes +doubt that comes from inferring values and assuming they should be padded. + +This behavior was previously available in via the ``w3.enable_strict_bytes_checking()`` +method. This is now, however, a toggleable flag on the ``Web3`` instance via the +``w3.strict_bytes_type_checking`` property. As outlined above, this property is set to +``True`` by default but can be toggled on and off via the property's setter +(e.g. ``w3.strict_bytes_type_checking = False``). + + +Snake Case +~~~~~~~~~~ + +web3.py v6 moved to the more Pythonic convention of snake_casing wherever +possible. There are some exceptions to this pattern: + +- Contract methods and events use whatever is listed in the ABI. If the smart contract + convention is to use camelCase for method and event names, web3.py won't do + any magic to convert it to snake_casing. +- Arguments to JSON-RPC methods. For example: transaction and filter + parameters still use camelCasing. The reason for + this is primarily due to error messaging. It would be confusing to pass in a + snake_cased parameter and get an error message with a camelCased parameter. +- Data that is returned from JSON-RPC methods. For example: + The keys in a transaction receipt will still be returned as camelCase. + + +Python 3.10 and 3.11 Support +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Support for Python 3.10 and 3.11 is here. In order to support Python 3.10, we had to +update the ``websockets`` dependency to v10+. + +Exceptions +~~~~~~~~~~ + +Exceptions inherit from a base class +```````````````````````````````````` + +In v5, some web3.py exceptions inherited from ``AttributeError``, namely: + +- ``NoABIFunctionsFound`` +- ``NoABIFound`` +- ``NoABIEventsFound`` + +Others inherited from ``ValueError``, namely: + +- ``InvalidAddress`` +- ``NameNotFound`` +- ``LogTopicError`` +- ``InvalidEventABI`` + +Now web3.py exceptions inherit from the same base ``Web3Exception``. + +As such, any code that was expecting a ``ValueError`` or an ``AttributeError`` from +web3.py must update to expecting one of the exceptions listed above, or +``Web3Exception``. + +Similarly, exceptions raised in the EthPM and ENS modules inherit from the base +``EthPMException`` and ``ENSException``, respectively. + +ValidationError +``````````````` + +The Python dev tooling ecosystem is moving towards standardizing +``ValidationError``, so users know that they're catching the correct +``ValidationError``. The base ``ValidationError`` is imported from +``eth_utils``. However, we also wanted to empower users to catch all errors emitted +by a particular module. So we now have a ``Web3ValidationError``, ``EthPMValidationError``, +and an ``ENSValidationError`` that all inherit from the generic +``eth_utils.exceptions.ValidationError``. + +Web3 class split into Web3 and AsyncWeb3 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The `Web3` class previously contained both sync and async methods. We've separated +`Web3` and `AsyncWeb3` functionality to tighten up typing. For example: + +.. code-block:: python + + from web3 import Web3, AsyncWeb3 + + w3 = Web3(Web3.HTTPProvider()) + async_w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider()) + +`dict` to `AttributeDict` conversion moved to middleware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +`Eth` module data returned as key-value pairs was previously automatically converted to +an `AttributeDict` by result formatters, which could cause problems with typing. This +conversion has been moved to a default `attrdict_middleware` where it can be easily +removed if necessary. See the `Eth module `_ docs for more detail. + +Other Misc Changes +~~~~~~~~~~~~~~~~~~ + +- ``InfuraKeyNotFound`` exception has been changed to ``InfuraProjectIdNotFound`` +- ``SolidityError`` has been removed in favor of ``ContractLogicError`` +- When a method is unavailable from a node provider (i.e. a response error + code of -32601 is returned), a ``MethodUnavailable`` error is + now raised instead of ``ValueError`` +- Logs' `data` field was previously formatted with `to_ascii_if_bytes`, now formatted to `HexBytes` +- Receipts' `type` field was previously not formatted, now formatted with `to_integer_if_hex` + +Removals +~~~~~~~~ + +- Removed unused IBAN module +- Removed ``WEB3_INFURA_API_KEY`` environment variable in favor of ``WEB3_INFURA_PROJECT_ID`` +- Removed Kovan auto provider +- Removed deprecated ``sha3`` and ``soliditySha3`` methods in favor of ``keccak`` and ``solidityKeccak`` +- Remove Parity Module and References + + +Other notable changes +~~~~~~~~~~~~~~~~~~~~~ + +- The ``ipfshttpclient`` library is now opt-in via a web3 install extra. + This only affects the ethpm ipfs backends, which rely on the library. + + +.. _migrating_v4_to_v5: + +Migrating from v4 to v5 +----------------------- + +Web3.py follows `Semantic Versioning `_, which means +that version 5 introduced backwards-incompatible changes. If your +project depends on Web3.py v4, then you'll probably need to make some changes. + +Here are the most common required updates: + +Python 3.5 no longer supported +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You will need to upgrade to either Python 3.6 or 3.7 + +``eth-abi`` v1 no longer supported +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You will need to upgrade the ``eth-abi`` dependency to v2 + +Changes to base API +~~~~~~~~~~~~~~~~~~~ + +JSON-RPC Updates +```````````````` + +In v4, JSON-RPC calls that looked up transactions or blocks and +didn't find them, returned ``None``. Now if a transaction or +block is not found, a ``BlockNotFound`` or a ``TransactionNotFound`` +error will be thrown as appropriate. This applies to the +following web3 methods: + +- :meth:`~web3.eth.Eth.getTransaction` will throw a ``TransactionNotFound`` error +- :meth:`~web3.eth.Eth.getTransactionReceipt` will throw a ``TransactionNotFound`` error +- :meth:`~web3.eth.Eth.getTransactionByBlock` will throw a ``TransactionNotFound`` error +- :meth:`~web3.eth.Eth.getTransactionCount` will throw a ``BlockNotFound`` error +- :meth:`~web3.eth.Eth.getBlock` will throw a ``BlockNotFound`` error +- :meth:`~web3.eth.Eth.getUncleCount` will throw a ``BlockNotFound`` error +- :meth:`~web3.eth.Eth.getUncleByBlock` will throw a ``BlockNotFound`` error + +Removed Methods +``````````````` + +- ``contract.buildTransaction`` was removed for ``contract.functions.buildTransaction.`` +- ``contract.deploy`` was removed for ``contract.constructor.transact`` +- ``contract.estimateGas`` was removed for ``contract.functions..estimateGas`` +- ``contract.call`` was removed for ``contract...call`` +- ``contract.transact`` was removed for ``contract...transact`` +- ``contract.eventFilter`` was removed for ``contract.events..createFilter`` +- ``middleware_stack`` was renamed to :meth:`~Web3.middleware_onion` +- ``web3.miner.hashrate`` was a duplicate of :meth:`~web3.eth.Eth.hashrate` and was removed. +- ``web3.version.network`` was a duplicate of :meth:`~web3.net.Net.version` and was removed. +- ``web3.providers.tester.EthereumTesterProvider`` and ``web3.providers.tester.TestRPCProvider`` have been removed for :meth:`~web3.providers.eth_tester.EthereumTesterProvider` +- ``web3.eth.enableUnauditedFeatures`` was removed +- ``web3.txpool`` was moved to :meth:`~web3.geth.txpool` +- ``web3.version.node`` was removed for ``web3.clientVersion`` +- ``web3.version.ethereum`` was removed for :meth:`~web3.eth.Eth.protocolVersion` +- Relocated personal RPC endpoints to reflect Parity and Geth implementations: + + - ``web3.personal.listAccounts`` was removed for :meth:`~web3.geth.personal.listAccounts` or :meth:`~web3.parity.personal.listAccounts` + - ``web3.personal.importRawKey`` was removed for :meth:`~web3.geth.personal.importRawKey` or :meth:`~web3.parity.personal.importRawKey` + - ``web3.personal.newAccount`` was removed for :meth:`~web3.geth.personal.newAccount` or :meth:`~web3.parity.personal.newAccount` + - ``web3.personal.lockAccount`` was removed for :meth:`~web3.geth.personal.lockAccount` + - ``web3.personal.unlockAccount`` was removed for :meth:`~web3.geth.personal.unlockAccount` or :meth:`~web3.parity.personal.unlockAccount` + - ``web3.personal.sendTransaction`` was removed for :meth:`~web3.geth.personal.sendTransaction` or :meth:`~web3.parity.personal.sendTransaction` + +- Relocated ``web3.admin`` module to ``web3.geth`` namespace +- Relocated ``web3.miner`` module to ``web3.geth`` namespace + +Deprecated Methods +`````````````````` + +Expect the following methods to be removed in v6: + +- ``web3.sha3`` was deprecated for :meth:`~Web3.keccak` +- ``web3.soliditySha3`` was deprecated for :meth:`~Web3.solidityKeccak` +- :meth:`~web3.net.Net.chainId` was deprecated for :meth:`~web3.eth.Eth.chainId`. + Follow issue `#1293 `_ for details +- ``web3.eth.getCompilers()`` was deprecated and will not be replaced +- :meth:`~web3.eth.getTransactionFromBlock()` was deprecated for :meth:`~Web3.getTransactionByBlock` + +Deprecated ConciseContract and ImplicitContract +``````````````````````````````````````````````` +The ConciseContract and ImplicitContract have been deprecated and will be removed in v6. + +ImplicitContract instances will need to use the verbose syntax. For example: + +``contract.functions..transact({})`` + +ConciseContract has been replaced with the ContractCaller API. Instead of using the ConciseContract factory, you can now use: + +``contract.caller.`` + +or the classic contract syntax: + +``contract.functions..call()``. + +Some more concrete examples can be found in the `ContractCaller docs `_ + + +Manager Provider +~~~~~~~~~~~~~~~~ + +In v5, only a single provider will be allowed. While allowing +multiple providers is a feature we'd like to support in the future, +the way that multiple providers was handled in v4 wasn't ideal. +The only thing they could do was fall back. There was no mechanism for any +round robin, nor was there any control around which provider +was chosen. Eventually, the idea is to expand the Manager API +to support injecting custom logic into the provider selection process. + +For now, ``manager.providers`` has changed to ``manager.provider``. +Similarly, instances of ``web3.providers`` have been changed to +``web3.provider``. + +Testnet Changes +~~~~~~~~~~~~~~~ + +Web3.py will no longer automatically look up a testnet connection +in IPCProvider. + +ENS +~~~ + +Web3.py has stopped inferring the ``.eth`` TLD on domain names. +If a domain name is used instead of an address, you'll need +to specify the TLD. An ``InvalidTLD`` error will be thrown if +the TLD is missing. + +Required Infura API Key +~~~~~~~~~~~~~~~~~~~~~~~ + +In order to interact with Infura after March 27, 2019, you'll need to set an +environment variable called ``WEB3_INFURA_PROJECT_ID``. You can get a +project id by visiting https://infura.io/register. + + +Migrating from v3 to v4 +----------------------- + +Web3.py follows `Semantic Versioning `_, which means +that version 4 introduced backwards-incompatible changes. If your +project depends on Web3.py v3, then you'll probably need to make some changes. + +Here are the most common required updates: + +Python 2 to Python 3 +~~~~~~~~~~~~~~~~~~~~ + +Only Python 3 is supported in v4. If you are running in Python 2, +it's time to upgrade. We recommend using `2to3` which can make +most of your code compatible with Python 3, automatically. + +The most important update, relevant to Web3.py, is the new :class:`bytes` +type. It is used regularly, throughout the library, whenever dealing with data +that is not guaranteed to be text. + +Many different methods in Web3.py accept text or binary data, like contract methods, +transaction details, and cryptographic functions. The following example +uses :meth:`~Web3.sha3`, but the same pattern applies elsewhere. + +In v3 & Python 2, you might have calculated the hash of binary data this way: + +.. code-block:: python + + >>> Web3.sha3('I\xe2\x99\xa5SF') + '0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e' + +Or, you might have calculated the hash of text data this way: + +.. code-block:: python + + >>> Web3.sha3(text=u'I♥SF') + '0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e' + +After switching to Python 3, these would instead be executed as: + +.. code-block:: python + + >>> Web3.sha3(b'I\xe2\x99\xa5SF') + HexBytes('0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e') + + >>> Web3.sha3(text='I♥SF') + HexBytes('0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e') + +Note that the return value is different too: you can treat :class:`hexbytes.main.HexBytes` +like any other bytes value, but the representation on the console shows you the hex encoding of +those bytes, for easier visual comparison. + +It takes a little getting used to, but the new py3 types are much better. We promise. + +Filters +~~~~~~~ + +Filters usually don't work quite the way that people want them to. + +The first step toward fixing them was to simplify them by removing the polling +logic. Now, you must request an update on your filters explicitly. That +means that any exceptions during the request will bubble up into your code. + +In v3, those exceptions (like "filter is not found") were swallowed silently +in the automated polling logic. Here was the invocation for +printing out new block hashes as they appear: + +.. code-block:: python + + >>> def new_block_callback(block_hash): + ... print(f"New Block: {block_hash}") + ... + >>> new_block_filter = web3.eth.filter('latest') + >>> new_block_filter.watch(new_block_callback) + +In v4, that same logic: + +.. code-block:: python + + >>> new_block_filter = web3.eth.filter('latest') + >>> for block_hash in new_block_filter.get_new_entries(): + ... print(f"New Block: {block_hash}") + +The caller is responsible for polling the results from ``get_new_entries()``. +See :ref:`asynchronous_filters` for examples of filter-event handling with web3 v4. + +TestRPCProvider and EthereumTesterProvider +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These providers are fairly uncommon. If you don't recognize the names, +you can probably skip the section. + +However, if you were using web3.py for testing contracts, +you might have been using TestRPCProvider or EthereumTesterProvider. + +In v4 there is a new :class:`EthereumTesterProvider`, and the old v3 implementation has been +removed. Web3.py v4 uses :class:`eth_tester.main.EthereumTester` under the hood, instead +of eth-testrpc. While ``eth-tester`` is still in beta, many parts are +already in better shape than testrpc, so we decided to replace it in v4. + +If you were using TestRPC, or were explicitly importing EthereumTesterProvider, like: +``from web3.providers.tester import EthereumTesterProvider``, then you will need to update. + +With v4 you should import with ``from web3 import EthereumTesterProvider``. As before, you'll +need to install Web3.py with the ``tester`` extra to get these features, like: + +.. code-block:: bash + + $ pip install web3[tester] + + +Changes to base API convenience methods +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Web3.toDecimal() +```````````````` + +In v4 ``Web3.toDecimal()`` is renamed: :meth:`~Web3.toInt` for improved clarity. It does not return a :class:`decimal.Decimal`, it returns an :class:`int`. + + +Removed Methods +``````````````` + +- ``Web3.toUtf8`` was removed for :meth:`~Web3.toText`. +- ``Web3.fromUtf8`` was removed for :meth:`~Web3.toHex`. +- ``Web3.toAscii`` was removed for :meth:`~Web3.toBytes`. +- ``Web3.fromAscii`` was removed for :meth:`~Web3.toHex`. +- ``Web3.fromDecimal`` was removed for :meth:`~Web3.toHex`. + +Provider Access +~~~~~~~~~~~~~~~~~ + +In v4, ``w3.currentProvider`` was removed, in favor of ``w3.providers``. + +Disambiguating String Inputs +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are a number of places where an arbitrary string input might be either +a byte-string that has been hex-encoded, or unicode characters in text. +These are named ``hexstr`` and ``text`` in Web3.py. +You specify which kind of :class:`str` you have by using the appropriate +keyword argument. See examples in :ref:`overview_type_conversions`. + +In v3, some methods accepted a :class:`str` as the first positional argument. +In v4, you must pass strings as one of ``hexstr`` or ``text`` keyword arguments. + +Notable methods that no longer accept ambiguous strings: + +- :meth:`~Web3.sha3` +- :meth:`~Web3.toBytes` + +Contracts +~~~~~~~~~ + +- When a contract returns the ABI type ``string``, Web3.py v4 now returns a :class:`str` + value by decoding the underlying bytes using UTF-8. +- When a contract returns the ABI type ``bytes`` (of any length), + Web3.py v4 now returns a :class:`bytes` value + +Personal API +~~~~~~~~~~~~ + +``w3.personal.signAndSendTransaction`` is no longer available. Use +:meth:`w3.personal.sendTransaction() ` instead. diff --git a/_build/html_zh_CN/_sources/overview.rst.txt b/_build/html_zh_CN/_sources/overview.rst.txt new file mode 100644 index 0000000000..31a20e4844 --- /dev/null +++ b/_build/html_zh_CN/_sources/overview.rst.txt @@ -0,0 +1,317 @@ +.. _overview: + +Overview +======== + +The purpose of this page is to give you a sense of everything web3.py can do +and to serve as a quick reference guide. You'll find a summary of each feature +with links to learn more. + +Configuration +------------- + +After installing web3.py (via ``pip install web3``), you'll need to configure +a provider endpoint and any middleware you want to use beyond the defaults. + + +Providers +~~~~~~~~~ + +:doc:`providers` are how web3.py connects to a blockchain. The library comes with the +following built-in providers: + +- :class:`~web3.providers.rpc.HTTPProvider` for connecting to http and https based JSON-RPC servers. +- :class:`~web3.providers.ipc.IPCProvider` for connecting to ipc socket based JSON-RPC servers. +- :class:`~web3.providers.legacy_websocket.LegacyWebSocketProvider` (deprecated) for connecting to websocket based JSON-RPC servers. +- :class:`~web3.providers.async_rpc.AsyncHTTPProvider` for connecting to http and https based JSON-RPC servers asynchronously. +- :class:`~web3.providers.persistent.AsyncIPCProvider` for connecting to ipc socket based JSON-RPC servers asynchronously via a persistent connection. +- :class:`~web3.providers.persistent.WebSocketProvider` for connecting to websocket based JSON-RPC servers asynchronously via a persistent connection. + +Examples +```````` + +.. code-block:: python + + >>> from web3 import Web3, AsyncWeb3 + + # IPCProvider: + >>> w3 = Web3(Web3.IPCProvider('./path/to/filename.ipc')) + >>> w3.is_connected() + True + + # HTTPProvider: + >>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) + >>> w3.is_connected() + True + + # AsyncHTTPProvider: + >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545')) + >>> await w3.is_connected() + True + + # -- Persistent Connection Providers -- # + + # WebSocketProvider: + >>> w3 = await AsyncWeb3(AsyncWeb3.WebSocketProvider('ws://127.0.0.1:8546')) + >>> await w3.is_connected() + True + + # AsyncIPCProvider + >>> w3 = await AsyncWeb3(AsyncWeb3.AsyncIPCProvider('./path/to/filename.ipc')) + >>> await w3.is_connected() + True + + +For more context, see the :doc:`providers` documentation. + + +Middleware +~~~~~~~~~~ + +Your web3.py instance may be further configured via :doc:`middleware`. + +web3.py middleware is described using an onion metaphor, where each layer of +middleware may affect both the incoming request and outgoing response from your +provider. The documentation includes a :ref:`visualization ` +of this idea. + +Several middleware are :ref:`included by default `. You may add to +(:meth:`add `, :meth:`inject `, +:meth:`replace `) or disable +(:meth:`remove `, +:meth:`clear `) any of these middleware. + + +Accounts and Private Keys +------------------------- + +Private keys are required to approve any transaction made on your behalf. The manner in +which your key is secured will determine how you create and send transactions in web3.py. + +A local node, like `Geth `_, may manage your keys for you. +You can reference those keys using the :attr:`web3.eth.accounts ` +property. + +A hosted node, like `Infura `_, will have no knowledge of your keys. +In this case, you'll need to have your private key available locally for signing +transactions. + +Full documentation on the distinction between keys can be found :ref:`here `. +The separate guide to :doc:`transactions` may also help clarify how to manage keys. + + +Base API +-------- + +The :ref:`Web3 ` class includes a number of convenient utility functions: + + +Encoding and Decoding Helpers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- :meth:`Web3.is_encodable() ` +- :meth:`Web3.to_bytes() ` +- :meth:`Web3.to_hex() ` +- :meth:`Web3.to_int() ` +- :meth:`Web3.to_json() ` +- :meth:`Web3.to_text() ` + + +Address Helpers +~~~~~~~~~~~~~~~ + +- :meth:`Web3.is_address() ` +- :meth:`Web3.is_checksum_address() ` +- :meth:`Web3.to_checksum_address() ` + + +Currency Conversions +~~~~~~~~~~~~~~~~~~~~ + +- :meth:`Web3.from_wei() ` +- :meth:`Web3.to_wei() ` + + +Cryptographic Hashing +~~~~~~~~~~~~~~~~~~~~~ + +- :meth:`Web3.keccak() ` +- :meth:`Web3.solidity_keccak() ` + + +web3.eth API +------------ + +The most commonly used APIs for interacting with Ethereum can be found under the +:ref:`web3-eth` namespace. + + +Fetching Data +~~~~~~~~~~~~~ + +Viewing account balances (:meth:`get_balance `), transactions +(:meth:`get_transaction `), and block data +(:meth:`get_block `) are some of the most common starting +points in web3.py. + + +API +``` + +- :meth:`web3.eth.get_balance() ` +- :meth:`web3.eth.get_block() ` +- :meth:`web3.eth.get_block_transaction_count() ` +- :meth:`web3.eth.get_code() ` +- :meth:`web3.eth.get_proof() ` +- :meth:`web3.eth.get_storage_at() ` +- :meth:`web3.eth.get_transaction() ` +- :meth:`web3.eth.get_transaction_by_block() ` +- :meth:`web3.eth.get_transaction_count() ` +- :meth:`web3.eth.get_uncle_by_block() ` +- :meth:`web3.eth.get_uncle_count() ` + + +Sending Transactions +~~~~~~~~~~~~~~~~~~~~ + +The most common use cases will be satisfied with +:meth:`send_transaction ` or the combination of +:meth:`sign_transaction ` and +:meth:`send_raw_transaction `. For more context, +see the full guide to :doc:`transactions`. + +.. note:: + + If interacting with a smart contract, a dedicated API exists. See the next + section, :ref:`Contracts `. + + +API +``` + +- :meth:`web3.eth.send_transaction() ` +- :meth:`web3.eth.sign_transaction() ` +- :meth:`web3.eth.send_raw_transaction() ` +- :meth:`web3.eth.replace_transaction() ` +- :meth:`web3.eth.modify_transaction() ` +- :meth:`web3.eth.wait_for_transaction_receipt() ` +- :meth:`web3.eth.get_transaction_receipt() ` +- :meth:`web3.eth.sign() ` +- :meth:`web3.eth.sign_typed_data() ` +- :meth:`web3.eth.estimate_gas() ` +- :meth:`web3.eth.generate_gas_price() ` +- :meth:`web3.eth.set_gas_price_strategy() ` + + +.. _overview_contracts: + +Contracts +--------- + +web3.py can help you deploy, read from, or execute functions on a deployed contract. + +Deployment requires that the contract already be compiled, with its bytecode and ABI +available. This compilation step can be done within +`Remix `_ or one of the many contract development +frameworks, such as `Ape `_. + +Once the contract object is instantiated, calling ``transact`` on the +:meth:`constructor ` method will deploy an +instance of the contract: + +.. code-block:: python + + >>> ExampleContract = w3.eth.contract(abi=abi, bytecode=bytecode) + >>> tx_hash = ExampleContract.constructor().transact() + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> tx_receipt.contractAddress + '0x8a22225eD7eD460D7ee3842bce2402B9deaD23D3' + +Once a deployed contract is loaded into a Contract object, the functions of that +contract are available on the ``functions`` namespace: + +.. code-block:: python + + >>> deployed_contract = w3.eth.contract(address=tx_receipt.contractAddress, abi=abi) + >>> deployed_contract.functions.myFunction(42).transact() + +If you want to read data from a contract (or see the result of transaction locally, +without executing it on the network), you can use the +:meth:`ContractFunction.call ` method, or the +more concise :attr:`ContractCaller ` syntax: + +.. code-block:: python + + # Using ContractFunction.call + >>> deployed_contract.functions.getMyValue().call() + 42 + + # Using ContractCaller + >>> deployed_contract.caller().getMyValue() + 42 + +For more, see the full :ref:`Contracts` documentation. + + +API +~~~ + +- :meth:`web3.eth.contract() ` +- :attr:`Contract.address ` +- :attr:`Contract.abi ` +- :attr:`Contract.bytecode ` +- :attr:`Contract.bytecode_runtime ` +- :attr:`Contract.functions ` +- :attr:`Contract.events ` +- :attr:`Contract.fallback ` +- :meth:`Contract.constructor() ` +- :meth:`Contract.encode_abi() ` +- :attr:`web3.contract.ContractFunction ` +- :attr:`web3.contract.ContractEvents ` + + +Events, Logs, and Filters +------------------------- + +If you want to react to new blocks being mined or specific events being emitted by +a contract, you can leverage ``get_logs``, subscriptions, or filters. + +See the :doc:`filters` guide for more information. + + +API +~~~ + +- :meth:`web3.eth.subscribe() ` +- :meth:`web3.eth.filter() ` +- :meth:`web3.eth.get_filter_changes() ` +- :meth:`web3.eth.get_filter_logs() ` +- :meth:`web3.eth.uninstall_filter() ` +- :meth:`web3.eth.get_logs() ` +- :meth:`Contract.events.your_event_name.create_filter() ` +- :meth:`Contract.events.your_event_name.build_filter() ` +- :meth:`Filter.get_new_entries() ` +- :meth:`Filter.get_all_entries() ` +- :meth:`Filter.format_entry() ` +- :meth:`Filter.is_valid_entry() ` + + +Net API +------- + +Some basic network properties are available on the ``web3.net`` object: + +- :attr:`web3.net.listening` +- :attr:`web3.net.peer_count` +- :attr:`web3.net.version` + + +ENS +--- + +`Ethereum Name Service (ENS) `_ provides the infrastructure +for human-readable addresses. If an address is registered with the ENS registry, +the domain name can be used in place of the address itself. For example, the registered domain +name ``ethereum.eth`` will resolve to the address +``0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe``. web3.py has support for ENS, documented +:ref:`here `. diff --git a/_build/html_zh_CN/_sources/providers.rst.txt b/_build/html_zh_CN/_sources/providers.rst.txt new file mode 100644 index 0000000000..21e9c490c3 --- /dev/null +++ b/_build/html_zh_CN/_sources/providers.rst.txt @@ -0,0 +1,606 @@ +.. _providers: + +Providers +========= + +Using Ethereum requires access to an Ethereum node. If you have the means, you're +encouraged to `run your own node`_. (Note that you do not need to stake ether to +run a node.) If you're unable to run your own node, you can use a `remote node`_. + +Once you have access to a node, you can connect to it using a **provider**. +Providers generate `JSON-RPC`_ requests and return the response. This is done by submitting +the request to an HTTP, WebSocket, or IPC socket-based server. + +.. note:: + + web3.py supports one provider per instance. If you have an advanced use case + that requires multiple providers, create and configure a new web3 instance + per connection. + +If you are already happily connected to your Ethereum node, then you +can skip the rest of this providers section. + +.. _run your own node: https://ethereum.org/en/developers/docs/nodes-and-clients/run-a-node/ +.. _remote node: https://ethereum.org/en/developers/docs/nodes-and-clients/nodes-as-a-service/ +.. _JSON-RPC: https://ethereum.org/en/developers/docs/apis/json-rpc/ + +.. _choosing_provider: + +Choosing a Provider +------------------- + +Most nodes have a variety of ways to connect to them. Most commonly: + +1. IPC (uses local filesystem: fastest and most secure) +2. WebSocket (works remotely, faster than HTTP) +3. HTTP (more nodes support it) + +If you're not sure how to decide, choose this way: + +- If you have the option of running web3.py on the same machine as the node, choose IPC. +- If you must connect to a node on a different computer, use WebSocket. +- If your node does not support WebSocket, use HTTP. + +Once you have decided how to connect, you'll select and configure the appropriate provider +class: + +- :class:`~web3.providers.rpc.HTTPProvider` +- :class:`~web3.providers.ipc.IPCProvider` +- :class:`~web3.providers.async_rpc.AsyncHTTPProvider` +- :class:`~web3.providers.persistent.AsyncIPCProvider` (Persistent Connection Provider) +- :class:`~web3.providers.persistent.WebSocketProvider` (Persistent Connection Provider) + +Each provider above links to the documentation on how to properly initialize that +provider. Once you have reviewed the relevant documentation for the provider of your +choice, you are ready to :ref:`get started with web3.py`. + +Provider via Environment Variable +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Alternatively, you can set the environment variable ``WEB3_PROVIDER_URI`` +before starting your script, and web3 will look for that provider first. + +Valid formats for this environment variable are: + +- ``file:///path/to/node/rpc-json/file.ipc`` +- ``http://192.168.1.2:8545`` +- ``https://node.ontheweb.com`` +- ``ws://127.0.0.1:8546`` + + +Auto-initialization Provider Shortcuts +-------------------------------------- + +Geth dev Proof of Authority +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To connect to a ``geth --dev`` Proof of Authority instance with +the POA middleware loaded by default: + +.. code-block:: python + + >>> from web3.auto.gethdev import w3 + + # confirm that the connection succeeded + >>> w3.is_connected() + True + +Or, connect to an async web3 instance: + +.. code-block:: python + + >>> from web3.auto.gethdev import async_w3 + >>> await async_w3.provider.connect() + + # confirm that the connection succeeded + >>> await async_w3.is_connected() + True + + +Built In Providers +------------------ + +Web3 ships with the following providers which are appropriate for connecting to +local and remote JSON-RPC servers. + + +HTTPProvider +~~~~~~~~~~~~ + +.. py:class:: web3.providers.rpc.HTTPProvider(endpoint_uri, request_kwargs={}, session=None, exception_retry_configuration=ExceptionRetryConfiguration()) + + This provider handles interactions with an HTTP or HTTPS based JSON-RPC server. + + * ``endpoint_uri`` should be the full URI to the RPC endpoint such as + ``'https://localhost:8545'``. For RPC servers behind HTTP connections + running on port 80 and HTTPS connections running on port 443 the port can + be omitted from the URI. + * ``request_kwargs`` should be a dictionary of keyword arguments which + will be passed onto each http/https POST request made to your node. + * ``session`` allows you to pass a ``requests.Session`` object initialized + as desired. + * ``exception_retry_configuration`` is an instance of the + :class:`~web3.providers.rpc.utils.ExceptionRetryConfiguration` + class which allows you to configure how the provider should handle exceptions + when making certain requests. Setting this to ``None`` will disable + exception retries. + + .. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545")) + + Note that you should create only one HTTPProvider with the same provider URL + per python process, as the HTTPProvider recycles underlying TCP/IP + network connections, for better performance. Multiple HTTPProviders with different + URLs will work as expected. + + Under the hood, the ``HTTPProvider`` uses the python requests library for + making requests. If you would like to modify how requests are made, you can + use the ``request_kwargs`` to do so. A common use case for this is increasing + the timeout for each request. + + + .. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", request_kwargs={'timeout': 60})) + + + To tune the connection pool size, you can pass your own ``requests.Session``. + + .. code-block:: python + + >>> from web3 import Web3 + >>> adapter = requests.adapters.HTTPAdapter(pool_connections=20, pool_maxsize=20) + >>> session = requests.Session() + >>> session.mount('http://', adapter) + >>> session.mount('https://', adapter) + >>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", session=session)) + + +IPCProvider +~~~~~~~~~~~ + +.. py:class:: web3.providers.ipc.IPCProvider(ipc_path=None, timeout=10) + + This provider handles interaction with an IPC Socket based JSON-RPC + server. + + * ``ipc_path`` is the filesystem path to the IPC socket: + + .. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.IPCProvider("~/Library/Ethereum/geth.ipc")) + + If no ``ipc_path`` is specified, it will use a default depending on your operating + system. + + - On Linux and FreeBSD: ``~/.ethereum/geth.ipc`` + - On Mac OS: ``~/Library/Ethereum/geth.ipc`` + - On Windows: ``\\.\pipe\geth.ipc`` + + +AsyncHTTPProvider +~~~~~~~~~~~~~~~~~ + +.. py:class:: web3.providers.rpc.AsyncHTTPProvider(endpoint_uri, request_kwargs={}, exception_retry_configuration=ExceptionRetryConfiguration()) + + This provider handles interactions with an HTTP or HTTPS based JSON-RPC server asynchronously. + + * ``endpoint_uri`` should be the full URI to the RPC endpoint such as + ``'https://localhost:8545'``. For RPC servers behind HTTP connections + running on port 80 and HTTPS connections running on port 443 the port can + be omitted from the URI. + * ``request_kwargs`` should be a dictionary of keyword arguments which + will be passed onto each http/https POST request made to your node. + * ``exception_retry_configuration`` is an instance of the + :class:`~web3.providers.rpc.utils.ExceptionRetryConfiguration` + class which allows you to configure how the provider should handle exceptions + when making certain requests. Setting this to ``None`` will disable + exception retries. + + The ``cache_async_session()`` method allows you to use your own + ``aiohttp.ClientSession`` object. + + .. code-block:: python + + >>> from aiohttp import ClientSession + >>> from web3 import AsyncWeb3, AsyncHTTPProvider + + >>> w3 = AsyncWeb3(AsyncHTTPProvider(endpoint_uri)) + + >>> # If you want to pass in your own session: + >>> custom_session = ClientSession() + >>> await w3.provider.cache_async_session(custom_session) # This method is an async method so it needs to be handled accordingly + >>> # when you're finished, disconnect: + >>> w3.provider.disconnect() + + Under the hood, the ``AsyncHTTPProvider`` uses the python + `aiohttp `_ library for making requests. + +Persistent Connection Providers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Persistent Connection Base Class +++++++++++++++++++++++++++++++++ + +.. note:: + This class is not meant to be used directly. If your provider class inherits + from this class, look to these docs for additional configuration options. + +.. py:class:: web3.providers.persistent.PersistentConnectionProvider(\ + request_timeout: float = 50.0, \ + subscription_response_queue_size: int = 500, \ + silence_listener_task_exceptions: bool = False \ + max_connection_retries: int = 5, \ + request_information_cache_size: int = 500, \ + ) + + This is a base provider class, inherited by the following providers: + + - :class:`~web3.providers.persistent.WebSocketProvider` + - :class:`~web3.providers.persistent.AsyncIPCProvider` + + It handles interactions with a persistent connection to a JSON-RPC server. Among + its configuration, it houses all of the + :class:`~web3.providers.persistent.request_processor.RequestProcessor` logic for + handling the asynchronous sending and receiving of requests and responses. See + the :ref:`internals__persistent_connection_providers` section for more details on + the internals of persistent connection providers. + + * ``request_timeout`` is the timeout in seconds, used when sending data over the + connection and waiting for a response to be received from the listener task. + Defaults to ``50.0``. + + * ``subscription_response_queue_size`` is the size of the queue used to store + subscription responses, defaults to ``500``. While messages are being consumed, + this queue should never fill up as it is a transient queue and meant to handle + asynchronous receiving and processing of responses. When in sync with the + socket stream, this queue should only ever store 1 to a few messages at a time. + + * ``silence_listener_task_exceptions`` is a boolean that determines whether + exceptions raised by the listener task are silenced. Defaults to ``False``, + raising any exceptions that occur in the listener task. + + * ``max_connection_retries`` is the maximum number of times to retry a connection + to the provider when initializing the provider. Defaults to ``5``. + + * ``request_information_cache_size`` specifies the size of the transient cache for + storing request details, enabling the provider to process responses based on the + original request information. Defaults to ``500``. + +AsyncIPCProvider +++++++++++++++++ + +.. py:class:: web3.providers.persistent.AsyncIPCProvider(ipc_path=None, max_connection_retries=5) + + This provider handles asynchronous, persistent interaction with an IPC Socket based + JSON-RPC server. + + * ``ipc_path`` is the filesystem path to the IPC socket: + * ``read_buffer_limit`` is the maximum size of data, in bytes, that can be read + from the socket at one time. Defaults to 20MB (20 * 1024 * 1024). Raises + ``ReadBufferLimitReached`` if the limit is reached, suggesting that the buffer + limit be increased. + + This provider inherits from the + :class:`~web3.providers.persistent.PersistentConnectionProvider` class. Refer to + the :class:`~web3.providers.persistent.PersistentConnectionProvider` documentation + for details on additional configuration options available for this provider. + + If no ``ipc_path`` is specified, it will use a default depending on your operating + system. + + - On Linux and FreeBSD: ``~/.ethereum/geth.ipc`` + - On Mac OS: ``~/Library/Ethereum/geth.ipc`` + - On Windows: ``\\.\pipe\geth.ipc`` + +WebSocketProvider ++++++++++++++++++ + +.. py:class:: web3.providers.persistent.WebSocketProvider(endpoint_uri: str, websocket_kwargs: Dict[str, Any] = {}, use_text_frames: bool = False) + + This provider handles interactions with an WS or WSS based JSON-RPC server. + + * ``endpoint_uri`` should be the full URI to the RPC endpoint such as + ``'ws://localhost:8546'``. + * ``websocket_kwargs`` this should be a dictionary of keyword arguments which + will be passed onto the ws/wss websocket connection. + * ``use_text_frames`` will ensure websocket data is sent as text frames + for servers that do not support binary communication. + + This provider inherits from the + :class:`~web3.providers.persistent.PersistentConnectionProvider` class. Refer to + the :class:`~web3.providers.persistent.PersistentConnectionProvider` documentation + for details on additional configuration options available for this provider. + + Under the hood, the ``WebSocketProvider`` uses the python websockets library for + making requests. If you would like to modify how requests are made, you can + use the ``websocket_kwargs`` to do so. See the `websockets documentation`_ for + available arguments. + + +.. _subscription-examples: + +Using Persistent Connection Providers ++++++++++++++++++++++++++++++++++++++ + +The ``AsyncWeb3`` class may be used as a context manager, utilizing the ``async with`` +syntax, when instantiating with a +:class:`~web3.providers.persistent.PersistentConnectionProvider`. This will +automatically close the connection when the context manager exits and is the +recommended way to initiate a persistent connection to the provider. + +A similar example using a ``websockets`` connection as an asynchronous context manager +can be found in the `websockets connection`_ docs. + +.. code-block:: python + + >>> import asyncio + >>> from web3 import AsyncWeb3 + >>> from web3.providers.persistent import ( + ... AsyncIPCProvider, + ... WebSocketProvider, + ... ) + + >>> LOG = True # toggle debug logging + >>> if LOG: + ... import logging + ... # logger = logging.getLogger("web3.providers.AsyncIPCProvider") # for the AsyncIPCProvider + ... logger = logging.getLogger("web3.providers.WebSocketProvider") # for the WebSocketProvider + ... logger.setLevel(logging.DEBUG) + ... logger.addHandler(logging.StreamHandler()) + + >>> async def context_manager_subscription_example(): + ... # async with AsyncWeb3(AsyncIPCProvider("./path/to.filename.ipc") as w3: # for the AsyncIPCProvider + ... async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3: # for the WebSocketProvider + ... # subscribe to new block headers + ... subscription_id = await w3.eth.subscribe("newHeads") + ... + ... async for response in w3.socket.process_subscriptions(): + ... print(f"{response}\n") + ... # handle responses here + ... + ... if some_condition: + ... # unsubscribe from new block headers and break out of + ... # iterator + ... await w3.eth.unsubscribe(subscription_id) + ... break + ... + ... # still an open connection, make any other requests and get + ... # responses via send / receive + ... latest_block = await w3.eth.get_block("latest") + ... print(f"Latest block: {latest_block}") + ... + ... # the connection closes automatically when exiting the context + ... # manager (the `async with` block) + + >>> asyncio.run(context_manager_subscription_example()) + + +The ``AsyncWeb3`` class may also be used as an asynchronous iterator, utilizing the +``async for`` syntax, when instantiating with a +:class:`~web3.providers.persistent.PersistentConnectionProvider`. This may be used to +set up an indefinite websocket connection and reconnect automatically if the connection +is lost. + +A similar example using a ``websockets`` connection as an asynchronous iterator can +be found in the `websockets connection`_ docs. + +.. _`websockets connection`: https://websockets.readthedocs.io/en/stable/reference/asyncio/client.html#websockets.client.connect + +.. code-block:: python + + >>> import asyncio + >>> import websockets + >>> from web3 import AsyncWeb3 + >>> from web3.providers.persistent import ( + ... AsyncIPCProvider, + ... WebSocketProvider, + ... ) + + >>> async def subscription_iterator_example(): + ... # async for w3 in AsyncWeb3(AsyncIPCProvider("./path/to/filename.ipc")): # for the AsyncIPCProvider + ... async for w3 in AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")): # for the WebSocketProvider + ... try: + ... ... + ... except websockets.ConnectionClosed: + ... continue + + # run the example + >>> asyncio.run(subscription_iterator_example()) + + +Awaiting the instantiation with a +:class:`~web3.providers.persistent.PersistentConnectionProvider`, or instantiating +and awaiting the ``connect()`` method is also possible. Both of these examples are +shown below. + +.. code-block:: python + + >>> async def await_instantiation_example(): + ... # w3 = await AsyncWeb3(AsyncIPCProvider("./path/to/filename.ipc")) # for the AsyncIPCProvider + ... w3 = await AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) # for the WebSocketProvider + ... + ... # some code here + ... + ... # manual cleanup + ... await w3.provider.disconnect() + + # run the example + >>> asyncio.run(await_instantiation_example()) + +.. code-block:: python + + >>> async def await_provider_connect_example(): + ... # w3 = AsyncWeb3(AsyncIPCProvider("./path/to/filename.ipc")) # for the AsyncIPCProvider + ... w3 = AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) # for the WebSocketProvider + ... await w3.provider.connect() + ... + ... # some code here + ... + ... # manual cleanup + ... await w3.provider.disconnect() + + # run the example + >>> asyncio.run(await_provider_connect_example()) + +:class:`~web3.providers.persistent.PersistentConnectionProvider` classes use the +:class:`~web3.providers.persistent.request_processor.RequestProcessor` class under the +hood to sync up the receiving of responses and response processing for one-to-one and +one-to-many request-to-response requests. Refer to the +:class:`~web3.providers.persistent.request_processor.RequestProcessor` +documentation for details. + +AsyncWeb3 with Persistent Connection Providers +++++++++++++++++++++++++++++++++++++++++++++++ + +When an ``AsyncWeb3`` class is connected to a +:class:`~web3.providers.persistent.PersistentConnectionProvider`, some attributes and +methods become available. + + .. py:attribute:: socket + + The public API for interacting with the websocket connection is available via + the ``socket`` attribute of the ``Asyncweb3`` class. This attribute is an + instance of the + :class:`~web3.providers.persistent.persistent_connection.PersistentConnection` + class and is the main interface for interacting with the socket connection. + + +Interacting with the Persistent Connection +++++++++++++++++++++++++++++++++++++++++++ + +.. py:class:: web3.providers.persistent.persistent_connection.PersistentConnection + + This class handles interactions with a persistent socket connection. It is available + via the ``socket`` attribute on the ``AsyncWeb3`` class. The + ``PersistentConnection`` class has the following methods and attributes: + + .. py:attribute:: subscriptions + + This attribute returns the current active subscriptions as a dict mapping + the subscription ``id`` to a dict of metadata about the subscription + request. + + .. py:method:: process_subscriptions() + + This method is available for listening to websocket subscriptions indefinitely. + It is an asynchronous iterator that yields strictly one-to-many + (e.g. ``eth_subscription`` responses) request-to-response messages from the + websocket connection. To receive responses for one-to-one request-to-response + calls, use the standard API for making requests via the appropriate module + (e.g. ``block_num = await w3.eth.block_number``) + + The responses from this method are formatted by *web3.py* formatters and run + through the middleware that were present at the time of subscription. + Examples on how to use this method can be seen above in the + `Using Persistent Connection Providers`_ section. + + .. py:method:: send(method: RPCEndpoint, params: Sequence[Any]) + + This method is available strictly for sending raw requests to the socket, + if desired. It is not recommended to use this method directly, as the + responses will not be formatted by *web3.py* formatters or run through the + middleware. Instead, use the methods available on the respective web3 + module. For example, use ``w3.eth.get_block("latest")`` instead of + ``w3.socket.send("eth_getBlockByNumber", ["latest", True])``. + + .. py:method:: recv() + + The ``recv()`` method can be used to receive the next response for a request + from the socket. The response from this method is the raw response. This is not + the recommended way to receive a response for a request, as it is not formatted + by *web3.py* formatters or run through the middleware. Instead, use the methods + available on the respective web3 module + (e.g. ``block_num = await w3.eth.block_number``) for retrieving responses for + one-to-one request-to-response calls. + + .. py:method:: make_request(method: RPCEndpoint, params: Sequence[Any]) + + This method is available for making requests to the socket and retrieving the + response. It is not recommended to use this method directly, as the responses + will not be properly formatted by *web3.py* formatters or run through the + middleware. Instead, use the methods available on the respective web3 module. + For example, use ``w3.eth.get_block("latest")`` instead of + ``w3.socket.make_request("eth_getBlockByNumber", ["latest", True])``. + + +LegacyWebSocketProvider +~~~~~~~~~~~~~~~~~~~~~~~ + +.. warning:: + + ``LegacyWebSocketProvider`` is deprecated and is likely to be removed in a + future major release. Please use ``WebSocketProvider`` instead. + +.. py:class:: web3.providers.legacy_websocket.LegacyWebSocketProvider(endpoint_uri[, websocket_timeout, websocket_kwargs]) + + This provider handles interactions with an WS or WSS based JSON-RPC server. + + * ``endpoint_uri`` should be the full URI to the RPC endpoint such as + ``'ws://localhost:8546'``. + * ``websocket_timeout`` is the timeout in seconds, used when receiving or + sending data over the connection. Defaults to 10. + * ``websocket_kwargs`` this should be a dictionary of keyword arguments which + will be passed onto the ws/wss websocket connection. + + .. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.LegacyWebSocketProvider("ws://127.0.0.1:8546")) + + Under the hood, ``LegacyWebSocketProvider`` uses the python ``websockets`` library for + making requests. If you would like to modify how requests are made, you can + use the ``websocket_kwargs`` to do so. See the `websockets documentation`_ for + available arguments. + + .. _`websockets documentation`: https://websockets.readthedocs.io/en/stable/reference/asyncio/client.html#websockets.client.WebSocketClientProtocol + + Unlike HTTP connections, the timeout for WS connections is controlled by a + separate ``websocket_timeout`` argument, as shown below. + + + .. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.LegacyWebSocketProvider("ws://127.0.0.1:8546", websocket_timeout=60)) + + +AutoProvider +~~~~~~~~~~~~ + +:class:`~web3.providers.auto.AutoProvider` is the default used when initializing +:class:`web3.Web3` without any providers. There's rarely a reason to use it +explicitly. + +.. py:currentmodule:: web3.providers.eth_tester + +EthereumTesterProvider +~~~~~~~~~~~~~~~~~~~~~~ + +.. warning:: Experimental: This provider is experimental. There are still significant + gaps in functionality. However it is being actively developed and supported. + +.. py:class:: EthereumTesterProvider(ethereum_tester=None, api_endpoints=None) +.. py:class:: AsyncEthereumTesterProvider(ethereum_tester=None, api_endpoints=None) + + This provider integrates with the ``eth-tester`` library. The ``ethereum_tester`` + constructor argument should be an instance of the :class:`~eth_tester.EthereumTester` + or a subclass of :class:`~eth_tester.backends.base.BaseChainBackend` class provided + by the ``eth-tester`` library. The ``api_endpoints`` argument should be a ``dict`` + of RPC endpoints. You can see the structure and defaults `here `_. + If you would like a custom ``eth-tester`` instance to test with, see the + ``eth-tester`` library `documentation `_ + for details. + + .. code-block:: python + + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider()) + +.. NOTE:: To install the needed dependencies to use EthereumTesterProvider, you can + install the pip extras package that has the correct interoperable versions of the + ``eth-tester`` and ``py-evm`` dependencies needed: e.g. ``pip install "web3[tester]"`` diff --git a/_build/html_zh_CN/_sources/quickstart.rst.txt b/_build/html_zh_CN/_sources/quickstart.rst.txt new file mode 100644 index 0000000000..5f7c68daaa --- /dev/null +++ b/_build/html_zh_CN/_sources/quickstart.rst.txt @@ -0,0 +1,163 @@ +.. _quickstart: + +Quickstart +========== + +.. contents:: :local: + +.. NOTE:: All code starting with a ``$`` is meant to run on your terminal. + All code starting with a ``>>>`` is meant to run in a python interpreter, + like `ipython `_. + +Installation +------------ + +web3.py can be installed (preferably in a :ref:`virtualenv `) +using ``pip`` as follows: + +.. code-block:: shell + + $ pip install web3 + + +.. NOTE:: If you run into problems during installation, you might have a + broken environment. See the troubleshooting guide to :ref:`setting up a + clean environment `. + + +Using Web3 +---------- + +This library depends on a connection to an Ethereum node. We call these connections +*Providers* and there are several ways to configure them. The full details can be found +in the :ref:`Providers` documentation. This Quickstart guide will highlight +a couple of the most common use cases. + + +Test Provider +************* + +If you're just learning the ropes or doing some quick prototyping, you can use a test +provider, `eth-tester `_. This provider includes +some accounts prepopulated with test ether and instantly includes each transaction into a block. +web3.py makes this test provider available via ``EthereumTesterProvider``. + +.. note:: + + The ``EthereumTesterProvider`` requires additional dependencies. Install them via + ``pip install "web3[tester]"``, then import and instantiate the provider as seen below. + +.. code-block:: python + + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider()) + >>> w3.is_connected() + True + + +Local Providers +*************** + +The hardware requirements are `steep `_, +but the safest way to interact with Ethereum is to run an Ethereum client on your own hardware. +For locally run nodes, an IPC connection is the most secure option, but HTTP and +websocket configurations are also available. By default, the popular `Geth client `_ +exposes port ``8545`` to serve HTTP requests and ``8546`` for websocket requests. Connecting +to this local node can be done as follows: + +.. code-block:: python + + >>> from web3 import Web3, AsyncWeb3 + + # IPCProvider: + >>> w3 = Web3(Web3.IPCProvider('./path/to/filename.ipc')) + >>> w3.is_connected() + True + + # HTTPProvider: + >>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) + >>> w3.is_connected() + True + + # AsyncHTTPProvider: + >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545')) + >>> await w3.is_connected() + True + + # -- Persistent Connection Providers -- # + + # WebSocketProvider: + >>> w3 = await AsyncWeb3(AsyncWeb3.WebSocketProvider('ws://127.0.0.1:8546')) + >>> await w3.is_connected() + True + + # AsyncIPCProvider: + >>> w3 = await AsyncWeb3(AsyncWeb3.AsyncIPCProvider('./path/to/filename.ipc')) + >>> await w3.is_connected() + True + + +Remote Providers +**************** + +The quickest way to interact with the Ethereum blockchain is to use a `remote node provider `_. +You can connect to a remote node by specifying the endpoint, just like the previous local node example: + +.. code-block:: python + + >>> from web3 import Web3, AsyncWeb3 + + >>> w3 = Web3(Web3.HTTPProvider('https://')) + + >>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('https://')) + + >>> w3 = await AsyncWeb3(AsyncWeb3.WebSocketProvider('wss://')) + +This endpoint is provided by the remote node service, typically after you create an account. + +.. _first_w3_use: + + +Getting Blockchain Info +----------------------- + +It's time to start using web3.py! Once properly configured, the ``w3`` instance will allow you +to interact with the Ethereum blockchain. Try getting all the information about the latest block: + +.. code-block:: python + + >>> w3.eth.get_block('latest') + {'difficulty': 1, + 'gasLimit': 6283185, + 'gasUsed': 0, + 'hash': HexBytes('0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178291ffeb8750'), + 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), + 'miner': '0x0000000000000000000000000000000000000000', + 'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), + 'nonce': HexBytes('0x0000000000000000'), + 'number': 0, + 'parentHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), + 'proofOfAuthorityData': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000dddc391ab2bf6701c74d0c8698c2e13355b2e4150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), + 'receiptsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'), + 'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'), + 'size': 622, + 'stateRoot': HexBytes('0x1f5e460eb84dc0606ab74189dbcfe617300549f8f4778c3c9081c119b5b5d1c1'), + 'timestamp': 0, + 'totalDifficulty': 1, + 'transactions': [], + 'transactionsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'), + 'uncles': []} + +web3.py can help you read block data, sign and send transactions, deploy and interact with contracts, +and a number of other features. + +A few suggestions from here: + +- The :doc:`overview` page provides a summary of web3.py's features. +- The :class:`w3.eth ` API contains the most frequently used methods. +- A guide to :ref:`contracts` includes deployment and usage examples. +- The nuances of :doc:`transactions` are explained in another guide. + +.. NOTE:: It is recommended that your development environment have the ``PYTHONWARNINGS=default`` + environment variable set. Some deprecation warnings will not show up + without this variable being set. diff --git a/_build/html_zh_CN/_sources/release_notes.rst.txt b/_build/html_zh_CN/_sources/release_notes.rst.txt new file mode 100644 index 0000000000..72b6123ebd --- /dev/null +++ b/_build/html_zh_CN/_sources/release_notes.rst.txt @@ -0,0 +1,4762 @@ +Release Notes +============= + +v7 Breaking Changes Summary + See the :ref:`v7 Migration Guide` + +.. towncrier release notes start + +web3.py v7.13.0 (2025-08-04) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Raise ``BadResponseFormat`` from within ``FormattingMiddleware`` if the raw response is not a dict. (`#3735 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix broken link to external ``eth_gasPrice`` documentation. (`#3717 `__) + + +Features +~~~~~~~~ + +- Support parallelization of subscription handling globally via the subscription manager ``parallelize`` flag, and on a per-subscription basis via the ``parallelize`` flag on the subscription itself. (`#3709 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Update integration test suite fixture to test against geth ``v1.16.2``. (`#1162 `__) +- Add missing async tests for ``FormattingMiddleware`` as a sanity check. (`#3735 `__) + + +web3.py v7.12.1 (2025-07-14) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Fix ``AutoProvider`` batching setup by adding a proxy batch request. (`#3712 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Update integrations tests to use geth ``v1.16.0``. (`#3727 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3698 `__, `#3710 `__ + + +web3.py v7.12.0 (2025-05-22) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Thread safety for batching and better consistency with ``PersistentConnectionProvider`` implementations: + + - Make request batching threadsafe by using ``contextvars.ContextVar`` rather than a global flag for setting the batching state. + - Deterministically match responses with request ids for ``PersistentConnectionProvider`` batch requests. (`#3705 `__) + + +Deprecations +~~~~~~~~~~~~ + +- Deprecate ``ens_encode_name`` in favor of ``dns_encode_name``. (`#3700 `__) + + +Features +~~~~~~~~ + +- Introduce ``ens.utils.dns_encode_name`` as a rename of the current ``ens_encode_name``, for consistency across other language implementations and with the ENS docs. Returns ``HexBytes`` instead of ``bytes``. (`#3700 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Update some types in ``web3._utils.method_formatters`` (`#3669 `__) +- Fix issues and start running the core tests with `pytest-xdist`, effectively reducing the CI test times by ~75-80%. (`#3705 `__) + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- optimize message formatting for logging (`#3643 `__) +- Optimize web3._utils.decorators.reject_recursive_repeats (`#3668 `__) +- optimize Method.method_selector_function (`#3696 `__) +- optimize map_abi_data (`#3697 `__) + + +web3.py v7.11.1 (2025-05-12) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Fix contract event ``FilterParams`` to validate and normalize ``address`` parameters. (`#3618 `__) +- Properly handle ``PersistentConnectionClosedOK`` for ``subscription_manager.handle_subscriptions()``. (`#3690 `__) + + +Deprecations +~~~~~~~~~~~~ + +- Deprecate eth.get_uncle* methods. Will be removed in v8. (`#3683 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Re-compile test contracts with new Solidity ``v0.8.30`` and re-generate integration test fixture to test against latest geth ``v1.15.11``. (`#3692 `__) +- Remove old test fixtures when generating a new test fixture. (`#3693 `__) +- Address some flaky tests due to a geth bug in state synchronization. (`#3695 `__) + + +web3.py v7.11.0 (2025-04-29) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Checks that ``PersistentConnectionProvider`` response cache value is a dict before attempting to access it like one. Also adds checks to ``make_batch_request`` to make sure it is in batching mode before being called and is not after. (`#3642 `__) +- Moves base providers' ``_is_batching`` and ``_batch_request_func_cache`` from class to instance attrs to help with thread safety. (`#3661 `__) + + +Features +~~~~~~~~ + +- Support for Prague network upgrade, mainly ``requests_hash`` and ``authorization_list`` formatters. Add support for serializing ``SignedSetCodeTransaction`` (`eth-account` pydantic model) directly added to transaction dicts. (`#3659 `__) +- Allow setting the ``request_information_cache_size`` for ``PersistentConnectionProvider`` implementations. (`#3662 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Update some outdated TODO notes in code & remove old un-tested uncles tests as no longer relevant post-merge. (`#3605 `__) +- Run each integration test in isolation and parallelize, instead of running them all within a single `geth` (for example) process. This prevents muddied test contexts. (`#3659 `__) +- Bound hypothesis integers in some tests to a max of uint256 value (`#3665 `__) +- AsyncENS tests were xfailing for the wrong reason. (`#3675 `__) + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Optimize performance for: + + * web3._utils.utility_methods.all_in_dict + * web3._utils.utility_methods.any_in_dict + * web3._utils.utility_methods.none_in_dict (`#3667 `__) +- optimize web3._utils.rpc_abi.apply_abi_formatters_to_dict (`#3671 `__) + + +web3.py v7.10.0 (2025-03-27) +---------------------------- + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3653 `__ + + +web3.py v7.9.0 (2025-03-12) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Prevent mutating list of subscriptions when unsubscribing via the ``subscription_manager`` by iterating over a copy of the provided list. (`#3604 `__) +- Batching can now be used with the AutoProvider (`#3607 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update and clean up Contributing docs. (`#3610 `__) + + +Features +~~~~~~~~ + +- Add ``use_text_frames`` flag for ``WebSocketProvider`` to work around websocket servers that don't support binary frames (`#3619 `__) +- Sync and async support for ``eth_simulateV1`` RPC method. (`#3622 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Renames a test so pytest finds it. (`#3606 `__) +- Merge template, replacing ``bumpversion`` with ``bump-my-version``. (`#3610 `__) +- Update integration test fixture to use latest geth version ``v1.15.5``. (`#3636 `__) +- Use ``-U`` to install latest `py-geth` version for CI geth steps. This is usually a requirement if we're missing the binary for the newly-generated fixture geth version. (`#3637 `__) +- Re-compile test contracts with newly released Solidity ``v0.8.29``. (`#3640 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3623 `__ + + +web3.py v7.8.0 (2025-02-03) +--------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- The bugfix to match ``unsubscribe`` to ``subscribe`` for multiple subscriptions breaks the function signature for ``unsubscribe``, changing the ``subscription`` argument to ``subscriptions``. (`#3585 `__) + + +Bugfixes +~~~~~~~~ + +- Handle the case when a single RPC error response is returned for a batch request, instead of always expecting a list of responses. (`#3585 `__) +- Don't raise on non-unique default subscription labels (no label provided). Only raise if a non-unique custom label is explicitly set for a subscription. (`#3594 `__) +- Fix bugs related to subscription manager: ``run_forever`` can start with ``0`` subscriptions and remains alive, ``unsubscribe`` accepts single or multiple subs as objects or hexstrs, ``subscribe`` for many subs returns a list of hexstr ids. (`#3595 `__) +- Fix issue where ``.values()`` raised a ``KeyError`` in ``NamedTupledOnion`` (`#3596 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Include ``topic`` attribute in ``ContractEvent`` docs. (`#3586 `__) +- Introduce Event Subscriptions docs guide (`#3600 `__) + + +Features +~~~~~~~~ + +- New ``Beacon`` and ``AsyncBeacon`` endpoints: ``get_peer_count``, ``get_attester_duties``, ``get_block_proposer_duties``, ``get_sync_committee_duties``, and ``get_attestation_rewards``. (`#3504 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Move duplicate code into ``BaseContract`` class from ``Contract`` and ``AsyncContract``. (`#3579 `__) +- Address flaky tests in CI runs. (`#3583 `__) +- Update copyright year from 2024 to 2025 in the LICENSE file. (`#3592 `__) + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Avoid unnecessary extra call to resolver when resolving an ENS address with no ``coin_type`` specified (default). (`#3584 `__) + + +web3.py v7.7.0 (2025-01-15) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Add a ``disconnect`` method to the AsyncHTTPProvider that closes all sessions and clears the cache (`#3557 `__) +- Fix a bug related to building the ipc path for connecting to a geth ``--dev`` instance via ``web3.auto.gethdev``. (`#3576 `__) + + +Features +~~~~~~~~ + +- Add a subscription manager to persistent connection providers, with support for handler methods for ``eth_subscribe`` subscriptions. (`#3554 `__) +- Implement a ``topic`` property for contract events to retrieve the topic for the event. (`#3578 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3546 `__ + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Improve ``AttributeDict.recursive()`` and ``AttributeDictMiddleware`` performance, effectively speeding up response processing for attrdict middleware by nearly 2x. (`#3575 `__) + + +web3.py v7.6.1 (2024-12-18) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Include an end-of-line delimiter when sending messages via IPC with the ``IPCProvider`` and ``AsyncIPCProvider``. (`#3537 `__) +- Contract functions and events no longer initialize for each call. Retrieval of overloaded functions and events is now deterministic. Any ambiguity will result in an exception being raised. (`#3540 `__) +- Bump the eth-tester version to one that works in the tester dependency extras (`#3555 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update ENS-related links (`#3563 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Upgrade Geth Fixture to 1.14.12 (`#3533 `__) +- Delete ``ARCHITECTURE.md`` as unused (`#3547 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3525 `__ + + +web3.py v7.6.0 (2024-11-22) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Update the `ContractEvents` class to raise a `NoABIFound` exception if the `Contract` is initialized without an `ABI` and an attempt to access an event is made. This exception makes `ContractEvents` consistent with `ContractFunctions`. (`#3491 `__) + + +Features +~~~~~~~~ + +- Contracts with overloaded functions or events are now supported. The Contract initializes functions and events using an identifier to distinguish between them. The identifier is the function or event signature, which consists of the name and the parameter types. (`#3491 `__) +- - Support for ``w3.eth.blob_base_fee`` + - Async support for ``w3.eth.blob_base_fee`` (`#3527 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Pin ``websockets<14`` due to breaking changes (`#3529 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3491 `__ + + +web3.py v7.5.0 (2024-11-06) +--------------------------- + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Polish docs index page (`#3522 `__) + + +Features +~~~~~~~~ + +- Add support for Geth Debug traceTransaction. (`#3334 `__) +- New contract methods to obtain event elements from a contract ABI using a name, signature, selector, or topic. (`#3472 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Add python 3.13 support (`#3493 `__) +- Compile test contracts with newly released Solidity ``v0.8.28`` to ensure compatibility. (`#3515 `__) + + +web3.py v7.4.0 (2024-10-16) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Fix a bug where CCIP-Read expected a ``{sender}`` in the url for a POST request. If ``{data}`` is missing from the url, assume a POST request is being made regardless of whether ``{sender}`` is present. (`#3291 `__) +- Fix a bug where non-mainnet chains could not cache requests based on missing ``finalized`` block number. (`#3508 `__) +- Send ``json``, not ``data`` with CCIP-Read POST requests. (`#3512 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update the request caching documentation to clarify on when to reach for request caching and how to configure the request validation threshold for certain endpoints. (`#3508 `__) + + +Features +~~~~~~~~ + +- Allow a time interval, in seconds, to be used as the ``request_cache_validation_threshold`` for request caching. Keep a list of internal default values based on the chain id for some of the bigger chains. (`#3508 `__) + + +web3.py v7.3.1 (2024-10-14) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Properly wrap ``AsyncBeacon.request_timeout`` float in a ``aiohttp.ClientTimeout`` when making requests. (`#3503 `__) +- Changes related to an `eth-typing` bugfix, input types for ``ABIEvent``: ``ABIComponent`` -> ``ABIComponentIndexed``. (`#3510 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix ``EthereumTesterProvider`` signature in docs, added an ``eth_tester`` example. (`#3500 `__) +- Fix `pip install -e ".[dev]"` command in linux README. (`#3505 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Update the ENSIP-15 to the latest spec and update the test suite. (`#3501 `__) + + +web3.py v7.3.0 (2024-09-25) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Base default ``maxFeePerGas`` calculation off of existing ``maxPriorityFeePerGas`` key instead of separate RPC call (`#3052 `__) +- Add back dependency extra for 'tester'. (`#3480 `__) +- Fix a bug where sensitive requests that make use of block data should not be cached until some validation threshold deems it is safe to do so, when request caching is turned on. (`#3483 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update ``contract.encode_abi`` signature in docs and migration guide (`#3473 `__) +- Update documentation around ``SignAndSendRawMiddlewareBuilder`` injection into the middleware onion. It should be injected lower in the stack than any middleware that modifies the transaction, in order to ensure those modified fields are signed. (`#3488 `__) +- Docs cleanups related to ``test`` vs ``tester`` install extras. (`#3496 `__) + + +Features +~~~~~~~~ + +- Add a configuration for request caching that sets a threshold for validating cached requests that make use of block data. This can be turned off altogether by setting the threshold to ``None``. (`#3483 `__) +- Add a configuration option for the ``read_buffer_limit`` for ``AsyncIPCProvider`` in order to control the expected message size limit (defaults to 20MB). Add ``ReadBufferLimitReached`` for when the read limit is reached, extend from ``PersistentConnectionError``. (`#3492 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Test warning cleanup (`#3468 `__) +- Re-compile test contracts with recently released Solidity ``v0.8.27``. (`#3475 `__) +- Re-organize the install extras. Re-define the ``test`` extra to always include the ``tester`` extra since it's needed for testing. (`#3495 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3490 `__ + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Improve logic for reading from the async IPC socket in order to properly handle and adjust the handling of large messages. This improves reading speeds in general. (`#3492 `__) + + +web3.py v7.2.0 (2024-08-29) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Fix a bug with newer ``hexbytes`` versions that yield non-0x-prefixed hex for ``HexBytes``: ``raw_transaction.hex()`` -> ``raw_transaction.to_0x_hex()``. (`#3471 `__) + + +Features +~~~~~~~~ + +- HTTPProvider and AsyncHTTPProvider's get_request_headers is now available on both the class and the instance (`#3467 `__) + + +web3.py v7.1.0 (2024-08-28) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Specify a unique ``__hash__()`` for unhashable ``Web3Middleware`` types and use this hash as the middleware onion key when a name is not provided for the middleware. This fixes a bug where different middleware were given the same name and therefore raised errors. (`#3463 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix bug in filters example code (`#3455 `__) +- Update ``v6`` -> ``v7`` migration guide with examples for importing and adding middleware, as well as examples on how to use the ``MiddlewareBuilder`` classes. (`#3462 `__) + + +Features +~~~~~~~~ + +- Add sync and async support for beacon ``/eth/v1/beacon/blob_sidecars`` endpoint. (`#3407 `__) +- Allow user to call ContractFunctions without parentheses (`#3444 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Refactor and DRY up CI run setup and reduce surface area for errors. Include pre-releases in CI runs for internally maintained libraries to try and catch any conflicts. (`#3452 `__) +- Bump `py-geth` to ``>=5.0.0`` from ``>=5.0.0b1`` now that stable has been released. This only matters for the ``test`` install extra (CI and dev purposes). (`#3458 `__) + + +web3.py v7.0.0 (2024-08-21) +--------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Update `eth-utils` and `eth-typing` to latest major versions + + `eth-utils` v5 and `eth-typing` v5 (`#3450 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Improve batch request documentation. (`#3448 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Fix Release Notes formatting (`#3454 `__) + + +web3.py v7.0.0-beta.9 (2024-08-01) +---------------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +* Upgrades to use latest ``ABI`` utilities and typings from ``eth-utils`` and ``eth-typing``. + + * Typings for ``ABI`` components are now available in the ``eth-typing`` package. ``ABI`` types previously in ``web3.types`` have been removed. + * New versions of existing ABI functions were added to ``eth-utils`` and are now exposed in `web3.py` via ``web3.utils.abi``. + * ABI exceptions have been renamed in ``web3.exceptions``. The ``ABIEventFunctionNotFound`` and ``FallbackNotFound`` exceptions have been removed. Use ``ABIEventNotFound`` and ``ABIFallbackNotFound`` instead. + * ``MismatchedABI`` exceptions are raised instead of a ``Web3ValidationError`` for ABI related errors. + * ``encode_abi`` arguments have been updated to use ``abi_element_name`` instead of ``fn_name``. (`#3408 `__) + +- Remove ``Web3ValidationError`` dependence / inheritance from `eth-utils` ``ValidationError``. (`#3443 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Use autodoc and update ABI functions with docstrings and doctests. (`#3408 `__) + + +Features +~~~~~~~~ + +* Utilities to extract function and event ``ABI`` attributes from a contract. Utilities in the ``web3.utils.abi`` module parse ABI elements and check encodability of provided arguments. ABI functions in ``eth-utils`` are exposed by the ``web3.utils.abi`` module. + + * ``get_abi_element_info`` returns an ``ABIElementInfo`` TypedDict with the ``abi``, ``selector``, and ``arguments``. + * ``get_abi_element`` returns the ``ABI`` of a function, event, or error given the name and arguments. + * ``check_if_arguments_can_be_encoded`` returns true if the arguments can be encoded with the given ABI. + * ``get_event_abi`` returns the ``ABI`` of an event given the name. + * ``get_event_log_topics`` returns the log topics of an event given the name. + * ``log_topics_to_bytes`` returns the log topics as bytes. (`#3408 `__) + +- Add explicit stream kwarg to HTTPProvider so that timeout can be more finely tuned. (`#3428 `__) +- Implement a ``RequestTimedOut`` exception, extending from ``Web3RPCError``, for when requests to the node time out. (`#3440 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Run ``mypy`` locally using ``pre-commit`` hook, instead of within ``pre-commit`` container (`#3414 `__) +- Mitigate inconsistently failing tests for CI runs with appropriate ``flaky`` or ``pytest.mark.xfail()`` decorators. (`#3440 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3408 `__, `#3445 `__ + + +web3.py v7.0.0-beta.8 (2024-07-24) +---------------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Refactor the public ``socket`` api for persistent connection providers to properly define ``send()``, ``recv()``, and ``make_request()`` (send and wait for response) methods for interacting with the open socket. (`#3433 `__) +- Format entries in ``accessList`` ``storageKeys`` to be ``HexStr`` instead of ``HexBytes`` (`#3434 `__) + + +Bugfixes +~~~~~~~~ + +- Handle ``ConnectionClosedOK`` case for ``WebSocketProvider``. If a persistent connection is closed gracefully, log and raise a silent ``PersistentConnectionClosedOK`` exception, triggering an end to the message listener task and breaking out of the ``process_subscriptions()`` iterator. (`#3432 `__) + + +Features +~~~~~~~~ + +- Add ``popitem()`` functionality to the ``SimpleCache`` class as well as an async utility method to wait for the next item, ``async_await_and_popitem()``. (`#3433 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Refactor some common logic for persistent connection providers back into the base ``PersistentConnectionProvider`` class to reduce code duplication and improve maintainability. (`#3433 `__) + + +web3.py v7.0.0-beta.7 (2024-06-26) +---------------------------------- + +Bugfixes +~~~~~~~~ + +- Change the ``exception_retry_configuration`` typing on http providers to be an ``Optional``, as setting this property to ``None`` effectively turns off retries on exceptions for requests. (`#3412 `__) +- A bugfix, pre-release, to update the ``Beacon`` APIs (sync and async) to properly use the new ``HTTPSessionManager``. (`#3421 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add an ``eth_subscribe`` example to the events guide (`#3403 `__) + + +Features +~~~~~~~~ + +- Properly handle ``InsufficientDataBytes`` errors when processing receipts (`#3388 `__) +- Provide explicit ``__all__`` exports for providers in `web3/providers/__init__.py`; update `web3/__init__.py` to include all provider classes including base classes. (`#3409 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Re-compile test contracts with Solidity v0.8.25 to ensure compatibility. (`#3307 `__) +- Increase allowable range of eth-tester: 0.11.x and 0.12.x (`#3400 `__) +- Remove uses of signHash in tests, require eth-account >=0.13.0 in doctests (`#3404 `__) +- Use a ``HTTPSessionManager`` to manage sessions for http providers, rather than have them share a single session manager / cache. (`#3412 `__) + + +web3.py v7.0.0-beta.6 (2024-05-15) +---------------------------------- + +Bugfixes +~~~~~~~~ + +- Properly propagate exceptions from the message listener task to the main loop for persistent connection providers. (`#3378 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Prunes the node onboarding text (`#3371 `__) +- Stale example cleanup (`#3374 `__) +- Merge migration guides into one page (`#3379 `__) +- Simplify titles of docs guides (`#3381 `__) +- Move ABI Types guide into the Troubleshooting page (`#3382 `__) +- Distribute examples into relevant guides and delete Example page (`#3383 `__) +- Add subscribe/unsubscribe API (`#3386 `__) +- Introduces batch request API (`#3393 `__) + + +Features +~~~~~~~~ + +- Add support for request batching via ``w3.batch_requests()`` context manager (sync and async). (`#3370 `__) +- Allow request cache configuration on provider ``__init__()`` for all provider classes. (`#3395 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Merge the python project template, notably adding python 3.12 support (`#3363 `__) +- Increase python-asyncio dependency to be >=0.21.2,<0.23 (`#3369 `__) +- Bump to ``mypy==1.10.0`` for ``pre-commit`` (`#3377 `__) +- Move signed.rawTransaction -> signed.raw_transaction in eth module tests (`#3380 `__) + + +web3.py v7.0.0-beta.5 (2024-04-26) +---------------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Snake-case remaining arguments ``fromBlock``, ``toBlock``, and ``blockHash`` in contract and filter methods where they are passed in as kwargs. (`#3353 `__) +- Employ an exponential backoff strategy using the ``backoff_factor`` in ``ExceptionRetryConfiguration`` for ``HTTPProvider`` and ``AsyncHTTPProvider``. Reduce the default initial delay to ``0.125`` seconds. (`#3358 `__) +- Validate JSON-RPC responses more strictly against the JSON-RPC 2.0 specifications. ``BlockNumberOutofRange`` -> ``BlockNumberOutOfRange``. (`#3359 `__) + + +Deprecations +~~~~~~~~~~~~ + +- ``messageHash`` and ``rawTransaction`` from ``eth-account`` have been deprecated for snake_case versions (`#3348 `__) + + +Features +~~~~~~~~ + +- Raise ``Web3RPCError`` on JSON-RPC errors rather than ``Web3ValueError``. Raise ``MethodNotSupported`` exception when a method is not supported within *web3.py*; keep ``MethodUnavailable`` for when a method is not available on the current provider (JSON-RPC error). (`#3359 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Bump ``eth-account`` dependency to ``>=0.12.2`` (`#3348 `__) + + +Removals +~~~~~~~~ + +- Remove the deprecated ``personal`` namespace and all references to it. (`#3350 `__) + + +web3.py v7.0.0-beta.4 (2024-04-11) +---------------------------------- + +Bugfixes +~~~~~~~~ + +- Fix misused call to `endpoint_uri` for all cases of ``PersistentConnectionProvider`` by being able to retrieve either the ``ipc_path`` or the ``endpoint_uri`` from the base class with ``endpoint_uri_or_ipc_path`` property. (`#3319 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix ``eth_createAccessList`` docs to reflect the correct behavior. (`#3327 `__) + + +Features +~~~~~~~~ + +- Use in-house exception wrappers for common Python exceptions, such as ``ValueError``, ``TypeError``, ``AttributeError``, and ``AssertionError``, for better control over exception handling. (`#3300 `__) +- Add request formatter for ``maxFeePerBlobGas`` when sending blob transactions. Add formatters for ``blobGasPrice`` and ``blobGasUsed`` for *eth_getTransactionReceipt*. (`#3322 `__) +- Add formatters to ensure that the result of a ``eth_createAccessList`` response can be plugged directly into an ``accessList`` in a transaction. (`#3327 `__) +- Add Cancun support to ``EthereumTesterProvider``; update Cancun-related fields in some internal types. (`#3332 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Use ``pre-commit`` for linting, run updated lint tools and fix errors (`#3297 `__) +- Dependency updates: ``eth-abi>=5.0.1``, ``eth-account>=0.12.0`` ``eth-typing>=4.0.0`` and ``hexbytes>=1.2.0`` with relevant changes to support these. (`#3298 `__) +- Remove code conditionally necessary for ``python<=3.7`` (`#3317 `__) + + +web3.py v7.0.0-beta.3 (2024-03-28) +---------------------------------- + +Bugfixes +~~~~~~~~ + +- Fix ``process_log()`` when parsing logs for events with indexed and non-indexed inputs. ``get_event_data()`` now compares log topics and event ABIs as hex values. (`#3289 `__) +- Fix ``process_log`` for ``HexStr`` inputs. Explicit type coercion of entry ``topics`` and ``data`` values. (`#3293 `__) +- Fix typing for json data argument to ``eth_signTypedData``. (`#3308 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add note about middlewares change to v7 migration guide. (`#3277 `__) +- Rearrange v7 migration guide and include upgrade path from WebsocketProviderV2 (`#3310 `__) + + +Features +~~~~~~~~ + +- Add support for ``eth_getRawTransactionByHash`` RPC method (`#3247 `__) +- Add ``user_message`` kwarg for human readable ``Web3Exception`` messages. (`#3263 `__) +- Add formatters for type 3 transaction fields ``maxFeePerBlobGas`` and ``blobVersionedHashes``. (`#3314 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Add a daily CI run (`#3272 `__) +- Add linting for non-inclusive language with ``blocklint``. (`#3275 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3304 `__ + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Importing ``ens._normalization`` is deferred until the first call of ``ens.utils.normalize_name`` in order to speed up ``import web3``. (`#3285 `__) +- Utilize ``async`` functionality when popping responses from request manager cache for persistent connection providers. (`#3306 `__) + + +Removals +~~~~~~~~ + +- Remove ``Contract.encodeABI()`` in favor of ``Contract.encode_abi()`` to follow standard conventions. (`#3281 `__) + + +web3.py v7.0.0-beta.2 (2024-03-11) +---------------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Move ``middlewares`` -> ``middleware`` (`#3276 `__) + + +Bugfixes +~~~~~~~~ + +- Fix/update methods and decorators in ``web3/_utils/abi.py`` to address issues raised by ``mypy`` (`#3269 `__) +- Catch all types of ``eth-abi`` ``DecodingError`` in ``EthereumTesterProvider->_make_request()`` (`#3271 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Remove annual user survey prompt from docs (`#3218 `__) +- Introduce feedback form banner prompt on docs (`#3253 `__) +- Refresh of the middleware docs (`#3266 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3259 `__, `#3262 `__ + + +Removals +~~~~~~~~ + +- Remove the ``ethpm`` module and related docs, tests, and dependencies (`#3261 `__) + + +web3.py v7.0.0-beta.1 (2024-02-28) +---------------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Refactor the middleware setup so that request processors and response processors are separated. This will allow for more flexibility in the future and aid in the implementation of features such as batched requests. This PR also closes out a few outstanding issues and will be the start of the breaking changes for `web3.py` ``v7``. Review PR for a full list of changes. (`#3169 `__) +- Use a message listener background task for ``WebsocketProviderV2`` rather than relying on ``ws.recv()`` blocking. Some breaking changes to API, notably ``listen_to_websocket`` -> ``process_subscriptions``. (`#3179 `__) +- Drop dependency on ``lru-dict`` library. (`#3196 `__) +- Drop support for python 3.7 (`#3198 `__) +- Return iterable of ``ABIFunction``s from the ``BaseContractFunctions`` iterator. (`#3200 `__) +- Name changes internal to the library related to ``v7``: ``WebsocketProvider`` -> ``LegacyWebSocketProvider``, ``WebsocketProviderV2`` -> ``WebSocketProvider`` (`#3225 `__) +- ``CallOverride`` type change to ``StateOverride`` to reflect better the type name for the state override. ``eth_call`` is also not the only method with this param, making the name more generic. (`#3227 `__) +- Rename `beacon/main.py` -> `beacon/beacon.py` (`#3233 `__) +- ``EthereumTesterProvider`` now returns ``input`` for `eth_getTransaction*` for better consistency with JSON-RPC spec. (`#3235 `__) +- Change the signature for the async version of ``wait_for_transaction_receipt()`` to use ``Optional[float]`` instead of ``float``. (`#3237 `__) +- ``get_default_ipc_path()`` and ``get_dev_ipc_path()`` now return the path value without checking if the ``geth.ipc`` file exists. (`#3245 `__) + + +Bugfixes +~~~~~~~~ + +- Fix return type of ``AsyncContract.constructor`` (`#3192 `__) +- Handle new geth errors related to waiting for a transaction receipt while transactions are still being indexed. (`#3216 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Documentation was updated to reflect early changes to ``v7`` from ``v6``. A ``v6`` -> ``v7`` migration guide was also started and will be added to as ``v7`` breaking changes are introduced. (`#3211 `__) +- Remove ENS v6 breaking change warning from v7 (`#3254 `__) + + +Features +~~~~~~~~ + +- Add AsyncIPCProvider (`#2984 `__) +- Implement ``state_override`` parameter for ``eth_estimateGas`` method. (`#3164 `__) +- Upgrade `eth-tester` to ``v0.10.0-b.1`` and turn on ``eth_feeHistory`` support for ``EthereumTesterProvider``. (`#3172 `__) +- Add formatters for new ``Cancun`` network upgrade block header fields: ``blobGasUsed``, ``excessBlobGas``, and ``parentBeaconBlockRoot``. (`#3223 `__) +- Contract event ``get_logs`` results sorted by each ``ContractEvent`` ``logIndex``. (`#3228 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Create test fixture for latest ``geth`` version. Run tests with ``geth`` in ``--dev`` mode. (`#3191 `__) +- Validate geth version used to generate the integration test fixture against the version in the binary that is used to run the tests. (`#3193 `__) +- Internal change to ``WebsocketProviderV2`` before release: raise exceptions in message listener task by default; opting to silence them via a flag. (`#3202 `__) +- Compile contracts with and test against new Solidity version ``v0.8.24``. (`#3204 `__) +- Formatting updates for ``black==24.1.0``. (`#3207 `__) +- Allow HTTP provider request retry configuration to be turned off appropriately. Internal change since ``v7`` has not yet been released. (`#3211 `__) +- Upgraded geth fixture version (`#3231 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2964 `__, `#3248 `__ + + +Performance Improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Remove call to ``parse_block_identifier`` when initializing ``ContractCaller`` functions. (`#3257 `__) + + +Removals +~~~~~~~~ + +- ``normalize_request_parameters`` middleware was in a stale state and not being used or tested. This middleware has been removed. (`#3211 `__) +- Remove deprecated ``geth.miner`` namespace and methods. (`#3236 `__) + + +web3.py v6.14.0 (2024-01-10) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Change ``fee_history`` default behavior. If ``reward_percentiles`` arg not included, pass it to the provider as an empty list instead of ``None``. (`#3185 `__) +- Use ``importlib.metadata`` for version info if python>=3.8 (`#3187 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Remove docs reference for removed ``protocol_version`` RPC method (`#3183 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Re-define how async vs sync core test suites are ran. (`#3180 `__) +- Add basic import and version tests for the ``web3`` module (`#3187 `__) + + +web3.py v6.13.0 (2023-12-20) +---------------------------- + +Features +~~~~~~~~ + +- Implement async ``eth_createAccessList`` RPC method to create an EIP-2930 access list. (`#3167 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Add flaky async Geth integration tests to CI (`#3170 `__) +- Fix wrong test reference for ``EthereumTesterProvider`` integration test suite. (`#3171 `__) +- Small fix for integration tests for ``tox`` to recognize independent patterns for each test run. (`#3173 `__) + + +web3.py v6.12.0 (2023-12-11) +---------------------------- + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Make downloadable versions of docs available in ``pdf``, ``htmlzip``, and ``epub`` formats (`#3153 `__) +- Add 2023 user survey fine art banner in the docs (`#3159 `__) +- Polish the community resources docs page (`#3162 `__) + + +Features +~~~~~~~~ + +- Implement ``createAccessList`` RPC endpoint to create an EIP-2930 access list. (`#2381 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Run flaky eth-tester tests on CI (`#3157 `__) +- Pin ``pytest-asyncio`` dependency to <0.23 (`#3160 `__) + + +web3.py v6.11.4 (2023-11-27) +---------------------------- + +Bugfixes +~~~~~~~~ + +- Fix collision of ``w3`` variable when initializing contract with function of the same name (`#3147 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3148 `__ + + +web3.py v6.11.3 (2023-11-08) +---------------------------- + +Bugfixes +~~~~~~~~ + +- When coming back through the middleware onion after a request is made, we have the response ``id``. Use it to match to the cached request information and process the response accordingly. (`#3140 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Adds Discord bot template repo to Resources page (`#3143 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Additional contract ``abi`` documentation to make it a clear requirement for contract instances. (`#2539 `__) +- Fix type annotations for ``web3`` constants. (`#3138 `__) +- Add upper pin to deprecated dependency ``lru-dict`` whose new minor version release introduced a typing issue with CI lint builds. (`#3144 `__) +- Recompile test contracts with new Solidity version ``v0.8.23`` to ensure compatibility. (`#3146 `__) + + +web3.py v6.11.2 (2023-10-30) +---------------------------- + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix formatting in documentation for creating an account. (`#3128 `__) +- Fix broken links for Apeworx and Sepolia faucet (`#3130 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Speed up the core test suite by splitting up sync and async tests. This reduces the CI build times to ~8min from ~12min. (`#3111 `__) +- Re-compile test contracts with Solidity ``v0.8.22`` to ensure compatibility with this latest Solidity version. (`#3134 `__) +- Improvements on yielding to the event loop while searching in response caches and calling ``recv()`` on the websocket connection for ``WebSocketProviderV2``. (`#3135 `__) + + +web3.py v6.11.1 (2023-10-18) +---------------------------- + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update ``WebsocketProviderV2`` documentation. Document a general overview of the ``RequestProcessor`` class and its internal caches. (`#3125 `__) + + +Features +~~~~~~~~ + +- Properly define an ``__await__()`` method on the ``_PersistentConnectionWeb3`` class so a persistent connection may be initialized using the ``await`` pattern. Integration tests added for initializing the persistent connection using the ``await`` pattern. (`#3125 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Updates and refactoring for the ``WebsocketProviderV2`` class and its internal supporting classes and logic. Separation of one-to-one and one-to-many request responses. Storing of one-to-many responses in a ``deque`` and one-to-one responses in a ``SimpleCache`` class. Provide an async lock around the websocket ``recv()``. (`#3125 `__) +- Add upper pin to ``hexbytes`` dependency to due incoming breaking change (`#3127 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#3114 `__, `#3129 `__ + + +web3.py v6.11.0 (2023-10-11) +---------------------------- + +Breaking Changes (to Beta APIs) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Refactor the async iterator pattern for message streams from the websocket connection for ``WebsocketProviderV2`` to a proper async iterator. This allows for a more natural usage of the iterator pattern and mimics the behavior of the underlying ``websockets`` library. (`#3116 `__) + + +Bugfixes +~~~~~~~~ + +- Use hashes to compare equality of two ``AttributeDict`` classes (`#3104 `__) +- Fix issues with formatting middleware, such as ``async_geth_poa_middleware`` and subscription responses for ``WebsocketProviderV2``. (`#3116 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Change ``docker-compose`` to ``docker compose`` in the Contributing docs examples. (`#3107 `__) +- Updates to the ``WebsocketProviderV2`` documentation async iterator example for iterating over a persistent stream of messages from the websocket connection via ``async for``. (`#3116 `__) +- Update outdated node and private key management verbiage. (`#3117 `__) + + +Features +~~~~~~~~ + +- Allow passing in a ``float`` for a ``request_timeout`` for requests for the ``Beacon`` class. Update some Beacon API endpoints (sync and async). (`#3106 `__) +- Add ``allow_list`` kwarg for ``exception_retry_middleware`` to allow for a custom list of RPC endpoints. Add a sleep between retries and a customizable ``backoff_factor`` to control the sleep time between retry attempts. (`#3120 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Refactor logic for the ``input_munger()`` method on the ``Method`` class. (`#2987 `__) +- Pin mypy to v1.4.1, the last to support py37 (`#3122 `__) + + +web3.py v6.10.0 (2023-09-21) +---------------------------- + +Breaking Changes (to Beta APIs) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Breaking change to the API for interacting with a persistent websocket connection via ``AsyncWeb3`` and ``WebsocketProviderV2``. This change internalizes the ``provider.ws`` property and opts for a ``w3.ws`` API achieved via a new ``WebsocketConnection`` class. With these changes, ``eth_subscription`` messages now return the subscription id as the ``subscription`` param and the formatted message as the ``result`` param. (`#3096 `__) + + +Bugfixes +~~~~~~~~ + +- Return `w3.eth.gas_price` when calculating time based gas price strategy for an empty chain. (`#1149 `__) +- Update `LogReceipt` and `TxReceipt` declarations. Remove `LogReceipt`'s `payload` and `topic` attributes. Refactor `LogEntry` to `LogReceipt`. (`#3043 `__) +- Fixes ``AsyncEth.max_priority_fee_per_gas``. It wasn't falling back to ``eth_feeHistory`` since the ``MethodUnavailable`` error was introduced. (`#3084 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update ``WebsocketProviderV2`` documentation to reflect the new public websocket API via the ``WebsocketConnection`` class. (`#3096 `__) + + +Features +~~~~~~~~ + +- Improved error messaging for exceptions from malformed JSON-RPC responses. (`#3053 `__) +- Enable filtering by non-indexed arguments for contract event ``get_logs()``. (`#3078 `__) +- Add ``eth_maxPriorityFeePerGas`` to ``exception_retry_middleware`` whitelist (`#3090 `__) +- Sync responses for ``WebsocketProviderV2`` open connections with requests via matching RPC ``id`` values. (`#3096 `__) +- Properly JSON encode ``AttributeDict``, ``bytes``, and ``HexBytes`` when sending a JSON-RPC request by utilizing the in-house ``Web3JsonEncoder`` class. (`#3101 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Fix an issue with an IPC test present only on MacOSX. (`#929 `__) +- Ignore flake8 rule F401 (unused import) in all ``__init__.py`` files (`#3097 `__) + + +web3.py v6.9.0 (2023-08-23) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Fix the type for ``input`` in ``TxData`` from ``HexStr`` -> ``HexBytes``. (`#3074 `__) +- Fix an issue with ``WebsocketProviderV2`` when responses to a request aren't found in the cache (``None`` values). (`#3075 `__) +- Re-expose some websockets constants found in ``web3.providers.websocket.websocket`` via ``web3.providers.websocket``. (`#3076 `__) +- Return ``NotImplemented`` constant, rather than raising ``NotImplementedError`` for ``NamedElementOnion.__add__()``, based on Python standards. (`#3080 `__) +- Only release ``async_lock`` if it's locked to begin with. (`#3083 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add MEV blocking tutorial to Resources docs page (`#3072 `__) +- Fix documentation around current state of ``get_logs()`` usage and arguments. (`#3073 `__) +- Add an Ape hackathon kit to Resources documentation page (`#3082 `__) + + +web3.py v6.8.0 (2023-08-02) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Fix the type for the optional param asking for "full transactions" when subscribing to ``newPendingTransactions`` via ``eth_subscribe`` to ``bool``. (`#3067 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Change docs to reflect AsyncHTTPProvider does accept ENS names now (`#3070 `__) + + +Features +~~~~~~~~ + +- Return structured JSON-RPC errors for missing or unimplemented eth-tester methods. (`#3061 `__) +- ENS name-to-address support for ``eth_subscribe``. (`#3066 `__) +- Asynchronous iterator support for ``AsyncWeb3`` with ``WebsocketProviderV2`` using ``async for`` syntax. (`#3067 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Minor fixes to type hinting in the core tests setup fixtures. (`#3069 `__) + + +web3.py v6.7.0 (2023-07-26) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Test wheel build in separate directory and virtualenv (`#3046 `__) +- Handle case where data gets returned as ``None`` in a JSON-RPC error response (`#3054 `__) +- Fixed default windows IPC provider path to work with python 3.11 (`#3058 `__) +- Fix return type for ``rpc_gas_price_strategy`` to ``int`` but also only convert the ``strategy_based_gas_price`` to ``hex`` if it is an ``int`` in the ``gas_price_strategy_middleware``. (`#3065 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add note to Release Notes about v5 end-of-life and v6.6.0 yank (`#3045 `__) +- Add documentation for ``WebsocketProviderV2`` (beta). (`#3048 `__) + + +Features +~~~~~~~~ + +- Add ENSIP-9 (Multichain Address Resolution) support for ``address()`` and ``setup_address()`` for ``ENS`` and ``AsyncENS`` classes. (`#3030 `__) +- Support for ``eth_subscribe`` and ``eth_unsubscribe`` methods has been added with the introduction of a new websocket provider, ``WebsocketProviderV2``. (`#3048 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Added recursive typing to ``ABIFunctionComponents`` type (`#3063 `__) +- Upgrade eth-tester requirement to v0.9.0-b.1 (`#3064 `__) + + +web3.py v6.6.1 (2023-07-12) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Add ``ens/specs`` to MANIFEST.in (`#3039 `__) + + +web3.py v6.6.0 (2023-07-12) +--------------------------- + +**Note: This release was missing the required ``ens/specs`` directory, so it was yanked +from Pypi in favor of v6.6.1** + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- ENS name normalization now uses ENSIP-15 by default. This is technically a breaking change introduced by ENS but, according to ENSIP-15, 99% of existing names should be unaffected. (`#3024 `__) + + +Bugfixes +~~~~~~~~ + +- Handle ``None`` in the formatting middleware (`#2546 `__) +- Fix for a possible bug in ``construct_sign_and_send_raw_middleware`` where the signed transaction was sent as bytes and expected to be converted to hex by formatting later on. It is now explicitly sent as the hex string hash within the middleware. (`#2936 `__) +- Fixes ``max_priority_fee_per_gas``. It wasn't falling back to ``eth_feeHistory`` since the ``MethodUnavailable`` error was introduced. (`#3002 `__) +- Properly initialize logger in ``AsyncHTTPProvider``. (`#3026 `__) +- Fix ``AsyncWeb3.solidity_keccak`` to match ``Web3.solidity_keccak``. (`#3034 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Replaced transaction examples with unused account addresses. (`#2011 `__) +- Removed obsolete docs for camelCase miner methods and ``deploy`` (`#2039 `__) +- Update documentation relating to ENS only being available on mainnet. ENS is available on all networks where the ENS contracts are deployed. (`#3012 `__) +- Add first steps section and tidy up learning resources (`#3013 `__) +- Replace references to ``jasoncarver.eth`` with ``ens.eth``. (`#3020 `__) +- Adds "Hackathon Helpers" section to Resources page (`#3035 `__) + + +Features +~~~~~~~~ + +- Update ENS Resolver ABI (`#1839 `__) +- ``async_http_retry_request_middleware``, an async http request retry middleware for ``AsyncHTTPProvider``. (`#3009 `__) +- Add ``eth_getStorageAt()`` support for ``EthereumTesterProvider``. (`#3011 `__) +- Add async support for ENS name-to-address resolution via ``async_name_to_address_middleware``. (`#3012 `__) +- Add async support for the sign-and-send raw transaction middleware via ``construct_async_sign_and_send_raw_middleware()``. (`#3025 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Remove some warnings from test output (`#2991 `__) +- Introduced the logic for ENSIP-15 ENS name normalization. Originally this was done via a flag in this PR but changed to the default behavior in #3024 before release. (`#3000 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2997 `__, `#3011 `__, `#3023 `__, `#3037 `__ + + +Removals +~~~~~~~~ + +- Removed references to deprecated middlewares with new tests to check default middlewares (`#2972 `__) + + +web3.py v6.5.0 (2023-06-15) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Properly create a fresh cache for each instance of ``simple_cache_middleware`` if no cache is provided. Fixes a bug when using this middleware with multiple instances of ``Web3``. (`#2979 `__) +- Fix potential race condition when writing cache entries in ``simple_cache_middleware`` (`#2981 `__) +- Catch ``UnicodeDecodeError`` for contract revert messages that cannot be decoded and issue a warning instead, raising a ``ContractLogicError`` with the raw ``data`` from the response. (`#2989 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Introduces resources page to documentation (`#2957 `__) +- Completed docstrings for ``ContractFunction`` and ``AsyncContractFunction`` classes (`#2960 `__) +- Added 'unsupported by any current clients' note to the ``Eth.sign_typed_data`` docs (`#2961 `__) +- Removed list of ``AsyncHTTPProvider``-supported methods, it supports them all now (`#2962 `__) +- Modernize the filtering guide, emphasizing ``get_logs`` (`#2968 `__) +- Removed references to defunct providers in ``IPCProvider`` docs (`#2971 `__) +- Update Matomo analytics script to move to cloud services (`#2978 `__) + + +Features +~~~~~~~~ + +- Add the ``sign_typed_data`` method to the ``AsyncEth`` class (`#2920 `__) +- Add support for Solidity ``Panic`` errors, available since Solidity 0.8.0. Raises ``ContractPanicError`` with appropriate messaging based on the known panic error codes. (`#2986 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- ``lint-roll`` - dropped ``isort`` ``--recursive`` flag, not needed as of their ``v5``, added black (`#2930 `__) +- Moved ``ethpm`` deprecation warning to only show when the module is explicitly enabled (`#2983 `__) +- Update make release to check remote upstream is pointing to ethereum/web3.py. (`#2988 `__) +- Removed `pluggy` from dev requirements (`#2992 `__) + + +Miscellaneous Changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2960 `__, `#2965 `__ + + +web3.py v6.4.0 (2023-05-15) +--------------------------- + +Bugfixes +~~~~~~~~ + +- fix AttributeDicts unhashable if they contain lists recursively tupleizing them (`#2908 `__) + + +Deprecations +~~~~~~~~~~~~ + +- add deprecation notice for the `ethPM` module (`#2953 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- remove reference to the ability to specify a list of providers - you can't anymore (`#2949 `__) +- add deprecation notice for the `ethPM` module (`#2953 `__) + + +Features +~~~~~~~~ + +- Update ``eth-tester`` to pull in Shanghai changes and make additional changes to fully support Shanghai with ``eth-tester``. (`#2958 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- bump sphinx and readthedocs py versions (`#2945 `__) +- re-compile test contracts with Solidity ``v0.8.20`` (`#2951 `__) +- Set towncrier settings in `pyproject.toml` to match the python project template and change newfragment type "doc" to "docs" (`#2959 `__) + + +v6.3.0 (2023-05-03) +------------------- + +Features +~~~~~~~~ + +- Add support for custom revert errors (`#2795 `__) +- Add the ``modify_transaction`` method to the ``AsyncEth`` class (`#2825 `__) +- add show_traceback flag to is_connected to allow user to see connection error reason (`#2912 `__) +- Add a ``data`` attribute on the ``ContractLogicError`` class that returns raw data returned by the node. (`#2922 `__) +- Add support via result formatters for ``reward`` type trace actions on tracing calls. (`#2929 `__) + + +Bugfixes +~~~~~~~~ + +- Typing was being ignored for the ``get_ipc_path`` and ``get_dev_ipc_path`` functions because of a missing ``None`` return. Those two methods now explicitly return ``None`` and have an ``Optional`` in their type definition. (`#2917 `__) +- fix AsyncEventFilterBuilder looking for Web3 instead of AsyncWeb3 (`#2931 `__) +- Add check for null withdrawal field on get_block response (`#2941 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add a decision tree guide for sending transactions (`#2919 `__) +- Update references to master branch (`#2933 `__) +- Cleanup Quickstart guide and next steps (`#2935 `__) +- Cleanup Overview page links and context (`#2938 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Added ``build`` to towncrier commands in Makefile (`#2915 `__) +- Update win wheel CI builds to use ``python -m tox -r`` instead of specifying the ``tox`` executable directly. (`#2923 `__) +- update pip and tox install on CI containers (`#2927 `__) + + +v6.2.0 (2023-04-12) +------------------- + +Features +~~~~~~~~ + +- Adds async version of `eth_getUncleCount` methods (`#2822 `__) +- Add the ``sign_transaction`` method to the ``AsyncEth`` class (`#2827 `__) +- Add the ``replace_transaction`` method to the ``AsyncEth`` class (`#2847 `__) + + +Bugfixes +~~~~~~~~ + +- Use ``TraceFilterParams`` instead of ``FilterParams`` for ``trace_filter`` typing (`#2913 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add welcome banner for Ethereum newcomers (`#2905 `__) +- Added breaking changes from pr2448 to v6 migration guide (`#2907 `__) + + +v6.1.0 (2023-04-05) +------------------- + +Features +~~~~~~~~ + +- Add tracing functionality back in via the ``tracing`` module, add formatters for human-readable input and output, and attach this module to ``Web3`` on init / make it a default module. (`#2851 `__) +- Add result formatters for ``withdrawals_root`` and ``withdrawals`` as part of ``Shanghai`` hard fork support. (`#2868 `__) +- add eth_chainId to exception_retry_middleware whitelist (`#2892 `__) + + +Bugfixes +~~~~~~~~ + +- Mark `test_async_eth_sign` with `@pytest.mark.asyncio` (`#2858 `__) +- fix readthedocs broken version selector (`#2883 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- remove camelCased method deprecation notices from web3.eth docs (`#2882 `__) +- Add doc blurb about multiple HTTPProviders with the same URL (`#2889 `__) +- fix styling and external link formatting (`#2897 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Bump pytest from 6.2.5 to 7+ because of CI ``DeprecationWarning`` (`#2863 `__) +- Require eth-abi v4 stable (`#2886 `__) +- remove unused docs dependencies and bump version of remaining (`#2890 `__) +- Update go-ethereum integration test fixture to use the latest version of geth - ``v1.11.5``. (`#2896 `__) +- Update ``geth_steps`` in CircleCI builds to pip install the proper version of ``py-geth``. (`#2898 `__) +- Update CircleCI windows orb path since it now uses python 3.11. (`#2899 `__) +- Bump go version used in CI jobs that install and run go-ethereum and parameterize the version in circleci config file for ease of configuration. (`#2900 `__) + + +Miscellaneous changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2887 `__ + + +v6.0.0 (2023-03-14) +------------------- + +Bugfixes +~~~~~~~~ + +- fix dict_to_namedtuple unable to handle empty dict as input (`#2867 + `__) + + +v6.0.0-beta.11 (2023-02-24) +--------------------------- + +Features +~~~~~~~~ + +- Add the ``sign`` method to the ``AsyncEth`` class (`#2833 + `__) + + +Bugfixes +~~~~~~~~ + +- More accurately define the ``eth_call`` return type as ``HexBytes`` since the + response is converted to ``HexBytes`` in the pythonic formatters and there + are differences between ``HexBytes`` and ``bytes`` types. (`#2842 + `__) +- Set default block_identifier in ContractFunction.call() to None (`#2846 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Remove unused module lines to instantiate the AsyncHTTPProvider (`#2789 + `__) +- Typos fix in docs (`#2817 + `__) +- Add/cleanup docs for the ``AsyncHTTPProvider`` in light of the new + ``AsyncWeb3`` class (`#2821 + `__) +- Remove user survey banner following close of survey (`#2831 + `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Do not invoke ``setup.py`` directly; use ``python -m build`` where + appropriate. (`#2714 `__) +- clean up ignored unused imports (`#2838 + `__) +- Recompile test contracts with the new Solidity version ``0.8.19``. (`#2840 + `__) +- Update ``py-geth`` version and re-generate integration test fixture with geth + ``v1.11.2``. (`#2841 `__) + + +Breaking changes +~~~~~~~~~~~~~~~~ + +- Use ``AsyncWeb3`` class and preserve typing for the async api calls. (`#2819 + `__) +- Fix typing for ``CallOverrideParams`` and add proper request formatters for + call state overrides. (`#2843 + `__) +- Remove python warning and doc notes related to unstable async providers. + (`#2845 `__) + + +v6.0.0-beta.10 (2023-02-15) +--------------------------- + +Features +~~~~~~~~ + +- add decode_tuples option to contract instantiation (`#2799 + `__) + + +Bugfixes +~~~~~~~~ + +- Fix ``ethpm`` import issues after making ``ipfshttpclient`` optional. (`#2775 + `__) +- Fix for recently-broken ``eth-tester`` exception message parsing for some + exception cases. (`#2783 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Added a v6 Migraion Guide (`#2778 + `__) +- Rebrand the library to lowercase "web3.py" (`#2804 + `__) +- remove references to Rinkeby or replace with Goerli (`#2815 + `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Organize the ``eth`` module into separate files for better readability. + (`#2753 `__) +- Rename the newly-split ``eth`` module files to match convention. (`#2772 + `__) +- Re-compile all test contracts with latest Solidity version. Refactor test + fixtures. Adds a script that compiles all test contracts to the same + directory with selected Solidity version. (`#2797 + `__) +- Updates to ``isort`` and ``black`` required some formatting changes and isort + config refactoring. (`#2802 + `__) +- Compile test contracts using newly-released Solidity version ``0.8.18``. + (`#2803 `__) + + +Breaking changes +~~~~~~~~~~~~~~~~ + +- All exceptions inherit from a custom class. EthPM exceptions inherit from + EthPMException, ENS exceptions inherit from ENSException, and all other + web3.py exceptions inherit from Web3Exception (`#1478 + `__) +- Reorganized contract to contract.py, async_contract.py, base_contract.py and + utils.py. In this change there was a small breaking change where the + constructor of BaseContractCaller contract_function_class was defaulting to a + ContractFunction now there is no default. This was done to separate the base + class from the implementation. (`#2567 + `__) +- When calling a contract, use ``w3.eth.default_block`` if no block_identifier + is specified instead of ``latest``. (`#2777 + `__) +- Strict bytes type checking is now default for ``web3.py``. This change also + adds a boolean flag on the ``Web3`` class for turning this feature on and + off, as well as a flag on the ``ENS`` class for control over a standalone + ``ENS`` instance. (`#2788 + `__) +- When a method is not supported by a node provider, raise a MethodUnavailable + error instead of the generic ValueError. (`#2796 + `__) +- ``dict`` to ``AttributeDict`` conversion is no longer a default result + formatter. This conversion is now done via a default middleware that may be + removed. (`#2805 `__) +- Removed deprecated ``manager.request_async`` and associated methods. (`#2810 + `__) +- removed Rinkeby from list of allowed chains in EthPM (`#2815 + `__) + + +v6.0.0-beta.9 (2023-01-03) +-------------------------- + +Features +~~~~~~~~ + +- Add async ``w3.eth.get_block_transaction_count`` (`#2687 + `__) +- Support Python 3.11 (`#2699 + `__) +- Load the ``AsyncHTTPProvider`` with default async middleware and default + async modules, just as the ``HTTPProvider``. (`#2736 + `__) +- Add support for Nethermind/Gnosis revert reason formatting (`#2739 + `__) +- Added async functionality to filter (`#2744 + `__) +- Get contract address from ``CREATE`` and ``CREATE2`` opcodes (`#2762 + `__) + + +Bugfixes +~~~~~~~~ + +- Fixing abi encoding for multidimensional arrays. (`#2764 + `__) + + +Performance improvements +~~~~~~~~~~~~~~~~~~~~~~~~ + +- Some minor performance improvements to the ``SimpleCache`` class and simple + cache middlewares (sync and async). (`#2719 + `__) +- Remove unnecessary ``await`` for ``generate_gas_price()`` method as it does + not need to be awaited. Move this method to ``BaseEth`` to be used directly + by both ``Eth`` and ``AsyncEth`` modules. (`#2735 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add user survey to docs banner (`#2720 + `__) +- Document improvements for private key info and account funding. (`#2722 + `__) +- Include eth-tester install note in quickstart (`#2755 + `__) + + +Deprecations and Removals +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Removal of Infura auto provider support. (`#2706 + `__) +- Removal of ``version`` module. (`#2729 + `__) +- Remove already-deprecated ``start_rpc`` and ``stop_rpc`` from the + ``w3.geth.admin`` module. (`#2731 + `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Use regex pattern for ``black`` command for ``tox`` / ``make lint`` linting + commands. (`#2727 `__) +- Use regex pattern for ``mypy`` command for ``tox`` / ``make lint`` linting + commands. (`#2734 `__) +- Remove internal method ``apply_formatter_to_array`` and use the method with + the same name from the ``eth-utils`` library. (`#2737 + `__) + + +Miscellaneous changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2751 `__ + + +Breaking changes +~~~~~~~~~~~~~~~~ + +- Snakecase the processReceipt, processLog, createFilter, and getLogs methods + (`#2709 `__) +- Remove Parity module and references. (`#2718 + `__) +- Make the ``ipfshttpclient`` library opt-in via a web3 install extra. This + only affects the ``ethpm`` ``ipfs`` backends, which rely on the library. + (`#2730 `__) + + +v6.0.0-beta.8 (2022-11-14) +-------------------------- + +Features +~~~~~~~~ + +- Async support for caching certain methods via + ``async_simple_cache_middleware`` as well as constructing custom async + caching middleware via ``async_construct_simple_cache_middleware``. + ``SimpleCache`` class was also added to the public ``utils`` module. (`#2579 + `__) +- Remove upper pins on dependencies (`#2648 + `__) +- Async support for beacon api. (`#2689 + `__) +- If the loop for a cached async session is closed, or the session itself was + closed, create a new session at that cache key and properly close and evict + the stale session. (`#2713 + `__) + + +Bugfixes +~~~~~~~~ + +- bump `sphinx_rtd_theme` version to fix missing unordered list bullets (`#2688 + `__) +- Fix bug to generate unique cache keys when multi-threading & with unique + event loops for async. (`#2690 + `__) +- Properly release ``async_lock`` for session requests if an exception is + raised during a task. (`#2695 + `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- move definition of RTD install requirements file from their dashboard into + `.readthedocs.yml`, and remove unused `sphinx-better-theme` from requirements + (`#2688 `__) + + +Miscellaneous changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2690 `__, `#2694 + `__ + + +Breaking changes +~~~~~~~~~~~~~~~~ + +- Remove support for dictionary-based caches, for simple-cache-middleware, in + favor of the internal ``SimpleCache`` class. (`#2579 + `__) +- Snakecase the clientVersion method (`#2686 + `__) +- change instances of `createFilter` to `create_filter` (`#2692 + `__) +- Remove ``SolidityError`` in favor of ``ContractLogicError`` (`#2697 + `__) +- Snakecase the solidityKeccak method (`#2702 + `__) +- Snakecase the fromWeb3 method (`#2703 + `__) +- Snakecase the toBytes, toHex, toInt, toJSON, and toText methods (`#2707 + `__) +- Snakecase the toAddress, isChecksumAddress, and toChecksumAddress methods + (`#2708 `__) + + +v6.0.0-beta.7 (2022-10-19) +-------------------------- + +Bugfixes +~~~~~~~~ + +- Protobuf dependency had a DoS-able bug. It was fixed in v4.21.6. See: + https://nvd.nist.gov/vuln/detail/CVE-2022-1941 (`#2666 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Added Chainstack link to quickstart docs. (`#2677 + `__) + + +Deprecations and Removals +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Remove Ropsten auto provider and the relevant references to Ropsten across + the repo (`#2672 `__) + + +Internal Changes - for web3.py Contributors +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Clean up remaining uses of deprecated ``eth_abi`` methods. (`#2668 + `__) + + +Miscellaneous changes +~~~~~~~~~~~~~~~~~~~~~ + +- `#2671 `__, `#2682 + `__ + + +v6.0.0-beta.6 (2022-09-26) +-------------------------- + +Bugfixes +~~~~~~~~ + +- Protobuf dependency breaks at version ``3.20.2`` and above; pin to ``3.20.1`` + for now. (`#2657 `__) + + +Features +~~~~~~~~ + +- Add new predefined block identifiers ``safe`` and ``finalized``. (`#2652 + `__) + + +v6.0.0-beta.5 (2022-09-19) +-------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Removed IBAN since it was an unused feature (`#2537 + `__) +- Update eth-tester dependency to v0.7.0-beta.1; Update eth-account version to + >=0.7.0,<0.8.0 (`#2623 `__) +- Remove ``WEB3_INFURA_API_KEY`` environment variable in favor of + ``WEB3_INFURA_PROJECT_ID``. Change ``InfuraKeyNotFound`` exception to + ``InfuraProjectIdNotFound`` (`#2634 + `__) +- Remove Kovan auto provider (`#2635 + `__) +- Snakecase the `isConnected` method (`#2643 + `__) +- Snakecase the ``toWei`` and ``fromWei`` methods (`#2647 + `__) + + +Bugfixes +~~~~~~~~ + +- Fix ``eth-tester`` key remapping for ``logsBloom`` and ``receiptsRoot`` + (`#1630 `__) +- Improve upon issues with session caching - better support for multithreading + and make sure session eviction from cache does not happen prematurely. + (`#2409 `__) +- Allow classes to inherit from the ``Web3`` class by attaching modules + appropriately. (`#2592 `__) +- fixed bug in how async_eth_tester_middleware fills default fields (`#2600 + `__) +- Allow hex for ``value`` field when validating via ``validate_payable()`` + contracts method (`#2602 + `__) +- Update Beacon API to v2.3.0 (`#2616 + `__) +- Move ``flaky`` option to top-level conftest.py (`#2642 + `__) + + +Documentation Updates +~~~~~~~~~~~~~~~~~~~~~ + +- Update Proof of Authority middleware (`geth_poa_middleware`) documentation + for better clarity. (`#2538 + `__) +- Add some missing supported async middlewares to docs. (`#2574 + `__) +- Introduce AsyncENS and availability on w3 instance in ENS guide. (`#2585 + `__) +- Fix typo in eth.call docs (`#2613 + `__) +- remove section for deleted `account.recoverHash` method (`#2615 + `__) +- examples docs gave incorrect return type for `eth.get_transaction`, fixed + (`#2617 `__) +- minor typo fix in contracts overview (`#2628 + `__) +- fix bug in `Deploying new contracts` example (`#2646 + `__) + + +Features +~~~~~~~~ + +- Support for ``Account`` class access in ``AsyncEth`` via + ``async_w3.eth.account`` (`#2580 + `__) +- Expose public abi utility methods: ``get_abi_output_names()`` and + ``get_abi_input_names()`` (`#2596 + `__) +- update all references to deprecated `eth_abi.encode_abi` to `eth_abi.encode` + (`#2621 `__) +- update all references to deprecated `eth_abi.decode_abi` to `eth_abi.decode` + (`#2636 `__) +- Add Sepolia auto provider (`#2639 + `__) + + +Misc +~~~~ + +- `#2603 `__, `#2622 + `__, `#2630 + `__, `#2638 + `__ + + +v6.0.0-beta.4 (2022-07-13) +-------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- sha3 and soliditySha3 were previously deprecated and now removed (`#2479 + `__) +- Remove deprecated methods from Geth, Parity and Net modules (`#2480 + `__) +- Provide better messaging to wrong arguments for contract functions, + especially for ``tuple`` argument types. (`#2556 + `__) + + +Bugfixes +~~~~~~~~ + +- Properly format ``block_number`` for ``eth_getTransactionCount`` when using + ``EthereumTesterProvider`` (`#1801 + `__) +- removed `Optional` type hints for `passphrase` arguments that aren't actually + optional (`#2511 `__) +- Fix `is_dynamic_fee_transaction` and `TRANSACTION_DEFAULTS` when + `gas_price_strategy` returns zero (`#2562 + `__) + + +Documentation Updates +~~~~~~~~~~~~~~~~~~~~~ + +- Remove deprecated methods from Geth, Parity, and Net modules (`#2480 + `__) +- replace double- with single-quotes to make f-string valid (`#2504 + `__) +- added geth personal_sign and personal_ec_recover documentation (`#2511 + `__) + + +Features +~~~~~~~~ + +- Add transaction result formatters for `type` and `chainId` to convert values + to ``int`` if ``hexadecimal`` if the field is not null (`#2491 + `__) +- Add a global flag on the provider for enabling / disabling CCIP Read for + calls: ``global_ccip_read_enabled`` (defaults to ``True``). (`#2499 + `__) +- Deprecate Geth Admin StartRPC and StopRPC for StartHTTP and StopHTTP (`#2507 + `__) +- Added Async support for ENS (`#2547 + `__) +- support multi-dimensional arrays for ABI tuples types (`#2555 + `__) + + +Misc +~~~~ + +- `#2345 `__, `#2483 + `__, `#2505 + `__, `#2513 + `__, `#2514 + `__, `#2515 + `__, `#2516 + `__, `#2518 + `__, `#2520 + `__, `#2521 + `__, `#2522 + `__, `#2523 + `__, `#2524 + `__, `#2525 + `__, `#2527 + `__, `#2530 + `__, `#2531 + `__, `#2534 + `__, `#2542 + `__, `#2544 + `__, `#2550 + `__, `#2551 + `__, `#2559 + `__ + + +v6.0.0-beta.3 (2022-06-01) +-------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Removed deprecated methods from eth and geth (`#1416 + `__) + + +Bugfixes +~~~~~~~~ + +- Fix bug in _is_latest_block_number_request in cache middleware (`#2185 + `__) +- Increase cache size to allow for 20 entries. (`#2477 + `__) +- format receipt.type to int and log.data to HexBytes (`#2482 + `__) +- Only thread lock for methods attempting to access the cache for caching + middleware. (`#2496 `__) + + +Documentation Updates +~~~~~~~~~~~~~~~~~~~~~ + +- Fix typo in simple_cache_middleware example (`#2449 + `__) +- Fix dict type hints in EventScanner example (`#2469 + `__) +- Add clarification around ValueError and Local Signing middleware (`#2474 + `__) + + +Features +~~~~~~~~ + +- Add async version of contract functionality (`#2270 + `__) +- ENSIP-10 / wildcard resolution support for ENS module (`#2411 + `__) +- CCIP Read support and finalize implementation of and add tests for ENS + offchain resolution support (`#2457 + `__) + + +Misc +~~~~ + +- `#2454 `__, `#2450 + `__, `#2462 + `__, `#2471 + `__, `#2478 + `__ + + +v6.0.0-beta.2 (2022-04-27) +-------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Audit ``.rst`` and ``.py`` files and convert all Web3 instance variable names + to ``w3`` to avoid confusion with the ``web3`` module. (`#1183 + `__) +- Update dependency requirements: - eth-utils - eth-abi - eth-tester - + eth-account - eth-typing (`#2342 + `__) +- Add ``attach_methods()`` to ``Module`` class to facilitate attaching methods + to modules. (`#2383 `__) +- Move IOError -> OSError (`#2434 + `__) + + +Documentation Updates +~~~~~~~~~~~~~~~~~~~~~ + +- Clarify info about Infura filters over HTTP (`#2322 + `__) +- Document reading private keys from environment variables (`#2380 + `__) +- Add example for the ``construct_sign_and_send_raw_middleware`` when connected + to a hosted node (`#2410 + `__) +- Doc fix: Pending transaction filter returns a ``TransactionFilter`` not a + ``BlockFilter`` (`#2444 `__) + + +Features +~~~~~~~~ + +- Add 'get_text' method to look up ENS text record values (`#2286 + `__) +- For ``ENS.name()``, validate that the forward resolution returns the same + address as provided by the user as per the ENS documentation recommendation + for Reverse Resolution. (`#2420 + `__) +- Add sync chain_id to ``simple_middleware_cache`` (`#2425 + `__) + + +Misc +~~~~ + +- `#2369 `__, `#2372 + `__, `#2418 + `__ + + +v6.0.0-beta.1 (2022-02-28) +-------------------------- + +Breaking Changes +~~~~~~~~~~~~~~~~ + +- Update ``websockets`` dependency to v10+ (`#2324 + `__) +- Remove support for the unsupported Python 3.6 Also removes outdated Parity + tests (`#2343 `__) +- Update Sphinx requirement to ``>=4.2.0,<5`` (`#2362 + `__) + + +Bugfixes +~~~~~~~~ + +- Fix types for ``gas``, and ``gasLimit``: ``Wei -> int``. Also fix types for + ``effectiveGasPrice``: (``int -> Wei``) (`#2330 + `__) + + +Features +~~~~~~~~ + +- Added session caching to the AsyncHTTPProvider (`#2016 + `__) +- Add support for Python 3.10 (`#2175 + `__) +- Added 'Breaking Changes' and 'Deprecations' categories to our release notes + (`#2340 `__) +- Add async `eth.get_storage_at` method (`#2350 + `__) +- Upgrade ``jsonschema`` version to ``>=4.0.0<5`` (`#2361 + `__) + + +Misc +~~~~ + +- `#2353 `__, `#2365 + `__ + + +v5.28.0 (2022-02-09) +-------------------- + +Features +~~~~~~~~ + +- Added Async functions for Geth Personal and Admin modules (`#1413 + `__) +- async support for formatting, validation, and geth poa middlewares (`#2098 + `__) +- Calculate a default ``maxPriorityFeePerGas`` using ``eth_feeHistory`` when + ``eth_maxPriorityFeePerGas`` is not available, since the latter is not a part + of the Ethereum JSON-RPC specs and only supported by certain clients. (`#2259 + `__) +- Allow NamedTuples in ABI inputs (`#2312 + `__) +- Add async `eth.syncing` method (`#2331 + `__) + + +Bugfixes +~~~~~~~~ + +- remove `ens.utils.dict_copy` decorator (`#1423 + `__) +- The exception retry middleware whitelist was missing a comma between + ``txpool`` and ``testing`` (`#2327 + `__) +- Properly initialize external modules that do not inherit from the + ``web3.module.Module`` class (`#2328 + `__) + + +v5.27.0 (2022-01-31) +-------------------- + +Features +~~~~~~~~ + +- Added Async functions for Geth TxPool (`#1413 + `__) +- external modules are no longer required to inherit from the + ``web3.module.Module`` class (`#2304 + `__) +- Add async `eth.get_logs` method (`#2310 + `__) +- add Async access to `default_account` and `default_block` (`#2315 + `__) +- Update eth-tester and eth-account dependencies to pull in bugfix from + eth-keys (`#2320 `__) + + +Bugfixes +~~~~~~~~ + +- Fixed issues with parsing tuples and nested tuples in event logs (`#2211 + `__) +- In ENS the contract function to resolve an ENS address was being called twice + in error. One of those calls was removed. (`#2318 + `__) +- ``to_hexbytes`` block formatters no longer throw when value is ``None`` + (`#2321 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- fix typo in `eth.account` docs (`#2111 + `__) +- explicitly add `output_values` to contracts example (`#2293 + `__) +- update imports for `AsyncHTTPProvider` sample code (`#2302 + `__) +- fixed broken link to filter schema (`#2303 + `__) +- add github link to the main docs landing page (`#2313 + `__) +- fix typos and update referenced `geth` version (`#2326 + `__) + + +Misc +~~~~ + +- `#2217 `__ + + +v5.26.0 (2022-01-06) +-------------------- + +Features +~~~~~~~~ + +- Add ``middlewares`` property to ``NamedElementOnion`` / + ``web3.middleware_onion``. Returns current middlewares in proper order for + importing into a new ``Web3`` instance (`#2239 + `__) +- Add async ``eth.hashrate`` method (`#2243 + `__) +- Add async ``eth.chain_id`` method (`#2251 + `__) +- Add async ``eth.mining`` method (`#2252 + `__) +- Add async ``eth.get_transaction_receipt`` and + ``eth.wait_for_transaction_receipt`` methods (`#2265 + `__) +- Add async `eth.accounts` method (`#2284 + `__) +- Support for attaching external modules to the ``Web3`` instance when + instantiating the ``Web3`` instance, via the ``external_modules`` argument, + or via the new ``attach_modules()`` method (`#2288 + `__) + + +Bugfixes +~~~~~~~~ + +- Fixed doctest that wasn't running in ``docs/contracts.rst`` (`#2213 + `__) +- Key mapping fix to eth-tester middleware for access list storage keys (`#2224 + `__) +- Inherit ``Web3`` instance middlewares when instantiating ``ENS`` with + ``ENS.fromWeb3()`` method (`#2239 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix example docs to show a TransactionNotFound error, instead of None (`#2199 + `__) +- fix typo in ethpm.rst (`#2277 + `__) +- Clarify provider usage in Quickstart docs (`#2287 + `__) +- Address common BSC usage question (`#2289 + `__) + + +Misc +~~~~ + +- `#1729 `__, `#2233 + `__, `#2242 + `__, `#2260 + `__, `#2261 + `__, `#2283 + `__ + + +v5.25.0 (2021-11-19) +-------------------- + +Features +~~~~~~~~ + +- Support for ``w3.eth.get_raw_transaction_by_block``, and async support for + ``w3.eth.get_raw_transaction_by_block`` (`#2209 + `__) + + +Bugfixes +~~~~~~~~ + +- BadResponseFormat error thrown instead of KeyError when a response gets sent + back without a ``result`` key. (`#2188 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Correct link to Websocket library documentation (`#2173 + `__) +- Doc update to make it clearer that enable_unstable_package_management() + method is on the web3 instance (`#2208 + `__) + + +Misc +~~~~ + +- `#2102 `__, `#2179 + `__, `#2191 + `__, `#2201 + `__, `#2205 + `__, `#2212 + `__ + + +v5.24.0 (2021-09-27) +-------------------- + +Features +~~~~~~~~ + +- Add async ``eth.send_raw_transaction`` method (`#2135 + `__) +- Updated eth-account version to v0.5.6 - adds support for signing typed + transactions without needing to explicitly set the transaction type and now + accepts correct JSON-RPC structure for accessList for typed transactions + (`#2157 `__) + + +Bugfixes +~~~~~~~~ + +- Encode block_count as hex before making eth_feeHistory RPC call (`#2117 + `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix typo in AsyncHTTPProvider docs (`#2131 + `__) +- Update AsyncHTTPProvider doc Supported Methods to include + ``web3.eth.send_raw_transaction()``. (`#2135 + `__) +- Improve messaging around usage and implementation questions, directing users + to the appropriate channel (`#2138 + `__) +- Clarify some contract ``ValueError`` error messages. (`#2146 + `__) +- Updated docs for w3.eth.account.sign_transaction to reflect that transaction + type is no longer needed to successfully sign typed transactions and to + illustrate how to structure an optional accessList parameter in a typed + transaction (`#2157 `__) + + +Misc +~~~~ + +- `#2105 `__ + + +v5.23.1 (2021-08-27) +-------------------- + +Features +~~~~~~~~ + +- Add constants for the zero address, zero hash, max int, and wei per ether. (`#2109 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Renamed "1559 transaction" to "dynamic fee transaction" where appropriate to keep consistency among the general code base for 1559 transaction (type=2) naming (`#2118 `__) +- Update AsyncHTTPProvider doc example to include modules and middlewares keyword arguments (`#2123 `__) + + +Misc +~~~~ + +- `#2110 `__, `#2118 `__, `#2122 `__ + + +v5.23.0 (2021-08-12) +-------------------- + +Features +~~~~~~~~ + +- Add support for eth_feeHistory RPC method (`#2038 `__) +- Add support for eth_maxPriorityFeePerGas RPC method (`#2100 `__) + + +Bugfixes +~~~~~~~~ + +- Hot fix for string interpolation issue with contract function call decoding exception to facilitate extracting a meaningful message from the eth_call response (`#2096 `__) +- Bypass adding a ``gasPrice`` via the gas price strategy, if one is set, when EIP-1559 transaction params are used for ``send_transaction`` (`#2099 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update feeHistory docs (`#2104 `__) + + +v5.22.0 (2021-08-02) +-------------------- + +Features +~~~~~~~~ + +- Add support for eth_getRawTransactionByHash RPC method (`#2039 `__) +- Add AsyncNet module (`#2044 `__) +- Add async ``eth.get_balance``, ``eth.get_code``, ``eth.get_transaction_count`` methods. (`#2056 `__) +- eth_signTransaction support for eip-1559 params 'maxFeePerGas' and 'maxPriorityFeePerGas' (`#2082 `__) +- Add support for async ``w3.eth.call``. (`#2083 `__) + + +Bugfixes +~~~~~~~~ + +- If a transaction hash was passed as a string rather than a HexByte to ``w3.eth.wait_for_transaction_receipt``, and the time was exhausted before the transaction is in the chain, the error being raised was a TypeError instead of the correct TimeExhausted error. This is because the ``to_hex`` method in the TimeExhausted error message expects a primitive as the first argument, and a string doesn't qualify as a primitive. Fixed by converting the transaction_hash to HexBytes instead. (`#2068 `__) +- Hot fix for a string interpolation issue in message when BadFunctionCallOutput is raised for call_contract_function() (`#2069 `__) +- ``fill_transaction_defaults()`` no longer sets a default ``gasPrice`` if 1559 fees are present in the transaction parameters. This fixes sign-and-send middleware issues with 1559 fees. (`#2092 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Clarify that ``send_transaction``, ``modify_transaction``, and ``replace_transaction`` return HexByte objects instead of strings. (`#2058 `__) +- Added troubleshooting section for Microsoft Visual C++ error on Windows machines (`#2077 `__) +- Updated the sign-and-send middleware docs to include EIP-1559 as well as legacy transaction examples (`#2092 `__) + + +Misc +~~~~ + +- `#2073 `__, `#2080 `__, `#2085 `__ + + +v5.21.0 (2021-07-12) +-------------------- + +Features +~~~~~~~~ + +- Adds support for EIP 1559 transaction keys: `maxFeePerGas` and `maxPriorityFeePerGas` (`#2060 `__) + + +Bugfixes +~~~~~~~~ + +- Bugfix where an error response got passed to a function expecting a block identifier. + + Split out null result formatters from the error formatters and added some tests. (`#2022 `__) +- Fix broken tests and use the new 1559 params for most of our test transactions. (`#2053 `__) +- Set a default maxFeePerGas value consistent with Geth (`#2055 `__) +- Fix bug in geth PoA middleware where a ``None`` response should throw a ``BlockNotFound`` error, but was instead throwing an ``AttributeError`` (`#2064 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Added general documentation on unit and integration testing and how to contribute to our test suite. (`#2053 `__) + + +v5.20.1 (2021-07-01) +-------------------- + +Bugfixes +~~~~~~~~ + +- Have the geth dev IPC auto connection check for the ``WEB3_PROVIDER_URI`` environment variable. (`#2023 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Remove reference to allowing multiple providers in docs (`#2018 `__) +- Update "Contract Deployment Example" docs to use ``py-solc-x`` as ``solc`` is no longer maintained. (`#2020 `__) +- Detail using unreleased Geth builds in CI (`#2037 `__) +- Clarify that a missing trie node error could occur when using ``block_identifier`` with ``.call()`` + on a node that isn't running in archive mode (`#2048 `__) + + +Misc +~~~~ + +- `#1938 `__, `#2015 `__, `#2021 `__, `#2025 `__, `#2028 `__, `#2029 `__, `#2035 `__ + + +v5.20.0 (2021-06-09) +-------------------- + +Features +~~~~~~~~ + +- Add new AsyncHTTPProvider. No middleware or session caching support yet. + + Also adds async ``w3.eth.gas_price``, and async ``w3.isConnected()`` methods. (`#1978 `__) +- Add ability for AsyncHTTPProvider to accept middleware + + Also adds async gas_price_strategy middleware, and moves gas estimate to middleware. + + AsyncEthereumTesterProvider now inherits from AsyncBase (`#1999 `__) +- Support state_override in contract function call. (`#2005 `__) + + +Bugfixes +~~~~~~~~ + +- Test ethpm caching + bump Sphinx version. (`#1977 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Clarify solidityKeccak documentation. (`#1971 `__) +- Improve contributor documentation context and ordering. (`#2008 `__) +- Add docs for unstable AsyncHTTPProvider (`#2017 `__) + + +Misc +~~~~ + +- `#1979 `__, `#1980 `__, `#1993 `__, `#2002 `__ + + +v5.19.0 (2021-04-28) +-------------------- + +Features +~~~~~~~~ + +- Handle optional ``eth_call`` state override param. (`#1921 `__) +- Add list_storage_keys deprecate listStorageKeys (`#1944 `__) +- Add net_peers deprecate netPeers (`#1946 `__) +- Add trace_replay_transaction deprecate traceReplayTransaction (`#1949 `__) +- Add add_reserved_peer deprecate addReservedPeer (`#1951 `__) +- Add ``parity.set_mode``, deprecate ``parity.setMode`` (`#1954 `__) +- Add ``parity.trace_raw_transaction``, deprecate ``parity.traceRawTransaction`` (`#1955 `__) +- Add ``parity.trace_call``, deprecate ``parity.traceCall`` (`#1957 `__) +- Add trace_filter deprecate traceFilter (`#1960 `__) +- Add trace_block, deprecate traceBlock (`#1961 `__) +- Add trace_replay_block_transactions, deprecate traceReplayBlockTransactions (`#1962 `__) +- Add ``parity.trace_transaction``, deprecate ``parity.traceTransaction`` (`#1963 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Document ``eth_call`` state overrides. (`#1965 `__) + + +Misc +~~~~ + +- `#1774 `__, `#1805 `__, `#1945 `__, `#1964 `__ + + +v5.18.0 (2021-04-08) +-------------------- + +Features +~~~~~~~~ + +- Add ``w3.eth.modify_transaction`` deprecate ``w3.eth.modifyTransaction`` (`#1886 `__) +- Add ``w3.eth.get_transaction_receipt``, deprecate ``w3.eth.getTransactionReceipt`` (`#1893 `__) +- Add ``w3.eth.wait_for_transaction_receipt`` deprecate ``w3.eth.waitForTransactionReceipt`` (`#1896 `__) +- Add ``w3.eth.set_contract_factory`` deprecate ``w3.eth.setContractFactory`` (`#1900 `__) +- Add ``w3.eth.generate_gas_price`` deprecate ``w3.eth.generateGasPrice`` (`#1905 `__) +- Add ``w3.eth.set_gas_price_strategy`` deprecate ``w3.eth.setGasPriceStrategy`` (`#1906 `__) +- Add ``w3.eth.estimate_gas`` deprecate ``w3.eth.estimateGas`` (`#1913 `__) +- Add ``w3.eth.sign_typed_data`` deprecate ``w3.eth.signTypedData`` (`#1915 `__) +- Add ``w3.eth.get_filter_changes`` deprecate ``w3.eth.getFilterChanges`` (`#1916 `__) +- Add ``eth.get_filter_logs``, deprecate ``eth.getFilterLogs`` (`#1919 `__) +- Add ``eth.uninstall_filter``, deprecate ``eth.uninstallFilter`` (`#1920 `__) +- Add ``w3.eth.get_logs`` deprecate ``w3.eth.getLogs`` (`#1925 `__) +- Add ``w3.eth.submit_hashrate`` deprecate ``w3.eth.submitHashrate`` (`#1926 `__) +- Add ``w3.eth.submit_work`` deprecate ``w3.eth.submitWork`` (`#1927 `__) +- Add ``w3.eth.get_work``, deprecate ``w3.eth.getWork`` (`#1934 `__) +- Adds public get_block_number method. (`#1937 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add ABI type examples to docs (`#1890 `__) +- Promote the new Ethereum Python Discord server on the README. (`#1898 `__) +- Escape reserved characters in install script of Contributing docs. (`#1909 `__) +- Add detailed event filtering examples. (`#1910 `__) +- Add docs example for tuning log levels. (`#1928 `__) +- Add some performance tips in troubleshooting docs. (`#1929 `__) +- Add existing contract interaction to docs examples. (`#1933 `__) +- Replace Gitter links with the Python Discord server. (`#1936 `__) + + +Misc +~~~~ + +- `#1887 `__, `#1907 `__, `#1917 `__, `#1930 `__, `#1935 `__ + + +v5.17.0 (2021-02-24) +-------------------- + +Features +~~~~~~~~ + +- Added ``get_transaction_count``, and deprecated ``getTransactionCount`` (`#1844 `__) +- Add ``w3.eth.send_transaction``, deprecate ``w3.eth.sendTransaction`` (`#1878 `__) +- Add ``web3.eth.sign_transaction``, deprecate ``web3.eth.signTransaction`` (`#1879 `__) +- Add ``w3.eth.send_raw_transaction``, deprecate ``w3.eth.sendRawTransaction`` (`#1880 `__) +- Add ``w3.eth.replace_transaction`` deprecate ``w3.eth.replaceTransaction`` (`#1882 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix return type of ``send_transaction`` in docs. (`#686 `__) + + +v5.16.0 (2021-02-04) +-------------------- + +Features +~~~~~~~~ + +- Added ``get_block_transaction_count``, and deprecated ``getBlockTransactionCount`` (`#1841 `__) +- Move ``defaultAccount`` to ``default_account``. Deprecate ``defaultAccount``. (`#1848 `__) +- Add ``eth.default_block``, deprecate ``eth.defaultBlock``. + Also adds ``parity.default_block``, and deprecates ``parity.defaultBlock``. (`#1849 `__) +- Add ``eth.gas_price``, deprecate ``eth.gasPrice`` (`#1850 `__) +- Added ``eth.block_number`` property. Deprecated ``eth.blockNumber`` (`#1851 `__) +- Add ``eth.chain_id``, deprecate ``eth.chainId`` (`#1852 `__) +- Add ``eth.protocol_version``, deprecate ``eth.protocolVersion`` (`#1853 `__) +- Add ``eth.get_code``, deprecate ``eth.getCode`` (`#1856 `__) +- Deprecate ``eth.getProof``, add ``eth.get_proof`` (`#1857 `__) +- Add ``eth.get_transaction``, deprecate ``eth.getTransaction`` (`#1858 `__) +- Add ``eth.get_transaction_by_block``, deprecate ``eth.getTransactionByBlock`` (`#1859 `__) +- Add get_uncle_by_block, deprecate getUncleByBlock (`#1862 `__) +- Add get_uncle_count, deprecate getUncleCount (`#1863 `__) + + +Bugfixes +~~~~~~~~ + +- Fix event filter creation if the event ABI contains a ``values`` key. (`#1807 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Remove v5 breaking changes link from the top of the release notes. (`#1837 `__) +- Add account creation troubleshooting docs. (`#1855 `__) +- Document passing a struct into a contract function. (`#1860 `__) +- Add instance configuration troubleshooting docs. (`#1865 `__) +- Clarify nonce lookup in sendRawTransaction docs. (`#1866 `__) +- Updated docs for web3.eth methods: eth.getTransactionReceipt and eth.waitForTransactionReceipt (`#1868 `__) + + +v5.15.0 (2021-01-15) +-------------------- + +Features +~~~~~~~~ + +- Add ``get_storage_at`` method and deprecate ``getStorageAt``. (`#1828 `__) +- Add ``eth.get_block`` method and deprecate ``eth.getBlock``. (`#1829 `__) + + +Bugfixes +~~~~~~~~ + +- PR #1585 changed the error that was coming back from eth-tester when the Revert opcode was called, + which broke some tests in downstream libraries. This PR reverts back to raising the original error. (`#1813 `__) +- Added a new ``ContractLogicError`` for when a contract reverts a transaction. + ``ContractLogicError`` will replace ``SolidityError``, in v6. (`#1814 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Introduce Beacon API documentation (`#1836 `__) + + +Misc +~~~~ + +- `#1602 `__, `#1827 `__, `#1831 `__, `#1833 `__, `#1834 `__ + + +v5.14.0 (2021-01-05) +-------------------- + +Bugfixes +~~~~~~~~ + +- Remove docs/web3.* from the gitignore to allow for the beacon docs to be added to git, + and add ``beacon`` to the default web3 modules that get loaded. (`#1824 `__) +- Remove auto-documenting from the Beacon API (`#1825 `__) + + +Features +~~~~~~~~ + +- Introduce experimental Ethereum 2.0 beacon node API (`#1758 `__) +- Add new get_balance method on Eth class. Deprecated getBalance. (`#1806 `__) + + +Misc +~~~~ + +- `#1815 `__, `#1816 `__ + + +v5.13.1 (2020-12-03) +-------------------- + +Bugfixes +~~~~~~~~ + +- Handle revert reason parsing for Ganache (`#1794 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Document Geth and Parity/OpenEthereum fixture generation (`#1787 `__) + + +Misc +~~~~ + +- `#1778 `__, `#1780 `__, `#1790 `__, `#1791 `__, `#1796 `__ + + +v5.13.0 (2020-10-29) +-------------------- + +Features +~~~~~~~~ + +- Raise `SolidityError` exceptions that contain the revert reason when a `call` fails. (`#941 `__) + + +Bugfixes +~~~~~~~~ + +- Update eth-tester dependency to fix tester environment install version conflict. (`#1782 `__) + + +Misc +~~~~ + +- `#1757 `__, `#1767 `__ + + +v5.12.3 (2020-10-21) +-------------------- + +Misc +~~~~ + +- `#1752 `__, `#1759 `__, `#1773 `__, `#1775 `__ + + +v5.12.2 (2020-10-12) +-------------------- + +Bugfixes +~~~~~~~~ + +- Address the use of multiple providers in the docs (`#1701 `__) +- Remove stale connection errors from docs (`#1737 `__) +- Allow ENS name resolution for methods that use the ``Method`` class (`#1749 `__) + + +Misc +~~~~ + +- `#1727 `__, `#1728 `__, `#1733 `__, `#1735 `__, `#1741 `__, `#1746 `__, `#1748 `__, `#1753 `__, `#1768 `__ + + +v5.12.1 (2020-09-02) +-------------------- + +Misc +~~~~ + +- `#1708 `__, `#1709 `__, `#1715 `__, `#1722 `__, `#1724 `__ + + +v5.12.0 (2020-07-16) +-------------------- + +Features +~~~~~~~~ + +- Update `web3.pm` and `ethpm` module to EthPM v3 specification. (`#1652 `__) +- Allow consumer to initialize `HttpProvider` with their own `requests.Session`. This allows the `HttpAdapter` connection pool to be tuned as desired. (`#1469 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Use ethpm v3 packages in examples documentation. (`#1683 `__) +- Modernize the deploy contract example. (`#1679 `__) +- Add contribution guidelines and a code of conduct. (`#1691 `__) + + +Misc +~~~~ + +- `#1687 `__ +- `#1690 `__ + + +v5.12.0-beta.3 (2020-07-15) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Include ethpm-spec solidity examples in distribution. (`#1686 `__) + + +v5.12.0-beta.2 (2020-07-14) +--------------------------- + +Bugfixes +~~~~~~~~ + +- Support ethpm-spec submodule in distributions. (`#1682 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Modernize the deploy contract example. (`#1679 `__) +- Use ethpm v3 packages in examples documentation. (`#1683 `__) + + +v5.12.0-beta.1 (2020-07-09) +--------------------------- + +Features +~~~~~~~~ + +- Allow consumer to initialize `HttpProvider` with their own `requests.Session`. This allows the `HttpAdapter` connection pool to be tuned as desired. (`#1469 `__) +- Update `web3.pm` and `ethpm` module to EthPM v3 specification. (`#1652 `__) + + +Bugfixes +~~~~~~~~ + +- Update outdated reference url in ethpm docs and tests. (`#1680 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add a :meth:`~web3.eth.Eth.getBalance` example and provide more context for using the `fromWei` and `toWei` utility methods. (`#1676 `__) +- Overhaul the Overview documentation to provide a tour of major features. (`#1681 `__) + + +v5.11.1 (2020-06-17) +-------------------- + +Bugfixes +~~~~~~~~ + +- Added formatter rules for eth_tester middleware to allow :meth:`~web3.eth.Eth.getBalance` by using integer block numbers (`#1660 `__) +- Fix type annotations within the ``eth.py`` module. Several arguments that defaulted to ``None`` were not declared ``Optional``. (`#1668 `__) +- Fix type annotation warning when using string URI to instantiate an HTTP or WebsocketProvider. (`#1669 `__) +- Fix type annotations within the ``web3`` modules. Several arguments that defaulted to ``None`` were not declared ``Optional``. (`#1670 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Breaks up links into three categories (Intro, Guides, and API) and adds content to the index page: a lib introduction and some "Getting Started" links. (`#1671 `__) +- Fills in some gaps in the Quickstart guide and adds provider connection details for local nodes. (`#1673 `__) + + +v5.11.0 (2020-06-03) +-------------------- + +Features +~~~~~~~~ + +- Accept a block identifier in the ``Contract.estimateGas`` method. Includes a related upgrade of eth-tester to v0.5.0-beta.1. (`#1639 `__) +- Introduce a more specific validation error, ``ExtraDataLengthError``. This enables tools to detect when someone may be connected to a POA network, for example, and provide a smoother developer experience. (`#1666 `__) + + +Bugfixes +~~~~~~~~ + +- Correct the type annotations of `FilterParams.address` (`#1664 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Corrects the return value of ``getTransactionReceipt``, description of caching middleware, and deprecated method names. (`#1663 `__) +- Corrects documentation of websocket timeout configuration. (`#1665 `__) + + +v5.10.0 (2020-05-18) +-------------------- + +Features +~~~~~~~~ + +- An update of ``eth-tester`` includes a change of the default fork from Constantinople to Muir Glacier. `#1636 `__ + + +Bugfixes +~~~~~~~~ + +- ``my_contract.events.MyEvent`` was incorrectly annotated so that ``MyEvent`` was marked as a ``ContractEvent`` instance. Fixed to be a class type, i.e., ``Type[ContractEvent]``. (`#1646 `__) +- IPCProvider correctly handled ``pathlib.Path`` input, but warned against its type. Fixed to permit Path objects in addition to strings. (`#1647 `__) + + +Misc +~~~~ + +- `#1636 `__ + + +v5.9.0 (2020-04-30) +------------------- + +Features +~~~~~~~~ + +- Upgrade eth-account to use v0.5.2+. eth-account 0.5.2 adds support for hd accounts + + Also had to pin eth-keys to get dependencies to resolve. (`#1622 `__) + + +Bugfixes +~~~~~~~~ + +- Fix local_filter_middleware new entries bug (`#1514 `__) +- ENS ``name`` and ENS ``address`` can return ``None``. Fixes return types. (`#1633 `__) + + +v5.8.0 (2020-04-23) +------------------- + +Features +~~~~~~~~ + +- Introduced ``list_wallets`` method to the ``GethPersonal`` class. (`#1516 `__) +- Added block_identifier parameter to `ContractConstructor.estimateGas` method. (`#1588 `__) +- Add snake_case methods to Geth and Parity Personal Modules. + + Deprecate camelCase methods. (`#1589 `__) +- Added new weighted keyword argument to the time based gas price strategy. + + If ``True``, it will more give more weight to more recent block times. (`#1614 `__) +- Adds support for Solidity's new(ish) receive function. + + Adds a new contract API that mirrors the existing fallback API: ``contract.receive`` (`#1623 `__) + + +Bugfixes +~~~~~~~~ + +- Fixed hasattr overloader method in the web3.ContractEvent, web3.ContractFunction, + and web3.ContractCaller classes by implementing a try/except handler + that returns False if an exception is raised in the __getattr__ overloader method + (since __getattr__ HAS to be called in every __hasattr__ call). + + Created two new Exception classes, 'ABIEventFunctionNotFound' and 'ABIFunctionNotFound', + which inherit from both AttributeError and MismatchedABI, and replaced the MismatchedABI + raises in ContractEvent, ContractFunction, and ContractCaller with a raise to the created class + in the __getattr__ overloader method of the object. (`#1594 `__) +- Change return type of rpc_gas_price_strategy from int to Wei (`#1612 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Fix typo in "Internals" docs. Changed asyncronous --> asynchronous (`#1607 `__) +- Improve documentation that introduces and troubleshoots Providers. (`#1609 `__) +- Add documentation for when to use each transaction method. (`#1610 `__) +- Remove incorrect web3 for w3 in doc example (`#1615 `__) +- Add examples for using web3.contract via the ethpm module. (`#1617 `__) +- Add dark mode to documentation. Also fixes a bunch of formatting issues in docs. (`#1626 `__) + + +Misc +~~~~ + +- `#1545 `__ + + +v5.7.0 (2020-03-16) +------------------- + +Features +~~~~~~~~ + +- Add snake_case methods for the net module + + Also moved net module to use ModuleV2 instead of Module (`#1592 `__) + + +Bugfixes +~~~~~~~~ + +- Fix return type of eth_getCode. Changed from Hexstr to HexBytes. (`#1601 `__) + + +Misc +~~~~ + +- `#1590 `__ + + +v5.6.0 (2020-02-26) +------------------- + +Features +~~~~~~~~ + +- Add snake_case methods to Geth Miner class, deprecate camelCase methods (`#1579 `__) +- Add snake_case methods for the net module, deprecate camelCase methods (`#1581 `__) +- Add PEP561 type marker (`#1583 `__) + + +Bugfixes +~~~~~~~~ + +- Increase replacement tx minimum gas price bump + + Parity/OpenEthereum requires a replacement transaction's + gas to be a minimum of 12.5% higher than the original + (vs. Geth's 10%). (`#1570 `__) + + +v5.5.1 (2020-02-10) +------------------- + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Documents the `getUncleCount` method. (`#1534 `__) + + +Misc +~~~~ + +- `#1576 `__ + + +v5.5.0 (2020-02-03) +------------------- + +Features +~~~~~~~~ + +- ENS had to release a new registry to push a bugfix. See + `this article `_ + for background information. web3.py uses the new registry for all default ENS interactions, now. (`#1573 `__) + + +Bugfixes +~~~~~~~~ + +- Minor bugfix in how ContractCaller looks up abi functions. (`#1552 `__) +- Update modules to use compatible typing-extensions import. (`#1554 `__) +- Make 'from' and 'to' fields checksum addresses in returned transaction receipts (`#1562 `__) +- Use local Trinity's IPC socket if it is available, for newer versions of Trinity. (`#1563 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Add Matomo Tracking to Docs site. + + Matomo is an Open Source web analytics platform that allows us + to get better insights and optimize for our audience without + the negative consequences of other compareable platforms. + + Read more: https://matomo.org/why-matomo/ (`#1541 `__) +- Fix web3 typo in docs (`#1559 `__) + + +Misc +~~~~ + +- `#1521 `__, `#1546 `__, `#1571 `__ + + +v5.4.0 (2019-12-06) +------------------- + +Features +~~~~~~~~ + +- Add __str__ to IPCProvider (`#1536 `__) + + +Bugfixes +~~~~~~~~ + +- Add required typing-extensions library to setup.py (`#1544 `__) + + +v5.3.1 (2019-12-05) +------------------- + +Bugfixes +~~~~~~~~ + +- Only apply hexbytes formatting to r and s values in transaction if present (`#1531 `__) +- Update eth-utils dependency which contains mypy bugfix. (`#1537 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update Contract Event documentation to show correct example (`#1515 `__) +- Add documentation to methods that raise an error in v5 instead of returning ``None`` (`#1527 `__) + + +Misc +~~~~ + +- `#1518 `__, `#1532 `__ + + +v5.3.0 (2019-11-14) +------------------- + +Features +~~~~~~~~ + +- Support handling ENS domains in ERC1319 URIs. (`#1489 `__) + + +Bugfixes +~~~~~~~~ + +- Make local block filter return empty list when when no blocks mined (`#1255 `__) +- Google protobuf dependency was updated to `3.10.0` (`#1493 `__) +- Infura websocket provider works when no secret key is present (`#1501 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update Quickstart instructions to use the auto Infura module instead of the more complicated web3 auto module (`#1482 `__) +- Remove outdated py.test command from readme (`#1483 `__) + + +Misc +~~~~ + +- `#1461 `__, `#1471 `__, `#1475 `__, `#1476 `__, `#1479 `__, `#1488 `__, `#1492 `__, `#1498 `__ + + +v5.2.2 (2019-10-21) +------------------- + +Features +~~~~~~~~ + +- Add poll_latency to waitForTransactionReceipt (`#1453 `__) + + +Bugfixes +~~~~~~~~ + +- Fix flaky Parity whisper module test (`#1473 `__) + + +Misc +~~~~ + +- `#1472 `__, `#1474 `__ + + +v5.2.1 (2019-10-17) +------------------- + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Update documentation for unlock account duration (`#1464 `__) +- Clarify module installation command for OSX>=10.15 (`#1467 `__) + + +Misc +~~~~ + +- `#1468 `__ + + +v5.2.0 (2019-09-26) +------------------- + +Features +~~~~~~~~ + +- Add ``enable_strict_bytes_type_checking`` flag to web3 instance (`#1419 `__) +- Move Geth Whisper methods to snake case and deprecate camel case methods (`#1433 `__) + + +Bugfixes +~~~~~~~~ + +- Add null check to logsbloom formatter (`#1445 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Reformat autogenerated towncrier release notes (`#1460 `__) + + +Web3 5.1.0 (2019-09-18) +----------------------- + +Features +~~~~~~~~ + +- Add ``contract_types`` property to ``Package`` class. (`#1440 `__) + + +Bugfixes +~~~~~~~~ + +- Fix flaky parity integration test in the whisper module (`#1147 `__) + + +Improved Documentation +~~~~~~~~~~~~~~~~~~~~~~ + +- Remove whitespace, move ``topics`` key -> ``topic`` in Geth docs (`#1425 `__) +- Enforce stricter doc checking, turning warnings into errors to fail CI builds + to catch issues quickly. + + Add missing ``web3.tools.rst`` to the table of contents and fix incorrectly formatted + JSON example. (`#1437 `__) +- Add example using Geth POA Middleware with Infura Rinkeby Node (`#1444 `__) + + +Misc +~~~~ + +- `#1446 `__, `#1451 `__ + + +v5.0.2 +------ +Released August 22, 2019 + +- Bugfixes + + - [ethPM] Fix bug in package id and release id fetching strategy + - `#1427 `_ + +v5.0.1 +------ +Released August 15, 2019 + +- Bugfixes + + - [ethPM] Add begin/close chars to package name regex + - `#1418 `_ + - [ethPM] Update deployments to work when only abi available + - `#1417 `_ + - Fix tuples handled incorrectly in ``decode_function_input`` + - `#1410 `_ + +- Misc + + - Eliminate ``signTransaction`` warning + - `#1404 `_ + +v5.0.0 +------ +Released August 1, 2019 + +- Features + + - ``web3.eth.chainId`` now returns an integer instead of hex + - `#1394 `_ + +- Bugfixes + + - Deprecation Warnings now show for methods that have a + ``@combomethod`` decorator + - `#1401 `_ + +- Misc + + - [ethPM] Add ethPM to the docker file + - `#1405 `_ + +- Docs + + - Docs are updated to use checksummed addresses + - `#1390 `_ + - Minor doc formatting fixes + - `#1338 `_ & + `#1345 `_ + + + +v5.0.0-beta.5 +------------- +Released July 31, 2019 + +*This is intended to be the final release before the stable v5 release.* + +- Features + + - Parity operating mode can be read and set + - `#1355 `_ + - Process a single event log, instead of a whole transaction + receipt + - `#1354 `_ + +- Docs + + - Remove doctest dependency on ethtoken + - `#1395 `_ + +- Bugfixes + + - [ethPM] Bypass IPFS validation for large files + - `#1393 `_ + +- Misc + + - [ethPM] Update default Registry solidity contract + - `#1400 `_ + - [ethPM] Update web3.pm to use new simple Registry implementation + - `#1398 `_ + - Update dependency requirement formatting for releasing + - `#1403 `_ + + +v5.0.0-beta.4 +------------- +Released July 18,2019 + + + +- Features + + - [ethPM] Update registry uri to support basic uris w/o package id + - `#1389 `_ + +- Docs + + - Clarify in docs the return of ``Eth.sendRawTransaction()`` as + a HexBytes object, not a string. + - `#1384 `_ + +- Misc + + - [ethPM] Migrate tests over from pytest-ethereum + - `#1385 `_ + +v5.0.0-beta.3 +------------- +Released July 15, 2019 + +- Features + + - Add eth_getProof support + - `#1185 `_ + - Implement web3.pm.get_local_package() + - `#1372 `_ + - Update registry URIs to support chain IDs + - `#1382 `_ + - Add error flags to ``event.processReceipt`` + - `#1366 `_ + +- Bugfixes + + - Remove full IDNA processing in favor of UTS46 + - `#1364 `_ + +- Misc + + - Migrate py-ethpm library to web3/ethpm + - `#1379 `_ + - Relax canonical address requirement in ethPM + - `#1380 `_ + - Replace ethPM's infura strategy with web3's native infura support + - `#1383 `_ + - Change ``combine_argument_formatters`` to ``apply_formatters_to_sequence`` + - `#1360 `_ + - Move ``pytest.xfail`` instances to ``@pytest.mark.xfail`` + - `#1376 `_ + - Change ``net.version`` to ``eth.chainId`` in default + transaction params + - `#1378 `_ + + +v5.0.0-beta.2 +------------- +Released May 13, 2019 + +- Features + + - Mark deprecated sha3 method as static + - `#1350 `_ + - Upgrade to eth-account v0.4.0 + - `#1348 `_ + +- Docs + + - Add note about web3[tester] in documentation + - `#1325 `_ + +- Misc + + - Replace ``web3._utils.toolz`` imports with ``eth_utils.toolz`` + - `#1317 `_ + + +v5.0.0-beta.1 +------------- +Released May 6, 2019 + +- Features + + - Add support for tilda in provider IPC Path + - `#1049 `_ + - EIP 712 Signing Supported + - `#1319 `_ + +- Docs + + - Update contract example to use ``compile_standard`` + - `#1263 `_ + - Fix typo in middleware docs + - `#1339 `_ + + +v5.0.0-alpha.11 +--------------- +Released April 24, 2019 + +- Docs + + - Add documentation for web3.py unit tests + - `#1324 `_ + +- Misc + + - Update deprecated collections.abc imports + - `#1334 `_ + - Fix documentation typo + - `#1335 `_ + - Upgrade eth-tester version + - `#1332 `_ + + +v5.0.0-alpha.10 +--------------- +Released April 15, 2019 + +- Features + + - Add getLogs by blockHash + - `#1269 `_ + - Implement chainId endpoint + - `#1295 `_ + - Moved non-standard JSON-RPC endpoints to applicable + Parity/Geth docs. Deprecated ``web3.version`` for ``web3.api`` + - `#1290 `_ + - Moved Whisper endpoints to applicable Geth or Parity namespace + - `#1308 `_ + - Added support for Goerli provider + - `#1286 `_ + - Added addReservedPeer to Parity module + - `#1311 `_ + +- Bugfixes + + - Cast gas price values to integers in gas strategies + - `#1297 `_ + - Missing constructor function no longer ignores constructor args + - `#1316 `_ + +- Misc + + - Require eth-utils >= 1.4, downgrade Go version for integration tests + - `#1310 `_ + - Fix doc build warnings + - `#1331 `_ + - Zip Fixture data + - `#1307 `_ + - Update Geth version for integration tests + - `#1301 `_ + - Remove unneeded testrpc + - `#1322 `_ + - Add ContractCaller docs to v5 migration guide + - `#1323 `_ + + + +v5.0.0-alpha.9 +-------------- +Released March 26, 2019 + +- Breaking Changes + + - Raise error if there is no Infura API Key + - `#1294 `_ & + - `#1299 `_ + +- Misc + + - Upgraded Parity version for integration testing + - `#1292 `_ + +v5.0.0-alpha.8 +-------------- +Released March 20, 2019 + +- Breaking Changes + + - Removed ``web3/utils`` directory in favor of ``web3/_utils`` + - `#1282 `_ + - Relocated personal RPC endpoints to Parity and Geth class + - `#1211 `_ + - Deprecated ``web3.net.chainId()``, ``web3.eth.getCompilers()``, + and ``web3.eth.getTransactionFromBlock()``. Removed ``web3.eth.enableUnauditedFeatures()`` + - `#1270 `_ + - Relocated eth_protocolVersion and web3_clientVersion + - `#1274 `_ + - Relocated ``web3.txpool`` to ``web3.geth.txpool`` + - `#1275 `_ + - Relocated admin module to Geth namespace + - `#1288 `_ + - Relocated miner module to Geth namespace + - `#1287 `_ + +- Features + + - Implement ``eth_submitHashrate`` and ``eth_submitWork`` JSONRPC endpoints. + - `#1280 `_ + - Implement ``web3.eth.signTransaction`` + - `#1277 `_ + +- Docs + + - Added v5 migration docs + - `#1284 `_ + +v5.0.0-alpha.7 +-------------- +Released March 11, 2019 + +- Breaking Changes + + - Updated JSON-RPC calls that lookup txs or blocks to raise + an error if lookup fails + - `#1218 `_ and + `#1268 `_ + +- Features + + - Tuple ABI support + - `#1235 `_ + +- Bugfixes + + - One last ``middleware_stack`` was still hanging on. + Changed to ``middleware_onion`` + - `#1262 `_ + +v5.0.0-alpha.6 +-------------- +Released February 25th, 2019 + +- Features + + - New ``NoABIFound`` error for cases where there is no ABI + - `#1247 `_ + +- Misc + + - Interact with Infura using an API Key. Key will be required after March 27th. + - `#1232 `_ + - Remove ``process_type`` utility function in favor of + eth-abi functionality + - `#1249 `_ + + +v5.0.0-alpha.5 +-------------- + +Released February 13th, 2019 + +- Breaking Changes + + - Remove deprecated ``buildTransaction``, ``call``, ``deploy``, + ``estimateGas``, and ``transact`` methods + - `#1232 `_ + +- Features + + - Adds ``Web3.toJSON`` method + - `#1173 `_ + - Contract Caller API Implemented + - `#1227 `_ + - Add Geth POA middleware to use Rinkeby with Infura Auto + - `#1234 `_ + - Add manifest and input argument validation to ``pm.release_package()`` + - `#1237 `_ + +- Misc + + - Clean up intro and block/tx sections in Filter docs + - `#1223 `_ + - Remove unnecessary ``EncodingError`` exception catching + - `#1224 `_ + - Improvements to ``merge_args_and_kwargs`` utility function + - `#1228 `_ + - Update vyper registry assets + - `#1242 `_ + + +v5.0.0-alpha.4 +-------------- + +Released January 23rd, 2019 + +- Breaking Changes + + - Rename ``middleware_stack`` to ``middleware_onion`` + - `#1210 `_ + - Drop already deprecated ``web3.soliditySha3`` + - `#1217 `_ + - ENS: Stop inferring ``.eth`` TLD on domain names + - `#1205 `_ + +- Bugfixes + + - Validate ``ethereum_tester`` class in ``EthereumTesterProvider`` + - `#1217 `_ + - Support ``getLogs()`` method without creating filters + - `#1192 `_ + +- Features + + - Stablize the ``PM`` module + - `#1125 `_ + - Implement async ``Version`` module + - `#1166 `_ + +- Misc + + - Update .gitignore to ignore ``.DS_Store`` and ``.mypy_cache/`` + - `#1215 `_ + - Change CircleCI badge link to CircleCI project + - `#1214 `_ + + +v5.0.0-alpha.3 +-------------- + +Released January 15th, 2019 + +- Breaking Changes + + - Remove ``web3.miner.hashrate`` and ``web3.version.network`` + - `#1198 `_ + - Remove ``web3.providers.tester.EthereumTesterProvider`` + and ``web3.providers.tester.TestRPCProvider`` + - `#1199 `_ + - Change ``manager.providers`` from list to single ``manager.provider`` + - `#1200 `_ + - Replace deprecated ``web3.sha3`` method with ``web3.keccak`` method + - `#1207 `_ + - Drop auto detect testnets for IPCProvider + - `#1206 `_ + +- Bugfixes + + - Add check to make sure blockHash exists + - `#1158 `_ + +- Misc + + - Remove some unreachable code in `providers/base.py` + - `#1160 `_ + - Migrate tester provider results from middleware to defaults + - `#1188 `_ + - Fix doc formatting for build_filter method + - `#1187 `_ + - Add ERC20 example in docs + - `#1178 `_ + - Code style improvements + - `#1194 `_ + & `#1191 `_ + - Convert Web3 instance variables to w3 + - `#1186 `_ + - Update eth-utils dependencies and clean up other dependencies + - `#1195 `_ + + +v5.0.0-alpha.2 +-------------- + +Released December 20th, 2018 + +- Breaking Changes + + - Remove support for python3.5, drop support for eth-abi v1 + - `#1163 `_ +- Features + + - Support for custom ReleaseManager was fixed + - `#1165 `_ + +- Misc + + - Fix doctest nonsense with unicorn token + - `3b2047 `_ + - Docs for installing web3 in FreeBSD + - `#1156 `_ + - Use latest python in readthedocs + - `#1162 `_ + - Use twine in release script + - `#1164 `_ + - Upgrade eth-tester, for eth-abi v2 support + - `#1168 `_ + +v5.0.0-alpha.1 +-------------- + +Released December 13th, 2018 + +- Features + + - Add Rinkeby and Kovan Infura networks; made mainnet the default + - `#1150 `_ + - Add parity-specific ``listStorageKeys`` RPC + - `#1145 `_ + - Deprecated ``Web3.soliditySha3``; use ``Web3.solidityKeccak`` instead. + - `#1139 `_ + - Add default trinity locations to IPC path guesser + - `#1121 `_ + - Add wss to ``AutoProvider`` + - `#1110 `_ + - Add timeout for ``WebsocketProvider`` + - `#1109 `_ + - Receipt timeout raises ``TimeExhausted`` + - `#1070 `_ + - Allow specification of block number for ``eth_estimateGas`` + - `#1046 `_ + + +- Misc + + - Removed ``web3._utils.six`` support + - `#1116 `_ + - Upgrade eth-utils to 1.2.0 + - `#1104 `_ + - Require Python version 3.5.3 or greater + - `#1095 `_ + - Bump websockets version to 7.0.0 + - `#1146 `_ + - Bump parity test binary to 1.11.11 + - `#1064 `_ + + +v4.8.2 +-------- + +Released November 15, 2018 + +- Misc + + - Reduce unneeded memory usage + - `#1138 `_ + +v4.8.1 +-------- + +Released October 28, 2018 + +- Features + + - Add timeout for WebsocketProvider + - `#1119 `_ + - Reject transactions that send ether to non-payable contract functions + - `#1115 `_ + - Add Auto Infura Ropsten support: ``from web3.auto.infura.ropsten import w3`` + - `#1124 `_ + - Auto-detect trinity IPC file location + - `#1129 `_ +- Misc + + - Require Python >=3.5.3 + - `#1107 `_ + - Upgrade eth-tester and eth-utils + - `#1085 `_ + - Configure readthedocs dependencies + - `#1082 `_ + - soliditySha3 docs fixup + - `#1100 `_ + - Update ropsten faucet links in troubleshooting docs + +v4.7.2 +-------- + +Released September 25th, 2018 + +- Bugfixes + + - IPC paths starting with ``~`` are appropriately resolved to the home directory + - `#1072 `_ + - You can use the local signing middleware with :class:`bytes`-type addresses + - `#1069 `_ + +v4.7.1 +-------- + +Released September 11th, 2018 + +- Bugfixes + + - `old pip bug `_ used during + release made it impossible for non-windows users to install 4.7.0. + +v4.7.0 +-------- + +Released September 10th, 2018 + +- Features + + - Add traceFilter method to the parity module. + - `#1051 `_ + - Move :mod:`~web3.utils.datastructures` to public namespace :mod:`~web3.datastructures` + to improve support for type checking. + - `#1038 `_ + - Optimization to contract calls + - `#944 `_ +- Bugfixes + + - ENS name resolution only attempted on mainnet by default. + - `#1037 `_ + - Fix attribute access error when attributedict middleware is not used. + - `#1040 `_ +- Misc + - Upgrade eth-tester to 0.1.0-beta.32, and remove integration tests for py-ethereum. + - Upgrade eth-hash to 0.2.0 with pycryptodome 3.6.6 which resolves a vulnerability. + +v4.6.0 +-------- + +Released Aug 24, 2018 + +- Features + + - Support for Python 3.7, most notably in :class:`~web3.providers.websocket.WebsocketProvider` + - `#996 `_ + - You can now decode a transaction's data to its original function call and arguments with: + :meth:`contract.decode_function_input() ` - `#991 + `_ + - Support for :class:`~web3.providers.ipc.IPCProvider` in FreeBSD (and more readme docs) - `#1008 + `_ +- Bugfixes + + - Fix crash in time-based gas strategies with small number of transactions - `#983 + `_ + - Fx crash when passing multiple addresses to :meth:`w3.eth.getLogs() ` - + `#1005 `_ +- Misc + + - Disallow configuring filters with both manual and generated topic lists - `#976 + `_ + - Add support for the upcoming eth-abi v2, which does ABI string decoding differently - `#974 + `_ + - Add a lot more filter tests - `#997 + `_ + - Add more tests for filtering with ``None``. Note that geth & parity differ here. - `#985 + `_ + - Follow-up on Parity bug that we reported upstream (`parity#7816 + `_): they resolved in 1.10. We + removed xfail on that test. - `#992 + `_ + - Docs: add an example of interacting with an ERC20 contract - `#995 + `_ + - A couple doc typo fixes + + - `#1006 `_ + - `#1010 `_ + +v4.5.0 +-------- + +Released July 30, 2018 + +- Features + + - Accept addresses supplied in :class:`bytes` format (which does not provide checksum validation) + - Improve estimation of gas prices +- Bugfixes + + - Can now use a block number with :meth:`~web3.eth.Eth.getCode` when connected to + :class:`~web3.providers.eth_tester.EthereumTesterProvider` (without crashing) +- Misc + + - Test Parity 1.11.7 + - Parity integration tests upgrade to use sha256 instead of md5 + - Fix some filter docs + - eth-account upgrade to v0.3.0 + - eth-tester upgrade to v0.1.0-beta.29 + +v4.4.1 +-------- + +Released June 29, 2018 + +- Bugfixes + + - eth-pm package was renamed (old one deleted) which broke the web3 release. + eth-pm was removed from the web3.py install until it's stable. + +- Misc + + - :class:`~web3.providers.ipc.IPCProvider` now accepts a :class:`pathlib.Path` + argument for the IPC path + - Docs explaining the new custom autoproviders in web3 + +v4.4.0 +-------- + +Released June 21, 2018 + +- Features + + - Add support for https in WEB3_PROVIDER_URI environment variable + - Can send websocket connection parameters in :class:`~web3.providers.websocket.WebsocketProvider` + - Two new auto-initialization options: + + - ``from web3.auto.gethdev import w3`` + - ``from web3.auto.infura import w3`` + (After setting the ``INFURA_API_KEY`` environment variable) + - Alpha support for a new package management tool based on ethpm-spec +- Bugfixes + + - Can now receive large responses in :class:`~web3.providers.websocket.WebsocketProvider` by + specifying a large ``max_size`` in the websocket connection parameters. +- Misc + + - Websockets dependency upgraded to v5 + - Raise deprecation warning on :meth:`~web3.eth.Eth.getTransactionFromBlock` + - Fix docs for :meth:`~web3.eth.Eth.waitForTransactionReceipt` + - Developer Dockerfile now installs testing dependencies + +v4.3.0 +-------- + +Released June 6, 2018 + +- Features + + - Support for the ABI types like: `fixedMxN + `_ + which is used by Vyper. + - In-flight transaction-signing middleware: Use local keys as if they were hosted keys + using the new ``sign_and_send_raw_middleware`` + - New :meth:`~web3.eth.Eth.getUncleByBlock` API + - New name :meth:`~web3.eth.Eth.getTransactionByBlock`, which replaces the deprecated + :meth:`~web3.eth.Eth.getTransactionFromBlock` + - Add several new Parity trace functions + - New API to resolve ambiguous function calls, for example: + + - Two functions with the same name that accept similar argument types, like + ``myfunc(uint8)`` and ``myfunc(int8)``, and you want to call + ``contract.functions.myfunc(1).call()`` + - See how to use it at: :ref:`ambiguous-contract-functions` +- Bugfixes + + - Gas estimation doesn't crash, when 0 blocks are available. (ie~ on the genesis block) + - Close out all HTTPProvider sessions, to squash warnings on exit + - Stop adding Contract address twice to the filter. It was making some nodes unhappy +- Misc + + - Friendlier json encoding/decoding failure error messages + - Performance improvements, when the responses from the node are large + (by reducing the number of times we evaluate if the response is valid json) + - Parity CI test fixes (ugh, environment setup hell, thanks to the + community for cleaning this up!) + - Don't crash when requesting a transaction that was created with the parity bug + (which allowed an unsigned transaction to be included, so ``publicKey`` is ``None``) + - Doc fixes: addresses must be checksummed (or ENS names on mainnet) + - Enable local integration testing of parity on non-Debian OS + - README: + + - Testing setup for devs + - Change the build badge from Travis to Circle CI + - Cache the parity binary in Circle CI, to reduce the impact of their binary API going down + - Dropped the dot: ``py.test`` -> ``pytest`` + +v4.2.1 +-------- + +Released May 9, 2018 + +- Bugfixes + + - When :meth:`getting a transaction ` + with data attached and trying to :meth:`modify it ` + (say, to increase the gas price), the data was not being reattached in + the new transaction. + - :meth:`web3.personal.sendTransaction` was crashing when using a transaction + generated with ``buildTransaction()`` +- Misc + + - Improved error message when connecting to a geth-style PoA network + - Improved error message when address is not checksummed + - Started in on support for ``fixedMxN`` ABI arguments + - Lots of documentation upgrades, including: + + - Guide for understanding nodes/networks/connections + - Simplified Quickstart with notes for common issues + - A new Troubleshooting section + - Potential pypy performance improvements (use toolz instead of cytoolz) + - eth-tester upgraded to beta 24 + +v4.2.0 +-------- + +Released Apr 25, 2018 + +- Removed audit warning and opt-in requirement for ``w3.eth.account``. See more in: + :ref:`eth-account` +- Added an API to look up contract functions: ``fn = contract.functions['function_name_here']`` +- Upgrade Whisper (shh) module to use v6 API +- Bugfix: set 'to' field of transaction to empty when using + ``transaction = contract.constructor().buildTransaction()`` +- You can now specify `nonce` in ``buildTransaction()`` +- Distinguish between chain id and network id -- currently always return `None` for + :attr:`~web3.net.Net.chainId` +- Better error message when trying to use a contract function that has 0 or >1 matches +- Better error message when trying to install on a python version <3.5 +- Installs pypiwin32 during pip install, for a better Windows experience +- Cleaned up a lot of test warnings by upgrading from deprecated APIs, especially + from the deprecated ``contract.deploy(txn_dict, args=contract_args)`` + to the new ``contract.constructor(*contract_args).transact(txn_dict)`` +- Documentation typo fixes +- Better template for Pull Requests + +v4.1.0 +-------- + +Released Apr 9, 2018 + +- New :class:`~web3.providers.websocket.WebsocketProvider`. + If you're looking for better performance than HTTP, check out websockets. +- New :meth:`w3.eth.waitForTransactionReceipt() ` +- Added name collision detection to ConciseContract and ImplicitContract +- Bugfix to allow fromBlock set to 0 in createFilter, like + ``contract.events.MyEvent.createFilter(fromBlock=0, ...)`` +- Bugfix of ENS automatic connection +- eth-tester support for Byzantium +- New migration guide for v3 -> v4 upgrade +- Various documentation updates +- Pinned eth-account to older version + +v4.0.0 +----------------- + +Released Apr 2, 2018 + +- Marked beta.13 as stable +- Documentation tweaks + +v4.0.0-beta.13 +----------------- + +Released Mar 27, 2018 + +*This is intended to be the final release before the stable v4 release.* + +- Add support for geth 1.8 (fixed error on :meth:`~web3.eth.Eth.getTransactionReceipt`) +- You can now call a contract method at a specific block + with the ``block_identifier`` keyword argument, see: + :meth:`~web3.contract.ContractFunction.call` +- In preparation for stable release, disable ``w3.eth.account`` by default, + until a third-party audit is complete & resolved. +- New API for contract deployment, which enables gas estimation, local signing, etc. + See :meth:`~web3.contract.Contract.constructor`. +- Find contract events with :ref:`contract.events.$my_event.createFilter() ` +- Support auto-complete for contract methods. +- Upgrade most dependencies to stable + + - eth-abi + - eth-utils + - hexbytes + - *not included: eth-tester and eth-account* +- Switch the default EthereumTesterProvider backend from eth-testrpc to eth-tester: + :class:`web3.providers.eth_tester.EthereumTesterProvider` +- A lot of documentation improvements +- Test node integrations over a variety of providers +- geth 1.8 test suite + + +v4.0.0-beta.12 +----------------- + +A little hiccup on release. Skipped. + +v4.0.0-beta.11 +----------------- + +Released Feb 28, 2018 + +- New methods to modify or replace pending transactions +- A compatibility option for connecting to ``geth --dev`` -- see :ref:`geth-poa` +- A new :attr:`web3.net.chainId` +- Create a filter object from an existing filter ID. +- eth-utils v1.0.1 (stable) compatibility + + +v4.0.0-beta.10 +----------------- + +Released Feb 21, 2018 + +- bugfix: Compatibility with eth-utils v1-beta2 + (the incompatibility was causing fresh web3.py installs to fail) +- bugfix: crash when sending the output of ``contract.functions.myFunction().buildTransaction()`` + to :meth:`~web3.eth.Eth.sendTransaction`. Now, having a chainID key does not crash + sendTransaction. +- bugfix: a TypeError when estimating gas like: + ``contract.functions.myFunction().estimateGas()`` is fixed +- Added parity integration tests to the continuous integration suite! +- Some py3 and docs cleanup + +v4.0.0-beta.9 +------------- + +Released Feb 8, 2018 + +- Access event log parameters as attributes +- Support for specifying nonce in eth-tester +- `Bugfix `_ + dependency conflicts between eth-utils, eth-abi, and eth-tester +- Clearer error message when invalid keywords provided to contract constructor function +- New docs for working with private keys + set up doctests +- First parity integration tests +- replace internal implementation of w3.eth.account with + :class:`eth_account.account.Account` + +v4.0.0-beta.8 +------------- + +Released Feb 7, 2018, then recalled. It added 32MB of test data to git history, +so the tag was deleted, as well as the corresponding release. +(Although the release would not have contained that test data) + +v4.0.0-beta.7 +------------- + +Released Jan 29, 2018 + +- Support for :meth:`web3.eth.Eth.getLogs` in eth-tester with py-evm +- Process transaction receipts with Event ABI, using + `Contract.events.myEvent(*args, **kwargs).processReceipt(transaction_receipt)` + see :ref:`event-log-object` for the new type. +- Add timeout parameter to :class:`web3.providers.ipc.IPCProvider` +- bugfix: make sure `idna` package is always installed +- Replace ethtestrpc with py-evm, in all tests +- Dockerfile fixup +- Test refactoring & cleanup +- Reduced warnings during tests + +v4.0.0-beta.6 +------------- + +Released Jan 18, 2018 + +- New contract function call API: `my_contract.functions.my_func().call()` is preferred over the now + deprecated `my_contract.call().my_func()` API. +- A new, sophisticated gas estimation algorithm, based on the https://ethgasstation.info approach. + You must opt-in to the new approach, because it's quite slow. We recommend using the new caching middleware. + See :meth:`web3.gas_strategies.time_based.construct_time_based_gas_price_strategy` +- New caching middleware that can cache based on time, block, or indefinitely. +- Automatically retry JSON-RPC requests over HTTP, a few times. +- ConciseContract now has the address directly +- Many eth-tester fixes. :class:`web3.providers.eth_tester.main.EthereumTesterProvider` is now a + legitimate alternative to :class:`web3.providers.tester.EthereumTesterProvider`. +- ethtest-rpc removed from testing. Tests use eth-tester only, on pyethereum. Soon it will be + eth-tester with py-evm. +- Bumped several dependencies, like eth-tester +- Documentation updates + +v4.0.0-beta.5 +------------- + +Released Dec 28, 2017 + +* Improvements to working with eth-tester, using :class:`~web3.providers.eth_tester.EthereumTesterProvider`: + + * Bugfix the key names in event logging + * Add support for :meth:`~web3.eth.Eth.sendRawTransaction` +* :class:`~web3.providers.ipc.IPCProvider` now automatically retries on a broken connection, like when you restart your node +* New gas price engine API, laying groundwork for more advanced gas pricing strategies + +v4.0.0-beta.4 +------------- + +Released Dec 7, 2017 + +* New :meth:`~web3.contract.Contract.buildTransaction` method to prepare contract transactions, offline +* New automatic provider detection, for ``w3 = Web3()`` initialization +* Set environment variable `WEB3_PROVIDER_URI` to suggest a provider for automatic detection +* New API to set providers like: ``w3.providers = [IPCProvider()]`` +* Crashfix: :meth:`web3.eth.Eth.filter` when retrieving logs with the argument 'latest' +* Bump eth-tester to v0.1.0-beta.5, with bugfix for filtering by topic +* Removed GPL lib ``pylru``, now believed to be in full MIT license compliance. + +v4.0.0-beta.3 +------------- + +Released Dec 1, 2017 + +* Fix encoding of ABI types: ``bytes[]`` and ``string[]`` +* Windows connection error bugfix +* Bugfix message signatures that were broken ~1% of the time (zero-pad ``r`` and ``s``) +* Autoinit web3 now produces None instead of raising an exception on ``from web3.auto import w3`` +* Clearer errors on formatting failure (includes field name that failed) +* Python modernization, removing Py2 compatibility cruft +* Update dependencies with changed names, now: + + * ``eth-abi`` + * ``eth-keyfile`` + * ``eth-keys`` + * ``eth-tester`` + * ``eth-utils`` +* Faster Travis CI builds, with cached geth binary + +v4.0.0-beta.2 +------------- + +Released Nov 22, 2017 + +Bug Fixes: + +* :meth:`~web3.eth.Eth.sendRawTransaction` accepts raw bytes +* :meth:`~web3.eth.Eth.contract` accepts an ENS name as contract address +* :meth:`~web3.account.Account.signTransaction` returns the expected hash (*after* signing the transaction) +* :class:`~web3.account.Account` methods can all be called statically, like: ``Account.sign(...)`` +* :meth:`~web3.eth.Eth.getTransactionReceipt` returns the ``status`` field as an ``int`` +* :meth:`Web3.soliditySha3` looks up ENS names if they are supplied with an "address" ABI +* If running multiple threads with the same w3 instance, ``ValueError: Recursively called ...`` is no longer raised + +Plus, various python modernization code cleanups, and testing against geth 1.7.2. + +v4.0.0-beta.1 +------------- + +* Python 3 is now required +* ENS names can be used anywhere that a hex address can +* Sign transactions and messages with local private keys +* New filter mechanism: :meth:`~web3.utils.filters.Filter.get_all_entries` and :meth:`~web3.utils.filters.Filter.get_new_entries` +* Quick automatic initialization with ``from web3.auto import w3`` +* All addresses must be supplied with an EIP-55 checksum +* All addresses are returned with a checksum +* Renamed ``Web3.toDecimal()`` to ``toInt()``, see: :ref:`overview_type_conversions` +* All filter calls are synchronous, gevent integration dropped +* Contract :meth:`~web3.contract.Contract.eventFilter` has replaced both ``Contract.on()`` and ``Contract.pastEvents()`` +* Contract arguments of ``bytes`` ABI type now accept hex strings. +* Contract arguments of ``string`` ABI type now accept python ``str``. +* Contract return values of ``string`` ABI type now return python ``str``. +* Many methods now return a ``bytes``-like object where they used to return a hex string, like in :meth:`Web3.sha3()` +* IPC connection left open and reused, rather than opened and closed on each call +* A number of deprecated methods from v3 were removed + +3.16.1 +------ + +* Addition of ``ethereum-tester`` as a dependency + + +3.16.0 +------ + +* Addition of *named* middlewares for easier manipulation of middleware stack. +* Provider middlewares can no longer be modified during runtime. +* Experimental custom ABI normalization API for Contract objects. + + +3.15.0 +------ + +* Change docs to use RTD theme +* Experimental new ``EthereumTesterProvider`` for the ``ethereum-tester`` library. +* Bugfix for ``function`` type abi encoding via ``ethereum-abi-utils`` upgrade to ``v0.4.1`` +* Bugfix for ``Web3.toHex`` to conform to RPC spec. + + +3.14.2 +------ + +* Fix PyPi readme text. + + +3.14.1 +------ + +* Fix PyPi readme text. + +3.14.0 +------ + +* New ``stalecheck_middleware`` +* Improvements to ``Web3.toHex`` and ``Web3.toText``. +* Improvements to ``Web3.sha3`` signature. +* Bugfixes for ``Web3.eth.sign`` api + + +3.13.5 +------ + +* Add experimental ``fixture_middleware`` +* Various bugfixes introduced in middleware API introduction and migration to + formatter middleware. + + +3.13.4 +------ + +* Bugfix for formatter handling of contract creation transaction. + + + +3.13.3 +------ + +* Improved testing infrastructure. + + +3.13.2 +------ + +* Bugfix for retrieving filter changes for both new block filters and pending + transaction filters. + + +3.13.1 +------ + +* Fix mispelled ``attrdict_middleware`` (was spelled ``attrdict_middlware``). + + +3.13.0 +------ + +* New Middleware API +* Support for multiple providers +* New ``web3.soliditySha3`` +* Remove multiple functions that were never implemented from the original web3. +* Deprecated ``web3.currentProvider`` accessor. Use ``web3.provider`` now instead. +* Deprecated password prompt within ``web3.personal.newAccount``. + + +3.12.0 +------ + +* Bugfix for abi filtering to correctly handle ``constructor`` and ``fallback`` type abi entries. + +3.11.0 +------ + +* All web3 apis which accept ``address`` parameters now enforce checksums if the address *looks* like it is checksummed. +* Improvements to error messaging with when calling a contract on a node that may not be fully synced +* Bugfix for ``web3.eth.syncing`` to correctly handle ``False`` + +3.10.0 +------ + +* Web3 now returns ``web3.utils.datastructures.AttributeDict`` in places where it previously returned a normal ``dict``. +* ``web3.eth.contract`` now performs validation on the ``address`` parameter. +* Added ``web3.eth.getWork`` API + +3.9.0 +----- + +* Add validation for the ``abi`` parameter of ``eth`` +* Contract return values of ``bytes``, ``bytesXX`` and ``string`` are no longer converted to text types and will be returned in their raw byte-string format. + +3.8.1 +----- + +* Bugfix for ``eth_sign`` double hashing input. +* Removed deprecated ``DelegatedSigningManager`` +* Removed deprecate ``PrivateKeySigningManager`` + +3.8.0 +----- + +* Update pyrlp dependency to ``>=0.4.7`` +* Update eth-testrpc dependency to ``>=1.2.0`` +* Deprecate ``DelegatedSigningManager`` +* Deprecate ``PrivateKeySigningManager`` + +3.7.1 +----- + +* upstream version bump for bugfix in eth-abi-utils + +3.7.0 +----- + +* deprecate ``eth.defaultAccount`` defaulting to the coinbase account. + +3.6.2 +----- + +* Fix error message from contract factory creation. +* Use ``ethereum-utils`` for utility functions. + +3.6.1 +----- + +* Upgrade ``ethereum-abi-utils`` dependency for upstream bugfix. + +3.6.0 +----- + +* Deprecate ``Contract.code``: replaced by ``Contract.bytecode`` +* Deprecate ``Contract.code_runtime``: replaced by ``Contract.bytecode_runtime`` +* Deprecate ``abi``, ``code``, ``code_runtime`` and ``source`` as arguments for the ``Contract`` object. +* Deprecate ``source`` as a property of the ``Contract`` object +* Add ``Contract.factory()`` API. +* Deprecate the ``construct_contract_factory`` helper function. + +3.5.3 +----- + +* Bugfix for how ``requests`` library is used. Now reuses session. + +3.5.2 +----- + +* Bugfix for construction of ``request_kwargs`` within HTTPProvider + +3.5.1 +----- + +* Allow ``HTTPProvider`` to be imported from ``web3`` module. +* make ``HTTPProvider`` accessible as a property of ``web3`` instances. + +3.5.0 +----- + +* Deprecate ``web3.providers.rpc.RPCProvider`` +* Deprecate ``web3.providers.rpc.KeepAliveRPCProvider`` +* Add new ``web3.providers.rpc.HTTPProvider`` +* Remove hard dependency on gevent. + +3.4.4 +----- + +* Bugfix for ``web3.eth.getTransaction`` when the hash is unknown. + +3.4.3 +----- + +* Bugfix for event log data decoding to properly handle dynamic sized values. +* New ``web3.tester`` module to access extra RPC functionality from ``eth-testrpc`` + +3.4.2 +----- + +* Fix package so that ``eth-testrpc`` is not required. + +3.4.1 +----- + +* Force gevent<1.2.0 until this issue is fixed: https://github.com/gevent/gevent/issues/916 + +3.4.0 +----- + +* Bugfix for contract instances to respect ``web3.eth.defaultAccount`` +* Better error reporting when ABI decoding fails for contract method response. + +3.3.0 +----- + +* New ``EthereumTesterProvider`` now available. Faster test runs than ``TestRPCProvider`` +* Updated underlying eth-testrpc requirement. + +3.2.0 +----- + +* ``web3.shh`` is now implemented. +* Introduced ``KeepAliveRPCProvider`` to correctly recycle HTTP connections and use HTTP keep alive + +3.1.1 +----- + +* Bugfix for contract transaction sending not respecting the + ``web3.eth.defaultAccount`` configuration. + +3.1.0 +----- + +* New DelegatedSigningManager and PrivateKeySigningManager classes. + +3.0.2 +----- + +* Bugfix or IPCProvider not handling large JSON responses well. + +3.0.1 +----- + +* Better RPC compliance to be compatable with the Parity JSON-RPC server. + +3.0.0 +----- + +* ``Filter`` objects now support controlling the interval through which they poll + using the ``poll_interval`` property + +2.9.0 +----- + +* Bugfix generation of event topics. +* Web3.Iban now allows access to Iban address tools. + +2.8.1 +----- + +* Bugfix for ``geth.ipc`` path on linux systems. + +2.8.0 +----- + +* Changes to the ``Contract`` API: + * ``Contract.deploy()`` parameter arguments renamed to args + * ``Contract.deploy()`` now takes args and kwargs parameters to allow + constructing with keyword arguments or positional arguments. + * ``Contract.pastEvents`` now allows you to specify a ``fromBlock or + ``toBlock.`` Previously these were forced to be ``'earliest'`` and + ``web3.eth.blockNumber`` respectively. + * ``Contract.call``, ``Contract.transact`` and ``Contract.estimateGas`` are now + callable as class methods as well as instance methods. When called this + way, an address must be provided with the transaction parameter. + * ``Contract.call``, ``Contract.transact`` and ``Contract.estimateGas`` now allow + specifying an alternate address for the transaction. +* ``RPCProvider`` now supports the following constructor arguments. + * ``ssl`` for enabling SSL + * ``connection_timeout`` and ``network_timeout`` for controlling the timeouts + for requests. + +2.7.1 +----- + +* Bugfix: Fix KeyError in merge_args_and_kwargs helper fn. + +2.7.0 +----- + +* Bugfix for usage of block identifiers 'latest', 'earliest', 'pending' +* Sphinx documentation +* Non-data transactions now default to 90000 gas. +* Web3 object now has helpers set as static methods rather than being set at + initialization. +* RPCProvider now takes a ``path`` parameter to allow configuration for requests + to go to paths other than ``/``. + +2.6.0 +----- + +* TestRPCProvider no longer dumps logging output to stdout and stderr. +* Bugfix for return types of ``address[]`` +* Bugfix for event data types of ``address`` + +2.5.0 +----- + +* All transactions which contain a ``data`` element will now have their gas + automatically estimated with 100k additional buffer. This was previously + only true with transactions initiated from a ``Contract`` object. + +2.4.0 +----- + +* Contract functions can now be called using keyword arguments. + +2.3.0 +----- + +* Upstream fixes for filters +* Filter APIs ``on`` and ``pastEvents`` now callable as both instance and class methods. + +2.2.0 +----- + +* The filters that come back from the contract ``on`` and ``pastEvents`` methods + now call their callbacks with the same data format as ``web3.js``. + +2.1.1 +----- + +* Cast RPCProvider port to an integer. + +2.1.0 +----- + +* Remove all monkeypatching + +2.0.0 +----- + +* Pull in downstream updates to proper gevent usage. +* Fix ``eth_sign`` +* Bugfix with contract operations mutating the transaction object that is passed in. +* More explicit linting ignore statements. + +1.9.0 +----- + +* BugFix: fix for python3 only ``json.JSONDecodeError`` handling. + +1.8.0 +----- + +* BugFix: ``RPCProvider`` not sending a content-type header +* Bugfix: ``web3.toWei`` now returns an integer instead of a decimal.Decimal + +1.7.1 +----- + +* ``TestRPCProvider`` can now be imported directly from ``web3`` + +1.7.0 +----- + +* Add ``eth.admin`` interface. +* Bugfix: Format the return value of ``web3.eth.syncing`` +* Bugfix: IPCProvider socket interactions are now more robust. + +1.6.0 +----- + +* Downstream package upgrades for ``eth-testrpc`` and ``ethereum-tester-client`` to + handle configuration of the Homestead and DAO fork block numbers. + +1.5.0 +----- + +* Rename ``web3.contract._Contract`` to ``web3.contract.Contract`` + to expose it for static analysis and auto completion tools +* Allow passing string parameters to functions +* Automatically compute gas requirements for contract deployment and +* transactions. +* Contract Filters +* Block, Transaction, and Log filters +* ``web3.eth.txpool`` interface +* ``web3.eth.mining`` interface +* Fixes for encoding. + +1.4.0 +----- + +* Bugfix to allow address types in constructor arguments. + +1.3.0 +----- + +* Partial implementation of the ``web3.eth.contract`` interface. + +1.2.0 +----- + +* Restructure project modules to be more *flat* +* Add ability to run test suite without the *slow* tests. +* Breakup ``encoding`` utils into smaller modules. +* Basic pep8 formatting. +* Apply python naming conventions to internal APIs +* Lots of minor bugfixes. +* Removal of dead code left behind from ``1.0.0`` refactor. +* Removal of ``web3/solidity`` module. + +1.1.0 +----- + +* Add missing ``isConnected()`` method. +* Add test coverage for ``setProvider()`` + +1.0.1 +----- + +* Specify missing ``pyrlp`` and ``gevent`` dependencies + +1.0.0 +----- + +* Massive refactor to the majority of the app. + +0.1.0 +----- + +* Initial release diff --git a/_build/html_zh_CN/_sources/resources.rst.txt b/_build/html_zh_CN/_sources/resources.rst.txt new file mode 100644 index 0000000000..983e9572fb --- /dev/null +++ b/_build/html_zh_CN/_sources/resources.rst.txt @@ -0,0 +1,98 @@ +.. _resources: + + +Resources and Learning Material +=============================== + +web3.py and the Ethereum Python ecosystem have an active community of developers and educators. +Here you'll find libraries, tutorials, examples, courses and other learning material. + +.. warning :: + + Links on this page are community submissions and are not vetted by the team that maintains + web3.py. As always, DYOR (Do Your Own Research). + + +First Steps +----------- + +Resources for those brand new to Ethereum: + +- `A Developer's Guide to Ethereum, Pt. 1 `__ +- `Ethereum Python Ecosystem Tour `__ + + +Courses +------- + +- `freeCodeCamp Solidity and Python Course (2022) `__ +- `Blockchain Python Programming Tutorial (2019) `__ + + +Tutorials +--------- + +- Intro to `Ape development framework `__ +- Intro to `websockets `__ and web3.py +- Intro to `asynchronous web3.py `__ +- Intro to `threaded web3.py `__ +- Sign `typed data messages `__ (EIP 712) +- Look up offchain data via `CCIP Read `__ +- Configure and `customize web3.py `__ +- `Decode a signed transaction `__ +- Find a historical contract `revert reason `__ +- Generate a `vanity address `__ +- Simulate transactions with `call state overrides `__ +- Configure web3 for `JSON-RPC fallback and MEV blocker providers `__ + + +Conference Presentations and Videos +----------------------------------- + +- `Web3.Py - Now And Near Future by Marc Garreau (2022, 15 mins) `__ +- `Python and DeFi by Curve Finance (2022, 15 mins) `__ +- `Working with MetaMask in Python by Rishab Kattimani (2022, 15 mins) `__ + + +Smart Contract Programming Languages +------------------------------------ + +- `Vyper `__ - Contract-oriented, pythonic programming language that targets EVM + + +Frameworks and Tooling +---------------------- + +- `Ape `__ - The Ethereum development framework for Python Developers, Data Scientists, and Security Professionals +- `Titanoboa `__ - A Vyper interpreter and testing framework +- `Wake `__ - A Python-based development and testing framework for Solidity +- `Brownie `__ - [No longer actively maintained] A Python-based development and testing framework for smart contracts targeting EVM + + +Libraries +--------- + +- `Web3 Ethereum DeFi `__ - Library for DeFi trading and protocols (Uniswap, PancakeSwap, Sushi, Aave, Chainlink) +- `lighter-v1-python `__ - Lighter.xyz DEX client for Python +- `uniswap-python `__ - Library lets you easily retrieve prices and make trades on all Uniswap versions. +- `pyWalletConnect `__ - WalletConnect implementation for wallets in Python +- `dydx-v3-python `__ - Python client for dYdX v3 +- `Lido Python SDK `__ - Library with which you can get all Lido validator's signatures and check their validity + + +Applications +------------ + +- `Curve Finance `__ +- `Yearn Finance `__ +- `StakeWise Oracle `__ + + +Hackathon Helpers +----------------- + +- `ape-hackathon-kit `__ - Ape project template with a web front-end (Next.js, Tailwind, RainbowKit, wagmi) +- `eth-flogger `__ - Sample web app utilizing async web3.py, Flask, SQLite, Sourcify +- `Temo `__ - Sample terminal app utilizing async web3py, Textual, Anvil +- `web3py-discord-bot `__ - Sample Discord bot utilizing websockets, ``eth_subscribe``, and discord.py +- `py-signer `__ - Demo of typed data message signing (EIP-712) with eth-account and Ape diff --git a/_build/html_zh_CN/_sources/subscriptions.rst.txt b/_build/html_zh_CN/_sources/subscriptions.rst.txt new file mode 100644 index 0000000000..6f853688e2 --- /dev/null +++ b/_build/html_zh_CN/_sources/subscriptions.rst.txt @@ -0,0 +1,335 @@ +.. _subscriptions: + +Event Subscriptions +=================== + +Most Ethereum clients include ``eth_subscribe`` support, allowing you to listen for specific events as they occur. This applies to a limited set of events: new block headers, the syncing status of a node, new pending transactions, and emitted logs from smart contracts. + +.. warning:: + + Subscriptions require a persistent socket connection between you and the Ethereum client. For that reason, you must use web3.py's :class:`~web3.providers.persistent.WebSocketProvider` or :class:`~web3.providers.persistent.AsyncIPCProvider` to utilize subscriptions. As it is the more common of the two, examples in this guide will leverage the ``WebSocketProvider``. + +An introduction to subscriptions +-------------------------------- + +When you subscribe to an event – new block headers, for example – you'll receive a subscription ID. The Ethereum client will then maintain a connection to your application and send along any related event until you unsubscribe with that ID. That example in code: + +.. code-block:: python + + import asyncio + from web3 import AsyncWeb3, WebSocketProvider + + async def example(): + # connect to a node: + async with AsyncWeb3(WebSocketProvider("wss://...")) as w3: + + # subscribe to new block headers: + subscription_id = await w3.eth.subscribe("newHeads") + print(subscription_id) + + # listen for events as they occur: + async for response in w3.socket.process_subscriptions(): + # handle each event: + print(response) + + # unsubscribe: + if response["number"] > 42012345: + await w3.eth.unsubscribe(subscription_id) + break + + asyncio.run(example()) + + +web3.py's ``subscription_manager`` +---------------------------------- + +The example above is the "manual" approach to managing subscriptions. It's not so complicated in the case of listening for new block headers, but things get considerably more complex once you start listening for smart contract event logs or managing multiple subscriptions. +As of v7.7.0, web3.py includes some additional convenient subscription management features. We'll step through them now. + +1.) The subscription_manager +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``w3`` (``AsyncWeb3``) instance has a ``subscription_manager`` module. While you may +still use the ``w3.eth.subscribe`` method from the previous example, the +``subscription_manager`` offers an additional way to start one or more subscriptions and +provides better management of those subscriptions. We're going to pass in a list of +events we want to subscribe to within the ``w3.subscription_manager.subscribe`` method. + +.. code-block:: python + + await w3.subscription_manager.subscribe([sub1, sub2, ...]) + + +2.) Subscription types +~~~~~~~~~~~~~~~~~~~~~~ + +To aid in defining those subscriptions, subscription type classes have been introduced: ``NewHeadsSubscription``, ``PendingTxSubscription``, ``LogsSubscription``, and ``SyncingSubscription``. Each class is context aware, meaning it will throw an error if you provide an unexpected data type. + +.. code-block:: python + + from web3.utils.subscriptions import ( + NewHeadsSubscription, + PendingTxSubscription, + LogsSubscription, + ) + + sub1 = NewHeadsSubscription( + label="new-heads-mainnet", # optional label + handler=new_heads_handler, + ) + + sub2 = PendingTxSubscription( + label="pending-tx-mainnet", # optional label + full_transactions=True, + handler=pending_tx_handler, + # optional parallelization flag (see Parallelizing subscriptions section below) + parallelize=True, + ) + + sub3 = LogsSubscription( + label="WETH transfers", # optional label + address=weth_contract.address, + topics=[weth_contract.events.Transfer().topic], + handler=log_handler, + # optional `handler_context` args to help parse a response + handler_context={"transfer_event": weth_contract.events.Transfer()}, + ) + + +3.) Handlers +~~~~~~~~~~~~ + +In the example above, there is a handler specified for each subscription. These are context-aware functions that you can declare separate from the subscription logic. Within each handler, parse and perform whatever logic you require. +Note that in addition to the result being processed, the ``handler_context`` in each handler provides access to your ``AsyncWeb3`` instance, the subscription instance, and any custom values declared within the ``handler_context`` of the subscription: ``from web3.utils.subscriptions import LogsSubscriptionContext`` + +.. code-block:: python + + async def new_heads_handler( + handler_context: LogsSubscriptionContext, + ) -> None: + log_receipt = handler_context.result + print(f"New log: {log_receipt}\n") + + event_data = handler_context.transfer_event.process_log(log_receipt) + print(f"Log event data: {event_data}\n") + + if log_receipt["blockNumber"] > 42012345: + await handler_context.subscription.unsubscribe() + + +4.) handle_subscriptions +~~~~~~~~~~~~~~~~~~~~~~~~ + +Finally, when all your subscriptions are configured, utilize the handle_subscriptions method to begin processing them. If you need to listen for events on multiple chains, create one w3 instance per chain. + +.. code-block:: python + + async def sub_manager(): + ... + + # handle subscriptions via configured handlers: + await w3.subscription_manager.handle_subscriptions() + + # or, gather one w3 instance per chain: + await asyncio.gather( + w3.subscription_manager.handle_subscriptions(), + l2_w3.subscription_manager.handle_subscriptions(), + ) + + asyncio.run(sub_manager()) + + +5.) Unsubscribing +~~~~~~~~~~~~~~~~~ + +If you don't want to subscribe indefinitely to an event, you can unsubscribe at any point. The first example in this post demonstrated the manual approach: ``await w3.eth.unsubscribe(subscription_id)`` + + +The new handler pattern will keep track of the subscription ID for you however, so the same can be accomplished via the ``handler_context`` without an ID: + +.. code-block:: python + + async def new_heads_handler(handler_context): + ... + if some_condition: + await handler_context.subscription.unsubscribe() + + +Lastly, if you're wrapping up the whole show, you can reach for ``unsubscribe_all`` on the subscription_manager: + +.. code-block:: python + + await w3.subscription_manager.unsubscribe_all() + assert subscription_manager.subscriptions == [] + + +An example +---------- + +Let's put all the pieces together. This example will subscribe to new block headers and transfer events from the WETH contract. It should work as written if you provide a WebSocket RPC URL. + +.. code-block:: python + + import asyncio + from web3 import AsyncWeb3, WebSocketProvider + from web3.utils.subscriptions import ( + NewHeadsSubscription, + NewHeadsSubscriptionContext, + LogsSubscription, + LogsSubscriptionContext, + ) + + # -- declare handlers -- + async def new_heads_handler( + handler_context: NewHeadsSubscriptionContext, + ) -> None: + header = handler_context.result + print(f"New block header: {header}\n") + + async def log_handler( + handler_context: LogsSubscriptionContext, + ) -> None: + log_receipt = handler_context.result + print(f"Log receipt: {log_receipt}\n") + + async def sub_manager(): + + # -- initialize provider -- + w3 = await AsyncWeb3(WebSocketProvider("wss://...")) + + # -- subscribe to event(s) -- + await w3.subscription_manager.subscribe( + [ + NewHeadsSubscription( + label="new-heads-mainnet", + handler=new_heads_handler + ), + LogsSubscription( + label="WETH transfers", + address=w3.to_checksum_address( + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" + ), + topics=["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"], + handler=log_handler, + ), + ] + ) + + # -- listen for events -- + await w3.subscription_manager.handle_subscriptions() + + asyncio.run(sub_manager()) + + +Parallelizing subscriptions +--------------------------- + +.. important:: + + Parallelizing subscriptions does not guarantee that events will be processed in the + order they are received. Most events should still be processed in the order they are + received, but if a particular handler takes a long time to execute, newer events may + be processed first. It is recommended to set the ``parallelize`` flag to ``False`` + (default behavior) for subscriptions that depend on the order of events. + + +If you have multiple subscriptions that can be processed in parallel, you can set the +``parallelize`` flag to ``True`` - either globally on the subscription manager, or +individually on each subscription. This control allows the subscription manager to +handle subscription processing concurrently. This flag can be set on the manager, as a +global setting, or on individual subscriptions. This can help with performance if +subscriptions are independent of each other, or do not rely on some external shared +state (no race conditions are present). + +Global parallelization is off by default, meaning all subscriptions will be processed +sequentially unless you set the ``parallelize`` flag to ``True`` on the subscription +manager or individual subscriptions. + +.. code-block:: python + + sub1 = NewHeadsSubscription( + label="new-heads-mainnet", + handler=new_heads_handler, + parallelize=True, # process this subscription in parallel + ) + + sub2 = LogsSubscription( + label="WETH transfers", + address=weth_contract.address, + topics=[weth_contract.events.Transfer().topic], + handler=log_handler, + parallelize=False, # process sequentially (this is the default behavior) + ) + + sub3 = LogsSubscription( + label="WETH approvals", + address=weth_contract.address, + topics=[weth_contract.events.Approval().topic], + handler=approval_handler, + parallelize=True, # process this subscription in parallel + ) + + await w3.subscription_manager.subscribe([sub1, sub2]) + +Global parallelization can also be set on the subscription manager, which will apply to +all subscriptions unless overridden by an individual subscription's ``parallelize`` +flag: + +.. code-block:: python + + # or set the parallelize flag globally on the subscription manager: + w3.subscription_manager.parallelize = True + + # parallelize is set globally, so this will be processed in parallel + sub1 = NewHeadsSubscription( + label="new-heads-mainnet", + handler=new_heads_handler, + ) + + # this will be processed sequentially since ``parallelize`` is set to ``False``, + # overriding the global setting + sub2 = LogsSubscription( + label="WETH transfers", + address=weth_contract.address, + topics=[weth_contract.events.Transfer().topic], + handler=log_handler, + parallelize=False, # process sequentially + ) + + # this will also be processed in parallel + sub3 = LogsSubscription( + label="WETH approvals", + address=weth_contract.address, + topics=[weth_contract.events.Approval().topic], + handler=approval_handler, + ) + + await w3.subscription_manager.subscribe([sub1, sub2, sub3]) + + +FAQ +--- + + +How can I subscribe to additional events once my application is running? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Wherever you have a ``w3`` instance of the ``AsyncWeb3`` object, you can use the ``subscription_manager`` to subscribe to new events. + +For example, the handler of one subscription could initialize a new subscription: + +.. code-block:: python + + async def log_handler( + handler_context: LogsSubscriptionContext, + ) -> None: + log_receipt = handler_context.result + print(f"Log receipt: {log_receipt}\n") + + # reference the w3 instance + w3 = handler_context.async_w3 + + # initialize a new subscription + await w3.subscription_manager.subscribe( + NewHeadsSubscription(handler=new_heads_handler) + ) diff --git a/_build/html_zh_CN/_sources/toc.rst.txt b/_build/html_zh_CN/_sources/toc.rst.txt new file mode 100644 index 0000000000..5cf40453f0 --- /dev/null +++ b/_build/html_zh_CN/_sources/toc.rst.txt @@ -0,0 +1,56 @@ +Table of Contents +----------------- + +.. toctree:: + :maxdepth: 1 + :caption: Intro + + quickstart + overview + release_notes + +.. toctree:: + :maxdepth: 1 + :caption: Guides + + providers + web3.eth.account + transactions + web3.contract + filters + subscriptions + middleware + internals + ens_overview + troubleshooting + migration + +.. toctree:: + :maxdepth: 1 + :caption: API + + web3.main + web3.eth + web3.beacon + web3.net + web3.geth + web3.tracing + web3.utils + gas_price + ens + constants + +.. toctree:: + :maxdepth: 1 + :caption: Community + + resources + contributing + code_of_conduct + +Indices and tables +------------------ + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/_build/html_zh_CN/_sources/transactions.rst.txt b/_build/html_zh_CN/_sources/transactions.rst.txt new file mode 100644 index 0000000000..b0066b29c6 --- /dev/null +++ b/_build/html_zh_CN/_sources/transactions.rst.txt @@ -0,0 +1,196 @@ +Transactions +============ + +There are a handful of ways to interact with transactions in web3.py. See the +:ref:`Web3.eth module ` for a full list of transaction-related methods. Note that you may also :ref:`batch requests ` that read transaction data, but not send new transactions in a batch request. + +The rest of this guide covers the decision tree for how to send a transaction. + +.. note:: + + Prefer to view this code in a Jupyter Notebook? View the repo `here `_. + +There are two methods for sending transactions using web3.py: :meth:`~web3.eth.Eth.send_transaction` and :meth:`~web3.eth.Eth.send_raw_transaction`. A brief guide: + +#. Want to sign a transaction offline or send pre-signed transactions? + + * use :meth:`sign_transaction ` + :meth:`~web3.eth.Eth.send_raw_transaction` + +#. Are you primarily using the same account for all transactions and would you prefer to save a few lines of code? + + * configure the ``build`` method for :class:`~web3.middleware.SignAndSendRawMiddlewareBuilder`, then + * use :meth:`~web3.eth.Eth.send_transaction` + +#. Otherwise: + + * load account via eth-account (:meth:`w3.eth.account.from_key(pk) `), then + * use :meth:`~web3.eth.Eth.send_transaction` + +Interacting with or deploying a contract? + +* Option 1: :meth:`~web3.contract.ContractFunction.transact` uses :meth:`~web3.eth.Eth.send_transaction` under the hood +* Option 2: :meth:`~web3.contract.ContractFunction.build_transaction` + :meth:`sign_transaction ` + :meth:`~web3.eth.Eth.send_raw_transaction` + +An example for each can be found below. + + +Chapter 0: ``w3.eth.send_transaction`` with ``eth-tester`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Many tutorials use ``eth-tester`` (via EthereumTesterProvider) for convenience and speed +of conveying ideas/building a proof of concept. Transactions sent by test accounts are +auto-signed. + +.. code-block:: python + + from web3 import Web3, EthereumTesterProvider + + w3 = Web3(EthereumTesterProvider()) + + # eth-tester populates accounts with test ether: + acct1 = w3.eth.accounts[0] + + some_address = "0x0000000000000000000000000000000000000000" + + # when using one of its generated test accounts, + # eth-tester signs the tx (under the hood) before sending: + tx_hash = w3.eth.send_transaction({ + "from": acct1, + "to": some_address, + "value": 123123123123123 + }) + + tx = w3.eth.get_transaction(tx_hash) + assert tx["from"] == acct1 + + +Chapter 1: ``w3.eth.send_transaction`` + signer middleware +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The :meth:`~web3.eth.Eth.send_transaction` method is convenient and to-the-point. +If you want to continue using the pattern after graduating from ``eth-tester``, you can +utilize web3.py middleware to sign transactions from a particular account: + +.. code-block:: python + + from web3.middleware import SignAndSendRawMiddlewareBuilder + import os + + # Note: Never commit your key in your code! Use env variables instead: + pk = os.environ.get('PRIVATE_KEY') + + # Instantiate an Account object from your key: + acct2 = w3.eth.account.from_key(pk) + + # For the sake of this example, fund the new account: + w3.eth.send_transaction({ + "from": acct1, + "value": w3.to_wei(3, 'ether'), + "to": acct2.address + }) + + # Add acct2 as auto-signer: + w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct2), layer=0) + # pk also works: w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(pk), layer=0) + + # Transactions from `acct2` will then be signed, under the hood, in the middleware: + tx_hash = w3.eth.send_transaction({ + "from": acct2.address, + "value": 3333333333, + "to": some_address + }) + + tx = w3.eth.get_transaction(tx_hash) + assert tx["from"] == acct2.address + + # Optionally, you can set a default signer as well: + # w3.eth.default_account = acct2.address + # Then, if you omit a "from" key, acct2 will be used. + + +Chapter 2: ``w3.eth.send_raw_transaction`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +if you don't opt for the middleware, you'll need to: + +- build each transaction, +- :meth:`sign_transaction `, and +- then use :meth:`~web3.eth.Eth.send_raw_transaction`. + +.. code-block:: python + + # 1. Build a new tx + transaction = { + 'from': acct2.address, + 'to': some_address, + 'value': 1000000000, + 'nonce': w3.eth.get_transaction_count(acct2.address), + 'gas': 200000, + 'maxFeePerGas': 2000000000, + 'maxPriorityFeePerGas': 1000000000, + } + + # 2. Sign tx with a private key + signed = w3.eth.account.sign_transaction(transaction, pk) + + # 3. Send the signed transaction + tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction) + tx = w3.eth.get_transaction(tx_hash) + assert tx["from"] == acct2.address + + +Chapter 3: Contract transactions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The same concepts apply for contract interactions, at least under the hood. + +Executing a function on a smart contract requires sending a transaction, which is typically done in one of two ways: + +- executing the :meth:`~web3.contract.ContractFunction.transact` function, or +- :meth:`~web3.contract.ContractFunction.build_transaction`, then signing and sending the raw transaction. + +.. code-block:: python + + ######################################### + #### SMOL CONTRACT FOR THIS EXAMPLE: #### + ######################################### + # // SPDX-License-Identifier: MIT + # pragma solidity 0.8.17; + # + # contract Billboard { + # string public message; + # + # constructor(string memory _message) { + # message = _message; + # } + # + # function writeBillboard(string memory _message) public { + # message = _message; + # } + # } + + # After compiling the contract, initialize the contract factory: + init_bytecode = "60806040523480156200001157600080fd5b5060..." + abi = '[{"inputs": [{"internalType": "string","name": "_message",...' + Billboard = w3.eth.contract(bytecode=init_bytecode, abi=abi) + + # Deploy a contract using `transact` + the signer middleware: + tx_hash = Billboard.constructor("gm").transact({"from": acct2.address}) + receipt = w3.eth.get_transaction_receipt(tx_hash) + deployed_addr = receipt["contractAddress"] + + # Reference the deployed contract: + billboard = w3.eth.contract(address=deployed_addr, abi=abi) + + # Manually build and sign a transaction: + unsent_billboard_tx = billboard.functions.writeBillboard("gn").build_transaction({ + "from": acct2.address, + "nonce": w3.eth.get_transaction_count(acct2.address), + }) + signed_tx = w3.eth.account.sign_transaction(unsent_billboard_tx, private_key=acct2.key) + + # Send the raw transaction: + assert billboard.functions.message().call() == "gm" + tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction) + w3.eth.wait_for_transaction_receipt(tx_hash) + assert billboard.functions.message().call() == "gn" diff --git a/_build/html_zh_CN/_sources/troubleshooting.rst.txt b/_build/html_zh_CN/_sources/troubleshooting.rst.txt new file mode 100644 index 0000000000..98d1c9d38c --- /dev/null +++ b/_build/html_zh_CN/_sources/troubleshooting.rst.txt @@ -0,0 +1,478 @@ +Troubleshooting +=============== + +.. _setup_environment: + +Set up a clean environment +-------------------------- + +Many things can cause a broken environment. You might be on an unsupported version of Python. +Another package might be installed that has a name or version conflict. +Often, the best way to guarantee a correct environment is with ``virtualenv``, like: + +.. code-block:: shell + + # Install pip if it is not available: + $ which pip || curl https://bootstrap.pypa.io/get-pip.py | python + + # Install virtualenv if it is not available: + $ which virtualenv || pip install --upgrade virtualenv + + # *If* the above command displays an error, you can try installing as root: + $ sudo pip install virtualenv + + # Create a virtual environment: + $ virtualenv -p python3 ~/.venv-py3 + + # Activate your new virtual environment: + $ source ~/.venv-py3/bin/activate + + # With virtualenv active, make sure you have the latest packaging tools + $ pip install --upgrade pip setuptools + + # Now we can install web3.py... + $ pip install --upgrade web3 + +.. NOTE:: Remember that each new terminal session requires you to reactivate your virtualenv, like: + ``$ source ~/.venv-py3/bin/activate`` + + +.. _instance_troubleshooting: + +Why can't I use a particular function? +-------------------------------------- + +Note that a web3.py instance must be configured before you can use most of its capabilities. +One symptom of not configuring the instance first is an error that looks something like this: +``AttributeError: type object 'Web3' has no attribute 'eth'``. + +To properly configure your web3.py instance, specify which provider you're using to connect to the +Ethereum network. An example configuration, if you're connecting to a locally run node, might be: + +.. code-block:: python + + >>> from web3 import Web3 + >>> w3 = Web3(Web3.HTTPProvider('http://localhost:8545')) + + # now `w3` is available to use: + >>> w3.is_connected() + True + >>> w3.eth.send_transaction(...) + +Refer to the :ref:`providers` documentation for further help with configuration. + + +.. _use_metamask_accounts: + +Why isn't my web3 instance connecting to the network? +----------------------------------------------------- +You can check that your instance is connected via the ``is_connected`` method: + +.. code-block:: python + + >>> w3.is_connected() + False + +There are a variety of explanations for why you may see ``False`` here. To help you +diagnose the problem, ``is_connected`` has an optional ``show_traceback`` argument: + +.. code-block:: python + + >>> w3.is_connected(show_traceback=True) + # this is an example, your error may differ + + # + ProviderConnectionError: Problem connecting to provider with error: : cannot connect to IPC socket at path: None + +If you're running a local node, such as Geth, double-check that you've indeed started +the binary and that you've started it from the intended directory - particularly if +you've specified a relative path to its ipc file. + +If that does not address your issue, it's probable that you still have a +Provider configuration issue. There are several options for configuring +a Provider, detailed :ref:`here`. + +.. _faucets: + +How do I get ether for my test network? +--------------------------------------- + +Test networks usually have something called a "faucet" to +help get test ether to people who want to use it. The faucet +simply sends you test ether when you visit a web page, or ping a chat bot, etc. + +Each test network has its own version of test ether, so each one must maintain +its own faucet. Faucet mechanisms tend to come and go, so a web search for +"ethereum testnet faucet" should give you the most up-to-date options. + +How do I use my MetaMask accounts from web3.py? +----------------------------------------------- + +Export your private key from MetaMask, and use +the local private key tools in web3.py to sign and send transactions. + +See `how to export your private key +`_ +and :ref:`eth-account`. + +.. _account_troubleshooting: + +How do I create an account? +--------------------------- + +In general, your options for accounts are: + +- Import a keystore file for an account and :ref:`extract the private key`. +- Create an account via the :ref:`eth-account ` API, e.g., ``new_acct = w3.eth.account.create()``. +- Use an external service (e.g. Metamask) to generate a new account, then securely import its private key. + +.. Warning:: Don't store real value in an account until you are familiar with security best practices. + If you lose your private key, you lose your account! + +Why doesn't my transaction work on another network? +--------------------------------------------------- + +web3.py is an Ethereum-specific library, which defaults to +`"type 2" EIP-1559 transactions `_ +as of the London network upgrade. Some chains (including Ethereum L2s) do not support +the same transaction types. + +If your chain doesn't support this transaction type, you likely need to create a +"legacy" transaction, i.e., include ``gasPrice``, but not ``type``, ``maxFeePerGas``, +or ``maxPriorityFeePerGas`` in your transaction body. + +If that doesn't resolve your issue, open a GitHub issue or reach out for help in the community +`Discord`_ server if you're having trouble with an Ethereum-ecosystem chain. If you're +debugging in an alternative ecosystem, please find another appropriate forum to raise +your question. + +.. _Discord: https://discord.gg/GHryRvPB84 + + +How do I conform to ABI types? +------------------------------ + +The web3 library follows the following conventions: + +Bytes vs Text +~~~~~~~~~~~~~ + +* The term *bytes* is used to refer to the binary representation of a string. +* The term *text* is used to refer to unicode representations of strings. + +Hexadecimal Representations +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* All hexadecimal values will be returned as text. +* All hexadecimal values will be ``0x`` prefixed. + +Ethereum Addresses +~~~~~~~~~~~~~~~~~~ + +All addresses must be supplied in one of three ways: + +* A 20-byte hexadecimal that is checksummed using the `EIP-55 + `_ spec. +* A 20-byte binary address (python bytes type). +* While connected to an Ethereum Name Service (ENS) supported chain, an ENS name + (often in the form ``myname.eth``). + +Disabling Strict Bytes Type Checking +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There is a boolean flag on the ``Web3`` class and the ``ENS`` class that will disable +strict bytes type checking. This allows bytes values of Python strings and allows byte +strings less than the specified byte size, appropriately padding values that need +padding. To disable stricter checks, set the ``w3.strict_bytes_type_checking`` +(or ``ns.strict_bytes_type_checking``) flag to ``False``. This will no longer cause +the ``Web3`` / ``ENS`` instance to raise an error if a Python string is passed in +without a "0x" prefix. It will also render valid byte strings or hex strings +that are below the exact number of bytes specified by the ABI type by padding the value +appropriately, according to the ABI type. See the :ref:`disable-strict-byte-check` +section for an example on using the flag and more details. + +.. note:: + If a standalone ``ENS`` instance is instantiated from a ``Web3`` instance, i.e. + ``ns = ENS.from_web3(w3)``, it will inherit the value of the + ``w3.strict_bytes_type_checking`` flag from the ``Web3`` instance at the time of + instantiation. + + Also of note, all modules on the ``Web3`` class will inherit the value of this flag, + since all modules use the parent ``w3`` object reference under the hood. This means + that ``w3.eth.w3.strict_bytes_type_checking`` will always have the same value as + ``w3.strict_bytes_type_checking``. + + +For more details on the ABI +specification, refer to the +`Solidity ABI Spec `_. + + +Types by Example +~~~~~~~~~~~~~~~~ + +Let's use a contrived contract to demonstrate input types in web3.py: + +.. code-block:: none + + contract ManyTypes { + // booleans + bool public b; + + // unsigned ints + uint8 public u8; + uint256 public u256; + uint256[] public u256s; + + // signed ints + int8 public i8; + + // addresses + address public addr; + address[] public addrs; + + // bytes + bytes1 public b1; + + // structs + struct S { + address sa; + bytes32 sb; + } + mapping(address => S) addrStructs; + + function updateBool(bool x) public { b = x; } + function updateUint8(uint8 x) public { u8 = x; } + function updateUint256(uint256 x) public { u256 = x; } + function updateUintArray(uint256[] memory x) public { u256s = x; } + function updateInt8(int8 x) public { i8 = x; } + function updateAddr(address x) public { addr = x; } + function updateBytes1(bytes1 x) public { b1 = x; } + function updateMapping(S memory x) public { addrStructs[x.sa] = x; } + } + +Booleans +```````` + +.. code-block:: python + + contract_instance.functions.updateBool(True).transact() + +Unsigned Integers +````````````````` + +.. code-block:: python + + contract_instance.functions.updateUint8(255).transact() + contract_instance.functions.updateUint256(2**256 - 1).transact() + contract_instance.functions.updateUintArray([1, 2, 3]).transact() + +Signed Integers +``````````````` + +.. code-block:: python + + contract_instance.functions.updateInt8(-128).transact() + +Addresses +````````` + +.. code-block:: python + + contract_instance.functions.updateAddr("0x0000000000000000000000000000000000000000").transact() + +Bytes +````` + +.. code-block:: python + + contract_instance.functions.updateBytes1(HexBytes(255)).transact() + +Structs +``````` + +.. code-block:: python + + contract_instance.functions.updateMapping({"sa": "0x0000000000000000000000000000000000000000", "sb": HexBytes(123)}).transact() + + +How can I optimize Ethereum JSON-RPC API access? +------------------------------------------------ + +Your Ethereum node JSON-RPC API might be slow when fetching multiple and large requests, especially when running batch jobs. Here are some tips for how to speed up your web3.py application. + +- Run your client locally, e.g., `Go Ethereum `_ or `TurboGeth `_. The network latency and speed are the major limiting factors for fast API access. + +- Use IPC communication instead of HTTP/WebSockets. See :ref:`choosing_provider`. + +- Use an optimised JSON decoder. A future iteration of web3.py may change the default decoder or provide an API to configure one, but for now, you may patch the provider class to use `ujson `_. + +.. code-block:: python + + """JSON-RPC decoding optimised for web3.py""" + + from typing import cast + + import ujson + + from web3.providers import JSONBaseProvider + from web3.types import RPCResponse + + + def _fast_decode_rpc_response(raw_response: bytes) -> RPCResponse: + decoded = ujson.loads(raw_response) + return cast(RPCResponse, decoded) + + + def patch_provider(provider: JSONBaseProvider): + """Monkey-patch web3.py provider for faster JSON decoding. + + Call this on your provider after construction. + + This greatly improves JSON-RPC API access speeds, when fetching + multiple and large responses. + """ + provider.decode_rpc_response = _fast_decode_rpc_response + +Why am I getting Visual C++ or Cython not installed error? +---------------------------------------------------------- + +Some Windows users that do not have Microsoft Visual C++ version 14.0 or greater installed may see an error message +when installing web3.py as shown below: + +.. code-block:: shell + + error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ + + +To fix this error, download and install Microsoft Visual C++ from here : + +`Microsoft Visual C++ Redistributable for Visual Studio `_ + +- `x64 Visual C++ `_ + +- `x86 Visual C++ `_ + +- `ARM64 Visual C++ `_ + + +How do I convert currency denominations? +---------------------------------------- + +The following denominations are supported: + ++--------------+---------------------------------+ +| denomination | amount in wei | ++--------------+---------------------------------+ +| wei | 1 | ++--------------+---------------------------------+ +| kwei | 1000 | ++--------------+---------------------------------+ +| babbage | 1000 | ++--------------+---------------------------------+ +| femtoether | 1000 | ++--------------+---------------------------------+ +| mwei | 1000000 | ++--------------+---------------------------------+ +| lovelace | 1000000 | ++--------------+---------------------------------+ +| picoether | 1000000 | ++--------------+---------------------------------+ +| gwei | 1000000000 | ++--------------+---------------------------------+ +| shannon | 1000000000 | ++--------------+---------------------------------+ +| nanoether | 1000000000 | ++--------------+---------------------------------+ +| nano | 1000000000 | ++--------------+---------------------------------+ +| szabo | 1000000000000 | ++--------------+---------------------------------+ +| microether | 1000000000000 | ++--------------+---------------------------------+ +| micro | 1000000000000 | ++--------------+---------------------------------+ +| finney | 1000000000000000 | ++--------------+---------------------------------+ +| milliether | 1000000000000000 | ++--------------+---------------------------------+ +| milli | 1000000000000000 | ++--------------+---------------------------------+ +| ether | 1000000000000000000 | ++--------------+---------------------------------+ +| kether | 1000000000000000000000 | ++--------------+---------------------------------+ +| grand | 1000000000000000000000 | ++--------------+---------------------------------+ +| mether | 1000000000000000000000000 | ++--------------+---------------------------------+ +| gether | 1000000000000000000000000000 | ++--------------+---------------------------------+ +| tether | 1000000000000000000000000000000 | ++--------------+---------------------------------+ + +You can use the :meth:`~web3.from_wei` method +to convert a balance to ether (or another denomination). + +.. code-block:: python + + >>> web3.from_wei(3841357360894980500000001, 'ether') + Decimal('3841357.360894980500000001') + +To convert back to wei, you can use the inverse function, :meth:`~web3.to_wei`. +Note that Python's default floating point precision is insufficient for this +use case, so it's necessary to cast the value to a +`Decimal `_ if it isn't already. + +.. code-block:: python + + >>> from decimal import Decimal + >>> web3.to_wei(Decimal('3841357.360894980500000001'), 'ether') + 3841357360894980500000001 + +Best practice: If you need to work with multiple currency denominations, default +to wei. A typical workflow may require a conversion from some denomination to +wei, then from wei to whatever you need. + +.. code-block:: python + + >>> web3.to_wei(Decimal('0.000000005'), 'ether') + 5000000000 + >>> web3.from_wei(5000000000, 'gwei') + Decimal('5') + + +How do I adjust the log levels? +------------------------------- + +web3.py internally uses `Python logging subsystem `_. + +If you want to run your application logging in debug mode, below is an example of how to make some JSON-RPC traffic quieter. + +.. code-block:: python + + import logging + import coloredlogs + + def setup_logging(log_level=logging.DEBUG): + """Setup root logger and quiet some levels.""" + logger = logging.getLogger() + + # Set log format to display the logger name to hunt down verbose logging modules + fmt = "%(name)-25s %(levelname)-8s %(message)s" + + # Use colored logging output for console with the coloredlogs package + # https://pypi.org/project/coloredlogs/ + coloredlogs.install(level=log_level, fmt=fmt, logger=logger) + + # Disable logging of JSON-RPC requests and replies + logging.getLogger("web3.RequestManager").setLevel(logging.WARNING) + logging.getLogger("web3.providers.HTTPProvider").setLevel(logging.WARNING) + # logging.getLogger("web3.RequestManager").propagate = False + + # Disable all internal debug logging of requests and urllib3 + # E.g. HTTP traffic + logging.getLogger("requests").setLevel(logging.WARNING) + logging.getLogger("urllib3").setLevel(logging.WARNING) + + return logger diff --git a/_build/html_zh_CN/_sources/web3.beacon.rst.txt b/_build/html_zh_CN/_sources/web3.beacon.rst.txt new file mode 100644 index 0000000000..d1c952c50e --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.beacon.rst.txt @@ -0,0 +1,559 @@ +Beacon API +========== + +.. warning:: This API Is experimental. Client support is incomplete and the API itself is still evolving. + +To use this API, you'll need a beacon node running locally or remotely. To set that up, refer to the documentation of your specific client. + +Once you have a running beacon node, import and configure your beacon instance: + +.. code-block:: python + + >>> from web3.beacon import Beacon + >>> beacon = Beacon("http://localhost:5051") + +Methods +------- + +.. py:method:: Beacon.get_genesis() + + .. code-block:: python + + >>> beacon.get_genesis() + { + 'data': { + 'genesis_time': '1605700807', + 'genesis_validators_root': '0x9436e8a630e3162b7ed4f449b12b8a5a368a4b95bc46b941ae65c11613bfa4c1', + 'genesis_fork_version': '0x00002009' + } + } + +.. py:method:: Beacon.get_hash_root(state_id="head") + + .. code-block:: python + + >>> beacon.get_hash_root() + { + "data": { + "root":"0xbb399fda70617a6f198b3d9f1c1cdbd70077677231b84f34e58568c9dc903558" + } + } + +.. py:method:: Beacon.get_fork_data(state_id="head") + + .. code-block:: python + + >>> beacon.get_fork_data() + { + 'data': { + 'previous_version': '0x00002009', + 'current_version': '0x00002009', + 'epoch': '0' + } + } + +.. py:method:: Beacon.get_finality_checkpoint(state_id="head") + + .. code-block:: python + + >>> beacon.get_finality_checkpoint() + { + 'data': { + 'previous_justified': { + 'epoch': '5024', + 'root': '0x499ba555e8e8be639dd84be1be6d54409738facefc662f37d97065aa91a1a8d4' + }, + 'current_justified': { + 'epoch': '5025', + 'root': '0x34e8a230f11536ab2ec56a0956e1f3b3fd703861f96d4695877eaa48fbacc241' + }, + 'finalized': { + 'epoch': '5024', + 'root': '0x499ba555e8e8be639dd84be1be6d54409738facefc662f37d97065aa91a1a8d4' + } + } + } + +.. py:method:: Beacon.get_validators(state_id="head") + + .. code-block:: python + + >>> beacon.get_validators() + { + 'data': [ + { + 'index': '110280', + 'balance': '32000000000', + 'status': 'pending_queued', + 'validator': { + 'pubkey': '0x99d37d1f7dd15859995330f75c158346f86d298e2ffeedfbf1b38dcf3df89a7dbd1b34815f3bcd1b2a5588592a35b783', + 'withdrawal_credentials': '0x00f338cfdb0c22bb85beed9042bd19fff58ad6421c8a833f8bc902b7cca06f5f', + 'effective_balance': '32000000000', + 'slashed': False, + 'activation_eligibility_epoch': '5029', + 'activation_epoch': '18446744073709551615', + 'exit_epoch': '18446744073709551615', + 'withdrawable_epoch': '18446744073709551615' + } + }, + ... + ] + } + +.. py:method:: Beacon.get_validator(validator_id, state_id="head") + + .. code-block:: python + + >>> beacon.get_validator(110280) + { + 'data': { + 'index': '110280', + 'balance': '32000000000', + 'status': 'pending_queued', + 'validator': { + 'pubkey': '0x99d37d1f7dd15859995330f75c158346f86d298e2ffeedfbf1b38dcf3df89a7dbd1b34815f3bcd1b2a5588592a35b783', + 'withdrawal_credentials': '0x00f338cfdb0c22bb85beed9042bd19fff58ad6421c8a833f8bc902b7cca06f5f', + 'effective_balance': '32000000000', + 'slashed': False, + 'activation_eligibility_epoch': '5029', + 'activation_epoch': '18446744073709551615', + 'exit_epoch': '18446744073709551615', + 'withdrawable_epoch': '18446744073709551615' + } + } + } + +.. py:method:: Beacon.get_validator_balances(state_id="head") + + .. code-block:: python + + >>> beacon.get_validator_balances() + { + 'data': [ + { + 'index': '110278', + 'balance': '32000000000' + }, + ... + ] + } + +.. py:method:: Beacon.get_epoch_committees(state_id="head") + + .. code-block:: python + + >>> beacon.get_epoch_committees() + { + 'data': [ + { + 'slot': '162367', + 'index': '25', + 'validators': ['50233', '36829', '84635', ...], + }, + ... + ] + } + +.. py:method:: Beacon.get_block_headers() + + .. code-block:: python + + >>> beacon.get_block_headers() + { + 'data': [ + { + 'root': '0xa3873e7b1e0bcc7c59013340cfea59dff16e42e79825e7b8ab6c243dbafd4fe0', + 'canonical': True, + 'header': { + 'message': { + 'slot': '163587', + 'proposer_index': '69198', + 'parent_root': '0xc32558881dbb791ef045c48e3709a0978dc445abee4ae34d30df600eb5fbbb3d', + 'state_root': '0x4dc0a72959803a84ee0231160b05dda76a91b8f8b77220b4cfc7db160840b8a8', + 'body_root': '0xa3873e7b1e0bcc7c59013340cfea59dff16e42e79825e7b8ab6c243dbafd4fe0' + }, + 'signature': '0x87b549448d36e5e8b1783944b5511a05f34bb78ad3fcbf71a1adb346eed363d46e50d51ac53cd23bd03d0107d064e05913a6ef10f465f9171aba3b2b8a7a4d621c9e18d5f148813295a2d5aa5053029ccbd88cec72130833de2b4b7addf7faca' + } + } + ] + } + +.. py:method:: Beacon.get_block_header(block_id) + + .. code-block:: python + + >>> beacon.get_block_header(1) + { + 'data': { + root': '0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d', + 'canonical': True, + 'header': { + 'message': { + 'slot': '1', + 'proposer_index': '61090', + 'parent_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87', + 'state_root': '0x7773ed5a7e944c6238cd0a5c32170663ef2be9efc594fb43ad0f07ecf4c09d2b', + 'body_root': '0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d' + }, + 'signature': '0xa30d70b3e62ff776fe97f7f8b3472194af66849238a958880510e698ec3b8a470916680b1a82f9d4753c023153fbe6db10c464ac532c1c9c8919adb242b05ef7152ba3e6cd08b730eac2154b9802203ead6079c8dfb87f1e900595e6c00b4a9a' + } + } + } + +.. py:method:: Beacon.get_block(block_id) + + .. code-block:: python + + >>> beacon.get_block(1) + { + 'data': { + 'message': { + 'slot': '1', + 'proposer_index': '61090', + 'parent_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87', + 'state_root': '0x7773ed5a7e944c6238cd0a5c32170663ef2be9efc594fb43ad0f07ecf4c09d2b', + 'body': { + 'randao_reveal': '0x8e245a52a0a680fcfe789013e123880c321f237de10cad108dc55dd47290d7cfe50cdaa003c6f783405efdac48cef44e152493abba40d9f9815a060dd6151cb0635906c9e3c1ad4859cada73ccd2d6b8747e4aeeada7d75d454bcc8672afa813', + 'eth1_data': { + 'deposit_root': '0x4e910ac762815c13e316e72506141f5b6b441d58af8e0a049cd3341c25728752', + 'deposit_count': '100596', + 'block_hash': '0x89cb78044843805fb4dab8abd743fc96c2b8e955c58f9b7224d468d85ef57130' + }, + 'graffiti': '0x74656b752f76302e31322e31342b34342d673863656562663600000000000000', + 'proposer_slashings': [], + 'attester_slashings': [], + 'attestations': [ + { + 'aggregation_bits': '0x0080020004000000008208000102000905', + 'data': { + 'slot': '0', + 'index': '7', + 'beacon_block_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87', + 'source': { + 'epoch': '0', + 'root': '0x0000000000000000000000000000000000000000000000000000000000000000' + }, + 'target': { + 'epoch': '0', + 'root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87' + } + }, + 'signature': '0x967dd2946358db7e426ed19d4576bc75123520ef6a489ca50002222070ee4611f9cef394e5e3071236a93b825f18a4ad07f1d5a1405e6c984f1d71e03f535d13a2156d6ba22cb0c2b148df23a7b8a7293315d6e74b9a26b64283e8393f2ad4c5' + } + ], + 'deposits': [], + 'voluntary_exits': [] + } + }, + 'signature': '0xa30d70b3e62ff776fe97f7f8b3472194af66849238a958880510e698ec3b8a470916680b1a82f9d4753c023153fbe6db10c464ac532c1c9c8919adb242b05ef7152ba3e6cd08b730eac2154b9802203ead6079c8dfb87f1e900595e6c00b4a9a' + } + } + +.. py:method:: Beacon.get_block_root(block_id) + + .. code-block:: python + + >>> beacon.get_block_root(1) + { + 'data': { + 'root': '0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d' + } + } + +.. py:method:: Beacon.get_block_attestations(block_id) + + .. code-block:: python + + >>> beacon.get_block_attestations(1) + { + 'data': [ + { + 'aggregation_bits': '0x0080020004000000008208000102000905', + 'data': { + 'slot': '0', + 'index': '7', + 'beacon_block_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87', + 'source': { + 'epoch': '0', + 'root': '0x0000000000000000000000000000000000000000000000000000000000000000' + }, + 'target': { + 'epoch': '0', + 'root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87' + } + }, + 'signature': '0x967dd2946358db7e426ed19d4576bc75123520ef6a489ca50002222070ee4611f9cef394e5e3071236a93b825f18a4ad07f1d5a1405e6c984f1d71e03f535d13a2156d6ba22cb0c2b148df23a7b8a7293315d6e74b9a26b64283e8393f2ad4c5' + }, + ... + ] + } + +.. py:method:: Beacon.get_attestations() + + .. code-block:: python + + >>> beacon.get_attestations() + {'data': []} + + +.. py:method:: Beacon.get_attester_slashings() + + .. code-block:: python + + >>> beacon.get_attester_slashings() + {'data': []} + +.. py:method:: Beacon.get_proposer_slashings() + + .. code-block:: python + + >>> beacon.get_proposer_slashings() + {'data': []} + +.. py:method:: Beacon.get_voluntary_exits() + + .. code-block:: python + + >>> beacon.get_voluntary_exits() + {'data': []} + + +.. py:method:: Beacon.get_fork_schedule() + + .. code-block:: python + + >>> beacon.get_fork_schedule() + { + 'data': [ + { + 'previous_version': '0x00002009', + 'current_version': '0x00002009', + 'epoch': '0' + } + ] + } + +.. py:method:: Beacon.get_spec() + + .. code-block:: python + + >>> beacon.get_spec() + { + 'data': { + 'DEPOSIT_CONTRACT_ADDRESS': '0x8c5fecdC472E27Bc447696F431E425D02dd46a8c', + 'MIN_ATTESTATION_INCLUSION_DELAY': '1', + 'SLOTS_PER_EPOCH': '32', + 'SHUFFLE_ROUND_COUNT': '90', + 'MAX_EFFECTIVE_BALANCE': '32000000000', + 'DOMAIN_BEACON_PROPOSER': '0x00000000', + 'MAX_ATTESTER_SLASHINGS': '2', + 'DOMAIN_SELECTION_PROOF': '0x05000000', + ... + } + } + +.. py:method:: Beacon.get_deposit_contract() + + .. code-block:: python + + >>> beacon.get_deposit_contract() + { + 'data': { + 'chain_id': '5', + 'address': '0x8c5fecdC472E27Bc447696F431E425D02dd46a8c' + } + } + +.. py:method:: Beacon.get_beacon_state(state_id="head") + + .. code-block:: python + + >>> beacon.get_beacon_state() + { + 'data': { + 'genesis_time': '1', + 'genesis_validators_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2', + 'slot': '1', + 'fork': { + 'previous_version': '0x00000000', + 'current_version': '0x00000000', + 'epoch': '1' + }, + 'latest_block_header': { + 'slot': '1', + 'proposer_index': '1', + 'parent_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2', + 'state_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2', + 'body_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2' + }, + 'block_roots': ['0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'], + 'state_roots': ['0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'], + 'historical_roots': ['0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'], + 'eth1_data': { + 'deposit_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2', + 'deposit_count': '1', + 'block_hash': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2' + }, + 'eth1_data_votes': [...], + 'eth1_deposit_index': '1', + 'validators': [...], + 'balances': [...], + 'randao_mixes': [...], + 'slashings': [...], + 'previous_epoch_attestations': [...], + 'current_epoch_attestations': [...], + 'justification_bits': '0x0f', + 'previous_justified_checkpoint': { + 'epoch': '5736', + 'root': '0xec7ef54f1fd81bada8170dd0cb6be8216f8ee2f445e6936f95f5c6894a4a3b38' + }, + 'current_justified_checkpoint': { + 'epoch': '5737', + 'root': '0x781f0166e34c361ce2c88070c1389145abba2836edcb446338a2ca2b0054826e' + }, + 'finalized_checkpoint': { + 'epoch': '5736', + 'root': '0xec7ef54f1fd81bada8170dd0cb6be8216f8ee2f445e6936f95f5c6894a4a3b38' + } + } + } + +.. py:method:: Beacon.get_beacon_heads() + + .. code-block:: python + + >>> beacon.get_beacon_heads() + { + 'data': [ + { + 'slot': '221600', + 'root': '0x9987754077fe6100a60c75d81a51b1ef457d019404d1546a66f4f5d6c23fae45' + } + ] + } + +.. py:method:: Beacon.get_blob_sidecars(block_id, indices=[]) + + .. code-block:: python + + >>> beacon.get_blob_sidecars(1, indices=[1]) + { + "data": [ + { + "index": "1", + "blob": ..., # omitted + "kzg_commitment": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a", + "kzg_proof": "0x7FB0A12D11Ffe8A48c2fF80dCA17adbCC1da5F6aADaAEF2b338717dcDEECf6DaB9FD7C4e4265CfBc097cD31dCB19E836", + "signed_block_header": { + "message": { + "slot": "1", + "proposer_index": "1", + "parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "body_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" + }, + "signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505" + }, + "kzg_commitment_inclusion_proof": [ + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2", + "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2" + ] + } + ] + } + +.. py:method:: Beacon.get_node_identity() + + .. code-block:: python + + >>> beacon.get_node_identity() + { + 'data': { + 'peer_id': '16Uiu2HAmLZ1CYVFKpa3wwn4cnknZqosum8HX3GHDhUpEULQc9ixE', + 'enr': 'enr:-KG4QCIp6eCZ6hG_fd93qsw12qmbfsl2rUTfQvwVP4FOTlWeNXYo0Gg9y3WVYIdF6FQC6R0E8CbK0Ywq_6TKMx1BpGlAhGV0aDKQOwiHlQAAIAn__________4JpZIJ2NIJpcIR_AAABiXNlY3AyNTZrMaEDdVT4g1gw86BfbrtLCq2fRBlG0AnMxsXtAQgA327S5FeDdGNwgiMog3VkcIIjKA', + 'p2p_addresses': ['/ip4/127.0.0.1/tcp/9000/p2p/16Uiu2HAmLZ1CYVFKpa3wwn4cnknZqosum8HX3GHDhUpEULQc9ixE'], + 'discovery_addresses': ['/ip4/127.0.0.1/udp/9000/p2p/16Uiu2HAmLZ1CYVFKpa3wwn4cnknZqosum8HX3GHDhUpEULQc9ixE'], + 'metadata': {'seq_number': '0', 'attnets': '0x0000000000000000'} + } + } + +.. py:method:: Beacon.get_peers() + + .. code-block:: python + + >>> beacon.get_peers() + { + 'data': [ + { + 'peer_id': '16Uiu2HAkw1yVqF3RtMCBHMbkLZbNhfGcTUdD6Uo4X3wfzPhGVnqv', + 'address': '/ip4/3.127.23.51/tcp/9000', + 'state': 'connected', + 'direction': 'outbound' + }, + { + 'peer_id': '16Uiu2HAmEJHiCzgS8GwiEYLyM3d148mzvZ9iZzsz8yqayWVPANMG', + 'address': '/ip4/3.88.7.240/tcp/9000', + 'state': 'connected', + 'direction': 'outbound' + } + ] + } + +.. py:method:: Beacon.get_peer(peer_id) + + .. code-block:: python + + >>> beacon.get_peer('16Uiu2HAkw1yVqF3RtMCBHMbkLZbNhfGcTUdD6Uo4X3wfzPhGVnqv') + { + 'data': { + 'peer_id': '16Uiu2HAkw1yVqF3RtMCBHMbkLZbNhfGcTUdD6Uo4X3wfzPhGVnqv', + 'address': '/ip4/3.127.23.51/tcp/9000', + 'state': 'connected', + 'direction': 'outbound' + } + } + +.. py:method:: Beacon.get_health() + + .. code-block:: python + + >>> beacon.get_health() + 200 + +.. py:method:: Beacon.get_version() + + .. code-block:: python + + >>> beacon.get_version() + { + 'data': { + 'version': 'teku/v20.12.0+9-g9392008/osx-x86_64/adoptopenjdk-java-15' + } + } + +.. py:method:: Beacon.get_syncing() + + .. code-block:: python + + >>> beacon.get_syncing() + { + 'data': { + 'head_slot': '222270', + 'sync_distance': '190861' + } + } diff --git a/_build/html_zh_CN/_sources/web3.contract.rst.txt b/_build/html_zh_CN/_sources/web3.contract.rst.txt new file mode 100644 index 0000000000..1348012cff --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.contract.rst.txt @@ -0,0 +1,1769 @@ +.. _contracts: + +Contracts +========= + +.. py:module:: web3.contract + +Smart contracts are programs deployed to the Ethereum network. See the +`ethereum.org docs `_ +for a proper introduction. + +Interacting with deployed contracts +----------------------------------- + +In order to use an existing contract, you'll need its deployed address and its ABI. +Both can be found using block explorers, like Etherscan. Once you instantiate a contract +instance, you can read data and execute transactions. + +.. code-block:: python + + # Configure w3, e.g., w3 = Web3(...) + address = '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F988' + abi = '[{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"minter_","type":"address"},...' + contract_instance = w3.eth.contract(address=address, abi=abi) + + # read state: + contract_instance.functions.storedValue().call() + # 42 + + # update state: + tx_hash = contract_instance.functions.updateValue(43).transact() + +.. _contract_example: + +Contract Deployment Example +--------------------------- + +To run this example, you will need to install a few extra features: + +- The sandbox node provided by eth-tester. You can install it with: + +.. code-block:: bash + + $ pip install -U "web3[tester]" + +- ``py-solc-x``. This is the supported route to installing the solidity compiler ``solc``. You can install it with: + +.. code-block:: bash + + $ pip install py-solc-x + +After ``py-solc-x`` is installed, you will need to install a version of ``solc``. You can install the latest version via a new REPL with: + +.. code-block:: python + + >>> from solcx import install_solc + >>> install_solc(version='latest') + +You should now be set up to compile and deploy a contract. + +The following example runs through these steps: + +#. Compile Solidity contract into bytecode and an ABI +#. Initialize a Contract instance +#. Deploy the contract using the Contract instance to initiate a transaction +#. Interact with the contract functions using the Contract instance + +.. code-block:: python + + >>> from web3 import Web3 + >>> from solcx import compile_source + + # Solidity source code + >>> compiled_sol = compile_source( + ... ''' + ... pragma solidity >0.5.0; + ... + ... contract Greeter { + ... string public greeting; + ... + ... constructor() public { + ... greeting = 'Hello'; + ... } + ... + ... function setGreeting(string memory _greeting) public { + ... greeting = _greeting; + ... } + ... + ... function greet() view public returns (string memory) { + ... return greeting; + ... } + ... } + ... ''', + ... output_values=['abi', 'bin'] + ... ) + + # retrieve the contract interface + >>> contract_id, contract_interface = compiled_sol.popitem() + + # get bytecode / bin + >>> bytecode = contract_interface['bin'] + + # get abi + >>> abi = contract_interface['abi'] + + # web3.py instance + >>> w3 = Web3(Web3.EthereumTesterProvider()) + + # set pre-funded account as sender + >>> w3.eth.default_account = w3.eth.accounts[0] + + >>> Greeter = w3.eth.contract(abi=abi, bytecode=bytecode) + + # Submit the transaction that deploys the contract + >>> tx_hash = Greeter.constructor().transact() + + # Wait for the transaction to be mined, and get the transaction receipt + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + + >>> greeter = w3.eth.contract( + ... address=tx_receipt.contractAddress, + ... abi=abi + ... ) + + >>> greeter.functions.greet().call() + 'Hello' + + >>> tx_hash = greeter.functions.setGreeting('Nihao').transact() + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> greeter.functions.greet().call() + 'Nihao' + + +Contract Factories +------------------ + +These factories are not intended to be initialized directly. +Instead, create contract objects using the :meth:`w3.eth.contract() ` +method. By default, the contract factory is :class:`Contract`. + +.. py:class:: Contract(address) + + Contract provides a default interface for deploying and interacting with + Ethereum smart contracts. + + The address parameter can be a hex address or an ENS name, like ``mycontract.eth``. + + +Properties +---------- + +Each Contract Factory exposes the following properties. + + +.. py:attribute:: Contract.address + + The hexadecimal encoded 20-byte address of the contract, or an ENS name. + May be ``None`` if not provided during factory creation. + + +.. py:attribute:: Contract.abi + + The contract ``abi``, or Application Binary Interface, specifies how a contract can + be interacted with. Without an ``abi``, the contract cannot be decoded. The ``abi`` + enables the Contract instance to expose functions and events as object properties. + + For further details, see the `Solidity ABI specification `_. + + +.. py:attribute:: Contract.bytecode + + The contract bytecode string. May be ``None`` if not provided during + factory creation. + + +.. py:attribute:: Contract.bytecode_runtime + + The runtime part of the contract bytecode string. May be ``None`` if not + provided during factory creation. + + +.. py:attribute:: Contract.decode_tuples + + If a Tuple/Struct is returned by a contract function, this flag defines whether + to apply the field names from the ABI to the returned data. + If False, the returned value will be a normal Python ``Tuple``. If True, the returned + value will be a Python ``NamedTuple`` of the class ``ABIDecodedNamedTuple``. + + NamedTuples have some restrictions regarding field names. + web3.py sets ``NamedTuple``'s ``rename=True``, so disallowed field names may be + different than expected. See the `Python docs `_ + for more information. + + Defaults to ``False`` if not provided during factory creation. + + +.. py:attribute:: Contract.functions + + This provides access to contract functions as attributes. For example: + ``myContract.functions.MyMethod()``. The exposed contract functions are classes of the + type :py:class:`ContractFunction`. + + +.. py:attribute:: Contract.events + + This provides access to contract events as attributes. For example: + ``myContract.events.MyEvent()``. The exposed contract events are classes of the + type :py:class:`ContractEvent`. + +Methods +------- + +Method doctests use the following ABI and bytecode. + +.. code-block:: python + + >>> bytecode = '6060604052341561000c57fe5b604051602080610acb833981016040528080519060200190919050505b620f42408114151561003b5760006000fd5b670de0b6b3a76400008102600281905550600254600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b610a27806100a46000396000f30060606040523615610097576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610099578063095ea7b31461013257806318160ddd1461018957806323b872dd146101af578063313ce5671461022557806370a082311461025157806395d89b411461029b578063a9059cbb14610334578063dd62ed3e1461038b575bfe5b34156100a157fe5b6100a96103f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b61016f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061042e565b604051808215151515815260200191505060405180910390f35b341561019157fe5b610199610521565b6040518082815260200191505060405180910390f35b34156101b757fe5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610527565b604051808215151515815260200191505060405180910390f35b341561022d57fe5b610235610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561025957fe5b610285600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610796565b6040518082815260200191505060405180910390f35b34156102a357fe5b6102ab6107e0565b60405180806020018281038252838181518152602001915080519060200190808383600083146102fa575b8051825260208311156102fa576020820191506020810190506020830392506102d6565b505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033c57fe5b610371600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061081a565b604051808215151515815260200191505060405180910390f35b341561039357fe5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610973565b6040518082815260200191505060405180910390f35b604060405190810160405280600981526020017f54657374546f6b656e000000000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410806105f1575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b156105fc5760006000fd5b81600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b604060405190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156108695760006000fd5b81600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058205071371ee2a4a1be3c96e77d939cdc26161a256fdd638efc08bd33dfc65d3b850029' + >>> abi = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"inputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"type":"constructor","stateMutability":"nonpayable"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]' + >>> contract = w3.eth.contract(abi=abi, bytecode=bytecode) + +Each Contract Factory exposes the following methods. + +.. testsetup:: contractmethods + + from web3 import Web3 + w3 = Web3(Web3.EthereumTesterProvider()) + bytecode = '6060604052341561000c57fe5b604051602080610acb833981016040528080519060200190919050505b620f42408114151561003b5760006000fd5b670de0b6b3a76400008102600281905550600254600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b610a27806100a46000396000f30060606040523615610097576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610099578063095ea7b31461013257806318160ddd1461018957806323b872dd146101af578063313ce5671461022557806370a082311461025157806395d89b411461029b578063a9059cbb14610334578063dd62ed3e1461038b575bfe5b34156100a157fe5b6100a96103f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b61016f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061042e565b604051808215151515815260200191505060405180910390f35b341561019157fe5b610199610521565b6040518082815260200191505060405180910390f35b34156101b757fe5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610527565b604051808215151515815260200191505060405180910390f35b341561022d57fe5b610235610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561025957fe5b610285600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610796565b6040518082815260200191505060405180910390f35b34156102a357fe5b6102ab6107e0565b60405180806020018281038252838181518152602001915080519060200190808383600083146102fa575b8051825260208311156102fa576020820191506020810190506020830392506102d6565b505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033c57fe5b610371600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061081a565b604051808215151515815260200191505060405180910390f35b341561039357fe5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610973565b6040518082815260200191505060405180910390f35b604060405190810160405280600981526020017f54657374546f6b656e000000000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410806105f1575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b156105fc5760006000fd5b81600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b604060405190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156108695760006000fd5b81600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058205071371ee2a4a1be3c96e77d939cdc26161a256fdd638efc08bd33dfc65d3b850029' + abi = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"inputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"type":"constructor","stateMutability":"nonpayable"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]' + contract = w3.eth.contract(abi=abi, bytecode=bytecode) + +.. py:classmethod:: Contract.constructor(*args, **kwargs).transact(transaction=None) + + Construct and deploy a contract by sending a new public transaction. + + If provided ``transaction`` should be a dictionary conforming to the + ``web3.eth.send_transaction(transaction)`` method. This value may not + contain the keys ``data`` or ``to``. + + If the contract takes constructor parameters they should be provided as + positional arguments or keyword arguments. + + If any of the arguments specified in the ABI are an ``address`` type, they + will accept ENS names. + + If a ``gas`` value is not provided, then the ``gas`` value for the + deployment transaction will be created using the ``web3.eth.estimate_gas()`` + method. + + Returns the transaction hash for the deploy transaction. + + .. doctest:: contractmethods + + >>> deploy_txn = contract.constructor(1000000).transact({'from': w3.eth.accounts[0], 'gas': 899000, 'gasPrice': Web3.to_wei(1, 'gwei')}) + >>> txn_receipt = w3.eth.get_transaction_receipt(deploy_txn) + >>> txn_receipt['contractAddress'] + '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b' + + +.. py:classmethod:: Contract.constructor(*args, **kwargs).estimate_gas(transaction=None, block_identifier=None) + :noindex: + + Estimate gas for constructing and deploying the contract. + + This method behaves the same as the + :py:meth:`Contract.constructor(*args, **kwargs).transact` method, + with transaction details being passed into the end portion of the + function call, and function arguments being passed into the first portion. + + The ``block_identifier`` parameter is passed directly to the call at the end portion + of the function call. + + Returns the amount of gas consumed which can be used as a gas estimate for + executing this transaction publicly. + + Returns the gas needed to deploy the contract. + + .. doctest:: contractmethods + + >>> contract.constructor(1000000).estimate_gas() + 664971 + +.. py:classmethod:: Contract.constructor(*args, **kwargs).build_transaction(transaction=None) + :noindex: + + Construct the contract deploy transaction bytecode data. + + If the contract takes constructor parameters they should be provided as + positional arguments or keyword arguments. + + If any of the ``args`` specified in the ABI are an ``address`` type, they + will accept ENS names. + + Returns the transaction dictionary that you can pass to send_transaction method. + + .. doctest:: contractmethods + + >>> transaction = { + ... 'gas': 664971, + ... 'chainId': 131277322940537 + ... } + >>> contract_data = contract.constructor(1000000).build_transaction(transaction) + >>> w3.eth.send_transaction(contract_data) + HexBytes('0x40c51804800dee88e14e69826cfe51bc5f25f61935331e8aa6d8d7771fb36350') + +.. _contract_create_filter: + +.. py:classmethod:: Contract.events.your_event_name.create_filter(from_block=None, to_block="latest", argument_filters={}, topics=[]) + + Creates a new event filter, an instance of :py:class:`web3.utils.filters.LogFilter`. + + - ``from_block`` is a mandatory field. Defines the starting block (exclusive) filter block range. It can be either the starting block number, or 'latest' for the last mined block, or 'pending' for unmined transactions. In the case of ``from_block``, 'latest' and 'pending' set the 'latest' or 'pending' block as a static value for the starting filter block. + - ``to_block`` optional. Defaults to 'latest'. Defines the ending block (inclusive) in the filter block range. Special values 'latest' and 'pending' set a dynamic range that always includes the 'latest' or 'pending' blocks for the filter's upper block range. + - ``address`` optional. Defaults to the contract address. The filter matches the event logs emanating from ``address``. + - ``argument_filters``, optional. Expects a dictionary of argument names and values. When provided event logs are filtered for the event argument values. Event arguments can be both indexed or unindexed. Indexed values will be translated to their corresponding topic arguments. Unindexed arguments will be filtered using a regular expression. + - ``topics`` optional, accepts the standard JSON-RPC topics argument. See the JSON-RPC documentation for `eth_newFilter `_ more information on the ``topics`` parameters. + + .. doctest:: contractmethods + + >>> filter = contract.events.Transfer.create_filter(from_block='latest') + +.. py:classmethod:: Contract.events.your_event_name.build_filter() + + Creates a EventFilterBuilder instance with the event abi, and the contract address if called from a deployed contract instance. The EventFilterBuilder provides a convenient way to construct the filter parameters with value checking against the event abi. It allows for defining multiple match values or of single values through the match_any and match_single methods. + + .. doctest:: contractmethods + + >>> filter_builder = contract.events.Transfer.build_filter() + >>> filter_builder.from_block = "latest" + >>> filter_builder.args['from'].match_any(w3.eth.accounts[0]) + >>> filter_builder.args['to'].match_single(w3.eth.accounts[1]) + >>> filter_builder.args['value'].match_single(10000) + >>> filter_instance = filter_builder.deploy(w3) + + The ``deploy`` method returns a :py:class:`web3.utils.filters.LogFilter` instance from the filter parameters generated by the filter builder. Defining multiple match values for array arguments can be accomplished easily with the filter builder: + + .. doctest:: contractmethods + + >>> filter_builder = contract.events.Transfer.build_filter() + >>> filter_builder.args['to'].match_any(w3.eth.accounts[0], w3.eth.accounts[1]) + + The filter builder blocks already defined filter parameters from being changed. + + .. doctest:: contractmethods + + >>> filter_builder = contract.events.Transfer.build_filter() + >>> filter_builder.from_block = "latest" + >>> filter_builder.from_block = 0 + Traceback (most recent call last): + web3.exceptions.Web3ValueError: from_block is already set to 'latest'. Resetting filter parameters is not permitted + +.. py:classmethod:: Contract.encode_abi(abi_element_identifier, args=None, kwargs=None, data=None) + + Encodes the arguments using the Ethereum ABI for the contract function that + matches the given ``abi_element_identifier`` and arguments ``args``. The ``data`` parameter + defaults to the function selector. + + .. doctest:: contractmethods + + >>> contract.encode_abi("approve", args=[w3.eth.accounts[0], 10]) + '0x095ea7b30000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf000000000000000000000000000000000000000000000000000000000000000a' + +.. py:classmethod:: Contract.all_events() + + Returns a list of all the events present in a Contract where every event is + an instance of :py:class:`ContractEvent`. + + .. doctest:: contractmethods + + >>> contract.all_events() + [, ] + + +.. py:classmethod:: Contract.get_event_by_signature(signature) + + Searches for a distinct event with matching signature. Returns an instance of + :py:class:`ContractEvent` upon finding a match. Raises ``Web3ValueError`` if no + match is found. + + .. doctest:: contractmethods + + >>> contract.get_event_by_signature('Transfer(address,address,uint256)') + + + +.. py:classmethod:: Contract.find_events_by_name(name) + + Searches for all events matching the provided name. Returns a list of matching + events where every event is an instance of :py:class:`ContractEvent`. Returns an + empty list when no match is found. + + .. doctest:: contractmethods + + >>> contract.find_events_by_name('Transfer') + [] + + +.. py:classmethod:: Contract.get_event_by_name(name) + + Searches for a distinct event matching the name. Returns an instance of + :py:class:`ContractEvent` upon finding a match. Raises ``Web3ValueError`` if no + match is found or if multiple matches are found. + + .. doctest:: contractmethods + + >>> contract.get_event_by_name('Approval') + + +.. py:classmethod:: Contract.find_events_by_selector(selector) + + Searches for all events matching the provided selector. Returns a list of matching + events where every event is an instance of :py:class:`ContractEvent`. Returns an + empty list when no match is found. + + .. doctest:: contractmethods + + >>> contract.find_events_by_selector('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925') + [] + +.. py:classmethod:: Contract.get_event_by_selector(selector) + + Searches for a distinct event with matching selector. + The selector can be a hexadecimal string, bytes or int. + Returns an instance of :py:class:`ContractEvent` upon finding a match. + Raises ``Web3ValueError`` if no match is found. + + .. doctest:: contractmethods + + >>> contract.get_event_by_selector('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925') + + >>> contract.get_event_by_selector(b'\x8c[\xe1\xe5\xeb\xec}[\xd1OqB}\x1e\x84\xf3\xdd\x03\x14\xc0\xf7\xb2)\x1e[ \n\xc8\xc7\xc3\xb9%') + + >>> contract.get_event_by_selector(0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925) + + +.. py:classmethod:: Contract.find_events_by_topic(topic) + + Searches for all events matching the provided topic. Returns a list of matching + events where every event is an instance of :py:class:`ContractEvent`. Returns an + empty list when no match is found. + + .. doctest:: contractmethods + + >>> contract.find_events_by_topic('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925') + [] + +.. py:classmethod:: Contract.get_event_by_topic(topic) + + Searches for a distinct event with matching topic. + The topic is a hexadecimal string. + Returns an instance of :py:class:`ContractEvent` upon finding a match. + Raises ``Web3ValueError`` if no match is found. + + .. doctest:: contractmethods + + >>> contract.get_event_by_topic('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925') + + +.. py:classmethod:: Contract.all_functions() + + Returns a list of all the functions present in a Contract where every function is + an instance of :py:class:`ContractFunction`. + + .. doctest:: contractmethods + + >>> contract.all_functions() + [, , , , , , , , ] + + +.. py:classmethod:: Contract.get_function_by_signature(signature) + + Searches for a distinct function with matching signature. Returns an instance of + :py:class:`ContractFunction` upon finding a match. Raises ``Web3ValueError`` if no + match is found. + + .. doctest:: contractmethods + + >>> contract.get_function_by_signature('approve(address,uint256)') + + + +.. py:classmethod:: Contract.find_functions_by_name(name) + + Searches for all functions matching the name. Returns a list of matching functions + where every function is an instance of :py:class:`ContractFunction`. Returns an empty + list when no match is found. + + .. doctest:: contractmethods + + >>> contract.find_functions_by_name('transferFrom') + [] + + +.. py:classmethod:: Contract.get_function_by_name(name) + + Searches for a distinct function with matching name. Returns an instance of + :py:class:`ContractFunction` upon finding a match. Raises ``Web3ValueError`` if no + match is found or if multiple matches are found. + + .. doctest:: contractmethods + + >>> contract.get_function_by_name('decimals') + + + +.. py:classmethod:: Contract.get_function_by_selector(selector) + + Searches for a distinct function with matching selector. + The selector can be a hexadecimal string, bytes or int. + Returns an instance of :py:class:`ContractFunction` upon finding a match. + Raises ``Web3ValueError`` if no match is found. + + .. doctest:: contractmethods + + >>> contract.get_function_by_selector('0xdd62ed3e') + + >>> contract.get_function_by_selector(b'\xddb\xed>') + + >>> contract.get_function_by_selector(0xdd62ed3e) + + + +.. py:classmethod:: Contract.find_functions_by_args(*args) + + Searches for all function with matching args. Returns a list of matching functions + where every function is an instance of :py:class:`ContractFunction`. Returns an empty + list when no match is found. + + .. doctest:: contractmethods + + >>> contract.find_functions_by_args(w3.eth.accounts[0], 10000) + [, ] + + +.. py:classmethod:: Contract.get_function_by_args(*args) + + Searches for a distinct function with matching args. Returns an instance of + :py:class:`ContractFunction` upon finding a match. Raises ``ValueError`` if no + match is found or if multiple matches are found. + + .. doctest:: contractmethods + + >>> contract.get_function_by_args(w3.eth.accounts[0], w3.eth.accounts[1], 10000) + + + +.. note:: + ``Contract`` methods ``all_functions``, ``get_function_by_signature``, ``find_functions_by_name``, + ``get_function_by_name``, ``get_function_by_selector``, ``find_functions_by_args`` and + ``get_function_by_args`` can only be used when abi is provided to the contract. + + +.. note:: + web3.py rejects the initialization of contracts that have more than one function + with the same selector or signature. + eg. ``blockHashAddendsInexpansible(uint256)`` and ``blockHashAskewLimitary(uint256)`` have the + same selector value equal to ``0x00000000``. A contract containing both of these functions + will be rejected. + + +.. _disable-strict-byte-check: + +Disabling Strict Checks for Bytes Types +--------------------------------------- + +By default, web3 is strict when it comes to hex and bytes values, as of ``v6``. +If an abi specifies a byte size, but the value that gets passed in is not the specified +size, web3 will invalidate the value. For example, if an abi specifies a type of +``bytes4``, web3 will invalidate the following values: + +.. list-table:: Invalid byte and hex strings with strict (default) bytes4 type checking + :widths: 25 75 + :header-rows: 1 + + * - Input + - Reason + * - ``''`` + - Needs to be prefixed with a "0x" to be interpreted as an empty hex string + * - ``2`` + - Wrong type + * - ``'ah'`` + - String is not valid hex + * - ``'1234'`` + - Needs to either be a bytestring (b'1234') or be a hex value of the right size, prefixed with 0x (in this case: '0x31323334') + * - ``b''`` + - Needs to have exactly 4 bytes + * - ``b'ab'`` + - Needs to have exactly 4 bytes + * - ``'0xab'`` + - Needs to have exactly 4 bytes + * - ``'0x6162636464'`` + - Needs to have exactly 4 bytes + +However, you may want to be less strict with acceptable values for bytes types. +This may prove useful if you trust that values coming through are what they are +meant to be with respect to the ABI. In this case, the automatic padding might be +convenient for inferred types. For this, you can set the +:meth:`w3.strict_bytes_type_checking` flag to ``False``, which is available on the +Web3 instance. A Web3 instance which has this flag set to ``False`` will have a less +strict set of rules on which values are accepted. A ``bytes`` type will allow values as +a hex string, a bytestring, or a regular Python string that can be decoded as a hex. +0x-prefixed hex strings are also not required. + + - A Python string that is not prefixed with ``0x`` is valid. + - A bytestring whose length is less than the specified byte size is valid. + +.. list-table:: Valid byte and hex strings for a non-strict bytes4 type + :widths: 25 75 + :header-rows: 1 + + * - Input + - Normalizes to + * - ``''`` + - ``b'\x00\x00\x00\x00'`` + * - ``'0x'`` + - ``b'\x00\x00\x00\x00'`` + * - ``b''`` + - ``b'\x00\x00\x00\x00'`` + * - ``b'ab'`` + - ``b'ab\x00\x00'`` + * - ``'0xab'`` + - ``b'\xab\x00\x00\x00'`` + * - ``'1234'`` + - ``b'\x124\x00\x00'`` + * - ``'0x61626364'`` + - ``b'abcd'`` + * - ``'1234'`` + - ``b'1234'`` + + +Taking the following contract code as an example: + +.. testsetup:: arrayscontract + + from web3 import Web3 + w3 = Web3(Web3.EthereumTesterProvider()) + bytecode = "608060405234801561001057600080fd5b506040516106103803806106108339810180604052602081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8281019050602081018481111561006157600080fd5b815185602082028301116401000000008211171561007e57600080fd5b5050929190505050806000908051906020019061009c9291906100a3565b505061019c565b82805482825590600052602060002090600f0160109004810192821561015a5791602002820160005b8382111561012a57835183826101000a81548161ffff02191690837e010000000000000000000000000000000000000000000000000000000000009004021790555092602001926002016020816001010492830192600103026100cc565b80156101585782816101000a81549061ffff021916905560020160208160010104928301926001030261012a565b505b509050610167919061016b565b5090565b61019991905b8082111561019557600081816101000a81549061ffff021916905550600101610171565b5090565b90565b610465806101ab6000396000f3fe608060405260043610610051576000357c0100000000000000000000000000000000000000000000000000000000900480633b3230ee14610056578063d7c8a410146100e7578063dfe3136814610153575b600080fd5b34801561006257600080fd5b5061008f6004803603602081101561007957600080fd5b8101908080359060200190929190505050610218565b60405180827dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b3480156100f357600080fd5b506100fc61026c565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561013f578082015181840152602081019050610124565b505050509050019250505060405180910390f35b34801561015f57600080fd5b506102166004803603602081101561017657600080fd5b810190808035906020019064010000000081111561019357600080fd5b8201836020820111156101a557600080fd5b803590602001918460208302840111640100000000831117156101c757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610326565b005b60008181548110151561022757fe5b9060005260206000209060109182820401919006600202915054906101000a90047e010000000000000000000000000000000000000000000000000000000000000281565b6060600080548060200260200160405190810160405280929190818152602001828054801561031c57602002820191906000526020600020906000905b82829054906101000a90047e01000000000000000000000000000000000000000000000000000000000000027dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190600201906020826001010492830192600103820291508084116102a95790505b5050505050905090565b806000908051906020019061033c929190610340565b5050565b82805482825590600052602060002090600f016010900481019282156103f75791602002820160005b838211156103c757835183826101000a81548161ffff02191690837e01000000000000000000000000000000000000000000000000000000000000900402179055509260200192600201602081600101049283019260010302610369565b80156103f55782816101000a81549061ffff02191690556002016020816001010492830192600103026103c7565b505b5090506104049190610408565b5090565b61043691905b8082111561043257600081816101000a81549061ffff02191690555060010161040e565b5090565b9056fea165627a7a72305820a8f9f1f4815c1eedfb8df31298a5cd13b198895de878871328b5d96296b69b4e0029" + abi = ''' + [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "bytes2Value", + "outputs": [ + { + "name": "", + "type": "bytes2" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBytes2Value", + "outputs": [ + { + "name": "", + "type": "bytes2[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_bytes2Value", + "type": "bytes2[]" + } + ], + "name": "setBytes2Value", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "name": "_bytes2Value", + "type": "bytes2[]" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + } + ] + '''.strip() + +.. code-block:: python + + >>> # pragma solidity >=0.4.22 <0.6.0; + ... + ... # contract ArraysContract { + ... # bytes2[] public bytes2Value; + + ... # constructor(bytes2[] memory _bytes2Value) public { + ... # bytes2Value = _bytes2Value; + ... # } + + ... # function setBytes2Value(bytes2[] memory _bytes2Value) public { + ... # bytes2Value = _bytes2Value; + ... # } + + ... # function getBytes2Value() public view returns (bytes2[] memory) { + ... # return bytes2Value; + ... # } + ... # } + + >>> # abi = "..." + >>> # bytecode = "6080..." + +.. doctest:: arrayscontract + + >>> arrays_contract_instance = w3.eth.contract(abi=abi, bytecode=bytecode) + + >>> tx_hash = arrays_contract_instance.constructor([b'bb']).transact() + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> arrays_contract = w3.eth.contract( + ... address=tx_receipt.contractAddress, + ... abi=abi + ... ) + >>> arrays_contract.functions.getBytes2Value().call() + [b'bb'] + + >>> # set value with appropriate byte size + >>> arrays_contract.functions.setBytes2Value([b'aa']).transact({'gas': 420000, "maxPriorityFeePerGas": 10 ** 9, "maxFeePerGas": 10 ** 9}) + HexBytes('0xcb95151142ea56dbf2753d70388aef202a7bb5a1e323d448bc19f1d2e1fe3dc9') + >>> # check value + >>> arrays_contract.functions.getBytes2Value().call() + [b'aa'] + + >>> # trying to set value without appropriate size (bytes2) is not valid + >>> arrays_contract.functions.setBytes2Value([b'b']).transact() + Traceback (most recent call last): + ... + web3.exceptions.MismatchedABI: + Could not identify the intended function with name + >>> # check value is still b'aa' + >>> arrays_contract.functions.getBytes2Value().call() + [b'aa'] + + >>> # disabling strict byte checking... + >>> w3.strict_bytes_type_checking = False + + >>> tx_hash = arrays_contract_instance.constructor([b'b']).transact() + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> arrays_contract = w3.eth.contract( + ... address=tx_receipt.contractAddress, + ... abi=abi + ... ) + >>> # check value is zero-padded... i.e. b'b\x00' + >>> arrays_contract.functions.getBytes2Value().call() + [b'b\x00'] + + >>> # set the flag back to True + >>> w3.strict_bytes_type_checking = True + + >>> arrays_contract.functions.setBytes2Value([b'a']).transact() + Traceback (most recent call last): + ... + web3.exceptions.MismatchedABI: + Could not identify the intended function with name + +.. _contract-functions: + +Contract Functions +------------------ + +The named functions exposed through the :py:attr:`Contract.functions` property are +of the ContractFunction type. This class is not to be used directly, +but instead through :py:attr:`Contract.functions`. + +For example: + + .. code-block:: python + + myContract = web3.eth.contract(address=contract_address, abi=contract_abi) + twentyone = myContract.functions.multiply7(3).call() + +If you have the function name in a variable, you might prefer this alternative: + + .. code-block:: python + + func_to_call = 'multiply7' + contract_func = myContract.functions[func_to_call] + twentyone = contract_func(3).call() + +You can also interact with contract functions without parentheses if the function doesn't +take any arguments. For example: + + .. code-block:: python + + >>> myContract.functions.return13.call() + 13 + >>> myContract.functions.return13().call() + 13 + +In cases where functions are overloaded and use arguments of similar types, a function +may resolve to an undesired function when using the method syntax. For example, given +two functions with the same name that take a single argument of differing types of +``bytes`` and ``bytes32``. When a reference to :meth:`contract.functions.setBytes(b'1')` +is used, the function will resolve as the one that takes ``bytes``. If a value is passed +that was meant to be 32 bytes but the given argument was off by one, the function +reference will still use the one that takes ``bytes``. + +When in doubt, use explicit function references to the signature. Use bracket notation +(:meth:`contract.functions["setBytes(bytes32)"](b'')`) or the contract API +`contract.get_function_by_signature("setBytes(bytes32)")` to retrieve the desired +function. This will ensure an exception is raised if the argument is not strictly +32 bytes in length. + +.. py:class:: ContractFunction + +Attributes +~~~~~~~~~~ + +The :py:class:`ContractFunction` class provides attributes for each function. Access the function attributes through `Contract.functions.myMethod`. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).abi_element_identifier + + The signature of the function assigned to the class ``__name__`` during initialization. + Fallback and Receive functions will be assigned as classes :py:class:`FallbackFn` or + :py:class:`ReceiveFn` respectively. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).name + + A string representing the function, receive or fallback name. + + Use :py:attr:`ContractFunction.signature` when the function arguments are needed. + + This is an alias of :py:attr:`ContractFunction.fn_name`. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).signature + + A string representing the function, receive or fallback signature. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).selector + + A HexStr encoded from the first four bytes of the function signature. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).abi + + The function ABI with the type, name, inputs and outputs. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).arguments + + A tuple of all function inputs, normalized so that `kwargs` themselves are + flattened into a tuple as returned by :py:meth:`eth_utils.abi.get_normalized_abi_inputs`. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).argument_names + + The function input names. + +.. py:attribute:: ContractFunction.myMethod(*args, **kwargs).argument_types + + The function input types. + +Methods +~~~~~~~ + +:py:class:`ContractFunction` provides methods to interact with contract functions. +Positional and keyword arguments supplied to the contract function subclass +will be used to find the contract function by signature, +and forwarded to the contract function when applicable. + +`EIP-3668 `_ introduced support for the ``OffchainLookup`` revert / +CCIP Read support. CCIP Read is set to ``True`` for calls by default, as recommended in EIP-3668. This is done via a +global ``global_ccip_read_enabled`` flag on the provider. If raising the ``OffchainLookup`` revert is preferred for a +specific call, the ``ccip_read_enabled`` flag on the call may be set to ``False``. + + .. code-block:: python + + >>> # raises the revert instead of handling the offchain lookup + >>> myContract.functions.revertsWithOffchainLookup(myData).call(ccip_read_enabled=False) + *** web3.exceptions.OffchainLookup + +Disabling CCIP Read support can be useful if a transaction needs to be sent to the callback function. In such cases, +"preflighting" with an ``eth_call``, handling the ``OffchainLookup``, and sending the data via a transaction may be +necessary. See :ref:`ccip-read-example` in the examples section for how to preflight a transaction with a contract call. + +Similarly, if CCIP Read is globally set to ``False`` via the ``global_ccip_read_enabled`` flag on the provider, it may be +enabled on a per-call basis - overriding the global flag. This ensures only explicitly enabled calls will handle the +``OffchainLookup`` revert appropriately. + + .. code-block:: python + + >>> # global flag set to `False` + >>> w3.provider.global_ccip_read_enabled = False + + >>> # does not raise the revert since explicitly enabled on the call: + >>> response = myContract.functions.revertsWithOffchainLookup(myData).call(ccip_read_enabled=True) + +If the function called results in a ``revert`` error, a ``ContractLogicError`` will be raised. +If there is an error message with the error, web3.py attempts to parse the +message that comes back and return it to the user as the error string. +As of v6.3.0, the raw data is also returned and +can be accessed via the ``data`` attribute on ``ContractLogicError``. + +.. py:method:: ContractFunction.transact(transaction) + + Execute the specified function by sending a new public transaction. + + Refer to the following invocation: + + .. code-block:: python + + myContract.functions.myMethod(*args, **kwargs).transact(transaction) + + The first portion of the function call ``myMethod(*args, **kwargs)`` + selects the appropriate contract function based on the name and provided + argument. Arguments can be provided as positional arguments, keyword + arguments, or a mix of the two. + + The end portion of this function call ``transact(transaction)`` takes a + single parameter which should be a python dictionary conforming to + the same format as the ``web3.eth.send_transaction(transaction)`` method. + This dictionary may not contain the keys ``data``. + + If any of the ``args`` or ``kwargs`` specified in the ABI are an ``address`` type, they + will accept ENS names. + + If a ``gas`` value is not provided, then the ``gas`` value for the + method transaction will be created using the ``web3.eth.estimate_gas()`` + method. + + Returns the transaction hash. + + .. code-block:: python + + >>> token_contract.functions.transfer(web3.eth.accounts[1], 12345).transact() + "0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd" + + +.. py:method:: ContractFunction.call(transaction, block_identifier='latest') + + Call a contract function, executing the transaction locally using the + ``eth_call`` API. This will not create a new public transaction. + + Refer to the following invocation: + + .. code-block:: python + + myContract.functions.myMethod(*args, **kwargs).call(transaction) + + This method behaves the same as the :py:meth:`ContractFunction.transact` method, + with transaction details being passed into the end portion of the + function call, and function arguments being passed into the first portion. + + Returns the return value of the executed function. + + .. code-block:: python + + >>> my_contract.functions.multiply7(3).call() + 21 + >>> token_contract.functions.myBalance().call({'from': web3.eth.accounts[0]}) + 12345 # the token balance for `web3.eth.accounts[0]` + >>> token_contract.functions.myBalance().call({'from': web3.eth.accounts[1]}) + 54321 # the token balance for the account `web3.eth.accounts[1]` + + You can call the method at a historical block using ``block_identifier``. Some examples: + + .. code-block:: python + + # You can call your contract method at a block number: + >>> token_contract.functions.myBalance().call(block_identifier=10) + + # or a number of blocks back from pending, + # in this case, the block just before the latest block: + >>> token_contract.functions.myBalance().call(block_identifier=-2) + + # or a block hash: + >>> token_contract.functions.myBalance().call(block_identifier='0x4ff4a38b278ab49f7739d3a4ed4e12714386a9fdf72192f2e8f7da7822f10b4d') + >>> token_contract.functions.myBalance().call(block_identifier=b'O\xf4\xa3\x8b\'\x8a\xb4\x9fw9\xd3\xa4\xedN\x12qC\x86\xa9\xfd\xf7!\x92\xf2\xe8\xf7\xdax"\xf1\x0bM') + + # Latest is the default, so this is redundant: + >>> token_contract.functions.myBalance().call(block_identifier='latest') + + # You can check the state after your pending transactions (if supported by your node): + >>> token_contract.functions.myBalance().call(block_identifier='pending') + + Passing the ``block_identifier`` parameter for past block numbers requires that your Ethereum API node + is running in the more expensive archive node mode. Normally synced Ethereum nodes will fail with + a "missing trie node" error, because Ethereum node may have purged the past state from its database. + `More information about archival nodes here `_. + +.. py:method:: ContractFunction.estimate_gas(transaction, block_identifier=None) + + Call a contract function, executing the transaction locally using the + ``eth_call`` API. This will not create a new public transaction. + + Refer to the following invocation: + + .. code-block:: python + + myContract.functions.myMethod(*args, **kwargs).estimate_gas(transaction) + + This method behaves the same as the :py:meth:`ContractFunction.transact` method, + with transaction details being passed into the end portion of the + function call, and function arguments being passed into the first portion. + + Returns the amount of gas consumed which can be used as a gas estimate for + executing this transaction publicly. + + .. code-block:: python + + >>> my_contract.functions.multiply7(3).estimate_gas() + 42650 + + .. note:: + The parameter ``block_identifier`` is not enabled in geth nodes, + hence passing a value of ``block_identifier`` when connected to a geth + nodes would result in an error like: ``ValueError: {'code': -32602, 'message': 'too many arguments, want at most 1'}`` + +.. py:method:: ContractFunction.build_transaction(transaction) + + Builds a transaction dictionary based on the contract function call specified. + + Refer to the following invocation: + + .. code-block:: python + + myContract.functions.myMethod(*args, **kwargs).build_transaction(transaction) + + This method behaves the same as the :py:meth:`Contract.transact` method, + with transaction details being passed into the end portion of the + function call, and function arguments being passed into the first portion. + + .. note:: + `nonce` is not returned as part of the transaction dictionary unless it is + specified in the first portion of the function call: + + .. code-block:: python + + >>> math_contract.functions.increment(5).build_transaction({'nonce': 10}) + + You may use :meth:`~web3.eth.Eth.getTransactionCount` to get the current nonce + for an account. Therefore a shortcut for producing a transaction dictionary with + nonce included looks like: + + .. code-block:: python + + >>> math_contract.functions.increment(5).build_transaction({'nonce': web3.eth.get_transaction_count('0xF5...')}) + + Returns a transaction dictionary. This transaction dictionary can then be sent using + :meth:`~web3.eth.Eth.send_transaction`. + + Additionally, the dictionary may be used for offline transaction signing using + :meth:`~web3.eth.account.Account.sign_transaction`. + + .. code-block:: python + + >>> math_contract.functions.increment(5).build_transaction({'maxFeePerGas': 2000000000, 'maxPriorityFeePerGas': 1000000000}) + { + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'data': '0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005', + 'value': 0, + 'gas': 43242, + 'maxFeePerGas': 2000000000, + 'maxPriorityFeePerGas': 1000000000, + 'chainId': 1 + } + +.. _fallback-function: + +Fallback Function +~~~~~~~~~~~~~~~~~ + + The Contract Factory also offers an API to interact with the fallback function, which supports four methods like + normal functions: + +.. py:method:: Contract.fallback.call(transaction) + + Call fallback function, executing the transaction locally using the + ``eth_call`` API. This will not create a new public transaction. + +.. py:method:: Contract.fallback.estimate_gas(transaction) + + Call fallback function and return the gas estimation. + +.. py:method:: Contract.fallback.transact(transaction) + + Execute fallback function by sending a new public transaction. + +.. py:method:: Contract.fallback.build_transaction(transaction) + + Builds a transaction dictionary based on the contract fallback function call. + +Contract Events +--------------- + +The named events exposed through the :py:attr:`Contract.events` property are of the ContractEvent type. This class is not to be used directly, but instead through :py:attr:`Contract.events`. + +For example: + + .. code-block:: python + + myContract = web3.eth.contract(address=contract_address, abi=contract_abi) + tx_hash = myContract.functions.myFunction().transact() + receipt = web3.eth.get_transaction_receipt(tx_hash) + myContract.events.MyEvent().process_receipt(receipt) + +.. py:class:: ContractEvent + +Attributes +~~~~~~~~~~ + +The :py:class:`ContractEvent` class provides attributes for each event. Access the event attributes through `Contract.events.MyEvent`. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).abi_element_identifier + + The signature of the event assigned to the class ``__name__`` during initialization. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).name + + A string representing the event, receive or fallback name. + + Use :py:attr:`ContractEvent.MyEvent(*args, **kwargs).signature` when the event arguments are needed. + + This is an alias of :py:attr:`ContractEvent.MyEvent(*args, **kwargs).event_name`. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).signature + + A string representing the event signature. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).abi + + The event ABI with the type, name, inputs. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).argument_names + + The event input names. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).argument_types + + The event input types. + +.. py:attribute:: ContractEvent.MyEvent(*args, **kwargs).topic + + The event topic represented by a hex encoded string from the keccak signature. + +Methods +~~~~~~~ + +:py:class:`ContractEvent` provides methods to interact with contract events. Positional and keyword arguments supplied to the contract event subclass will be used to find the contract event by signature. + +.. _contract_get_logs: + +.. py:method:: ContractEvent.get_logs(from_block=None, to_block="latest", block_hash=None, argument_filters={}) + :noindex: + + Fetches all logs for a given event within the specified block range or block hash. + + Returns a list of decoded event logs sorted by ``logIndex``. + + ``argument_filters`` is an optional dictionary argument that can be used to filter + for logs where the event's argument values match the values provided in the + dictionary. The keys must match the event argument names as they exist in the ABI. + The values can either be a single value or a list of values to match against. If a + list is provided, the logs will be filtered for any logs that match any of the + values in the list. Indexed arguments are filtered pre-call by building specific + ``topics`` to filter for. Non-indexed arguments are filtered by the library after + the logs are fetched from the node. + + .. code-block:: python + + my_contract = web3.eth.contract(address=contract_address, abi=contract_abi) + + # get ``MyEvent`` logs from block 1337 to block 2337 where the value for the + # event argument "eventArg1" is either 1, 2, or 3 + my_contract.events.MyEvent().get_logs( + argument_filters={"eventArg1": [1, 2, 3]}, + from_block=1337, + to_block=2337, + ) + +.. _process_receipt: + +.. py:method:: ContractEvent.process_receipt(transaction_receipt, errors=WARN) + :noindex: + + Extracts the pertinent logs from a transaction receipt. + + If there are no errors, ``process_receipt`` returns a tuple of :ref:`Event Log Objects `, emitted from the event (e.g. ``MyEvent``), + with decoded output. + + .. code-block:: python + + >>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address}) + >>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash) + >>> rich_logs = contract.events.MyEvent().process_receipt(tx_receipt) + >>> rich_logs[0]['args'] + {'myArg': 12345} + + If there are errors, the logs will be handled differently depending on the flag that is passed in: + + - ``WARN`` (default) - logs a warning to the console for the log that has an error, and discards the log. Returns any logs that are able to be processed. + - ``STRICT`` - stops all processing and raises the error encountered. + - ``IGNORE`` - returns any raw logs that raised an error with an added "errors" field, along with any other logs were able to be processed. + - ``DISCARD`` - silently discards any logs that have errors, and returns processed logs that don't have errors. + + An event log error flag needs to be imported from ``web3/logs.py``. + + .. code-block:: python + + >>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address}) + >>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash) + >>> processed_logs = contract.events.MyEvent().process_receipt(tx_receipt) + >>> processed_logs + ( + AttributeDict({ + 'args': AttributeDict({}), + 'event': 'MyEvent', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa'), + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'blockHash': HexBytes('0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68'), + 'blockNumber': 3 + }) + ) + + + # Or, if there were errors encountered during processing: + >>> from web3.logs import STRICT, IGNORE, DISCARD, WARN + >>> processed_logs = contract.events.MyEvent().process_receipt(tx_receipt, errors=IGNORE) + >>> processed_logs + ( + AttributeDict({ + 'type': 'mined', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('0x01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529'), + 'blockHash': HexBytes('0x92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a'), + 'blockNumber': 5, + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'data': '0x0000000000000000000000000000000000000000000000000000000000003039', + 'topics': [ + HexBytes('0xf70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb15') + ], + 'errors': LogTopicError('Expected 1 log topics. Got 0')}) + }) + ) + >>> processed_logs = contract.events.MyEvent().process_receipt(tx_receipt, errors=DISCARD) + >>> assert processed_logs == () + True + +.. py:method:: ContractEvent.process_log(log) + + Similar to process_receipt_, but only processes one log at a time, instead of a whole transaction receipt. + Will return a single :ref:`Event Log Object ` if there are no errors encountered during processing. If an error is encountered during processing, it will be raised. + + .. code-block:: python + + >>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address}) + >>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash) + >>> log_to_process = tx_receipt['logs'][0] + >>> processed_log = contract.events.MyEvent().process_log(log_to_process) + >>> processed_log + AttributeDict({ + 'args': AttributeDict({}), + 'event': 'MyEvent', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa'), + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'blockHash': HexBytes('0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68'), + 'blockNumber': 3 + }) + + +.. _event-log-object: + +Event Log Object +~~~~~~~~~~~~~~~~ + + The Event Log Object is a python dictionary with the following keys: + + * ``args``: Dictionary - The arguments coming from the event. + * ``event``: String - The event name. + * ``logIndex``: Number - integer of the log index position in the block. + * ``transactionIndex``: Number - integer of the transactions index position + log was created from. + * ``transactionHash``: String, 32 Bytes - hash of the transactions this log + was created from. + * ``address``: String, 32 Bytes - address from which this log originated. + * ``blockHash``: String, 32 Bytes - hash of the block where this log was + in. null when it's pending. + * ``blockNumber``: Number - the block number where this log was in. null + when it's pending. + +.. testsetup:: create_filter + + from web3 import Web3 + from hexbytes import HexBytes + w3 = Web3(Web3.EthereumTesterProvider()) + bytecode = '6060604052341561000c57fe5b604051602080610acb833981016040528080519060200190919050505b620f42408114151561003b5760006000fd5b670de0b6b3a76400008102600281905550600254600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b610a27806100a46000396000f30060606040523615610097576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610099578063095ea7b31461013257806318160ddd1461018957806323b872dd146101af578063313ce5671461022557806370a082311461025157806395d89b411461029b578063a9059cbb14610334578063dd62ed3e1461038b575bfe5b34156100a157fe5b6100a96103f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b61016f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061042e565b604051808215151515815260200191505060405180910390f35b341561019157fe5b610199610521565b6040518082815260200191505060405180910390f35b34156101b757fe5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610527565b604051808215151515815260200191505060405180910390f35b341561022d57fe5b610235610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561025957fe5b610285600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610796565b6040518082815260200191505060405180910390f35b34156102a357fe5b6102ab6107e0565b60405180806020018281038252838181518152602001915080519060200190808383600083146102fa575b8051825260208311156102fa576020820191506020810190506020830392506102d6565b505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033c57fe5b610371600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061081a565b604051808215151515815260200191505060405180910390f35b341561039357fe5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610973565b6040518082815260200191505060405180910390f35b604060405190810160405280600981526020017f54657374546f6b656e000000000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410806105f1575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b156105fc5760006000fd5b81600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b604060405190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156108695760006000fd5b81600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058205071371ee2a4a1be3c96e77d939cdc26161a256fdd638efc08bd33dfc65d3b850029' + ABI = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"inputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"type":"constructor","stateMutability":"nonpayable"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]' + my_token_contract = w3.eth.contract(abi=ABI, bytecode=bytecode) + alice, bob = w3.eth.accounts[0], w3.eth.accounts[1] + assert alice == '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', alice + assert bob == '0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF', bob + tx_hash = my_token_contract.constructor(1000000).transact({'from': alice, 'gas': 899000, 'gasPrice': Web3.to_wei(1, 'gwei')}) + assert tx_hash == HexBytes('0x49e3da72a95e4074a9eaea7b438c73ca154627d317e58abeae914e3769a15044'), tx_hash + txn_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + assert txn_receipt['contractAddress'] == '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', txn_receipt['contractAddress'] + contract_address = txn_receipt['contractAddress'] + contract = w3.eth.contract(contract_address, abi=ABI) + total_supply = contract.functions.totalSupply().call() + decimals = 10 ** 18 + assert total_supply == 1000000 * decimals, total_supply + tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': Web3.to_wei(1, 'gwei')}) + tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + +.. doctest:: create_filter + + >>> transfer_filter = my_token_contract.events.Transfer.create_filter(from_block="0x0", argument_filters={'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf'}) + >>> transfer_filter.get_new_entries() + [AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'value': 10}), + 'event': 'Transfer', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'), + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'blockHash': HexBytes('...'), + 'blockNumber': 2})] + >>> transfer_filter.get_new_entries() + [] + >>> tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 1000000000}) + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> transfer_filter.get_new_entries() + [AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'value': 10}), + 'event': 'Transfer', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('...'), + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'blockHash': HexBytes('...'), + 'blockNumber': 3})] + >>> transfer_filter.get_all_entries() + [AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'value': 10}), + 'event': 'Transfer', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('...'), + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'blockHash': HexBytes('...'), + 'blockNumber': 2}), + AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', + 'value': 10}), + 'event': 'Transfer', + 'logIndex': 0, + 'transactionIndex': 0, + 'transactionHash': HexBytes('...'), + 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', + 'blockHash': HexBytes('...'), + 'blockNumber': 3})] + +Utils +----- + +.. py:classmethod:: Contract.decode_function_input(data) + + Decodes the transaction data used to invoke a smart contract function, and returns + :py:class:`ContractFunction` and decoded parameters as :py:class:`dict`. + + .. code-block:: python + + >>> transaction = w3.eth.get_transaction('0x5798fbc45e3b63832abc4984b0f3574a13545f415dd672cd8540cd71f735db56') + >>> transaction.input + '0x612e45a3000000000000000000000000b656b2a9c3b2416437a811e07466ca712f5a5b5a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000116c6f6e656c792c20736f206c6f6e656c7900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + >>> contract.decode_function_input(transaction.input) + (, + {'_recipient': '0xB656b2a9c3b2416437A811e07466cA712F5a5b5a', + '_amount': 0, + '_description': b'lonely, so lonely', + '_transactionData': b'', + '_debatingPeriod': 604800, + '_newCurator': True}) + +ContractCaller +-------------- + +.. py:class:: ContractCaller + +The ``ContractCaller`` class provides an API to call functions in a contract. This class +is not to be used directly, but instead through ``Contract.caller``. + +There are a number of different ways to invoke the ``ContractCaller``. + +For example: + +.. testsetup:: contractcaller + + import json + from web3 import Web3 + w3 = Web3(Web3.EthereumTesterProvider()) + bytecode = "0x606060405261022e806100126000396000f360606040523615610074576000357c01000000000000000000000000000000000000000000000000000000009004806316216f391461007657806361bc221a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d578063dcf537b11461014057610074565b005b610083600480505061016c565b6040518082815260200191505060405180910390f35b6100a6600480505061017f565b6040518082815260200191505060405180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b6040518082815260200191505060405180910390f35b6101566004808035906020019091905050610217565b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90565b60006000505481565b6000816000600082828250540192505081905550600060005054905080507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b60006007820290508050809050610229565b91905056" + ABI = json.loads('[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"increased","type":"event"}]') + contract = w3.eth.contract(abi=ABI, bytecode=bytecode) + deploy_txn = contract.constructor().transact() + deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn) + address = deploy_receipt.contractAddress + +.. doctest:: contractcaller + + >>> myContract = w3.eth.contract(address=address, abi=ABI) + >>> twentyone = myContract.caller.multiply7(3) + >>> twentyone + 21 + +It can also be invoked using parentheses: + +.. doctest:: contractcaller + + >>> twentyone = myContract.caller().multiply7(3) + >>> twentyone + 21 + +And a transaction dictionary, with or without the ``transaction`` keyword. +You can also optionally include a block identifier. For example: + +.. doctest:: contractcaller + + >>> from_address = w3.eth.accounts[1] + >>> twentyone = myContract.caller({'from': from_address}).multiply7(3) + >>> twentyone + 21 + >>> twentyone = myContract.caller(transaction={'from': from_address}).multiply7(3) + >>> twentyone + 21 + >>> twentyone = myContract.caller(block_identifier='latest').multiply7(3) + >>> twentyone + 21 + +Like :py:class:`ContractFunction`, :py:class:`ContractCaller` +provides methods to interact with contract functions. +Positional and keyword arguments supplied to the contract caller subclass +will be used to find the contract function by signature, +and forwarded to the contract function when applicable. + + +Examples +-------- + +Working with an ERC-20 Token Contract +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Most fungible tokens on the Ethereum blockchain conform to the `ERC-20`_ +standard. This section of the guide covers interacting with an existing token +contract which conforms to this standard. + +.. testsetup:: + + from web3 import Web3 + from hexbytes import HexBytes + w3 = Web3(Web3.EthereumTesterProvider()) + bytecode = '6060604052341561000c57fe5b604051602080610acb833981016040528080519060200190919050505b620f42408114151561003b5760006000fd5b670de0b6b3a76400008102600281905550600254600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b610a27806100a46000396000f30060606040523615610097576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610099578063095ea7b31461013257806318160ddd1461018957806323b872dd146101af578063313ce5671461022557806370a082311461025157806395d89b411461029b578063a9059cbb14610334578063dd62ed3e1461038b575bfe5b34156100a157fe5b6100a96103f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b61016f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061042e565b604051808215151515815260200191505060405180910390f35b341561019157fe5b610199610521565b6040518082815260200191505060405180910390f35b34156101b757fe5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610527565b604051808215151515815260200191505060405180910390f35b341561022d57fe5b610235610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561025957fe5b610285600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610796565b6040518082815260200191505060405180910390f35b34156102a357fe5b6102ab6107e0565b60405180806020018281038252838181518152602001915080519060200190808383600083146102fa575b8051825260208311156102fa576020820191506020810190506020830392506102d6565b505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033c57fe5b610371600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061081a565b604051808215151515815260200191505060405180910390f35b341561039357fe5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610973565b6040518082815260200191505060405180910390f35b604060405190810160405280600981526020017f54657374546f6b656e000000000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410806105f1575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b156105fc5760006000fd5b81600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b604060405190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156108695760006000fd5b81600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058205071371ee2a4a1be3c96e77d939cdc26161a256fdd638efc08bd33dfc65d3b850029' + ABI = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"inputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"type":"constructor","stateMutability":"nonpayable"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]' + factory = w3.eth.contract(abi=ABI, bytecode=bytecode) + alice, bob = w3.eth.accounts[0], w3.eth.accounts[1] + assert alice == '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf', alice + assert bob == '0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF', bob + tx_hash = factory.constructor(1000000).transact({'from': alice, 'gas': 899000, 'gasPrice': Web3.to_wei(1, 'gwei')}) + assert tx_hash == HexBytes('0x49e3da72a95e4074a9eaea7b438c73ca154627d317e58abeae914e3769a15044'), tx_hash + txn_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + assert txn_receipt['contractAddress'] == '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', txn_receipt['contractAddress'] + contract_address = txn_receipt['contractAddress'] + contract = w3.eth.contract(contract_address, abi=ABI) + total_supply = contract.functions.totalSupply().call() + decimals = 10 ** 18 + assert total_supply == 1000000 * decimals, total_supply + + +In this guide we will interact with an existing token contract that we have +already deployed to a local testing chain. This guide assumes: + +1. An existing token contract at a known address. +2. Access to the proper ``ABI`` for the given contract. +3. A ``web3.main.Web3`` instance connected to a provider with an unlocked account which can send transactions. + + +Creating the contract factory +````````````````````````````` + +First we need to create a contract instance with the address of our token +contract and the ``ERC-20`` ABI. + +.. doctest:: + + >>> contract = w3.eth.contract(contract_address, abi=ABI) + >>> contract.address + '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b' + + +Querying token metadata +``````````````````````` + +Each token will have a total supply which represents the total number of tokens +in circulation. In this example we've initialized the token contract to have 1 +million tokens. Since this token contract is setup to have 18 decimal places, +the raw total supply returned by the contract is going to have 18 additional +decimal places. + +.. doctest:: + + >>> contract.functions.name().call() + 'TestToken' + >>> contract.functions.symbol().call() + 'TEST' + >>> decimals = contract.functions.decimals().call() + >>> decimals + 18 + >>> DECIMALS = 10 ** decimals + >>> contract.functions.totalSupply().call() // DECIMALS + 1000000 + + +Query account balances +`````````````````````` + +Next we can query some account balances using the contract's ``balanceOf`` +function. The token contract we are using starts with a single account which +we'll refer to as ``alice`` holding all of the tokens. + +.. doctest:: + + >>> alice = '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf' + >>> bob = '0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF' + >>> raw_balance = contract.functions.balanceOf(alice).call() + >>> raw_balance + 1000000000000000000000000 + >>> raw_balance // DECIMALS + 1000000 + >>> contract.functions.balanceOf(bob).call() + 0 + + +Sending tokens +`````````````` + +Next we can transfer some tokens from ``alice`` to ``bob`` using the contract's +``transfer`` function. + + +.. doctest:: + + >>> tx_hash = contract.functions.transfer(bob, 100).transact({'from': alice}) + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> contract.functions.balanceOf(alice).call() + 999999999999999999999900 + >>> contract.functions.balanceOf(bob).call() + 100 + + +Creating an approval for external transfers +``````````````````````````````````````````` + +Alice could also *approve* someone else to spend tokens from her account using +the ``approve`` function. We can also query how many tokens we're approved to +spend using the ``allowance`` function. + +.. doctest:: + + >>> contract.functions.allowance(alice, bob).call() + 0 + >>> tx_hash = contract.functions.approve(bob, 200).transact({'from': alice}) + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> contract.functions.allowance(alice, bob).call() + 200 + + +Performing an external transfer +``````````````````````````````` + +When someone has an allowance they can transfer those tokens using the +``transferFrom`` function. + +.. doctest:: + + >>> contract.functions.allowance(alice, bob).call() + 200 + >>> contract.functions.balanceOf(bob).call() + 100 + >>> tx_hash = contract.functions.transferFrom(alice, bob, 75).transact({'from': bob}) + >>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) + >>> contract.functions.allowance(alice, bob).call() + 125 + >>> contract.functions.balanceOf(bob).call() + 175 + + +.. _ERC-20: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-20.md + + +Using a struct as a function argument +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +web3.py accepts struct arguments as dictionaries. This format also supports nested structs. +Let's take a look at a quick example. Given the following Solidity contract: + +.. code-block:: none + + contract Example { + address addr; + + struct S1 { + address a1; + address a2; + } + + struct S2 { + bytes32 b1; + bytes32 b2; + } + + struct X { + S1 s1; + S2 s2; + address[] users; + } + + function update(X memory x) public { + addr = x.s1.a2; + } + + function retrieve() public view returns (address) { + return addr; + } + } + +You can interact with the web3.py contract API as follows: + +.. code-block:: python + + # deploy or lookup the deployed contract, then: + + >>> deployed_contract.functions.retrieve().call() + '0x0000000000000000000000000000000000000000' + + >>> deployed_contract.functions.update({'s1': ['0x0000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000002'], 's2': [b'0'*32, b'1'*32], 'users': []}).transact() + + >>> deployed_contract.functions.retrieve().call() + '0x0000000000000000000000000000000000000002' + + +.. _ambiguous-contract-functions: + +Invoke Ambiguous Contract Functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Calling overloaded functions can be done as you would expect. Passing arguments will +disambiguate which function you want to call. + +For example, if you have a contract with two functions with the name ``identity`` that +accept different types of arguments, you can call them like this: + +.. code-block:: python + + >>> ambiguous_contract = w3.eth.contract(address=..., abi=...) + >>> ambiguous_contract.functions.identity(1, True).call() + 1 + >>> ambiguous_contract.functions.identity("one", 1, True).call() + 1 + +If there is a need to first retrieve the function, you can use the contract instance's +``get_function_by_signature`` method to get the function you want to call. + +Below is an example of a contract that has multiple functions of the same name, +and the arguments are ambiguous. You can use the :meth:`Contract.get_function_by_signature` +method to reference the intended function and call it with the correct arguments. + +.. code-block:: python + + >>> contract_source_code = """ + pragma solidity ^0.8.24; + contract AmbiguousDuo { + function identity(uint256 input, bool uselessFlag) public pure returns (uint256) { + return input; + } + function identity(int256 input, bool uselessFlag) public pure returns (int256) { + return input; + } + } + """ + # fast forward all the steps of compiling and deploying the contract. + + >>> identity_func = ambiguous_contract.get_function_by_signature('identity(uint256,bool)') + >>> identity_func(1, True) + + >>> identity_func(1, True).call() + 1 + + +.. _ccip-read-example: + +CCIP Read support for offchain lookup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Contract calls support CCIP Read by default, via a ``ccip_read_enabled`` flag on the call and, more globally, a +``global_ccip_read_enabled`` flag on the provider. The following should work by default without raising an +``OffchainLookup`` and instead handling it appropriately as per the specification outlined in +`EIP-3668 `_. + +.. code-block:: python + + myContract.functions.revertsWithOffchainLookup(myData).call() + +If the offchain lookup requires the user to send a transaction rather than make a call, this may be handled +appropriately in the following way: + +.. code-block:: python + + from web3 import Web3, WebSocketProvider + from web3.utils import handle_offchain_lookup + + w3 = Web3(WebSocketProvider(...)) + + myContract = w3.eth.contract(address=...) + myData = b'data for offchain lookup function call' + + # preflight with an `eth_call` and handle the exception + try: + myContract.functions.revertsWithOffchainLookup(myData).call(ccip_read_enabled=False) + except OffchainLookup as ocl: + tx = {'to': myContract.address, 'from': my_account} + data_for_callback_function = handle_offchain_lookup(ocl.payload) + tx['data'] = data_for_callback_function + + # send the built transaction with `eth_sendTransaction` or sign and send with `eth_sendRawTransaction` + tx_hash = w3.eth.send_transaction(tx) + +Contract Unit Tests in Python +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Here is an example of how one can use the `pytest`_ framework in python, web3.py, +eth-tester, and PyEVM to perform unit tests entirely in python without any +additional need for a full featured ethereum node/client. To install needed +dependencies you can use the pinned extra for testing: + +.. _pytest: https://docs.pytest.org/en/latest/ + +.. code-block:: bash + + $ pip install web3[test] pytest + +Once you have an environment set up for testing, you can then write your tests +like so: + +.. include:: ../tests/core/contracts/test_contract_example.py + :code: python + :start-line: 1 diff --git a/_build/html_zh_CN/_sources/web3.eth.account.rst.txt b/_build/html_zh_CN/_sources/web3.eth.account.rst.txt new file mode 100644 index 0000000000..ad0cec455c --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.eth.account.rst.txt @@ -0,0 +1,454 @@ +.. _eth-account: + +Accounts +======== + +.. _local_vs_hosted: + +Local vs Hosted Nodes +--------------------- + +Hosted Node + A **hosted** node is controlled by someone else. You may also see these referred to + as **remote** nodes. View a list of commercial `node providers `_. + +Local Node + A **local** node is started and controlled by you on your computer. For several reasons + (e.g., privacy, security), this is the recommended path, but it requires more resources + and work to set up and maintain. See `ethereum.org `_ for a guided tour. + +Local vs Hosted Keys +-------------------- + +An Ethereum private key is a 256-bit (32 bytes) random integer. +For each private key, you get one Ethereum address, +also known as an Externally Owned Account (EOA). + +In Python, the private key is expressed as a 32-byte long Python ``bytes`` object. +When a private key is presented to users in a hexadecimal format, it may or may +not contain a starting ``0x`` hexadecimal prefix. + +Local Private Key + A local private key is a locally stored secret you import to your Python application. + Please read below how you can create and import a local private key + and use it to sign transactions. + +Hosted Private Key + This is a legacy way to use accounts when working with unit test backends like + ``EthereumTesterProvider`` or `Anvil `_. + Calling ``web3.eth.accounts`` gives you a + predefined list of accounts that have been funded with test ETH. + You can use :meth:`~web3.eth.Eth.send_transaction` on any of these accounts + without further configuration. + + In the past, around 2015, this was also a way to use private keys + in a locally hosted node, but this practice is now discouraged. + +.. warning:: + + ``web3.eth.send_transaction`` does not work with modern node providers, + because they relied on a node state and all modern nodes are stateless. + You must always use local private keys when working with nodes hosted by + someone else. + + +Some Common Uses for Local Private Keys +--------------------------------------- + +A very common reason to work with local private keys is to interact +with a hosted node. + +Some common things you might want to do with a `Local Private Key` are: + +- `Sign a Transaction`_ +- `Sign a Contract Transaction`_ +- `Sign a Message`_ +- `Verify a Message`_ + +Using private keys usually involves ``w3.eth.account`` in one way or another. Read on for more, +or see a full list of things you can do in the docs for +:class:`eth_account.Account `. + + +Creating a Private Key +---------------------- + +Each Ethereum address has a matching private key. To create a new Ethereum +account you can just generate a random number that acts as a private key. + +- A private key is just a random unguessable, or cryptographically safe, 256-bit integer number + +- A valid private key is > 0 and < max private key value (a number above the elliptic curve order FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141) + +- Private keys do not have checksums. + +To create a private key using web3.py and command line you can do: + +.. code-block:: shell + + python -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(f'private key={w3.to_hex(acc.key)}, account={acc.address}')" + +Which outputs a new private key and an account pair:: + + private key=0x480c4aec9fa..., account=0x9202a9d5D2d129CB400a40e00aC822a53ED81167 + +- *Never store private key with your source*. Use environment variables + to store the key. Read more below. + +- You can also import the raw hex private key to MetaMask and any other + wallet - the private key can be shared between your Python code + and any number of wallets. + + +Funding a New Account +--------------------- + +If you create a private key, it comes with its own Ethereum address. +By default, the balance of this address is zero. +Before you can send any transactions with your account, +you need to top up. + +- For a local test environment (e.g., ``EthereumTesterProvider``), any + environment is bootstrapped with accounts that have test ETH in them. + Move ETH from default accounts to your newly created account. + +- For public mainnet, you need to buy ETH in a cryptocurrency exchange + and send it to your privately controlled account. + +- For a testnet, find a relevant testnet :ref:`faucet `. + + +Reading a Private Key from an Environment Variable +-------------------------------------------------- + +In this example we pass the private key to our Python application in an +`environment variable `_. +This private key is then added to the transaction signing keychain +with ``Signing`` middleware. + +If unfamiliar, note that you can `export your private keys from Metamask and other wallets `_. + +.. warning :: + + - **Never** share your private keys. + - **Never** put your private keys in source code. + - **Never** commit private keys to a Git repository. + +Example ``account_test_script.py`` + +.. code-block:: python + + import os + from eth_account import Account + from eth_account.signers.local import LocalAccount + from web3 import Web3, EthereumTesterProvider + from web3.middleware import SignAndSendRawMiddlewareBuilder + + w3 = Web3(EthereumTesterProvider()) + + private_key = os.environ.get("PRIVATE_KEY") + assert private_key is not None, "You must set PRIVATE_KEY environment variable" + assert private_key.startswith("0x"), "Private key must start with 0x hex prefix" + + account: LocalAccount = Account.from_key(private_key) + w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(account), layer=0) + + print(f"Your hot wallet address is {account.address}") + + # Now you can use web3.eth.send_transaction(), Contract.functions.xxx.transact() functions + # with your local private key through middleware and you no longer get the error + # "ValueError: The method eth_sendTransaction does not exist/is not available + +Example how to run this in UNIX shell: + +.. code-block:: shell + + # Generate a new 256-bit random integer using openssl UNIX command that acts as a private key. + # You can also do: + # python -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(f'private key={w3.to_hex(acc.key)}, account={acc.address}')" + # Store this in a safe place, like in your password manager. + export PRIVATE_KEY=0x`openssl rand -hex 32` + + # Run our script + python account_test_script.py + + +This will print:: + + Your hot wallet address is 0x27C8F899bb69E1501BBB96d09d7477a2a7518918 + + +.. _extract_geth_pk: + +Extract private key from geth keyfile +------------------------------------- + +.. NOTE:: + The amount of available ram should be greater than 1GB. + +.. code-block:: python + + with open('~/.ethereum/keystore/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') as keyfile: + encrypted_key = keyfile.read() + private_key = w3.eth.account.decrypt(encrypted_key, 'correcthorsebatterystaple') + # tip: do not save the key or password anywhere, especially into a shared source file + + +Sign a Message +-------------- + +.. WARNING:: There is no single message format that is broadly adopted + with community consensus. Keep an eye on several options, + like `EIP-683 `_, + `EIP-712 `_, and + `EIP-719 `_. Consider + the :meth:`w3.eth.sign() ` approach be deprecated. + +For this example, we will use the same message hashing mechanism that +is provided by :meth:`w3.eth.sign() `. + +.. doctest:: + + >>> from web3 import Web3, EthereumTesterProvider + >>> from eth_account.messages import encode_defunct + + >>> w3 = Web3(EthereumTesterProvider()) + >>> msg = "I♥SF" + >>> private_key = b"\xb2\\}\xb3\x1f\xee\xd9\x12''\xbf\t9\xdcv\x9a\x96VK-\xe4\xc4rm\x03[6\xec\xf1\xe5\xb3d" + >>> message = encode_defunct(text=msg) + >>> signed_message = w3.eth.account.sign_message(message, private_key=private_key) + >>> signed_message + SignedMessage(message_hash=HexBytes('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750'), + r=104389933075820307925104709181714897380569894203213074526835978196648170704563, + s=28205917190874851400050446352651915501321657673772411533993420917949420456142, + v=28, + signature=HexBytes('0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb33e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce1c')) + + +Verify a Message +---------------- + +With the original message text and a signature: + +.. doctest:: + + >>> message = encode_defunct(text="I♥SF") + >>> w3.eth.account.recover_message(message, signature=signed_message.signature) + '0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E' + + +Prepare message for ecrecover in Solidity +----------------------------------------- + +Let's say you want a contract to validate a signed message, +like if you're making payment channels, and you want to +validate the value in Remix or web3.js. + +You might have produced the signed_message locally, as in +`Sign a Message`_. If so, this will prepare it for Solidity: + +.. doctest:: + + >>> from web3 import Web3 + + # ecrecover in Solidity expects v as a uint8, but r and s as left-padded bytes32 + # Remix / web3.js expect r and s to be encoded to hex + # This convenience method will do the pad & hex for us: + >>> def to_32byte_hex(val): + ... return Web3.to_hex(Web3.to_bytes(val).rjust(32, b'\0')) + + >>> ec_recover_args = (msghash, v, r, s) = ( + ... Web3.to_hex(signed_message.message_hash), + ... signed_message.v, + ... to_32byte_hex(signed_message.r), + ... to_32byte_hex(signed_message.s), + ... ) + >>> ec_recover_args + ('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750', + 28, + '0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3', + '0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce') + +Instead, you might have received a message and a signature encoded to hex. Then +this will prepare it for Solidity: + +.. doctest:: + + >>> from web3 import Web3 + >>> from eth_account.messages import encode_defunct, _hash_eip191_message + + >>> hex_message = '0x49e299a55346' + >>> hex_signature = '0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb33e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce1c' + + # ecrecover in Solidity expects an encoded version of the message + + # - encode the message + >>> message = encode_defunct(hexstr=hex_message) + + # - hash the message explicitly + >>> message_hash = _hash_eip191_message(message) + + # Remix / web3.js expect the message hash to be encoded to a hex string + >>> hex_message_hash = Web3.to_hex(message_hash) + + # ecrecover in Solidity expects the signature to be split into v as a uint8, + # and r, s as a bytes32 + # Remix / web3.js expect r and s to be encoded to hex + >>> sig = Web3.to_bytes(hexstr=hex_signature) + >>> v, hex_r, hex_s = Web3.to_int(sig[-1]), Web3.to_hex(sig[:32]), Web3.to_hex(sig[32:64]) + + # ecrecover in Solidity takes the arguments in order = (msghash, v, r, s) + >>> ec_recover_args = (hex_message_hash, v, hex_r, hex_s) + >>> ec_recover_args + ('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750', + 28, + '0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3', + '0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce') + + +Verify a message with ecrecover in Solidity +------------------------------------------- + +Create a simple ecrecover contract in `Remix `_: + +.. code-block:: none + + pragma solidity ^0.4.19; + + contract Recover { + function ecr (bytes32 msgh, uint8 v, bytes32 r, bytes32 s) public pure + returns (address sender) { + return ecrecover(msgh, v, r, s); + } + } + +Then call ecr with these arguments from `Prepare message for ecrecover in Solidity`_ in Remix, +``"0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750", 28, "0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3", "0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce"`` + +The message is verified, because we get the correct sender of +the message back in response: ``0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12e``. + + +.. _local-sign-transaction: + +Sign a Transaction +------------------ + +Create a transaction, sign it locally, and then send it to your node for broadcasting, +with :meth:`~web3.eth.Eth.send_raw_transaction`. + +.. doctest:: + + >>> transaction = { + ... 'to': '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55', + ... 'value': 1000000000, + ... 'gas': 2000000, + ... 'maxFeePerGas': 2000000000, + ... 'maxPriorityFeePerGas': 1000000000, + ... 'nonce': 0, + ... 'chainId': 1, + ... 'type': '0x2', # the type is optional and, if omitted, will be interpreted based on the provided transaction parameters + ... 'accessList': ( # accessList is optional for dynamic fee transactions + ... { + ... 'address': '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae', + ... 'storageKeys': ( + ... '0x0000000000000000000000000000000000000000000000000000000000000003', + ... '0x0000000000000000000000000000000000000000000000000000000000000007', + ... ) + ... }, + ... { + ... 'address': '0xbb9bc244d798123fde783fcc1c72d3bb8c189413', + ... 'storageKeys': () + ... }, + ... ) + ... } + >>> key = '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318' + >>> signed = w3.eth.account.sign_transaction(transaction, key) + >>> signed.raw_transaction + HexBytes('0x02f8e20180843b9aca008477359400831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca0080f872f85994de0b295669a9fd93d5f28d9ec85e40f4cb697baef842a00000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000007d694bb9bc244d798123fde783fcc1c72d3bb8c189413c001a0b9ec671ccee417ff79e06e9e52bfa82b37cf1145affde486006072ca7a11cf8da0484a9beea46ff6a90ac76e7bbf3718db16a8b4b09cef477fb86cf4e123d98fde') + >>> signed.hash + HexBytes('0xe85ce7efa52c16cb5c469c7bde54fbd4911639fdfde08003f65525a85076d915') + >>> signed.r + 84095564551732371065849105252408326384410939276686534847013731510862163857293 + >>> signed.s + 32698347985257114675470251181312399332782188326270244072370350491677872459742 + >>> signed.v + 1 + + # When you run send_raw_transaction, you get back the hash of the transaction: + >>> w3.eth.send_raw_transaction(signed.raw_transaction) # doctest: +SKIP + '0xe85ce7efa52c16cb5c469c7bde54fbd4911639fdfde08003f65525a85076d915' + + +Sign a Contract Transaction +--------------------------- + +To sign a transaction locally that will invoke a smart contract: + +#. Initialize your :meth:`Contract ` object +#. Build the transaction +#. Sign the transaction, with :meth:`w3.eth.account.sign_transaction() + ` +#. Broadcast the transaction with :meth:`~web3.eth.Eth.send_raw_transaction` + +.. testsetup:: + + import json + + nonce = 0 + + EIP20_ABI = json.loads('[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event"}]') # noqa: 501 + + +.. doctest:: + + # When running locally, execute the statements found in the file linked below to load the EIP20_ABI variable. + # See: https://github.com/carver/ethtoken.py/blob/v0.0.1-alpha.4/ethtoken/abi.py + + >>> from web3 import Web3, EthereumTesterProvider + >>> w3 = Web3(EthereumTesterProvider()) + + >>> unicorns = w3.eth.contract(address="0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359", abi=EIP20_ABI) + + >>> nonce = w3.eth.get_transaction_count('0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') # doctest: +SKIP + + # Build a transaction that invokes this contract's function, called transfer + >>> unicorn_txn = unicorns.functions.transfer( + ... '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359', + ... 1, + ... ).build_transaction({ + ... 'chainId': 1, + ... 'gas': 70000, + ... 'maxFeePerGas': w3.to_wei('2', 'gwei'), + ... 'maxPriorityFeePerGas': w3.to_wei('1', 'gwei'), + ... 'nonce': nonce, + ... }) + + >>> unicorn_txn + {'value': 0, + 'chainId': 1, + 'gas': 70000, + 'maxFeePerGas': 2000000000, + 'maxPriorityFeePerGas': 1000000000, + 'nonce': 0, + 'to': '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359', + 'data': '0xa9059cbb000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000001'} + + >>> private_key = b"\xb2\\}\xb3\x1f\xee\xd9\x12''\xbf\t9\xdcv\x9a\x96VK-\xe4\xc4rm\x03[6\xec\xf1\xe5\xb3d" + >>> signed_txn = w3.eth.account.sign_transaction(unicorn_txn, private_key=private_key) + >>> signed_txn.hash + HexBytes('0x748db062639a45e519dba934fce09c367c92043867409160c9989673439dc817') + >>> signed_txn.raw_transaction + HexBytes('0x02f8b00180843b9aca0084773594008301117094fb6916095ca1df60bb79ce92ce3ea74c37c5d35980b844a9059cbb000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000001c001a0cec4150e52898cf1295cc4020ac0316cbf186071e7cdc5ec44eeb7cdda05afa2a06b0b3a09c7fb0112123c0bef1fd6334853a9dcf3cb5bab3ccd1f5baae926d449') + >>> signed_txn.r + 93522894155654168208483453926995743737629589441154283159505514235904280342434 + >>> signed_txn.s + 48417310681110102814014302147799665717176259465062324746227758019974374282313 + >>> signed_txn.v + 1 + + >>> w3.eth.send_raw_transaction(signed_txn.raw_transaction) # doctest: +SKIP + + # When you run send_raw_transaction, you get the same result as the hash of the transaction: + >>> w3.to_hex(w3.keccak(signed_txn.raw_transaction)) + '0x748db062639a45e519dba934fce09c367c92043867409160c9989673439dc817' diff --git a/_build/html_zh_CN/_sources/web3.eth.rst.txt b/_build/html_zh_CN/_sources/web3.eth.rst.txt new file mode 100644 index 0000000000..9d391938b4 --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.eth.rst.txt @@ -0,0 +1,1409 @@ +.. _web3-eth: + +web3.eth API +============ + +.. py:module:: web3.eth + +.. py:class:: Eth + +The ``web3.eth`` object exposes the following properties and methods to +interact with the RPC APIs under the ``eth_`` namespace. + +By default, when a property or method returns a mapping of keys to values, it +will return an ``AttributeDict`` which acts like a ``dict`` but you can +access the keys as attributes and cannot modify its fields. For example, +you can find the latest block number in these two ways: + + .. code-block:: python + + >>> block = web3.eth.get_block('latest') + AttributeDict({ + 'hash': '0xe8ad537a261e6fff80d551d8d087ee0f2202da9b09b64d172a5f45e818eb472a', + 'number': 4022281, + # ... etc ... + }) + + >>> block['number'] + 4022281 + >>> block.number + 4022281 + + >>> block.number = 4022282 + Traceback # ... etc ... + TypeError: This data is immutable -- create a copy instead of modifying + +This feature is available via the ``AttributeDictMiddleware`` which is a default +middleware. + +.. note:: + Accessing an ``AttributeDict`` property via attribute will break type hinting. If + typing is crucial for your application, accessing via key / value, as well as + removing the ``AttributeDictMiddleware`` altogether, may be desired. + + +Properties +---------- + +The following properties are available on the ``web3.eth`` namespace. + + +.. py:attribute:: Eth.default_account + + The ethereum address that will be used as the default ``from`` address for + all transactions. Defaults to empty. + + +.. py:attribute:: Eth.default_block + + The default block number that will be used for any RPC methods that accept + a block identifier. Defaults to ``'latest'``. + + +.. py:attribute:: Eth.syncing + + * Delegates to ``eth_syncing`` RPC Method + + Returns either ``False`` if the node is not syncing or a dictionary + showing sync status. + + .. code-block:: python + + >>> web3.eth.syncing + AttributeDict({ + 'currentBlock': 2177557, + 'highestBlock': 2211611, + 'knownStates': 0, + 'pulledStates': 0, + 'startingBlock': 2177365, + }) + + +.. py:attribute:: Eth.max_priority_fee + + * Delegates to ``eth_maxPriorityFeePerGas`` RPC Method + + Returns a suggestion for a max priority fee for dynamic fee transactions in Wei. + + .. code-block:: python + + >>> web3.eth.max_priority_fee + 2000000000 + + +.. py:attribute:: Eth.gas_price + + * Delegates to ``eth_gasPrice`` RPC Method + + Returns the current gas price in Wei. + + .. code-block:: python + + >>> web3.eth.gas_price + 20000000000 + + +.. py:attribute:: Eth.accounts + + * Delegates to ``eth_accounts`` RPC Method + + Returns the list of known accounts. + + .. code-block:: python + + >>> web3.eth.accounts + ['0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD'] + + +.. py:attribute:: Eth.block_number + + * Delegates to ``eth_blockNumber`` RPC Method + + Returns the number of the most recent block + + Alias for :meth:`~web3.eth.Eth.get_block_number` + + .. code-block:: python + + >>> web3.eth.block_number + 2206939 + + +.. py:attribute:: Eth.chain_id + + * Delegates to ``eth_chainId`` RPC Method + + Returns an integer value for the currently configured "Chain Id" value introduced in `EIP-155 `_. Returns ``None`` if no Chain Id is available. + + .. code-block:: python + + >>> web3.eth.chain_id + 61 + + .. note:: + + This property gets called frequently in validation middleware, but `eth_chainId` + is an allowed method for caching by default. Simply turn on request caching to + avoid repeated calls to this method. + + .. code-block:: python + + >>> w3.provider.cache_allowed_requests = True + + +.. _web3-eth-methods: + +Methods +------- + +The following methods are available on the ``web3.eth`` namespace. + + +.. py:method:: Eth.get_balance(account, block_identifier=eth.default_block) + + * Delegates to ``eth_getBalance`` RPC Method + + Returns the balance of the given ``account`` at the block specified by + ``block_identifier``. + + ``account`` may be a checksum address or an ENS name + + .. code-block:: python + + >>> web3.eth.get_balance('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + 77320681768999138915 + + +.. py:method:: Eth.get_block_number() + + * Delegates to ``eth_blockNumber`` RPC Method + + Returns the number of the most recent block. + + .. code-block:: python + + >>> web3.eth.get_block_number() + 2206939 + + +.. py:method:: Eth.get_storage_at(account, position, block_identifier=eth.default_block) + + * Delegates to ``eth_getStorageAt`` RPC Method + + Returns the value from a storage position for the given ``account`` at the + block specified by ``block_identifier``. + + ``account`` may be a checksum address or an ENS name + + .. code-block:: python + + >>> web3.eth.get_storage_at('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', 0) + '0x00000000000000000000000000000000000000000000000000120a0b063499d4' + +.. py:method:: Eth.blob_base_fee + + Fetches the expected base fee for blobs in the next block. + + * Delegates to ``eth_blobBaseFee`` RPC Method + + Returns the expected base fee in Wei. + + .. code-block:: python + + >>> web3.eth.blob_base_fee() + 537070730 + + +.. py:method:: Eth.get_proof(account, positions, block_identifier=eth.default_block) + + * Delegates to ``eth_getProof`` RPC Method + + Returns the values from an array of storage positions for the given ``account`` at the + block specified by ``block_identifier``. + + ``account`` may be a checksum address or an ENS name + + .. code-block:: python + + >>> web3.eth.get_proof('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', [0], 3391) + AttributeDict({ + 'address': '0x4CB06C43fcdABeA22541fcF1F856A6a296448B6c', + 'accountProof': ['0xf90211a03841a7ddd65c70c94b8efa79190d00f0ab134b26f18dcad508f60a7e74559d0ba0464b07429a05039e22931492d6c6251a860c018ea390045d596b1ac11b5c7aa7a011f4b89823a03c9c4b5a8ab079ee1bc0e2a83a508bb7a5dc7d7fb4f2e95d3186a0b5f7c51c3b2d51d97f171d2b38a4df1a7c0acc5eb0de46beeff4d07f5ed20e19a0b591a2ce02367eda31cf2d16eca7c27fd44dbf0864b64ea8259ad36696eb2a04a02b646a7552b8392ae94263757f699a27d6e9176b4c06b9fc0a722f893b964795a02df05d68bceb88eebf68aafde61d10ab942097afc1c58b8435ffd3895358a742a0c2f16143c4d1db03276c433696dddb3e9f3b113bcd854b127962262e98f43147a0828820316cc02bfefd899aba41340659fd06df1e0a0796287ec2a4110239f6d2a050496598670b04df7bbff3718887fa36437d6d8c7afb4eff86f76c5c7097dcc4a0c14e9060c6b3784e35b9e6ae2ad2984142a75910ccc89eb89dc1e2f44b6c58c2a009804db571d0ce07913e1cbacc4f1dc4fb8265c936f5c612e3a47e91c64d8e9fa063d96f38b3cb51b1665c6641e25ffe24803f2941e5df79942f6a53b7169647e4a0899f71abb18c6c956118bf567fac629b75f7e9526873e429d3d8abb6dbb58021a00fd717235298742623c0b3cafb3e4bd86c0b5ab1f71097b4dd19f3d6925d758da0096437146c16097f2ccc1d3e910d65a4132803baee2249e72c8bf0bcaaeb37e580', + '0xf90151a097b17a89fd2c03ee98cb6459c08f51b269da5cee46650e84470f62bf83b43efe80a03b269d284a4c3cf8f8deacafb637c6d77f607eec8d75e8548d778e629612310480a01403217a7f1416830c870087c524dabade3985271f6f369a12b010883c71927aa0f592ac54c879817389663be677166f5022943e2fe1b52617a1d15c2f353f27dda0ac8d015a9e668f5877fcc391fae33981c00577096f0455b42df4f8e8089ece24a003ba34a13e2f2fb4bf7096540b42d4955c5269875b9cf0f7b87632585d44c9a580a0b179e3230b07db294473ae57f0170262798f8c551c755b5665ace1215cee10ca80a0552d24252639a6ae775aa1df700ffb92c2411daea7286f158d44081c8172d072a0772a87d08cf38c4c68bfde770968571abd16fd3835cb902486bd2e515d53c12d80a0413774f3d900d2d2be7a3ad999ffa859a471dc03a74fb9a6d8275455f5496a548080', + '0xf869a020d13b52a61d3c1325ce3626a51418adebd6323d4840f1bdd93906359d11c933b846f8440180a01ab7c0b0a2a4bbb5a1495da8c142150891fc64e0c321e1feb70bd5f881951f7ea0551332d96d085185ab4019ad8bcf89c45321e136c261eb6271e574a2edf1461f' + ], + 'balance': 0, + 'codeHash': '0x551332d96d085185ab4019ad8bcf89c45321e136c261eb6271e574a2edf1461f', + 'nonce': 1, + 'storageHash': '0x1ab7c0b0a2a4bbb5a1495da8c142150891fc64e0c321e1feb70bd5f881951f7e', + 'storageProof': [ + AttributeDict({ + 'key': '0x00', + 'value': '0x48656c6c6f00000000000000000000000000000000000000000000000000000a', + 'proof': ['0xf9019180a01ace80e7bed79fbadbe390876bd1a7d9770edf9462049ef8f4b555d05715d53ea049347a3c2eac6525a3fd7e3454dab19d73b4adeb9aa27d29493b9843f3f88814a085079b4abcd07fd4a5d6c52d35f4c4574aecc85830e90c478ca8c18fcbe590de80a02e3f8ad7ea29e784007f51852b9c3e470aef06b11bac32586a8b691134e4c27da064d2157a14bc31f195f73296ea4dcdbe7698edbf3ca81c44bf7730179d98d94ca09e7dc2597c9b7f72ddf84d7eebb0fe2a2fa2ab54fe668cd14fee44d9b40b1a53a0aa5d4acc7ac636d16bc9655556770bc325e1901fb62dc53770ef9110009e080380a0d5fde962bd2fb5326ddc7a9ca7fe0ee47c5bb3227f838b6d73d3299c22457596a08691410eff46b88f929ef649ea25025f62a5362ca8dc8876e5e1f4fc8e79256d80a0673e88d3a8a4616f676793096b5ae87cff931bd20fb8dd466f97809a1126aad8a08b774a45c2273553e2daf4bbc3a8d44fb542ea29b6f125098f79a4d211b3309ca02fed3139c1791269acb9365eddece93e743900eba6b42a6a8614747752ba268f80', + '0xf891808080a0c7d094301e0c54da37b696d85f72de5520b224ab2cf4f045d8db1a3374caf0488080a0fc5581783bfe27fab9423602e1914d719fd71433e9d7dd63c95fe7e58d10c9c38080a0c64f346fc7a21f6679cba8abdf37ca2de8c4fcd8f8bcaedb261b5f77627c93908080808080a0ddef2936a67a3ac7d3d4ff15a935a45f2cc4976c8f0310aed85daf763780e2b480', + '0xf843a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563a1a048656c6c6f00000000000000000000000000000000000000000000000000000a' + ] + }) + ] + }) + + * Merkle proof verification using py-trie. + + The following example verifies that the values returned in the ``AttributeDict`` + are included in the state of given trie ``root``. + + .. code-block:: python + + from eth_utils import ( + keccak, + ) + import rlp + from rlp.sedes import ( + Binary, + big_endian_int, + ) + from trie import ( + HexaryTrie, + ) + from web3._utils.encoding import ( + pad_bytes, + ) + + def format_proof_nodes(proof): + trie_proof = [] + for rlp_node in proof: + trie_proof.append(rlp.decode(bytes(rlp_node))) + return trie_proof + + def verify_eth_get_proof(proof, root): + trie_root = Binary.fixed_length(32, allow_empty=True) + hash32 = Binary.fixed_length(32) + + class _Account(rlp.Serializable): + fields = [ + ('nonce', big_endian_int), + ('balance', big_endian_int), + ('storage', trie_root), + ('code_hash', hash32) + ] + acc = _Account( + proof.nonce, proof.balance, proof.storageHash, proof.codeHash + ) + rlp_account = rlp.encode(acc) + trie_key = keccak(bytes.fromhex(proof.address[2:])) + + assert rlp_account == HexaryTrie.get_from_proof( + root, trie_key, format_proof_nodes(proof.accountProof) + ), f"Failed to verify account proof {proof.address}" + + for storage_proof in proof.storageProof: + trie_key = keccak(pad_bytes(b'\x00', 32, storage_proof.key)) + root = proof.storageHash + if storage_proof.value == b'\x00': + rlp_value = b'' + else: + rlp_value = rlp.encode(storage_proof.value) + + assert rlp_value == HexaryTrie.get_from_proof( + root, trie_key, format_proof_nodes(storage_proof.proof) + ), f"Failed to verify storage proof {storage_proof.key}" + + return True + + block = w3.eth.get_block(3391) + proof = w3.eth.get_proof('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', [0, 1], 3391) + assert verify_eth_get_proof(proof, block.stateRoot) + + +.. py:method:: Eth.get_code(account, block_identifier=eth.default_block) + + * Delegates to ``eth_getCode`` RPC Method + + Returns the bytecode for the given ``account`` at the block specified by + ``block_identifier``. + + ``account`` may be a checksum address or an ENS name + + .. code-block:: python + + # For a contract address. + >>> web3.eth.get_code('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B') + '0x6060604052361561027c5760e060020a60003504630199.....' + # For a private key address. + >>> web3.eth.get_code('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + '0x' + + +.. py:method:: Eth.get_block(block_identifier=eth.default_block, full_transactions=False) + + * Delegates to ``eth_getBlockByNumber`` or ``eth_getBlockByHash`` RPC Methods + + Returns the block specified by ``block_identifier``. Delegates to + ``eth_getBlockByNumber`` if ``block_identifier`` is an integer or one of + the predefined block parameters ``'latest', 'earliest', 'pending', + 'safe', 'finalized'`` - otherwise delegates to ``eth_getBlockByHash``. + Throws ``BlockNotFound`` error if the block is not found. + + If ``full_transactions`` is ``True`` then the ``'transactions'`` key will + contain full transactions objects. Otherwise it will be an array of + transaction hashes. + + .. code-block:: python + + >>> web3.eth.get_block(2000000) + AttributeDict({ + 'difficulty': 49824742724615, + 'extraData': '0xe4b883e5bda9e7a59ee4bb99e9b1bc', + 'gasLimit': 4712388, + 'gasUsed': 21000, + 'hash': '0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6', + 'logsBloom': '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + 'miner': '0x61c808d82a3ac53231750dadc13c777b59310bd9', + 'nonce': '0x3b05c6d5524209f1', + 'number': 2000000, + 'parentHash': '0x57ebf07eb9ed1137d41447020a25e51d30a0c272b5896571499c82c33ecb7288', + 'receiptsRoot': '0x84aea4a7aad5c5899bd5cfc7f309cc379009d30179316a2a7baa4a2ea4a438ac', + 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + 'size': 650, + 'stateRoot': '0x96dbad955b166f5119793815c36f11ffa909859bbfeb64b735cca37cbf10bef1', + 'timestamp': 1470173578, + 'totalDifficulty': 44010101827705409388, + 'transactions': ['0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef'], + 'transactionsRoot': '0xb31f174d27b99cdae8e746bd138a01ce60d8dd7b224f7c60845914def05ecc58', + 'uncles': [], + }) + + +.. py:method:: Eth.get_block_transaction_count(block_identifier) + + * Delegates to ``eth_getBlockTransactionCountByNumber`` or + ``eth_getBlockTransactionCountByHash`` RPC Methods + + Returns the number of transactions in the block specified by + ``block_identifier``. Delegates to + ``eth_getBlockTransactionCountByNumber`` if ``block_identifier`` is an + integer or one of the predefined block parameters ``'latest', 'earliest', + 'pending', 'safe', 'finalized'``, + otherwise delegates to ``eth_getBlockTransactionCountByHash``. + Throws ``BlockNotFoundError`` if transactions are not found. + + .. code-block:: python + + >>> web3.eth.get_block_transaction_count(46147) + 1 + >>> web3.eth.get_block_transaction_count('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd') # block 46147 + 1 + + +.. py:method:: Eth.get_uncle_by_block(block_identifier, uncle_index) + + .. warning:: Deprecated. Will be removed in v8. + + * Delegates to ``eth_getUncleByBlockHashAndIndex`` or + ``eth_getUncleByBlockNumberAndIndex`` RPC methods + + Returns the uncle at the index specified by ``uncle_index`` + from the block specified by ``block_identifier``. Delegates to + ``eth_getUncleByBlockNumberAndIndex`` if ``block_identifier`` is an + integer or one of the predefined block parameters ``'latest', 'earliest', + 'pending'``, otherwise delegates to + ``eth_getUncleByBlockHashAndIndex``. Throws ``BlockNotFound`` if the block is not found. + + .. code-block:: python + + >>> web3.eth.get_uncle_by_block(56160, 0) + AttributeDict({ + 'author': '0xbe4532e1b1db5c913cf553be76180c1777055403', + 'difficulty': '0x17dd9ca0afe', + 'extraData': '0x476574682f686261722f76312e302e312f6c696e75782f676f312e342e32', + 'gasLimit': '0x2fefd8', + 'gasUsed': '0x0', + 'hash': '0xc78c35720d930f9ef34b4e6fb9d02ffec936f9b02a8f0fa858456e4afd4d5614', + 'logsBloom':'0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + 'miner': '0xbe4532e1b1db5c913cf553be76180c1777055403', + 'mixHash': '0x041e14603f35a82f6023802fec96ef760433292434a39787514f140950597e5e', + 'nonce': '0x5d2b7e3f1af09995', + 'number': '0xdb5e', + 'parentHash': '0xcc30e8a9b15c548d5bf113c834143a8f0e1909fbfea96b2a208dc154293a78cf', + 'receiptsRoot': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', + 'sealFields': ['0xa0041e14603f35a82f6023802fec96ef760433292434a39787514f140950597e5e', '0x885d2b7e3f1af09995'], + 'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + 'size': None, 'stateRoot': '0x8ce2b1bf8e25a06a8ca34c647ff5fd0fa48ac725cc07f657ae1645ab8ef68c91', + 'timestamp': '0x55c6a972', + 'totalDifficulty': '0xce4c4f0a0b810b', + 'transactions': [], + 'transactionsRoot': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421', + 'uncles': [] + }) + + # You can also refer to the block by hash: + >>> web3.eth.get_uncle_by_block('0x685b2226cbf6e1f890211010aa192bf16f0a0cba9534264a033b023d7367b845', 0) + AttributeDict({ + ... + }) + + +.. py:method:: Eth.get_uncle_count(block_identifier) + + .. warning:: Deprecated. Will be removed in v8. + + * Delegates to ``eth_getUncleCountByBlockHash`` or + ``eth_getUncleCountByBlockNumber`` RPC methods + + Returns the (integer) number of uncles associated with the block specified by ``block_identifier``. + Delegates to ``eth_getUncleCountByBlockNumber`` if ``block_identifier`` is an + integer or one of the predefined block parameters ``'latest', 'earliest', + 'pending'``, otherwise delegates to ``eth_getUncleCountByBlockHash``. + Throws ``BlockNotFound`` if the block is not found. + + .. code-block:: python + + >>> web3.eth.get_uncle_count(56160) + 1 + + # You can also refer to the block by hash: + >>> web3.eth.get_uncle_count('0x685b2226cbf6e1f890211010aa192bf16f0a0cba9534264a033b023d7367b845') + 1 + + +.. py:method:: Eth.get_transaction(transaction_hash) + + * Delegates to ``eth_getTransactionByHash`` RPC Method + + Returns the transaction specified by ``transaction_hash``. If the transaction cannot be found throws :class:`web3.exceptions.TransactionNotFound`. + + .. code-block:: python + + >>> web3.eth.get_transaction('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060') + AttributeDict({'blockHash': HexBytes('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd'), + 'blockNumber': 46147, + 'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4', + 'gas': 21000, + 'gasPrice': 50000000000000, + 'hash': HexBytes('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'), + 'input': HexBytes('0x'), + 'nonce': 0, + 'r': HexBytes('0x88ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0'), + 's': HexBytes('0x45e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a'), + 'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734', + 'transactionIndex': 0, + 'type': 0, + 'v': 28, + 'value': 31337 + }) + + +.. py:method:: Eth.get_raw_transaction(transaction_hash) + + * Delegates to ``eth_getRawTransactionByHash`` RPC Method + + Returns the raw form of transaction specified by ``transaction_hash``. + + If no transaction is found, ``TransactionNotFound`` is raised. + + .. code-block:: python + + >>> web3.eth.get_raw_transaction('0x86fbfe56cce542ff0a2a2716c31675a0c9c43701725c4a751d20ee2ddf8a733d') + HexBytes('0xf86907843b9aca0082520894dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd018086eecac466e115a0f9db4e25484b28f486b247a372708d4cd0643fc63e604133afac577f4cc1eab8a044841d84e799d4dc18ba146816a937e8a0be8bc296bd8bb8aea126de5e627e06') + + +.. py:method:: Eth.get_transaction_by_block(block_identifier, transaction_index) + + * Delegates to ``eth_getTransactionByBlockNumberAndIndex`` or + ``eth_getTransactionByBlockHashAndIndex`` RPC Methods + + Returns the transaction at the index specified by ``transaction_index`` + from the block specified by ``block_identifier``. Delegates to + ``eth_getTransactionByBlockNumberAndIndex`` if ``block_identifier`` is an + integer or one of the predefined block parameters ``'latest', 'earliest', + 'pending', 'safe', 'finalized'``, otherwise delegates to + ``eth_getTransactionByBlockHashAndIndex``. + If a transaction is not found at specified arguments, throws :class:`web3.exceptions.TransactionNotFound`. + + .. code-block:: python + + >>> web3.eth.get_transaction_by_block(46147, 0) + AttributeDict({ + 'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd', + 'blockNumber': 46147, + 'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4', + 'gas': 21000, + 'gasPrice': None, + 'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060', + 'input': '0x', + 'maxFeePerGas': 2000000000, + 'maxPriorityFeePerGas': 1000000000, + 'nonce': 0, + 'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734', + 'transactionIndex': 0, + 'value': 31337, + }) + >>> web3.eth.get_transaction_by_block('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd', 0) + AttributeDict({ + 'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd', + 'blockNumber': 46147, + 'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4', + 'gas': 21000, + 'gasPrice': None, + 'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060', + 'input': '0x', + 'maxFeePerGas': 2000000000, + 'maxPriorityFeePerGas': 1000000000, + 'nonce': 0, + 'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734', + 'transactionIndex': 0, + 'value': 31337, + }) + + +.. py:method:: Eth.get_raw_transaction_by_block(block_identifier, transaction_index) + + * Delegates to ``eth_getRawTransactionByBlockNumberAndIndex`` or + ``eth_getRawTransactionByBlockHashAndIndex`` RPC Methods + + Returns the raw transaction at the index specified by ``transaction_index`` + from the block specified by ``block_identifier``. Delegates to + ``eth_getRawTransactionByBlockNumberAndIndex`` if ``block_identifier`` is an + integer or one of the predefined block parameters ``'latest', 'earliest', + 'pending', 'safe', 'finalized'``, otherwise delegates to + ``eth_getRawTransactionByBlockHashAndIndex``. + If a transaction is not found at specified arguments, throws :class:`web3.exceptions.TransactionNotFound`. + + .. code-block:: python + + >>> web3.eth.get_raw_transaction_by_block('latest', 0) + HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c') + >>> web3.eth.get_raw_transaction_by_block(2, 0) + HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c') + >>> web3.eth.get_raw_transaction_by_block('0xca609fb606a04ce6aaec76415cd0b9d8c2bc83ad2a4d17db7fd403ee7d97bf40', 0) + HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c') + +.. py:method:: Eth.wait_for_transaction_receipt(transaction_hash, timeout=120, poll_latency=0.1) + + Waits for the transaction specified by ``transaction_hash`` to be included in a block, then + returns its transaction receipt. + + Optionally, specify a ``timeout`` in seconds. If timeout elapses before the transaction + is added to a block, then :meth:`~Eth.wait_for_transaction_receipt` raises a + :class:`web3.exceptions.TimeExhausted` exception. + + .. code-block:: python + + >>> web3.eth.wait_for_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060') + # If transaction is not yet in a block, time passes, while the thread sleeps... + # ... + # Then when the transaction is added to a block, its receipt is returned: + AttributeDict({ + 'blockHash': HexBytes('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd'), + 'blockNumber': 46147, + 'contractAddress': None, + 'cumulativeGasUsed': 21000, + 'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4', + 'gasUsed': 21000, + 'logs': [], + 'logsBloom': HexBytes('0x000000000000000000000000000000000000000000000000...0000'), + 'status': 1, + 'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734', + 'transactionHash': HexBytes('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'), + 'transactionIndex': 0, + }) + + +.. py:method:: Eth.get_transaction_receipt(transaction_hash) + + * Delegates to ``eth_getTransactionReceipt`` RPC Method + + Returns the transaction receipt specified by ``transaction_hash``. If the transaction cannot be found throws :class:`web3.exceptions.TransactionNotFound`. + + If ``status`` in response equals 1 the transaction was successful. If it is equals 0 the transaction was reverted by EVM. + + .. code-block:: python + + >>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060') # not yet mined + Traceback # ... etc ... + TransactionNotFound: Transaction with hash: 0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060 not found. + + # wait for it to be mined.... + >>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060') + AttributeDict({ + 'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd', + 'blockNumber': 46147, + 'contractAddress': None, + 'cumulativeGasUsed': 21000, + 'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4', + 'gasUsed': 21000, + 'logs': [], + 'logsBloom': '0x000000000000000000000000000000000000000000000000...0000', + 'status': 1, # 0 or 1 + 'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734', + 'transactionHash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060', + 'transactionIndex': 0, + }) + + +.. py:method:: Eth.get_transaction_count(account, block_identifier=web3.eth.default_block) + + * Delegates to ``eth_getTransactionCount`` RPC Method + + Returns the number of transactions that have been sent from ``account`` as + of the block specified by ``block_identifier``. + + ``account`` may be a checksum address or an ENS name + + .. code-block:: python + + >>> web3.eth.get_transaction_count('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + 340 + + +.. py:method:: Eth.send_transaction(transaction) + + * Delegates to ``eth_sendTransaction`` RPC Method + + Signs and sends the given ``transaction`` + + The ``transaction`` parameter should be a dictionary with the following fields. + + * ``from``: ``bytes or text``, checksum address or ENS name - (optional, default: + ``web3.eth.defaultAccount``) The address the transaction is sent from. + * ``to``: ``bytes or text``, checksum address or ENS name - (optional when creating new + contract) The address the transaction is directed to. + * ``gas``: ``integer`` - (optional) Integer of the gas + provided for the transaction execution. It will return unused gas. + * ``maxFeePerGas``: ``integer or hex`` - (optional) maximum amount you're willing + to pay, inclusive of ``baseFeePerGas`` and ``maxPriorityFeePerGas``. The difference + between ``maxFeePerGas`` and ``baseFeePerGas + maxPriorityFeePerGas`` is refunded + to the user. + * ``maxPriorityFeePerGas``: ``integer or hex`` - (optional) the part of the fee + that goes to the miner + * ``gasPrice``: ``integer`` - Integer of the gasPrice used for each paid gas + **LEGACY** - unless you have a good reason to use ``gasPrice``, use ``maxFeePerGas`` + and ``maxPriorityFeePerGas`` instead. + * ``value``: ``integer`` - (optional) Integer of the value send with this + transaction + * ``data``: ``bytes or text`` - The compiled code of a contract OR the hash + of the invoked method signature and encoded parameters. For details see + `Ethereum Contract ABI `_. + * ``nonce``: ``integer`` - (optional) Integer of a nonce. This allows to + overwrite your own pending transactions that use the same nonce. + + If the ``transaction`` specifies a ``data`` value but does not specify + ``gas`` then the ``gas`` value will be populated using the + :meth:`~web3.eth.Eth.estimate_gas()` function with an additional buffer of ``100000`` + gas up to the ``gasLimit`` of the latest block. In the event that the + value returned by :meth:`~web3.eth.Eth.estimate_gas()` method is greater than the + ``gasLimit`` a ``ValueError`` will be raised. + + + .. code-block:: python + + # simple example (web3.py and / or client determines gas and fees, typically defaults to a dynamic fee transaction post London fork) + >>> web3.eth.send_transaction({ + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'from': web3.eth.accounts[0], + 'value': 12345 + }) + + # Dynamic fee transaction, introduced by EIP-1559: + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + >>> web3.eth.send_transaction({ + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'from': web3.eth.accounts[0], + 'value': 12345, + 'gas': 21000, + 'maxFeePerGas': web3.to_wei(250, 'gwei'), + 'maxPriorityFeePerGas': web3.to_wei(2, 'gwei'), + }) + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + + # Legacy transaction (less efficient) + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + >>> web3.eth.send_transaction({ + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'from': web3.eth.accounts[0], + 'value': 12345, + 'gas': 21000, + 'gasPrice': web3.to_wei(50, 'gwei'), + }) + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + + +.. py:method:: Eth.sign_transaction(transaction) + + * Delegates to ``eth_signTransaction`` RPC Method. + + Returns a transaction that's been signed by the node's private key, but not yet submitted. + The signed tx can be submitted with ``Eth.send_raw_transaction`` + + .. code-block:: python + + >>> signed_txn = w3.eth.sign_transaction(dict( + nonce=w3.eth.get_transaction_count(w3.eth.accounts[0]), + maxFeePerGas=2000000000, + maxPriorityFeePerGas=1000000000, + gas=100000, + to='0xd3CdA913deB6f67967B99D67aCDFa1712C293601', + value=1, + data=b'', + ) + ) + b"\xf8d\x80\x85\x040\xe24\x00\x82R\x08\x94\xdcTM\x1a\xa8\x8f\xf8\xbb\xd2\xf2\xae\xc7T\xb1\xf1\xe9\x9e\x18\x12\xfd\x01\x80\x1b\xa0\x11\r\x8f\xee\x1d\xe5=\xf0\x87\x0en\xb5\x99\xed;\xf6\x8f\xb3\xf1\xe6,\x82\xdf\xe5\x97lF|\x97%;\x15\xa04P\xb7=*\xef \t\xf0&\xbc\xbf\tz%z\xe7\xa3~\xb5\xd3\xb7=\xc0v\n\xef\xad+\x98\xe3'" # noqa: E501 + + +.. py:method:: Eth.send_raw_transaction(raw_transaction) + + * Delegates to ``eth_sendRawTransaction`` RPC Method + + Sends a signed and serialized transaction. Returns the transaction hash as a HexBytes object. + + .. code-block:: python + + >>> signed_txn = w3.eth.account.sign_transaction(dict( + nonce=w3.eth.get_transaction_count(public_address_of_senders_account), + maxFeePerGas=3000000000, + maxPriorityFeePerGas=2000000000, + gas=100000, + to='0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + value=12345, + data=b'', + type=2, # (optional) the type is now implicitly set based on appropriate transaction params + chainId=1, + ), + private_key_for_senders_account, + ) + >>> w3.eth.send_raw_transaction(signed_txn.raw_transaction) + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + + +.. py:method:: Eth.replace_transaction(transaction_hash, new_transaction) + + * Delegates to ``eth_sendTransaction`` RPC Method + + Sends a transaction that replaces the transaction with ``transaction_hash``. + + The ``transaction_hash`` must be the hash of a pending transaction. + + The ``new_transaction`` parameter should be a dictionary with transaction fields + as required by :meth:`~web3.eth.Eth.send_transaction`. It will be used to entirely + replace the transaction of ``transaction_hash`` without using any of the pending + transaction's values. + + If the ``new_transaction`` specifies a ``nonce`` value, it must match the pending + transaction's nonce. + + If the ``new_transaction`` specifies ``maxFeePerGas`` and ``maxPriorityFeePerGas`` + values, they must be greater than the pending transaction's values for each field, + respectively. + + * Legacy Transaction Support (Less Efficient - Not Recommended) + + If the pending transaction specified a ``gasPrice`` value (legacy transaction), the + ``gasPrice`` value for the ``new_transaction`` must be greater than the pending + transaction's ``gasPrice``. + + If the ``new_transaction`` does not specify any of ``gasPrice``, ``maxFeePerGas``, or + ``maxPriorityFeePerGas`` values, one of the following will happen: + + * If the pending transaction has a ``gasPrice`` value, this value will be used with a + multiplier of 1.125 - This is typically the minimum ``gasPrice`` increase a node requires + before it accepts a replacement transaction. + * If a gas price strategy is set, the ``gasPrice`` value from the gas price + strategy(See :ref:`Gas_Price`) will be used. + * If none of the above, the client will ultimately decide appropriate values for ``maxFeePerGas`` + and ``maxPriorityFeePerGas``. These will likely be default values and may result in an + unsuccessful replacement of the pending transaction. + + This method returns the transaction hash of the replacement transaction as a HexBytes object. + + .. code-block:: python + + >>> tx = web3.eth.send_transaction({ + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'from': web3.eth.accounts[0], + 'value': 1000 + }) + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + >>> web3.eth.replace_transaction('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', { + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'from': web3.eth.accounts[0], + 'value': 2000 + }) + HexBytes('0x4177e670ec6431606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1528989') + + +.. py:method:: Eth.modify_transaction(transaction_hash, **transaction_params) + + * Delegates to ``eth_sendTransaction`` RPC Method + + Sends a transaction that modifies the transaction with ``transaction_hash``. + + ``transaction_params`` are keyword arguments that correspond to valid transaction + parameters as required by :meth:`~web3.eth.Eth.send_transaction`. The parameter values + will override the pending transaction's values to create the replacement transaction + to send. + + The same validation and defaulting rules of :meth:`~web3.eth.Eth.replace_transaction` apply. + + This method returns the transaction hash of the newly modified transaction as a HexBytes object. + + .. code-block:: python + + >>> tx = web3.eth.send_transaction({ + 'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + 'from': web3.eth.accounts[0], + 'value': 1000 + }) + HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331') + >>> web3.eth.modify_transaction('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', value=2000) + HexBytes('0xec6434e6701771606e55d6b4ca35a1a6b75ee3d73315145a921026d15299d05') + + +.. py:method:: Eth.sign(account, data=None, hexstr=None, text=None) + + * Delegates to ``eth_sign`` RPC Method + + Caller must specify exactly one of: ``data``, ``hexstr``, or ``text``. + + Signs the given data with the private key of the given ``account``. + The account must be unlocked. + + ``account`` may be a checksum address or an ENS name + + .. code-block:: python + + >>> web3.eth.sign( + '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + text='some-text-tö-sign') + '0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401' + + >>> web3.eth.sign( + '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD', + data=b'some-text-t\xc3\xb6-sign') + '0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401' + + >>> web3.eth.sign( + '0xd3CdA913deB6f67967B99D67aCDFa1712C293601', + hexstr='0x736f6d652d746578742d74c3b62d7369676e') + '0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401' + + +.. py:method:: Eth.sign_typed_data(account, jsonMessage) + + * Delegates to ``eth_signTypedData`` RPC Method + + .. note:: + + ``eth_signTypedData`` is not currently supported by any major client (Besu, Erigon, Geth, or Nethermind) + + Please note that the ``jsonMessage`` argument is the loaded JSON Object + and **NOT** the JSON String itself. + + Signs the ``Structured Data`` (or ``Typed Data``) with the private key of the given ``account``. + The account must be unlocked. + + ``account`` may be a checksum address or an ENS name + + +.. py:method:: Eth.call(transaction, block_identifier=web3.eth.default_block, state_override=None, ccip_read_enabled=True) + + * Delegates to ``eth_call`` RPC Method + + Executes the given transaction locally without creating a new transaction + on the blockchain. Returns the return value of the executed contract. + + The ``transaction`` parameter is handled in the same manner as the + :meth:`~web3.eth.Eth.send_transaction()` method. + + .. code-block:: python + + >>> myContract.functions.setVar(1).transact() + HexBytes('0x79af0c7688afba7588c32a61565fd488c422da7b5773f95b242ea66d3d20afda') + >>> myContract.functions.getVar().call() + 1 + # The above call equivalent to the raw call: + >>> web3.eth.call({'value': 0, 'gas': 21736, 'maxFeePerGas': 2000000000, 'maxPriorityFeePerGas': 1000000000, 'to': '0xc305c901078781C232A2a521C2aF7980f8385ee9', 'data': '0x477a5c98'}) + HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001') + + In most cases it is better to make contract function call through the :py:class:`web3.contract.Contract` interface. + + Overriding state is a debugging feature available in Geth clients. + View their `usage documentation `_ + for a list of possible parameters. + + `EIP-3668 `_ introduced support for the ``OffchainLookup`` revert / CCIP + Read support. In order to properly handle a call to a contract function that reverts with an ``OffchainLookup`` + error for offchain data retrieval, the ``ccip_read_enabled`` flag has been added to the ``eth_call`` method. + ``ccip_read_enabled`` is optional, yielding the default value for CCIP Read on calls to a global + ``global_ccip_read_enabled`` flag on the provider which is set to ``True`` by default. This means CCIP Read is + enabled by default for calls, as is recommended in EIP-3668. Therefore, calls to contract functions that revert with + an ``OffchainLookup`` will be handled appropriately by default. + + The ``ccip_read_enabled`` flag on the call will always override the value of the global flag on the provider for + explicit control over specific calls. If the flag on the call is set to ``False``, the call will raise the + ``OffchainLookup`` instead of properly handling the exception according to EIP-3668. This may be useful for + "preflighting" a transaction with a call (see :ref:`ccip-read-example` within the examples section). + + If the function called results in a ``revert`` error, a ``ContractLogicError`` will be raised. + If there is an error message with the error, web3.py attempts to parse the + message that comes back and return it to the user as the error string. + As of v6.3.0, the raw data is also returned and + can be accessed via the ``data`` attribute on ``ContractLogicError``. + + +.. py:method:: Eth.simulateV1(payload, block_identifier) + + * Delegates to ``eth_simulateV1`` RPC Method + + Executes a simulation for the given payload at the given block. Returns the simulation results. + + .. code-block:: python + + >>> w3.eth.simulateV1( + ... { + ... "blockStateCalls": [ + ... { + ... "blockOverrides": { + ... "baseFeePerGas": Wei(10), + ... }, + ... "stateOverrides": { + ... "0xc100000000000000000000000000000000000000": { + ... "balance": Wei(500000000), + ... } + ... }, + ... "calls": [ + ... { + ... "from": "0xc100000000000000000000000000000000000000", + ... "to": "0xc100000000000000000000000000000000000000", + ... "maxFeePerGas": Wei(10), + ... "maxPriorityFeePerGas": Wei(10), + ... } + ... ], + ... } + ... ], + ... "validation": True, + ... "traceTransfers": True, + ... }, + ... "latest", + ... ) + [AttributeDict({ + 'baseFeePerGas': 10, + 'blobGasUsed': 0, + 'calls': [AttributeDict({ + 'returnData': HexBytes('0x'), + 'logs': [], + 'gasUsed': 21000, + 'status': 1 + })], + 'difficulty': 0, + 'excessBlobGas': 0, + 'extraData': HexBytes('0x'), + 'gasLimit': 983527531, + 'gasUsed': 21000, + 'hash': HexBytes('0xb2dba64c905dea42e940d67b8e0f44019f4a61c4833a9cba99c426b748d9e1a4'), + 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), + 'miner': '0x0000000000000000000000000000000000000000', + 'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), + 'nonce': HexBytes('0x0000000000000000'), + 'number': 18, + 'parentBeaconBlockRoot': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'), + 'parentHash': HexBytes('0x71d32db179a1291de86b5f7fa15224292ef9ee6ebb3fa62484896601d9f20d5f'), + 'receiptsRoot': HexBytes('0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa'), + 'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'), + 'size': 626, + 'stateRoot': HexBytes('0xbbbe846b616911d13780f58f500f8948e0878ba6f55cae7432da915cab3ba2b6'), + 'timestamp': 1739921487, + 'transactions': [HexBytes('0xfd801060af398c615f1ffb61586604aaf4fc688615cb1ff088531638a9b9e8e6')], + 'transactionsRoot': HexBytes('0xa6bc01d7707e94b62dccb8d097df1db25d6b44fad35463ecc99c9e5822e7aa5f'), + 'uncles': [], + 'withdrawals': [], + 'withdrawalsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421') + })] + + +.. py:method:: Eth.create_access_list(transaction, block_identifier=web3.eth.default_block) + + * Delegates to ``eth_createAccessList`` RPC Method + + This method creates an `EIP-2930 `_ type ``accessList`` based on a given + ``transaction``. The ``accessList`` contains all storage slots and addresses read and written by the transaction, + except for the sender account and the precompiles. This method uses the same ``transaction`` call object and + ``block_identifier`` object as :meth:`~web3.eth.Eth.call()`. An ``accessList`` can be used to access contracts that + became inaccessible due to gas cost increases. + + The ``transaction`` parameter is handled in the same manner as the + :meth:`~web3.eth.Eth.send_transaction()` method. + The optional ``block_identifier`` parameter is a block_number or ``latest`` or ``pending``. Default is ``latest``. + + .. code-block:: python + + >>> w3.eth.create_access_list( + ... { + ... "to": to_checksum_address("0xF0109fC8DF283027b6285cc889F5aA624EaC1F55"), + ... "gasPrice": 10**11, + ... "value": 0, + ... "data": "0x608060806080608155", + ... }, + ... "pending", + ... ) + AttributeDict({ + "accessList": [ + AttributeDict({ + "address": "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe", + "storageKeys": [ + "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x0000000000000000000000000000000000000000000000000000000000000007", + ] + }), + AttributeDict({ + "address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413", + "storageKeys": [] + }), + ], + "gasUsed": 21000 + }) + + The method ``eth_createAccessList`` returns a list of addresses and storage keys used by the transaction, plus the gas + consumed when the ``accessList`` is included. Like ``eth_estimateGas``, this is an estimation; the list could change when + the transaction is actually finalized. Adding an ``accessList`` to your transaction does not necessarily result in lower + gas usage compared to a transaction without an ``accessList``. + +.. py:method:: Eth.fee_history(block_count, newest_block, reward_percentiles=None) + + * Delegates to ``eth_feeHistory`` RPC Method + + Returns transaction fee data for up to 1,024 blocks. + + :param block_count: The number of blocks in the requested range. Depending on the client, this + value should be either a :py:class:`int` between 1 and 1024 or a hexstring. + Less than requested may be returned if not all blocks are available. + :type block_count: int or hexstring + :param newest_block: The newest, highest-numbered, block in the requested range. This value may be an + :py:class:`int` or one of the predefined block parameters ``'latest'``, ``'earliest'``, or ``'pending'``. + :type newest_block: int or BlockParams + :param reward_percentiles: *(optional)* A monotonically increasing list of percentile :py:class:`float` values to + sample from each block's effective priority fees per gas in ascending order, weighted by gas used. + :type reward_percentiles: List[float] or None + :return: An ``AttributeDict`` containing the following keys: + + * **oldestBlock** *(int)* -- The oldest, lowest-numbered, block in the range requested as a ``BlockNumber`` type + with :py:class:`int` value. + * **baseFeePerGas** *(List[Wei])* -- An array of block base fees per gas. This includes the next block after the + newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for + pre-EIP-1559 blocks. + * **gasUsedRatio** *(List[float])* -- An array of ``gasUsed``/``gasLimit`` float values for the requested blocks. + * **reward** *(List[List[Wei]])* -- *(optional)* A two-dimensional array of effective priority fees per gas at the + requested block percentiles. + + .. code-block:: python + + >>> w3.eth.fee_history(4, 'latest', [10, 90]) + AttributeDict({ + 'oldestBlock': 3, + 'reward': [[220, 7145389], [1000000, 6000213], [550, 550], [125, 12345678]], + 'baseFeePerGas': [202583058, 177634473, 155594425, 136217133, 119442408], + 'gasUsedRatio': [0.007390479689642084, 0.0036988514889990873, 0.0018512333048507866, 0.00741217041320997] + }) + + +.. py:method:: Eth.estimate_gas(transaction, block_identifier=None, state_override=None) + + * Delegates to ``eth_estimateGas`` RPC Method + + Executes the given transaction locally without creating a new transaction + on the blockchain. Returns amount of gas consumed by execution which can + be used as a gas estimate. + + The ``transaction`` and ``block_identifier`` parameters are handled in the + same manner as the :meth:`~web3.eth.Eth.send_transaction()` method. + + The ``state_override`` is useful when there is a chain of transaction calls. + It overrides state so that the gas estimate of a transaction is accurate in + cases where prior calls produce side effects. + + .. code-block:: python + + >>> web3.eth.estimate_gas({'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'from':web3.eth.accounts[0], 'value': 12345}) + 21000 + + +.. py:method:: Eth.generate_gas_price(transaction_params=None) + + Uses the selected gas price strategy to calculate a gas price. This method + returns the gas price denominated in wei. + + The ``transaction_params`` argument is optional however some gas price strategies + may require it to be able to produce a gas price. + + .. code-block:: python + + >>> web3.eth.generate_gas_price() + 20000000000 + + .. note:: + For information about how gas price can be customized in web3 see + :ref:`Gas_Price`. + + +.. py:method:: Eth.set_gas_price_strategy(gas_price_strategy) + + Set the selected gas price strategy. It must be a method of the signature + ``(web3, transaction_params)`` and return a gas price denominated in wei. + + +.. py:method:: Eth.subscribe(subscription_identifier, subscription_params) + + * Delegates to ``eth_subscribe`` RPC Method + + Only available on persistent connection providers: + :class:`~web3.providers.persistent.WebSocketProvider` and + :class:`~web3.providers.persistent.AsyncIPCProvider`. + + Returns a subscription ID that can be used to track a particular subscription to, or unsubscribe from, an event. + For usage examples see the docs on :ref:`subscription-examples`. + + .. code-block:: python + + >>> subscription_id = await web3.eth.subscribe('newHeaders') + >>> subscription_id + '0xbd63bb89e7475591a0a6fc9014307bc4' + + +.. py:method:: Eth.unsubscribe(subscription_id) + + * Delegates to ``eth_unsubscribe`` RPC Method + + Only available on persistent connection providers: + :class:`~web3.providers.persistent.WebSocketProvider` and + :class:`~web3.providers.persistent.AsyncIPCProvider`. + + Returns ``True`` if successfully unsubscribed. For usage examples see the docs on + :ref:`subscription-examples`. + + .. code-block:: python + + >>> result = await web3.eth.unsubscribe(subscription_id) + >>> result + True + + +Filters +------- + +The following methods are available on the ``web3.eth`` object for interacting +with the filtering API. + + +.. py:method:: Eth.filter(filter_params) + + * Delegates to ``eth_newFilter``, ``eth_newBlockFilter``, and + ``eth_newPendingTransactionFilter`` RPC Methods. + + This method delegates to one of three RPC methods depending on the value of + ``filter_params``. + + * If ``filter_params`` is the string ``'pending'`` then a new filter is + registered using the ``eth_newPendingTransactionFilter`` RPC method. + This will create a new filter that will be called for each new unmined + transaction that the node receives. + * If ``filter_params`` is the string ``'latest'`` then a new filter is + registered using the ``eth_newBlockFilter`` RPC method. This will create + a new filter that will be called each time the node receives a new block. + * If ``filter_params`` is a dictionary then a new filter is registered + using the ``eth_newFilter`` RPC method. This will create a new filter + that will be called for all log entries that match the provided + ``filter_params``. + + This method returns a ``web3.utils.filters.Filter`` object which can then + be used to either directly fetch the results of the filter or to register + callbacks which will be called with each result of the filter. + + When creating a new log filter, the ``filter_params`` should be a + dictionary with the following keys. Note that the keys are camel-cased + strings, as is expected in a JSON-RPC request. + + * ``fromBlock``: ``integer/tag`` - (optional, default: "latest") Integer + block number, or one of predefined block identifiers + "latest", "pending", "earliest", "safe", or "finalized". + * ``toBlock``: ``integer/tag`` - (optional, default: "latest") Integer + block number, or one of predefined block identifiers + "latest", "pending", "earliest", "safe", or "finalized". + * ``address``: ``string`` or list of ``strings``, each 20 Bytes - + (optional) Contract address or a list of addresses from which logs should + originate. + * ``topics``: list of 32 byte ``strings`` or ``null`` - (optional) Array of + topics that should be used for filtering. Topics are order-dependent. + This parameter can also be a list of topic lists in which case filtering + will match any of the provided topic arrays. + + .. note:: + + Though ``"latest"`` and ``"safe"`` block identifiers are not yet part of the + specifications for ``eth_newFilter``, they are supported by web3.py and may or + may not yield expected results depending on the node being accessed. + + See :doc:`./filters` for more information about filtering. + + .. code-block:: python + + >>> web3.eth.filter('latest') + + >>> web3.eth.filter('pending') + + >>> web3.eth.filter({'fromBlock': 1000000, 'toBlock': 1000100, 'address': '0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B'}) + + +.. py:method:: Eth.get_filter_changes(self, filter_id) + + * Delegates to ``eth_getFilterChanges`` RPC Method. + + Returns all new entries which occurred since the last call to this method + for the given ``filter_id`` + + .. code-block:: python + + >>> filter = web3.eth.filter() + >>> web3.eth.get_filter_changes(filter.filter_id) + [ + { + 'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24', + 'blockHash': '0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0', + 'blockNumber': 2217196, + 'data': '0x0000000000000000000000000000000000000000000000000000000000000001', + 'logIndex': 0, + 'topics': ['0xe65b00b698ba37c614af350761c735c5f4a82b4ab365a1f1022d49d9dfc8e930', + '0x000000000000000000000000754c50465885f1ed1fa1a55b95ee8ecf3f1f4324', + '0x296c7fb6ccafa3e689950b947c2895b07357c95b066d5cdccd58c301f41359a3'], + 'transactionHash': '0xfe1289fd3915794b99702202f65eea2e424b2f083a12749d29b4dd51f6dce40d', + 'transactionIndex': 1, + }, + ... + ] + + +.. py:method:: Eth.get_filter_logs(self, filter_id) + + * Delegates to ``eth_getFilterLogs`` RPC Method. + + Returns all entries for the given ``filter_id`` + + .. code-block:: python + + >>> filter = web3.eth.filter() + >>> web3.eth.get_filter_logs(filter.filter_id) + [ + { + 'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24', + 'blockHash': '0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0', + 'blockNumber': 2217196, + 'data': '0x0000000000000000000000000000000000000000000000000000000000000001', + 'logIndex': 0, + 'topics': ['0xe65b00b698ba37c614af350761c735c5f4a82b4ab365a1f1022d49d9dfc8e930', + '0x000000000000000000000000754c50465885f1ed1fa1a55b95ee8ecf3f1f4324', + '0x296c7fb6ccafa3e689950b947c2895b07357c95b066d5cdccd58c301f41359a3'], + 'transactionHash': '0xfe1289fd3915794b99702202f65eea2e424b2f083a12749d29b4dd51f6dce40d', + 'transactionIndex': 1, + }, + ... + ] + + +.. py:method:: Eth.uninstall_filter(self, filter_id) + + * Delegates to ``eth_uninstallFilter`` RPC Method. + + Uninstalls the filter specified by the given ``filter_id``. Returns + boolean as to whether the filter was successfully uninstalled. + + .. code-block:: python + + >>> filter = web3.eth.filter() + >>> web3.eth.uninstall_filter(filter.filter_id) + True + >>> web3.eth.uninstall_filter(filter.filter_id) + False # already uninstalled. + + +.. py:method:: Eth.get_logs(filter_params) + + This is the equivalent of: creating a new + filter, running :meth:`~Eth.get_filter_logs`, and then uninstalling the filter. See + :meth:`~Eth.filter` for details on allowed filter parameters. + + +Contracts +--------- + +.. py:method:: Eth.contract(address=None, contract_name=None, ContractFactoryClass=Contract, **contract_factory_kwargs) + + If ``address`` is provided, then this method will return an instance of the + contract defined by ``abi``. The address may be a checksum string, + or an ENS name like ``'mycontract.eth'``. + + .. code-block:: python + + from web3 import Web3 + + w3 = Web3(...) + + contract = w3.eth.contract(address='0x000000000000000000000000000000000000dEaD', abi=...) + + # alternatively: + contract = w3.eth.contract(address='mycontract.eth', abi=...) + + .. note:: + + If you use an ENS name to initialize a contract, the contract will be looked up by + name on each use. If the name could ever change maliciously, first + :ref:`ens_get_address`, and then create the contract with the checksum address. + + + If ``address`` is *not* provided, the newly created contract class will be returned. That + class will then be initialized by supplying the address. + + .. code-block:: python + + from web3 import Web3 + + w3 = Web3(...) + + Contract = w3.eth.contract(abi=...) + + # later, initialize contracts with the same metadata at different addresses: + contract1 = Contract(address='0x000000000000000000000000000000000000dEaD') + contract2 = Contract(address='mycontract.eth') + + ``contract_name`` will be used as the name of the contract class. If it is + ``None`` then the name of the ``ContractFactoryClass`` will be used. + + ``ContractFactoryClass`` will be used as the base Contract class. + + The following arguments are accepted for contract class creation. + + :param abi: Application Binary Interface. Usually provided since an ``abi`` is required to interact with any contract. + :type abi: ABI + :param asm: Assembly code generated by the compiler + :param ast: Abstract Syntax Tree of the contract generated by the compiler + :param bytecode: Bytecode of the contract generated by the compiler + :param bytecode_runtime: Bytecode stored at the contract address, excludes the constructor and initialization code + :param clone_bin: + :param dev_doc: + :param decode_tuples: Optionally convert tuples/structs to named tuples + :param interface: + :param metadata: Contract Metadata generated by the compiler + :param opcodes: Opcodes for the contract generated by the compiler + :param src_map: + :param src_map_runtime: + :param user_doc: + :return: Instance of the contract + :rtype: Contract + :raises TypeError: If the address is not provided + :raises AttributeError: If the contract class is not initialized + + See the :doc:`web3.contract` documentation for more information about Contracts. + + +.. py:method:: Eth.set_contract_factory(contractFactoryClass) + + Modify the default contract factory from ``Contract`` to ``contractFactoryClass``. + Future calls to ``Eth.contract()`` will then default to ``contractFactoryClass``. diff --git a/_build/html_zh_CN/_sources/web3.geth.rst.txt b/_build/html_zh_CN/_sources/web3.geth.rst.txt new file mode 100644 index 0000000000..8eaf29fa8c --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.geth.rst.txt @@ -0,0 +1,541 @@ +Geth API +======== + +.. py:module:: web3.geth + +The ``web3.geth`` object exposes modules that enable you to interact with the JSON-RPC endpoints supported by `Geth `_ that are not defined in the standard set of Ethereum JSONRPC endpoints according to `EIP 1474 `_. + +GethAdmin API +~~~~~~~~~~~~~ + +The following methods are available on the ``web3.geth.admin`` namespace. + +.. py:module:: web3.geth.admin + +The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs under the +``admin_`` namespace that are supported by the Geth client. + +.. py:method:: datadir() + + * Delegates to ``admin_datadir`` RPC Method + + Returns the system path of the node's data directory. + + .. code-block:: python + + >>> web3.geth.admin.datadir() + '/Users/snakecharmers/Library/Ethereum' + + +.. py:method:: node_info() + + * Delegates to ``admin_nodeInfo`` RPC Method + + Returns information about the currently running node. + + .. code-block:: python + + >>> web3.geth.admin.node_info() + { + 'enode': 'enode://e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3@[::]:30303', + 'id': 'e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3', + 'ip': '::', + 'listenAddr': '[::]:30303', + 'name': 'Geth/v1.4.11-stable-fed692f6/darwin/go1.7', + 'ports': {'discovery': 30303, 'listener': 30303}, + 'protocols': { + 'eth': { + 'difficulty': 57631175724744612603, + 'genesis': '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3', + 'head': '0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796', + 'network': 1, + }, + }, + } + + +.. py:method:: peers() + + * Delegates to ``admin_peers`` RPC Method + + Returns the current peers the node is connected to. + + .. code-block:: python + + >>> web3.geth.admin.peers() + [ + { + 'caps': ['eth/63'], + 'id': '146e8e3e2460f1e18939a5da37c4a79f149c8b9837240d49c7d94c122f30064e07e4a42ae2c2992d0f8e7e6f68a30e7e9ad31d524349ec9d17effd2426a37b40', + 'name': 'Geth/v1.4.10-stable/windows/go1.6.2', + 'network': { + 'localAddress': '10.0.3.115:64478', + 'remoteAddress': '72.208.167.127:30303', + }, + 'protocols': { + 'eth': { + 'difficulty': 17179869184, + 'head': '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3', + 'version': 63, + }, + } + }, + { + 'caps': ['eth/62', 'eth/63'], + 'id': '76cb6cd3354be081923a90dfd4cda40aa78b307cc3cf4d5733dc32cc171d00f7c08356e9eb2ea47eab5aad7a15a3419b859139e3f762e1e1ebf5a04f530dcef7', + 'name': 'Geth/v1.4.10-stable-5f55d95a/linux/go1.5.1', + 'network': { + 'localAddress': '10.0.3.115:64784', + 'remoteAddress': '60.205.92.119:30303', + }, + 'protocols': { + 'eth': { + 'difficulty': 57631175724744612603, + 'head': '0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796', + 'version': 63, + }, + }, + }, + ... + ] + + +.. py:method:: add_peer(node_url) + + * Delegates to ``admin_addPeer`` RPC Method + + Requests adding a new remote node to the list of tracked static nodes. + + .. code-block:: python + + >>> web3.geth.admin.add_peer('enode://e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3@52.71.255.237:30303') + True + + +.. py:method:: start_http(host='localhost', port=8545, cors="", apis="eth,net,web3") + + * Delegates to ``admin_startHTTP`` RPC Method + + Starts the HTTP based JSON RPC API webserver on the specified ``host`` and + ``port``, with the ``rpccorsdomain`` set to the provided ``cors`` value and + with the APIs specified by ``apis`` enabled. Returns boolean as to whether + the server was successfully started. + + .. code-block:: python + + >>> web3.geth.admin.start_http() + True + + +.. py:method:: start_ws(host='localhost', port=8546, cors="", apis="eth,net,web3") + + * Delegates to ``admin_startWS`` RPC Method + + Starts the WebSocket based JSON RPC API webserver on the specified ``host`` + and ``port``, with the ``rpccorsdomain`` set to the provided ``cors`` value + and with the APIs specified by ``apis`` enabled. Returns boolean as to + whether the server was successfully started. + + .. code-block:: python + + >>> web3.geth.admin.start_ws() + True + + +.. py:method:: stop_http() + + * Delegates to ``admin_stopHTTP`` RPC Method + + Stops the HTTP based JSON RPC server. + + .. code-block:: python + + >>> web3.geth.admin.stop_http() + True + + +.. py:method:: stop_ws() + + * Delegates to ``admin_stopWS`` RPC Method + + Stops the WebSocket based JSON RPC server. + + .. code-block:: python + + >>> web3.geth.admin.stop_ws() + True + + +.. py:module:: web3.geth.txpool + +GethTxPool API +~~~~~~~~~~~~~~ + +The ``web3.geth.txpool`` object exposes methods to interact with the RPC APIs under +the ``txpool_`` namespace. These methods are only exposed under the ``geth`` namespace +since they are not standard. + +The following methods are available on the ``web3.geth.txpool`` namespace. + +.. py:method:: TxPool.inspect() + + * Delegates to ``txpool_inspect`` RPC Method + + Returns a textual summary of all transactions currently pending for + inclusion in the next block(s) as well as ones that are scheduled for + future execution. + + .. code-block:: python + + >>> web3.geth.txpool.inspect() + { + 'pending': { + '0x26588a9301b0428d95e6Fc3A5024fcE8BEc12D51': { + 31813: ["0x3375Ee30428b2A71c428afa5E89e427905F95F7e: 0 wei + 500000 × 20000000000 gas"] + }, + '0x2a65Aca4D5fC5B5C859090a6c34d164135398226': { + 563662: ["0x958c1Fa64B34db746925c6F8a3Dd81128e40355E: 1051546810000000000 wei + 90000 × 20000000000 gas"], + 563663: ["0x77517B1491a0299A44d668473411676f94e97E34: 1051190740000000000 wei + 90000 × 20000000000 gas"], + 563664: ["0x3E2A7Fe169c8F8eee251BB00d9fb6d304cE07d3A: 1050828950000000000 wei + 90000 × 20000000000 gas"], + 563665: ["0xAF6c4695da477F8C663eA2D8B768Ad82Cb6A8522: 1050544770000000000 wei + 90000 × 20000000000 gas"], + 563666: ["0x139B148094C50F4d20b01cAf21B85eDb711574dB: 1048598530000000000 wei + 90000 × 20000000000 gas"], + 563667: ["0x48B3Bd66770b0D1EeceFCe090daFeE36257538aE: 1048367260000000000 wei + 90000 × 20000000000 gas"], + 563668: ["0x468569500925D53e06Dd0993014aD166fD7Dd381: 1048126690000000000 wei + 90000 × 20000000000 gas"], + 563669: ["0x3DcB4C90477a4b8Ff7190b79b524773CbE3bE661: 1047965690000000000 wei + 90000 × 20000000000 gas"], + 563670: ["0x6DfeF5BC94b031407FFe71ae8076CA0FbF190963: 1047859050000000000 wei + 90000 × 20000000000 gas"] + }, + '0x9174E688d7dE157C5C0583Df424EAAB2676aC162': { + 3: ["0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413: 30000000000000000000 wei + 85000 × 21000000000 gas"] + }, + '0xb18F9d01323e150096650ab989CfecD39D757Aec': { + 777: ["0xcD79c72690750F079ae6AB6ccd7e7aEDC03c7720: 0 wei + 1000000 × 20000000000 gas"] + }, + '0xB2916C870Cf66967B6510B76c07E9d13a5D23514': { + 2: ["0x576f25199D60982A8f31A8DfF4da8aCB982e6ABa: 26000000000000000000 wei + 90000 × 20000000000 gas"] + }, + '0xBc0CA4f217E052753614d6B019948824d0d8688B': { + 0: ["0x2910543Af39abA0Cd09dBb2D50200b3E800A63D2: 1000000000000000000 wei + 50000 × 1171602790622 gas"] + }, + '0xea674fdde714fd979de3edf0f56aa9716b898ec8': { + 70148: ["0xe39c55ead9f997f7fa20ebe40fb4649943d7db66: 1000767667434026200 wei + 90000 × 20000000000 gas"] + } + }, + 'queued': { + '0x0F6000De1578619320aBA5e392706b131FB1dE6f': { + 6: ["0x8383534d0bcd0186d326C993031311c0Ac0D9B2d: 9000000000000000000 wei + 21000 × 20000000000 gas"] + }, + '0x5b30608c678e1ac464A8994C3B33E5CdF3497112': { + 6: ["0x9773547e27f8303C87089dc42D9288aa2B9d8F06: 50000000000000000000 wei + 90000 × 50000000000 gas"] + }, + '0x976A3Fc5d6f7d259EBfb4cc2Ae75115475E9867C': { + 3: ["0x346FB27dE7E7370008f5da379f74dd49F5f2F80F: 140000000000000000 wei + 90000 × 20000000000 gas"] + }, + '0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A': { + 2: ["0x24a461f25eE6a318BDef7F33De634A67bb67Ac9D: 17000000000000000000 wei + 90000 × 50000000000 gas"], + 6: ["0x6368f3f8c2B42435D6C136757382E4A59436a681: 17990000000000000000 wei + 90000 × 20000000000 gas", "0x8db7b4e0ecb095fbd01dffa62010801296a9ac78: 16998950000000000000 wei + 90000 × 20000000000 gas"], + 7: ["0x6368f3f8c2B42435D6C136757382E4A59436a681: 17900000000000000000 wei + 90000 × 20000000000 gas"] + } + } + } + + +.. py:method:: TxPool.status() + + * Delegates to ``txpool_status`` RPC Method + + Returns a textual summary of all transactions currently pending for + inclusion in the next block(s) as well as ones that are scheduled for + future execution. + + .. code-block:: python + + { + pending: 10, + queued: 7, + } + + +.. py:method:: TxPool.content() + + * Delegates to ``txpool_content`` RPC Method + + Returns the exact details of all transactions that are pending or queued. + + .. code-block:: python + + >>> web3.geth.txpool.content() + { + 'pending': { + '0x0216D5032f356960Cd3749C31Ab34eEFF21B3395': { + 806: [{ + 'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000", + 'blockNumber': None, + 'from': "0x0216D5032f356960Cd3749C31Ab34eEFF21B3395", + 'gas': "0x5208", + 'gasPrice': None, + 'hash': "0xaf953a2d01f55cfe080c0c94150a60105e8ac3d51153058a1f03dd239dd08586", + 'input': "0x", + 'maxFeePerGas': '0x77359400', + 'maxPriorityFeePerGas': '0x3b9aca00', + 'nonce': "0x326", + 'to': "0x7f69a91A3CF4bE60020fB58B893b7cbb65376db8", + 'transactionIndex': None, + 'value': "0x19a99f0cf456000" + }] + }, + '0x24d407e5A0B506E1Cb2fae163100B5DE01F5193C': { + 34: [{ + 'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000", + 'blockNumber': None, + 'from': "0x24d407e5A0B506E1Cb2fae163100B5DE01F5193C", + 'gas': "0x44c72", + 'gasPrice': None, + 'hash': "0xb5b8b853af32226755a65ba0602f7ed0e8be2211516153b75e9ed640a7d359fe", + 'input': "0xb61d27f600000000000000000000000024d407e5a0b506e1cb2fae163100b5de01f5193c00000000000000000000000000000000000000000000000053444835ec580000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 'maxFeePerGas': '0x77359400', + 'maxPriorityFeePerGas': '0x3b9aca00', + 'nonce': "0x22", + 'to': "0x7320785200f74861B69C49e4ab32399a71b34f1a", + 'transactionIndex': None, + 'value': "0x0" + }] + } + }, + 'queued': { + '0x976A3Fc5d6f7d259EBfb4cc2Ae75115475E9867C': { + 3: [{ + 'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000", + 'blockNumber': None, + 'from': "0x976A3Fc5d6f7d259EBfb4cc2Ae75115475E9867C", + 'gas': "0x15f90", + 'gasPrice': None, + 'hash': "0x57b30c59fc39a50e1cba90e3099286dfa5aaf60294a629240b5bbec6e2e66576", + 'input': "0x", + 'maxFeePerGas': '0x77359400', + 'maxPriorityFeePerGas': '0x3b9aca00', + 'nonce': "0x3", + 'to': "0x346FB27dE7E7370008f5da379f74dd49F5f2F80F", + 'transactionIndex': None, + 'value': "0x1f161421c8e0000" + }] + }, + '0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A': { + 2: [{ + 'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000", + 'blockNumber': None, + 'from': "0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A", + 'gas': "0x15f90", + 'gasPrice': None, + 'hash': "0x3a3c0698552eec2455ed3190eac3996feccc806970a4a056106deaf6ceb1e5e3", + 'input': "0x", + 'maxFeePerGas': '0x77359400', + 'maxPriorityFeePerGas': '0x3b9aca00', + 'nonce': "0x2", + 'to': "0x24a461f25eE6a318BDef7F33De634A67bb67Ac9D", + 'transactionIndex': None, + 'value': "0xebec21ee1da40000" + }], + 6: [{ + 'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000", + 'blockNumber': None, + 'from': "0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A", + 'gas': "0x15f90", + 'gasPrice': None, + 'hash': "0xbbcd1e45eae3b859203a04be7d6e1d7b03b222ec1d66dfcc8011dd39794b147e", + 'input': "0x", + 'maxFeePerGas': '0x77359400', + 'maxPriorityFeePerGas': '0x3b9aca00', + 'nonce': "0x6", + 'to': "0x6368f3f8c2B42435D6C136757382E4A59436a681", + 'transactionIndex': None, + 'value': "0xf9a951af55470000" + }, { + 'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000", + 'blockNumber': None, + 'from': "0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A", + 'gas': "0x15f90", + 'gasPrice': None, + 'hash': "0x60803251d43f072904dc3a2d6a084701cd35b4985790baaf8a8f76696041b272", + 'input': "0x", + 'maxFeePerGas': '0x77359400', + 'maxPriorityFeePerGas': '0x3b9aca00', + 'nonce': "0x6", + 'to': "0x8DB7b4e0ECB095FBD01Dffa62010801296a9ac78", + 'transactionIndex': None, + 'value': "0xebe866f5f0a06000" + }], + } + } + } + +.. py:module:: web3.geth.debug + +GethDebug API +~~~~~~~~~~~~~~ + +The ``web3.geth.debug`` object exposes methods to interact with the RPC APIs under the +``debug_`` namespace. These methods are only exposed under the ``geth`` namespace. +Full documentation around options can be found in the +`Geth docs `_. + +.. py:method:: Debug.trace_transaction(transaction_hash) + + * Delegates to ``debug_traceTransaction`` RPC Method + + Returns the trace of the transaction with the given ``transaction_hash`` and ``trace_config``. + + .. code-block:: python + + >>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3') + AttributeDict({ + 'gas': 21000, + 'failed': False, + 'returnValue': '', + 'structLogs': [] + }) + + >>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3', { + "tracer": "prestateTracer", + }) + AttributeDict({ + '0x0000000000000000000000000000000000000000': AttributeDict({'balance': 0}), + '0x7fE3e4C21bDE162214B715AabcE05391301e9F5B': AttributeDict({'balance': 115792089237316195423570985008687907853269984665640564039457584007913129639927}), + '0x91fe3039271d43d3f8479f60Cc5293Bc8A461b75': AttributeDict({'balance': 0}) + }) + + >>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3', { + "tracer": "prestateTracer", + "traceConfig": {"diffMode": True} + }) + AttributeDict({ + 'post': AttributeDict({ + '0x0000000000000000000000000000000000000000': AttributeDict({'balance': 63000}), + '0xcF888Cc4FAe8a3D774e574Ef8C6a261958287d04': AttributeDict({ + 'balance': 115792089237316195423570985008687907853269984665640564039457583959368602105927, + 'nonce': 3 + }), + '0xD2593D3445a9F0f4c776715f5206FBf4CA6A0475': AttributeDict({'balance': 100000})}), + 'pre': AttributeDict({ + '0x0000000000000000000000000000000000000000': AttributeDict({'balance': 42000}), + '0xcF888Cc4FAe8a3D774e574Ef8C6a261958287d04': AttributeDict({ + 'balance': 115792089237316195423570985008687907853269984665640564039457583973451623990927, + 'nonce': 2 + }), + '0xD2593D3445a9F0f4c776715f5206FBf4CA6A0475': AttributeDict({'balance': 0}) + }) + }) + + >>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3', { + "tracer": "callTracer", + "tracerConfig": {"withLog": False}, + }) + AttributeDict({'calls': [AttributeDict({'from': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11', + 'gas': 154003, + 'gasUsed': 275, + 'input': HexBytes('0xad5c4648'), + 'output': HexBytes('0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), + 'to': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'type': 'STATICCALL'}), + AttributeDict({'from': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11', + 'gas': 150633, + 'gasUsed': 24678, + 'input': HexBytes('0x095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000000000000000007e37be2022c0914b2680000000'), + 'output': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001'), + 'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B', + 'type': 'CALL', + 'value': 0}), + AttributeDict({'calls': [AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 121167, + 'gasUsed': 27504, + 'input': HexBytes('0x23b872dd000000000000000000000000a0457775a08b175cbb444ed923556dc67ec5dc1100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d000000000000000000000000000000000000007e37be2022c0914b2680000000'), + 'output': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001'), + 'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B', + 'type': 'CALL', + 'value': 0}), + AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 89911, + 'gasUsed': 2504, + 'input': HexBytes('0x0902f1ac'), + 'output': HexBytes('0x00000000000000000000000000000000000000000000000053f54ccde429ceb70000000000000000000000000000000000000000001635eb93ecdb339a7dc022000000000000000000000000000000000000000000000000000000006641f6cf'), + 'to': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d', + 'type': 'STATICCALL'}), + AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 86926, + 'gasUsed': 621, + 'input': HexBytes('0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d'), + 'output': HexBytes('0x000000000000000000000000000000000000007e37d4560e547e265a1a7dc022'), + 'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B', + 'type': 'STATICCALL'}), + AttributeDict({'calls': [AttributeDict({'from': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d', + 'gas': 70279, + 'gasUsed': 29962, + 'input': HexBytes('0xa9059cbb0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000053f53dfc545d56a6'), + 'output': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001'), + 'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + 'type': 'CALL', + 'value': 0}), + AttributeDict({'from': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d', + 'gas': 40164, + 'gasUsed': 534, + 'input': HexBytes('0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d'), + 'output': HexBytes('0x00000000000000000000000000000000000000000000000000000ed18fcc7811'), + 'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + 'type': 'STATICCALL'}), + AttributeDict({'from': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d', + 'gas': 39233, + 'gasUsed': 621, + 'input': HexBytes('0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d'), + 'output': HexBytes('0x000000000000000000000000000000000000007e37d4560e547e265a1a7dc022'), + 'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B', + 'type': 'STATICCALL'})], + 'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 84769, + 'gasUsed': 64940, + 'input': HexBytes('0x022c0d9f00000000000000000000000000000000000000000000000053f53dfc545d56a600000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000'), + 'to': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d', + 'type': 'CALL', + 'value': 0}), + AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 20382, + 'gasUsed': 534, + 'input': HexBytes('0x70a082310000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d'), + 'output': HexBytes('0x00000000000000000000000000000000000000000000000053f53dfc545d56a6'), + 'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + 'type': 'STATICCALL'}), + AttributeDict({'calls': [AttributeDict({'from': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + 'gas': 2300, + 'gasUsed': 83, + 'input': HexBytes('0x'), + 'to': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'type': 'CALL', + 'value': 6049809828398585510})], + 'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 19432, + 'gasUsed': 9223, + 'input': HexBytes('0x2e1a7d4d00000000000000000000000000000000000000000000000053f53dfc545d56a6'), + 'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + 'type': 'CALL', + 'value': 0}), + AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'gas': 3353, + 'gasUsed': 0, + 'input': HexBytes('0x'), + 'to': '0xE11418f9961248da36b1008b1090235f680AE8f5', + 'type': 'CALL', + 'value': 6049809828398585510})], + 'from': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11', + 'gas': 125270, + 'gasUsed': 122013, + 'input': HexBytes('0x791ac947000000000000000000000000000000000000007e37be2022c0914b2680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000e11418f9961248da36b1008b1090235f680ae8f5000000000000000000000000000000000000000000000000000000006641fe7f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ec4cf8dcb526080792bc98e1ef41fb4775777b6b000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), + 'to': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', + 'type': 'CALL', + 'value': 0})], + 'from': '0xE11418f9961248da36b1008b1090235f680AE8f5', + 'gas': 185574, + 'gasUsed': 144300, + 'input': HexBytes('0x56feb11b000000000000000000000000ec4cf8dcb526080792bc98e1ef41fb4775777b6b000000000000000000000000000000000000007e37be2022c0914b2680000000'), + 'to': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11', + 'type': 'CALL', + 'value': 0}) + + >>> w3.geth.debug.trace_transaction(tx_hash, {'tracer': '4byteTracer'}) diff --git a/_build/html_zh_CN/_sources/web3.main.rst.txt b/_build/html_zh_CN/_sources/web3.main.rst.txt new file mode 100644 index 0000000000..ad849ecfab --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.main.rst.txt @@ -0,0 +1,607 @@ +.. _web3_base: + +Web3 API +======== + +.. contents:: :local: + +.. py:module:: web3 +.. py:currentmodule:: web3 + + +.. py:class:: Web3(provider) + +Each ``Web3`` instance exposes the following APIs. + +Providers +~~~~~~~~~ + +.. py:attribute:: Web3.HTTPProvider + + Convenience API to access :py:class:`web3.providers.rpc.HTTPProvider` + +.. py:attribute:: Web3.IPCProvider + + Convenience API to access :py:class:`web3.providers.ipc.IPCProvider` + + +Attributes +~~~~~~~~~~ + +.. py:attribute:: Web3.api + + Returns the current Web3 version. + + .. code-block:: python + + >>> web3.api + "4.7.0" + +.. py:attribute:: Web3.client_version + + * Delegates to ``web3_clientVersion`` RPC Method + + Returns the current client version. + + .. code-block:: python + + >>> web3.client_version + 'Geth/v1.4.11-stable-fed692f6/darwin/go1.7' + + +.. _batch_requests: + +Batch Requests +~~~~~~~~~~~~~~ + +.. py:method:: Web3.batch_requests() + + The JSON-RPC API allows for batch requests, meaning you can send a single request + that contains an array of request objects. Generally, this may be useful when you want + to limit the number of requests you send to a node. + + You can choose to build a batch of requests within or outside of a context manager: + + .. code-block:: python + + with w3.batch_requests() as batch: + batch.add(w3.eth.get_block(6)) + batch.add(w3.eth.get_block(4)) + batch.add(w3.eth.get_block(2)) + + responses = batch.execute() + assert len(responses) == 3 + + .. note:: + + Within the batching context above, calls are suspended until + ``batch.execute()`` is called. Calling a method without + passing it to ``batch.add`` might result in unexpected behavior. + + Using the batch object directly: + + .. code-block:: python + + batch = w3.batch_requests() + batch.add(w3.eth.get_block(1)) + batch.add(w3.eth.get_block(2)) + responses = batch.execute() + assert len(responses) == 2 + + Contract interactions can be included in batch requests by omitting the ``call()`` method: + + .. code-block:: python + + batch.add(math_contract.functions.multiply7(0)) + + Additionally, if you need to make multiple calls of the same function, you can add + a mapping of the function to its arguments: + + .. code-block:: python + + batch = w3.batch_requests() + batch.add_mapping( + { + math_contract.functions.multiply7: [1, 2], + w3.eth.get_block: [3, 4], + } + ) + responses = batch.execute() + assert len(responses) == 4 + + The ``execute`` method returns a list of responses in the order they were included in + the batch. + + If you need to abandon or rebuild a batch request, utilize the ``clear`` method: + + .. code-block:: python + + batch = w3.batch_requests() + batch.add(w3.eth.get_block(1)) + batch.add(w3.eth.get_block(2)) + assert len(batch._requests_info) == 2 + + batch.clear() + assert batch._requests_info == [] + + .. note:: + + Only read-only operations that exist within modules on the ``Web3`` class + (e.g. ``w3.eth``, ``w3.net``) are supported by ``batch_requests``. + Unsupported methods include: + + - :meth:`subscribe ` + - :meth:`unsubscribe ` + - :meth:`send_raw_transaction ` + - :meth:`send_transaction ` + - :meth:`sign_transaction ` + - :meth:`sign ` + - :meth:`sign_typed_data ` + - ``w3.provider.make_request()``. + + Async Batch Requests + ```````````````````` + + If using one of the asynchronous providers, you'll need to make use of + the ``async_execute`` method and the ``async`` and ``await`` keywords as appropriate. + + .. note:: + + If performance is a concern, consider using ``asyncio.gather()`` with single + concurrent requests instead of an asynchronous batch request. It will generally be + the faster option due to the overhead of batching. + + .. code-block:: python + + # context manager: + async with w3.batch_requests() as batch: + batch.add(w3.eth.get_block(6)) + batch.add(w3.eth.get_block(4)) + batch.add(w3.eth.get_block(2)) + + responses = await batch.async_execute() + assert len(responses) == 3 + + # object: + batch = w3.batch_requests() + batch.add(w3.eth.get_block(1)) + batch.add(w3.eth.get_block(2)) + responses = await batch.async_execute() + assert len(responses) == 2 + + +.. _overview_type_conversions: + +Encoding and Decoding Helpers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. py:method:: Web3.to_hex(primitive=None, hexstr=None, text=None) + + Takes a variety of inputs and returns it in its hexadecimal representation. + It follows the rules for converting to hex in the + `JSON-RPC spec`_ + + .. code-block:: python + + >>> Web3.to_hex(0) + '0x0' + >>> Web3.to_hex(1) + '0x1' + >>> Web3.to_hex(0x0) + '0x0' + >>> Web3.to_hex(0x000F) + '0xf' + >>> Web3.to_hex(b'') + '0x' + >>> Web3.to_hex(b'\x00\x0F') + '0x000f' + >>> Web3.to_hex(False) + '0x0' + >>> Web3.to_hex(True) + '0x1' + >>> Web3.to_hex(hexstr='0x000F') + '0x000f' + >>> Web3.to_hex(hexstr='000F') + '0x000f' + >>> Web3.to_hex(text='') + '0x' + >>> Web3.to_hex(text='cowmö') + '0x636f776dc3b6' + +.. _JSON-RPC spec: https://github.com/ethereum/wiki/wiki/JSON-RPC#hex-value-encoding + +.. py:method:: Web3.to_text(primitive=None, hexstr=None, text=None) + + Takes a variety of inputs and returns its string equivalent. + Text gets decoded as UTF-8. + + + .. code-block:: python + + >>> Web3.to_text(0x636f776dc3b6) + 'cowmö' + >>> Web3.to_text(b'cowm\xc3\xb6') + 'cowmö' + >>> Web3.to_text(hexstr='0x636f776dc3b6') + 'cowmö' + >>> Web3.to_text(hexstr='636f776dc3b6') + 'cowmö' + >>> Web3.to_text(text='cowmö') + 'cowmö' + + +.. py:method:: Web3.to_bytes(primitive=None, hexstr=None, text=None) + + Takes a variety of inputs and returns its bytes equivalent. + Text gets encoded as UTF-8. + + + .. code-block:: python + + >>> Web3.to_bytes(0) + b'\x00' + >>> Web3.to_bytes(0x000F) + b'\x0f' + >>> Web3.to_bytes(b'') + b'' + >>> Web3.to_bytes(b'\x00\x0F') + b'\x00\x0f' + >>> Web3.to_bytes(False) + b'\x00' + >>> Web3.to_bytes(True) + b'\x01' + >>> Web3.to_bytes(hexstr='0x000F') + b'\x00\x0f' + >>> Web3.to_bytes(hexstr='000F') + b'\x00\x0f' + >>> Web3.to_bytes(text='') + b'' + >>> Web3.to_bytes(text='cowmö') + b'cowm\xc3\xb6' + + +.. py:method:: Web3.to_int(primitive=None, hexstr=None, text=None) + + Takes a variety of inputs and returns its integer equivalent. + + + .. code-block:: python + + >>> Web3.to_int(0) + 0 + >>> Web3.to_int(0x000F) + 15 + >>> Web3.to_int(b'\x00\x0F') + 15 + >>> Web3.to_int(False) + 0 + >>> Web3.to_int(True) + 1 + >>> Web3.to_int(hexstr='0x000F') + 15 + >>> Web3.to_int(hexstr='000F') + 15 + +.. py:method:: Web3.to_json(obj) + + Takes a variety of inputs and returns its JSON equivalent. + + + .. code-block:: python + + >>> Web3.to_json(3) + '3' + >>> Web3.to_json({'one': 1}) + '{"one": 1}' + + +.. _overview_currency_conversions: + +Currency Conversions +~~~~~~~~~~~~~~~~~~~~~ + +.. py:method:: Web3.to_wei(value, currency) + + Returns the value in the denomination specified by the ``currency`` argument + converted to wei. + + + .. code-block:: python + + >>> Web3.to_wei(1, 'ether') + 1000000000000000000 + + +.. py:method:: Web3.from_wei(value, currency) + + Returns the value in wei converted to the given currency. The value is returned + as a ``Decimal`` to ensure precision down to the wei. + + + .. code-block:: python + + >>> Web3.from_wei(1000000000000000000, 'ether') + Decimal('1') + + +.. _overview_addresses: + +Addresses +~~~~~~~~~ + +.. py:method:: Web3.is_address(value) + + Returns ``True`` if the value is one of the recognized address formats. + + * Allows for both ``0x`` prefixed and non-prefixed values. + * If the address contains mixed upper and lower cased characters this function also + checks if the address checksum is valid according to `EIP55`_ + + .. code-block:: python + + >>> Web3.is_address('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + True + + +.. py:method:: Web3.is_checksum_address(value) + + Returns ``True`` if the value is a valid `EIP55`_ checksummed address + + + .. code-block:: python + + >>> Web3.is_checksum_address('0xd3CdA913deB6f67967B99D67aCDFa1712C293601') + True + >>> Web3.is_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601') + False + + +.. py:method:: Web3.to_checksum_address(value) + + Returns the given address with an `EIP55`_ checksum. + + + .. code-block:: python + + >>> Web3.to_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601') + '0xd3CdA913deB6f67967B99D67aCDFa1712C293601' + +.. _EIP55: https://github.com/ethereum/EIPs/issues/55 + + +.. _overview_hashing: + +Cryptographic Hashing +~~~~~~~~~~~~~~~~~~~~~ + +.. py:classmethod:: Web3.keccak(primitive=None, hexstr=None, text=None) + + Returns the Keccak-256 of the given value. Text is encoded to UTF-8 before + computing the hash, just like Solidity. Any of the following are + valid and equivalent: + + .. code-block:: python + + >>> Web3.keccak(0x747874) + >>> Web3.keccak(b'\x74\x78\x74') + >>> Web3.keccak(hexstr='0x747874') + >>> Web3.keccak(hexstr='747874') + >>> Web3.keccak(text='txt') + HexBytes('0xd7278090a36507640ea6b7a0034b69b0d240766fa3f98e3722be93c613b29d2e') + +.. py:classmethod:: Web3.solidity_keccak(abi_types, value) + + Returns the Keccak-256 as it would be computed by the solidity ``keccak`` + function on a *packed* ABI encoding of the ``value`` list contents. The ``abi_types`` + argument should be a list of solidity type strings which correspond to each + of the provided values. + + + .. code-block:: python + + >>> Web3.solidity_keccak(['bool'], [True]) + HexBytes("0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2") + + >>> Web3.solidity_keccak(['uint8', 'uint8', 'uint8'], [97, 98, 99]) + HexBytes("0x4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45") + + >>> Web3.solidity_keccak(['uint8[]'], [[97, 98, 99]]) + HexBytes("0x233002c671295529bcc50b76a2ef2b0de2dac2d93945fca745255de1a9e4017e") + + >>> Web3.solidity_keccak(['address'], ["0x49EdDD3769c0712032808D86597B84ac5c2F5614"]) + HexBytes("0x2ff37b5607484cd4eecf6d13292e22bd6e5401eaffcc07e279583bc742c68882") + + >>> Web3.solidity_keccak(['address'], ["ethereumfoundation.eth"]) + HexBytes("0x913c99ea930c78868f1535d34cd705ab85929b2eaaf70fcd09677ecd6e5d75e9") + + + Comparable solidity usage: + + .. code-block:: solidity + + bytes32 data1 = keccak256(abi.encodePacked(true)); + assert(data1 == hex"5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2"); + bytes32 data2 = keccak256(abi.encodePacked(uint8(97), uint8(98), uint8(99))); + assert(data2 == hex"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45"); + + +Check Encodability +~~~~~~~~~~~~~~~~~~~~ + +.. py:method:: w3.is_encodable(_type, value) + + Returns ``True`` if a value can be encoded as the given type. Otherwise returns ``False``. + + .. code-block:: python + + >>> from web3.auto.gethdev import w3 + >>> w3.is_encodable('bytes2', b'12') + True + >>> w3.is_encodable('bytes2', '0x1234') + True + >>> w3.is_encodable('bytes2', '1234') # not 0x-prefixed, no assumptions will be made + False + >>> w3.is_encodable('bytes2', b'1') # does not match specified bytes size + False + >>> w3.is_encodable('bytes2', b'123') # does not match specified bytes size + False + +.. py:attribute:: w3.strict_bytes_type_checking + + Disable the stricter bytes type checking that is loaded by default. For more + examples, see :ref:`disable-strict-byte-check` + + .. doctest:: + + >>> from web3.auto.gethdev import w3 + + >>> w3.is_encodable('bytes2', b'12') + True + + >>> # not of exact size bytes2 + >>> w3.is_encodable('bytes2', b'1') + False + + >>> w3.strict_bytes_type_checking = False + + >>> # zero-padded, so encoded to: b'1\x00' + >>> w3.is_encodable('bytes2', b'1') + True + + >>> # re-enable it + >>> w3.strict_bytes_type_checking = True + >>> w3.is_encodable('bytes2', b'1') + False + + +RPC API Modules +~~~~~~~~~~~~~~~ + +Each ``Web3`` instance also exposes these namespaced API modules. + + +.. py:attribute:: Web3.eth + + See :doc:`./web3.eth` + +.. py:attribute:: Web3.geth + + See :doc:`./web3.geth` + + +These internal modules inherit from the ``web3.module.Module`` class which give them some configurations internal to the +web3.py library. + + +Custom Methods +~~~~~~~~~~~~~~ + +You may add or overwrite methods within any module using the ``attach_methods`` function. +To create a property instead, set ``is_property`` to ``True``. + +.. code-block:: python + + >>> w3.eth.attach_methods({ + ... 'example_method': Method( + ... 'eth_example', + ... mungers=[...], + ... request_formatters=[...], + ... result_formatters=[...], + ... is_property=False, + ... ), + ... }) + >>> w3.eth.example_method() + + +External Modules +~~~~~~~~~~~~~~~~ + +External modules can be used to introduce custom or third-party APIs to your ``Web3`` instance. External modules are simply +classes whose methods and properties can be made available within the ``Web3`` instance. Optionally, the external module may +make use of the parent ``Web3`` instance by accepting it as the first argument within the ``__init__`` function: + +.. code-block:: python + + >>> class ExampleModule: + ... def __init__(self, w3): + ... self.w3 = w3 + ... + ... def print_balance_of_shaq(self): + ... print(self.w3.eth.get_balance('shaq.eth')) + + +.. warning:: Given the flexibility of external modules, use caution and only import modules from trusted third parties + and open source code you've vetted! + +Configuring external modules can occur either at instantiation of the ``Web3`` instance or by making use of the +``attach_modules()`` method. To instantiate the ``Web3`` instance with external modules use the ``external_modules`` +keyword argument: + +.. code-block:: python + + >>> from web3 import Web3, HTTPProvider + >>> from external_module_library import ( + ... ModuleClass1, + ... ModuleClass2, + ... ModuleClass3, + ... ModuleClass4, + ... ModuleClass5, + ... ) + >>> w3 = Web3( + ... HTTPProvider(provider_uri), + ... external_modules={ + ... 'module1': ModuleClass1, + ... 'module2': (ModuleClass2, { + ... 'submodule1': ModuleClass3, + ... 'submodule2': (ModuleClass4, { + ... 'submodule2a': ModuleClass5, # submodule children may be nested further if necessary + ... }) + ... }) + ... } + ... ) + + # `return_zero`, in this case, is an example attribute of the `ModuleClass1` object + >>> w3.module1.return_zero() + 0 + >>> w3.module2.submodule1.return_one() + 1 + >>> w3.module2.submodule2.submodule2a.return_two() + 2 + + +.. py:method:: w3.attach_modules(modules) + + The ``attach_modules()`` method can be used to attach external modules after the ``Web3`` instance has been + instantiated. + + Modules are attached via a `dict` with module names as the keys. The values can either be the module classes + themselves, if there are no submodules, or two-item tuples with the module class as the 0th index and a similarly + built `dict` containing the submodule information as the 1st index. This pattern may be repeated as necessary. + + .. code-block:: python + + >>> from web3 import Web3, HTTPProvider + >>> from external_module_library import ( + ... ModuleClass1, + ... ModuleClass2, + ... ModuleClass3, + ... ModuleClass4, + ... ModuleClass5, + ... ) + >>> w3 = Web3(HTTPProvider(provider_uri)) + + >>> w3.attach_modules({ + ... 'module1': ModuleClass1, # the module class itself may be used for a single module with no submodules + ... 'module2': (ModuleClass2, { # a tuple with module class and corresponding submodule dict may be used for modules with submodules + ... 'submodule1': ModuleClass3, + ... 'submodule2': (ModuleClass4, { # this pattern may be repeated as necessary + ... 'submodule2a': ModuleClass5, + ... }) + ... }) + ... }) + >>> w3.module1.return_zero() + 0 + >>> w3.module2.submodule1.return_one() + 1 + >>> w3.module2.submodule2.submodule2a.return_two() + 2 diff --git a/_build/html_zh_CN/_sources/web3.net.rst.txt b/_build/html_zh_CN/_sources/web3.net.rst.txt new file mode 100644 index 0000000000..bc5433725e --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.net.rst.txt @@ -0,0 +1,49 @@ +Net API +======= + +.. py:module:: web3.net + +The ``web3.net`` object exposes methods to interact with the RPC APIs under +the ``net_`` namespace. + + +Properties +---------- + +The following properties are available on the ``web3.net`` namespace. + +.. py:method:: listening + ..py:property:: + + * Delegates to ``net_listening`` RPC method + + Returns true if client is actively listening for network connections. + + .. code-block:: python + + >>> web3.net.listening + True + +.. py:method:: peer_count + ..py:property:: + + * Delegates to ``net_peerCount`` RPC method + + Returns number of peers currently connected to the client. + + .. code-block:: python + + >>> web3.net.peer_count + 1 + +.. py:method:: version + ..py:property:: + + * Delegates to ``net_version`` RPC Method + + Returns the current network id. + + .. code-block:: python + + >>> web3.net.version + '8996' diff --git a/_build/html_zh_CN/_sources/web3.tracing.rst.txt b/_build/html_zh_CN/_sources/web3.tracing.rst.txt new file mode 100644 index 0000000000..f17908aa60 --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.tracing.rst.txt @@ -0,0 +1,16 @@ +Tracing API +=========== + +.. py:module:: web3.tracing + +The ``web3.tracing`` object exposes modules that enable you to interact with the JSON-RPC ``trace_`` endpoints supported by Erigon and Nethermind. + +The following methods are available on the ``web3.tracing`` namespace: + +.. py:method:: trace_replay_transaction +.. py:method:: trace_replay_block_transactions +.. py:method:: trace_filter +.. py:method:: trace_block +.. py:method:: trace_transaction +.. py:method:: trace_call +.. py:method:: trace_raw_transaction diff --git a/_build/html_zh_CN/_sources/web3.utils.rst.txt b/_build/html_zh_CN/_sources/web3.utils.rst.txt new file mode 100644 index 0000000000..89fb0c0fda --- /dev/null +++ b/_build/html_zh_CN/_sources/web3.utils.rst.txt @@ -0,0 +1,53 @@ +Utils +===== + +.. py:module:: web3.utils + +The ``utils`` module houses public utility functions and classes. + +ABI +--- + +.. automodule:: web3.utils.abi + :members: + :undoc-members: + :show-inheritance: + +Address +------- + +.. py:method:: utils.get_create_address(sender, nonce) + + Return the checksummed contract address generated by using the ``CREATE`` opcode by + a sender address with a given nonce. + + +.. py:method:: utils.get_create2_address(sender, salt, init_code) + + Return the checksummed contract address generated by using the ``CREATE2`` opcode by + a sender address with a given salt and contract bytecode. See + `EIP-1014 `_. + + +Caching +------- + +.. py:class:: utils.SimpleCache + + The main cache class being used internally by web3.py. In some cases, it may prove + useful to set your own cache size and pass in your own instance of this class where + supported. + + +Exception Handling +------------------ + +.. py:method:: utils.handle_offchain_lookup(offchain_lookup_payload, transaction) + + Handle ``OffchainLookup`` reverts on contract function calls manually. For an example, see :ref:`ccip-read-example` + within the examples section. + + +.. py:method:: utils.async_handle_offchain_lookup(offchain_lookup_payload, transaction) + + The async version of the ``handle_offchain_lookup()`` utility method described above. diff --git a/_build/html_zh_CN/_static/_sphinx_javascript_frameworks_compat.js b/_build/html_zh_CN/_static/_sphinx_javascript_frameworks_compat.js new file mode 100644 index 0000000000..81415803ec --- /dev/null +++ b/_build/html_zh_CN/_static/_sphinx_javascript_frameworks_compat.js @@ -0,0 +1,123 @@ +/* Compatability shim for jQuery and underscores.js. + * + * Copyright Sphinx contributors + * Released under the two clause BSD licence + */ + +/** + * small helper function to urldecode strings + * + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL + */ +jQuery.urldecode = function(x) { + if (!x) { + return x + } + return decodeURIComponent(x.replace(/\+/g, ' ')); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node, addItems) { + if (node.nodeType === 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + var bbox = node.parentElement.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this, addItems); + }); + } + } + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); + }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} diff --git a/_build/html_zh_CN/_static/banner/banner-snek.jpg b/_build/html_zh_CN/_static/banner/banner-snek.jpg new file mode 100644 index 0000000000..f49a07dd8c Binary files /dev/null and b/_build/html_zh_CN/_static/banner/banner-snek.jpg differ diff --git a/_build/html_zh_CN/_static/banner/feedback.png b/_build/html_zh_CN/_static/banner/feedback.png new file mode 100644 index 0000000000..599768873a Binary files /dev/null and b/_build/html_zh_CN/_static/banner/feedback.png differ diff --git a/_build/html_zh_CN/_static/banner/user-survey.png b/_build/html_zh_CN/_static/banner/user-survey.png new file mode 100644 index 0000000000..9153b93b61 Binary files /dev/null and b/_build/html_zh_CN/_static/banner/user-survey.png differ diff --git a/_build/html_zh_CN/_static/basic.css b/_build/html_zh_CN/_static/basic.css new file mode 100644 index 0000000000..9c0c9b80c9 --- /dev/null +++ b/_build/html_zh_CN/_static/basic.css @@ -0,0 +1,906 @@ +/* + * Sphinx stylesheet -- basic theme. + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin-top: 10px; +} + +ul.search li { + padding: 5px 0; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 360px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +a:visited { + color: #551A8B; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} diff --git a/_build/html_zh_CN/_static/css/badge_only.css b/_build/html_zh_CN/_static/css/badge_only.css new file mode 100644 index 0000000000..eb61d1e5d4 --- /dev/null +++ b/_build/html_zh_CN/_static/css/badge_only.css @@ -0,0 +1 @@ +.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px} diff --git a/_build/html_zh_CN/_static/css/banner.css b/_build/html_zh_CN/_static/css/banner.css new file mode 100644 index 0000000000..939a201285 --- /dev/null +++ b/_build/html_zh_CN/_static/css/banner.css @@ -0,0 +1,11 @@ +/** + * Styles to display banner under the search box. + */ + +.search-banner-wrapper img { + width: auto; + height: auto; + padding: 0; + border-radius: 0; + margin: 12px 0 0 0; +} diff --git a/_build/html_zh_CN/_static/css/dark.css b/_build/html_zh_CN/_static/css/dark.css new file mode 100644 index 0000000000..da2235b5b0 --- /dev/null +++ b/_build/html_zh_CN/_static/css/dark.css @@ -0,0 +1,622 @@ +/* links */ + +a, +a:visited { + color: #aaddff; +} + + +/* code directives */ + +.method dt, +.class dt, +.data dt, +.attribute dt, +.function dt, +.classmethod dt, +.exception dt, +.descclassname, +.descname { + background-color: #2d2d2d !important; +} + +.rst-content dl:not(.docutils) dt { + color: #aaddff; + background-color: #2d2d2d; + border-top: solid 3px #525252; + border-left: solid 3px #525252; +} + +em.property { + color: #888888; +} + + +/* tables */ + +.rst-content table.docutils thead { + color: #ddd; +} + +.rst-content table.docutils td { + border: 0px; +} + +.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td { + background-color: #5a5a5a; +} + + +/* inlined code highlights */ + +.xref, +.py-meth, +.rst-content a code { + color: #aaddff !important; + font-weight: normal !important; +} + +.rst-content code { + color: #eee !important; + font-weight: normal !important; +} + +code.literal { + background-color: #2d2d2d !important; + border: 1px solid #6d6d6d !important; +} + +code.docutils.literal.notranslate { + color: #ddd; +} + + +/* notes, warnings, hints */ + +.hint .admonition-title { + background: #2aa87c !important; +} + +.warning .admonition-title { + background: #cc4444 !important; +} + +.admonition-title { + background: #3a7ca8 !important; +} + +.admonition, +.note { + background-color: #2d2d2d !important; +} + + +/* table of contents */ + +.wy-nav-content-wrap { + background-color: rgba(0, 0, 0, 0.6) !important; +} + +.sidebar { + background-color: #191919 !important; +} + +.sidebar-title { + background-color: #2b2b2b !important; +} + +.wy-menu-vertical a { + color: #ddd; +} + +.wy-menu-vertical code.docutils.literal.notranslate { + color: #404040; + background: none !important; + border: none !important; +} + +.wy-nav-content { + background: #3c3c3c; + color: #dddddd; +} + +.wy-menu-vertical li.on a, +.wy-menu-vertical li.current>a { + background: #a3a3a3; + border-bottom: 0px !important; + border-top: 0px !important; +} + +.wy-menu-vertical li.current { + background: #b3b3b3; +} + +.toc-backref { + color: grey !important; +} + +.highlight .hll { + background-color: #49483e +} + +.highlight { + background: #222; + color: #f8f8f2 +} + +.highlight .c { + color: #888 +} + + +/* Comment */ + +.highlight .err { + color: #960050; + background-color: #1e0010 +} + + +/* Error */ + +.highlight .k { + color: #66d9ef +} + + +/* Keyword */ + +.highlight .l { + color: #ae81ff +} + + +/* Literal */ + +.highlight .n { + color: #f8f8f2 +} + + +/* Name */ + +.highlight .o { + color: #f92672 +} + + +/* Operator */ + +.highlight .p { + color: #f8f8f2 +} + + +/* Punctuation */ + +.highlight .ch { + color: #888 +} + + +/* Comment.Hashbang */ + +.highlight .cm { + color: #888 +} + + +/* Comment.Multiline */ + +.highlight .cp { + color: #888 +} + + +/* Comment.Preproc */ + +.highlight .cpf { + color: #888 +} + + +/* Comment.PreprocFile */ + +.highlight .c1 { + color: #888 +} + + +/* Comment.Single */ + +.highlight .cs { + color: #888 +} + + +/* Comment.Special */ + +.highlight .gd { + color: #f92672 +} + + +/* Generic.Deleted */ + +.highlight .ge { + font-style: italic +} + + +/* Generic.Emph */ + +.highlight .gi { + color: #a6e22e +} + + +/* Generic.Inserted */ + +.highlight .gs { + font-weight: bold +} + + +/* Generic.Strong */ + +.highlight .gu { + color: #888 +} + + +/* Generic.Subheading */ + +.highlight .kc { + color: #66d9ef +} + + +/* Keyword.Constant */ + +.highlight .kd { + color: #66d9ef +} + + +/* Keyword.Declaration */ + +.highlight .kn { + color: #f92672 +} + + +/* Keyword.Namespace */ + +.highlight .kp { + color: #66d9ef +} + + +/* Keyword.Pseudo */ + +.highlight .kr { + color: #66d9ef +} + + +/* Keyword.Reserved */ + +.highlight .kt { + color: #66d9ef +} + + +/* Keyword.Type */ + +.highlight .ld { + color: #e6db74 +} + + +/* Literal.Date */ + +.highlight .m { + color: #ae81ff +} + + +/* Literal.Number */ + +.highlight .s { + color: #e6db74 +} + + +/* Literal.String */ + +.highlight .na { + color: #a6e22e +} + + +/* Name.Attribute */ + +.highlight .nb { + color: #f8f8f2 +} + + +/* Name.Builtin */ + +.highlight .nc { + color: #a6e22e +} + + +/* Name.Class */ + +.highlight .no { + color: #66d9ef +} + + +/* Name.Constant */ + +.highlight .nd { + color: #a6e22e +} + + +/* Name.Decorator */ + +.highlight .ni { + color: #f8f8f2 +} + + +/* Name.Entity */ + +.highlight .ne { + color: #a6e22e +} + + +/* Name.Exception */ + +.highlight .nf { + color: #a6e22e +} + + +/* Name.Function */ + +.highlight .nl { + color: #f8f8f2 +} + + +/* Name.Label */ + +.highlight .nn { + color: #f8f8f2 +} + + +/* Name.Namespace */ + +.highlight .nx { + color: #a6e22e +} + + +/* Name.Other */ + +.highlight .py { + color: #f8f8f2 +} + + +/* Name.Property */ + +.highlight .nt { + color: #f92672 +} + + +/* Name.Tag */ + +.highlight .nv { + color: #f8f8f2 +} + + +/* Name.Variable */ + +.highlight .ow { + color: #f92672 +} + + +/* Operator.Word */ + +.highlight .w { + color: #f8f8f2 +} + + +/* Text.Whitespace */ + +.highlight .mb { + color: #ae81ff +} + + +/* Literal.Number.Bin */ + +.highlight .mf { + color: #ae81ff +} + + +/* Literal.Number.Float */ + +.highlight .mh { + color: #ae81ff +} + + +/* Literal.Number.Hex */ + +.highlight .mi { + color: #ae81ff +} + + +/* Literal.Number.Integer */ + +.highlight .mo { + color: #ae81ff +} + + +/* Literal.Number.Oct */ + +.highlight .sa { + color: #e6db74 +} + + +/* Literal.String.Affix */ + +.highlight .sb { + color: #e6db74 +} + + +/* Literal.String.Backtick */ + +.highlight .sc { + color: #e6db74 +} + + +/* Literal.String.Char */ + +.highlight .dl { + color: #e6db74 +} + + +/* Literal.String.Delimiter */ + +.highlight .sd { + color: #e6db74 +} + + +/* Literal.String.Doc */ + +.highlight .s2 { + color: #e6db74 +} + + +/* Literal.String.Double */ + +.highlight .se { + color: #ae81ff +} + + +/* Literal.String.Escape */ + +.highlight .sh { + color: #e6db74 +} + + +/* Literal.String.Heredoc */ + +.highlight .si { + color: #e6db74 +} + + +/* Literal.String.Interpol */ + +.highlight .sx { + color: #e6db74 +} + + +/* Literal.String.Other */ + +.highlight .sr { + color: #e6db74 +} + + +/* Literal.String.Regex */ + +.highlight .s1 { + color: #e6db74 +} + + +/* Literal.String.Single */ + +.highlight .ss { + color: #e6db74 +} + + +/* Literal.String.Symbol */ + +.highlight .bp { + color: #f8f8f2 +} + + +/* Name.Builtin.Pseudo */ + +.highlight .fm { + color: #a6e22e +} + + +/* Name.Function.Magic */ + +.highlight .vc { + color: #f8f8f2 +} + + +/* Name.Variable.Class */ + +.highlight .vg { + color: #f8f8f2 +} + + +/* Name.Variable.Global */ + +.highlight .vi { + color: #f8f8f2 +} + + +/* Name.Variable.Instance */ + +.highlight .vm { + color: #f8f8f2 +} + + +/* Name.Variable.Magic */ + +.highlight .il { + color: #ae81ff +} + + +/* Literal.Number.Integer.Long */ diff --git a/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Bold.woff b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Bold.woff new file mode 100644 index 0000000000..6cb6000018 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Bold.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Bold.woff2 b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Bold.woff2 new file mode 100644 index 0000000000..7059e23142 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Bold.woff2 differ diff --git a/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Regular.woff b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Regular.woff new file mode 100644 index 0000000000..f815f63f99 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Regular.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Regular.woff2 b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Regular.woff2 new file mode 100644 index 0000000000..f2c76e5bda Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/Roboto-Slab-Regular.woff2 differ diff --git a/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.eot b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000000..e9f60ca953 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.eot differ diff --git a/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.svg b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000000..52c0773359 --- /dev/null +++ b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.ttf b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000000..35acda2fa1 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.ttf differ diff --git a/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.woff b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000000..400014a4b0 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.woff2 b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000000..4d13fc6040 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/fontawesome-webfont.woff2 differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-bold-italic.woff b/_build/html_zh_CN/_static/css/fonts/lato-bold-italic.woff new file mode 100644 index 0000000000..88ad05b9ff Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-bold-italic.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-bold-italic.woff2 b/_build/html_zh_CN/_static/css/fonts/lato-bold-italic.woff2 new file mode 100644 index 0000000000..c4e3d804b5 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-bold-italic.woff2 differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-bold.woff b/_build/html_zh_CN/_static/css/fonts/lato-bold.woff new file mode 100644 index 0000000000..c6dff51f06 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-bold.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-bold.woff2 b/_build/html_zh_CN/_static/css/fonts/lato-bold.woff2 new file mode 100644 index 0000000000..bb195043cf Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-bold.woff2 differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-normal-italic.woff b/_build/html_zh_CN/_static/css/fonts/lato-normal-italic.woff new file mode 100644 index 0000000000..76114bc033 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-normal-italic.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-normal-italic.woff2 b/_build/html_zh_CN/_static/css/fonts/lato-normal-italic.woff2 new file mode 100644 index 0000000000..3404f37e2e Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-normal-italic.woff2 differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-normal.woff b/_build/html_zh_CN/_static/css/fonts/lato-normal.woff new file mode 100644 index 0000000000..ae1307ff5f Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-normal.woff differ diff --git a/_build/html_zh_CN/_static/css/fonts/lato-normal.woff2 b/_build/html_zh_CN/_static/css/fonts/lato-normal.woff2 new file mode 100644 index 0000000000..3bf9843328 Binary files /dev/null and b/_build/html_zh_CN/_static/css/fonts/lato-normal.woff2 differ diff --git a/_build/html_zh_CN/_static/css/theme.css b/_build/html_zh_CN/_static/css/theme.css new file mode 100644 index 0000000000..aeaf63d5c7 --- /dev/null +++ b/_build/html_zh_CN/_static/css/theme.css @@ -0,0 +1,4 @@ +html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden],audio:not([controls]){display:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:0}dfn{font-style:italic}ins{background:#ff9;text-decoration:none}ins,mark{color:#000}mark{background:#ff0;font-style:italic;font-weight:700}.rst-content code,.rst-content tt,code,kbd,pre,samp{font-family:monospace,serif;_font-family:courier new,monospace;font-size:1em}pre{white-space:pre}q{quotes:none}q:after,q:before{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl,ol,ul{margin:0;padding:0;list-style:none;list-style-image:none}li{list-style:none}dd{margin:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle;max-width:100%}svg:not(:root){overflow:hidden}figure,form{margin:0}label{cursor:pointer}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}textarea{resize:vertical}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}.chromeframe{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}.ir{display:block;border:0;text-indent:-999em;overflow:hidden;background-color:transparent;background-repeat:no-repeat;text-align:left;direction:ltr;*line-height:0}.ir br{display:none}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.relative{position:relative}big,small{font-size:100%}@media print{body,html,section{background:none!important}*{box-shadow:none!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}a,a:visited{text-decoration:underline}.ir a:after,a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}.rst-content .toctree-wrapper>p.caption,h2,h3,p{orphans:3;widows:3}.rst-content .toctree-wrapper>p.caption,h2,h3{page-break-after:avoid}}.btn,.fa:before,.icon:before,.rst-content .admonition,.rst-content .admonition-title:before,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .code-block-caption .headerlink:before,.rst-content .danger,.rst-content .eqno .headerlink:before,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning,.rst-content code.download span:first-child:before,.rst-content dl dt .headerlink:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content p.caption .headerlink:before,.rst-content p .headerlink:before,.rst-content table>caption .headerlink:before,.rst-content tt.download span:first-child:before,.wy-alert,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before,.wy-menu-vertical li button.toctree-expand:before,input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select,textarea{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:FontAwesome;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713);src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix&v=4.7.0) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#fontawesomeregular) format("svg");font-weight:400;font-style:normal}.fa,.icon,.rst-content .admonition-title,.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content code.download span:first-child,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink,.rst-content tt.download span:first-child,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li button.toctree-expand{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14286em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14286em;width:2.14286em;top:.14286em;text-align:center}.fa-li.fa-lg{left:-1.85714em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa-pull-left.icon,.fa.fa-pull-left,.rst-content .code-block-caption .fa-pull-left.headerlink,.rst-content .eqno .fa-pull-left.headerlink,.rst-content .fa-pull-left.admonition-title,.rst-content code.download span.fa-pull-left:first-child,.rst-content dl dt .fa-pull-left.headerlink,.rst-content h1 .fa-pull-left.headerlink,.rst-content h2 .fa-pull-left.headerlink,.rst-content h3 .fa-pull-left.headerlink,.rst-content h4 .fa-pull-left.headerlink,.rst-content h5 .fa-pull-left.headerlink,.rst-content h6 .fa-pull-left.headerlink,.rst-content p .fa-pull-left.headerlink,.rst-content table>caption .fa-pull-left.headerlink,.rst-content tt.download span.fa-pull-left:first-child,.wy-menu-vertical li.current>a button.fa-pull-left.toctree-expand,.wy-menu-vertical li.on a button.fa-pull-left.toctree-expand,.wy-menu-vertical li button.fa-pull-left.toctree-expand{margin-right:.3em}.fa-pull-right.icon,.fa.fa-pull-right,.rst-content .code-block-caption .fa-pull-right.headerlink,.rst-content .eqno .fa-pull-right.headerlink,.rst-content .fa-pull-right.admonition-title,.rst-content code.download span.fa-pull-right:first-child,.rst-content dl dt .fa-pull-right.headerlink,.rst-content h1 .fa-pull-right.headerlink,.rst-content h2 .fa-pull-right.headerlink,.rst-content h3 .fa-pull-right.headerlink,.rst-content h4 .fa-pull-right.headerlink,.rst-content h5 .fa-pull-right.headerlink,.rst-content h6 .fa-pull-right.headerlink,.rst-content p .fa-pull-right.headerlink,.rst-content table>caption .fa-pull-right.headerlink,.rst-content tt.download span.fa-pull-right:first-child,.wy-menu-vertical li.current>a button.fa-pull-right.toctree-expand,.wy-menu-vertical li.on a button.fa-pull-right.toctree-expand,.wy-menu-vertical li button.fa-pull-right.toctree-expand{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left,.pull-left.icon,.rst-content .code-block-caption .pull-left.headerlink,.rst-content .eqno .pull-left.headerlink,.rst-content .pull-left.admonition-title,.rst-content code.download span.pull-left:first-child,.rst-content dl dt .pull-left.headerlink,.rst-content h1 .pull-left.headerlink,.rst-content h2 .pull-left.headerlink,.rst-content h3 .pull-left.headerlink,.rst-content h4 .pull-left.headerlink,.rst-content h5 .pull-left.headerlink,.rst-content h6 .pull-left.headerlink,.rst-content p .pull-left.headerlink,.rst-content table>caption .pull-left.headerlink,.rst-content tt.download span.pull-left:first-child,.wy-menu-vertical li.current>a button.pull-left.toctree-expand,.wy-menu-vertical li.on a button.pull-left.toctree-expand,.wy-menu-vertical li button.pull-left.toctree-expand{margin-right:.3em}.fa.pull-right,.pull-right.icon,.rst-content .code-block-caption .pull-right.headerlink,.rst-content .eqno .pull-right.headerlink,.rst-content .pull-right.admonition-title,.rst-content code.download span.pull-right:first-child,.rst-content dl dt .pull-right.headerlink,.rst-content h1 .pull-right.headerlink,.rst-content h2 .pull-right.headerlink,.rst-content h3 .pull-right.headerlink,.rst-content h4 .pull-right.headerlink,.rst-content h5 .pull-right.headerlink,.rst-content h6 .pull-right.headerlink,.rst-content p .pull-right.headerlink,.rst-content table>caption .pull-right.headerlink,.rst-content tt.download span.pull-right:first-child,.wy-menu-vertical li.current>a button.pull-right.toctree-expand,.wy-menu-vertical li.on a button.pull-right.toctree-expand,.wy-menu-vertical li button.pull-right.toctree-expand{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:""}.fa-music:before{content:""}.fa-search:before,.icon-search:before{content:""}.fa-envelope-o:before{content:""}.fa-heart:before{content:""}.fa-star:before{content:""}.fa-star-o:before{content:""}.fa-user:before{content:""}.fa-film:before{content:""}.fa-th-large:before{content:""}.fa-th:before{content:""}.fa-th-list:before{content:""}.fa-check:before{content:""}.fa-close:before,.fa-remove:before,.fa-times:before{content:""}.fa-search-plus:before{content:""}.fa-search-minus:before{content:""}.fa-power-off:before{content:""}.fa-signal:before{content:""}.fa-cog:before,.fa-gear:before{content:""}.fa-trash-o:before{content:""}.fa-home:before,.icon-home:before{content:""}.fa-file-o:before{content:""}.fa-clock-o:before{content:""}.fa-road:before{content:""}.fa-download:before,.rst-content code.download span:first-child:before,.rst-content tt.download span:first-child:before{content:""}.fa-arrow-circle-o-down:before{content:""}.fa-arrow-circle-o-up:before{content:""}.fa-inbox:before{content:""}.fa-play-circle-o:before{content:""}.fa-repeat:before,.fa-rotate-right:before{content:""}.fa-refresh:before{content:""}.fa-list-alt:before{content:""}.fa-lock:before{content:""}.fa-flag:before{content:""}.fa-headphones:before{content:""}.fa-volume-off:before{content:""}.fa-volume-down:before{content:""}.fa-volume-up:before{content:""}.fa-qrcode:before{content:""}.fa-barcode:before{content:""}.fa-tag:before{content:""}.fa-tags:before{content:""}.fa-book:before,.icon-book:before{content:""}.fa-bookmark:before{content:""}.fa-print:before{content:""}.fa-camera:before{content:""}.fa-font:before{content:""}.fa-bold:before{content:""}.fa-italic:before{content:""}.fa-text-height:before{content:""}.fa-text-width:before{content:""}.fa-align-left:before{content:""}.fa-align-center:before{content:""}.fa-align-right:before{content:""}.fa-align-justify:before{content:""}.fa-list:before{content:""}.fa-dedent:before,.fa-outdent:before{content:""}.fa-indent:before{content:""}.fa-video-camera:before{content:""}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:""}.fa-pencil:before{content:""}.fa-map-marker:before{content:""}.fa-adjust:before{content:""}.fa-tint:before{content:""}.fa-edit:before,.fa-pencil-square-o:before{content:""}.fa-share-square-o:before{content:""}.fa-check-square-o:before{content:""}.fa-arrows:before{content:""}.fa-step-backward:before{content:""}.fa-fast-backward:before{content:""}.fa-backward:before{content:""}.fa-play:before{content:""}.fa-pause:before{content:""}.fa-stop:before{content:""}.fa-forward:before{content:""}.fa-fast-forward:before{content:""}.fa-step-forward:before{content:""}.fa-eject:before{content:""}.fa-chevron-left:before{content:""}.fa-chevron-right:before{content:""}.fa-plus-circle:before{content:""}.fa-minus-circle:before{content:""}.fa-times-circle:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before{content:""}.fa-check-circle:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before{content:""}.fa-question-circle:before{content:""}.fa-info-circle:before{content:""}.fa-crosshairs:before{content:""}.fa-times-circle-o:before{content:""}.fa-check-circle-o:before{content:""}.fa-ban:before{content:""}.fa-arrow-left:before{content:""}.fa-arrow-right:before{content:""}.fa-arrow-up:before{content:""}.fa-arrow-down:before{content:""}.fa-mail-forward:before,.fa-share:before{content:""}.fa-expand:before{content:""}.fa-compress:before{content:""}.fa-plus:before{content:""}.fa-minus:before{content:""}.fa-asterisk:before{content:""}.fa-exclamation-circle:before,.rst-content .admonition-title:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before{content:""}.fa-gift:before{content:""}.fa-leaf:before{content:""}.fa-fire:before,.icon-fire:before{content:""}.fa-eye:before{content:""}.fa-eye-slash:before{content:""}.fa-exclamation-triangle:before,.fa-warning:before{content:""}.fa-plane:before{content:""}.fa-calendar:before{content:""}.fa-random:before{content:""}.fa-comment:before{content:""}.fa-magnet:before{content:""}.fa-chevron-up:before{content:""}.fa-chevron-down:before{content:""}.fa-retweet:before{content:""}.fa-shopping-cart:before{content:""}.fa-folder:before{content:""}.fa-folder-open:before{content:""}.fa-arrows-v:before{content:""}.fa-arrows-h:before{content:""}.fa-bar-chart-o:before,.fa-bar-chart:before{content:""}.fa-twitter-square:before{content:""}.fa-facebook-square:before{content:""}.fa-camera-retro:before{content:""}.fa-key:before{content:""}.fa-cogs:before,.fa-gears:before{content:""}.fa-comments:before{content:""}.fa-thumbs-o-up:before{content:""}.fa-thumbs-o-down:before{content:""}.fa-star-half:before{content:""}.fa-heart-o:before{content:""}.fa-sign-out:before{content:""}.fa-linkedin-square:before{content:""}.fa-thumb-tack:before{content:""}.fa-external-link:before{content:""}.fa-sign-in:before{content:""}.fa-trophy:before{content:""}.fa-github-square:before{content:""}.fa-upload:before{content:""}.fa-lemon-o:before{content:""}.fa-phone:before{content:""}.fa-square-o:before{content:""}.fa-bookmark-o:before{content:""}.fa-phone-square:before{content:""}.fa-twitter:before{content:""}.fa-facebook-f:before,.fa-facebook:before{content:""}.fa-github:before,.icon-github:before{content:""}.fa-unlock:before{content:""}.fa-credit-card:before{content:""}.fa-feed:before,.fa-rss:before{content:""}.fa-hdd-o:before{content:""}.fa-bullhorn:before{content:""}.fa-bell:before{content:""}.fa-certificate:before{content:""}.fa-hand-o-right:before{content:""}.fa-hand-o-left:before{content:""}.fa-hand-o-up:before{content:""}.fa-hand-o-down:before{content:""}.fa-arrow-circle-left:before,.icon-circle-arrow-left:before{content:""}.fa-arrow-circle-right:before,.icon-circle-arrow-right:before{content:""}.fa-arrow-circle-up:before{content:""}.fa-arrow-circle-down:before{content:""}.fa-globe:before{content:""}.fa-wrench:before{content:""}.fa-tasks:before{content:""}.fa-filter:before{content:""}.fa-briefcase:before{content:""}.fa-arrows-alt:before{content:""}.fa-group:before,.fa-users:before{content:""}.fa-chain:before,.fa-link:before,.icon-link:before{content:""}.fa-cloud:before{content:""}.fa-flask:before{content:""}.fa-cut:before,.fa-scissors:before{content:""}.fa-copy:before,.fa-files-o:before{content:""}.fa-paperclip:before{content:""}.fa-floppy-o:before,.fa-save:before{content:""}.fa-square:before{content:""}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:""}.fa-list-ul:before{content:""}.fa-list-ol:before{content:""}.fa-strikethrough:before{content:""}.fa-underline:before{content:""}.fa-table:before{content:""}.fa-magic:before{content:""}.fa-truck:before{content:""}.fa-pinterest:before{content:""}.fa-pinterest-square:before{content:""}.fa-google-plus-square:before{content:""}.fa-google-plus:before{content:""}.fa-money:before{content:""}.fa-caret-down:before,.icon-caret-down:before,.wy-dropdown .caret:before{content:""}.fa-caret-up:before{content:""}.fa-caret-left:before{content:""}.fa-caret-right:before{content:""}.fa-columns:before{content:""}.fa-sort:before,.fa-unsorted:before{content:""}.fa-sort-desc:before,.fa-sort-down:before{content:""}.fa-sort-asc:before,.fa-sort-up:before{content:""}.fa-envelope:before{content:""}.fa-linkedin:before{content:""}.fa-rotate-left:before,.fa-undo:before{content:""}.fa-gavel:before,.fa-legal:before{content:""}.fa-dashboard:before,.fa-tachometer:before{content:""}.fa-comment-o:before{content:""}.fa-comments-o:before{content:""}.fa-bolt:before,.fa-flash:before{content:""}.fa-sitemap:before{content:""}.fa-umbrella:before{content:""}.fa-clipboard:before,.fa-paste:before{content:""}.fa-lightbulb-o:before{content:""}.fa-exchange:before{content:""}.fa-cloud-download:before{content:""}.fa-cloud-upload:before{content:""}.fa-user-md:before{content:""}.fa-stethoscope:before{content:""}.fa-suitcase:before{content:""}.fa-bell-o:before{content:""}.fa-coffee:before{content:""}.fa-cutlery:before{content:""}.fa-file-text-o:before{content:""}.fa-building-o:before{content:""}.fa-hospital-o:before{content:""}.fa-ambulance:before{content:""}.fa-medkit:before{content:""}.fa-fighter-jet:before{content:""}.fa-beer:before{content:""}.fa-h-square:before{content:""}.fa-plus-square:before{content:""}.fa-angle-double-left:before{content:""}.fa-angle-double-right:before{content:""}.fa-angle-double-up:before{content:""}.fa-angle-double-down:before{content:""}.fa-angle-left:before{content:""}.fa-angle-right:before{content:""}.fa-angle-up:before{content:""}.fa-angle-down:before{content:""}.fa-desktop:before{content:""}.fa-laptop:before{content:""}.fa-tablet:before{content:""}.fa-mobile-phone:before,.fa-mobile:before{content:""}.fa-circle-o:before{content:""}.fa-quote-left:before{content:""}.fa-quote-right:before{content:""}.fa-spinner:before{content:""}.fa-circle:before{content:""}.fa-mail-reply:before,.fa-reply:before{content:""}.fa-github-alt:before{content:""}.fa-folder-o:before{content:""}.fa-folder-open-o:before{content:""}.fa-smile-o:before{content:""}.fa-frown-o:before{content:""}.fa-meh-o:before{content:""}.fa-gamepad:before{content:""}.fa-keyboard-o:before{content:""}.fa-flag-o:before{content:""}.fa-flag-checkered:before{content:""}.fa-terminal:before{content:""}.fa-code:before{content:""}.fa-mail-reply-all:before,.fa-reply-all:before{content:""}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:""}.fa-location-arrow:before{content:""}.fa-crop:before{content:""}.fa-code-fork:before{content:""}.fa-chain-broken:before,.fa-unlink:before{content:""}.fa-question:before{content:""}.fa-info:before{content:""}.fa-exclamation:before{content:""}.fa-superscript:before{content:""}.fa-subscript:before{content:""}.fa-eraser:before{content:""}.fa-puzzle-piece:before{content:""}.fa-microphone:before{content:""}.fa-microphone-slash:before{content:""}.fa-shield:before{content:""}.fa-calendar-o:before{content:""}.fa-fire-extinguisher:before{content:""}.fa-rocket:before{content:""}.fa-maxcdn:before{content:""}.fa-chevron-circle-left:before{content:""}.fa-chevron-circle-right:before{content:""}.fa-chevron-circle-up:before{content:""}.fa-chevron-circle-down:before{content:""}.fa-html5:before{content:""}.fa-css3:before{content:""}.fa-anchor:before{content:""}.fa-unlock-alt:before{content:""}.fa-bullseye:before{content:""}.fa-ellipsis-h:before{content:""}.fa-ellipsis-v:before{content:""}.fa-rss-square:before{content:""}.fa-play-circle:before{content:""}.fa-ticket:before{content:""}.fa-minus-square:before{content:""}.fa-minus-square-o:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before{content:""}.fa-level-up:before{content:""}.fa-level-down:before{content:""}.fa-check-square:before{content:""}.fa-pencil-square:before{content:""}.fa-external-link-square:before{content:""}.fa-share-square:before{content:""}.fa-compass:before{content:""}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:""}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:""}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:""}.fa-eur:before,.fa-euro:before{content:""}.fa-gbp:before{content:""}.fa-dollar:before,.fa-usd:before{content:""}.fa-inr:before,.fa-rupee:before{content:""}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:""}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:""}.fa-krw:before,.fa-won:before{content:""}.fa-bitcoin:before,.fa-btc:before{content:""}.fa-file:before{content:""}.fa-file-text:before{content:""}.fa-sort-alpha-asc:before{content:""}.fa-sort-alpha-desc:before{content:""}.fa-sort-amount-asc:before{content:""}.fa-sort-amount-desc:before{content:""}.fa-sort-numeric-asc:before{content:""}.fa-sort-numeric-desc:before{content:""}.fa-thumbs-up:before{content:""}.fa-thumbs-down:before{content:""}.fa-youtube-square:before{content:""}.fa-youtube:before{content:""}.fa-xing:before{content:""}.fa-xing-square:before{content:""}.fa-youtube-play:before{content:""}.fa-dropbox:before{content:""}.fa-stack-overflow:before{content:""}.fa-instagram:before{content:""}.fa-flickr:before{content:""}.fa-adn:before{content:""}.fa-bitbucket:before,.icon-bitbucket:before{content:""}.fa-bitbucket-square:before{content:""}.fa-tumblr:before{content:""}.fa-tumblr-square:before{content:""}.fa-long-arrow-down:before{content:""}.fa-long-arrow-up:before{content:""}.fa-long-arrow-left:before{content:""}.fa-long-arrow-right:before{content:""}.fa-apple:before{content:""}.fa-windows:before{content:""}.fa-android:before{content:""}.fa-linux:before{content:""}.fa-dribbble:before{content:""}.fa-skype:before{content:""}.fa-foursquare:before{content:""}.fa-trello:before{content:""}.fa-female:before{content:""}.fa-male:before{content:""}.fa-gittip:before,.fa-gratipay:before{content:""}.fa-sun-o:before{content:""}.fa-moon-o:before{content:""}.fa-archive:before{content:""}.fa-bug:before{content:""}.fa-vk:before{content:""}.fa-weibo:before{content:""}.fa-renren:before{content:""}.fa-pagelines:before{content:""}.fa-stack-exchange:before{content:""}.fa-arrow-circle-o-right:before{content:""}.fa-arrow-circle-o-left:before{content:""}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:""}.fa-dot-circle-o:before{content:""}.fa-wheelchair:before{content:""}.fa-vimeo-square:before{content:""}.fa-try:before,.fa-turkish-lira:before{content:""}.fa-plus-square-o:before,.wy-menu-vertical li button.toctree-expand:before{content:""}.fa-space-shuttle:before{content:""}.fa-slack:before{content:""}.fa-envelope-square:before{content:""}.fa-wordpress:before{content:""}.fa-openid:before{content:""}.fa-bank:before,.fa-institution:before,.fa-university:before{content:""}.fa-graduation-cap:before,.fa-mortar-board:before{content:""}.fa-yahoo:before{content:""}.fa-google:before{content:""}.fa-reddit:before{content:""}.fa-reddit-square:before{content:""}.fa-stumbleupon-circle:before{content:""}.fa-stumbleupon:before{content:""}.fa-delicious:before{content:""}.fa-digg:before{content:""}.fa-pied-piper-pp:before{content:""}.fa-pied-piper-alt:before{content:""}.fa-drupal:before{content:""}.fa-joomla:before{content:""}.fa-language:before{content:""}.fa-fax:before{content:""}.fa-building:before{content:""}.fa-child:before{content:""}.fa-paw:before{content:""}.fa-spoon:before{content:""}.fa-cube:before{content:""}.fa-cubes:before{content:""}.fa-behance:before{content:""}.fa-behance-square:before{content:""}.fa-steam:before{content:""}.fa-steam-square:before{content:""}.fa-recycle:before{content:""}.fa-automobile:before,.fa-car:before{content:""}.fa-cab:before,.fa-taxi:before{content:""}.fa-tree:before{content:""}.fa-spotify:before{content:""}.fa-deviantart:before{content:""}.fa-soundcloud:before{content:""}.fa-database:before{content:""}.fa-file-pdf-o:before{content:""}.fa-file-word-o:before{content:""}.fa-file-excel-o:before{content:""}.fa-file-powerpoint-o:before{content:""}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:""}.fa-file-archive-o:before,.fa-file-zip-o:before{content:""}.fa-file-audio-o:before,.fa-file-sound-o:before{content:""}.fa-file-movie-o:before,.fa-file-video-o:before{content:""}.fa-file-code-o:before{content:""}.fa-vine:before{content:""}.fa-codepen:before{content:""}.fa-jsfiddle:before{content:""}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:""}.fa-circle-o-notch:before{content:""}.fa-ra:before,.fa-rebel:before,.fa-resistance:before{content:""}.fa-empire:before,.fa-ge:before{content:""}.fa-git-square:before{content:""}.fa-git:before{content:""}.fa-hacker-news:before,.fa-y-combinator-square:before,.fa-yc-square:before{content:""}.fa-tencent-weibo:before{content:""}.fa-qq:before{content:""}.fa-wechat:before,.fa-weixin:before{content:""}.fa-paper-plane:before,.fa-send:before{content:""}.fa-paper-plane-o:before,.fa-send-o:before{content:""}.fa-history:before{content:""}.fa-circle-thin:before{content:""}.fa-header:before{content:""}.fa-paragraph:before{content:""}.fa-sliders:before{content:""}.fa-share-alt:before{content:""}.fa-share-alt-square:before{content:""}.fa-bomb:before{content:""}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:""}.fa-tty:before{content:""}.fa-binoculars:before{content:""}.fa-plug:before{content:""}.fa-slideshare:before{content:""}.fa-twitch:before{content:""}.fa-yelp:before{content:""}.fa-newspaper-o:before{content:""}.fa-wifi:before{content:""}.fa-calculator:before{content:""}.fa-paypal:before{content:""}.fa-google-wallet:before{content:""}.fa-cc-visa:before{content:""}.fa-cc-mastercard:before{content:""}.fa-cc-discover:before{content:""}.fa-cc-amex:before{content:""}.fa-cc-paypal:before{content:""}.fa-cc-stripe:before{content:""}.fa-bell-slash:before{content:""}.fa-bell-slash-o:before{content:""}.fa-trash:before{content:""}.fa-copyright:before{content:""}.fa-at:before{content:""}.fa-eyedropper:before{content:""}.fa-paint-brush:before{content:""}.fa-birthday-cake:before{content:""}.fa-area-chart:before{content:""}.fa-pie-chart:before{content:""}.fa-line-chart:before{content:""}.fa-lastfm:before{content:""}.fa-lastfm-square:before{content:""}.fa-toggle-off:before{content:""}.fa-toggle-on:before{content:""}.fa-bicycle:before{content:""}.fa-bus:before{content:""}.fa-ioxhost:before{content:""}.fa-angellist:before{content:""}.fa-cc:before{content:""}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:""}.fa-meanpath:before{content:""}.fa-buysellads:before{content:""}.fa-connectdevelop:before{content:""}.fa-dashcube:before{content:""}.fa-forumbee:before{content:""}.fa-leanpub:before{content:""}.fa-sellsy:before{content:""}.fa-shirtsinbulk:before{content:""}.fa-simplybuilt:before{content:""}.fa-skyatlas:before{content:""}.fa-cart-plus:before{content:""}.fa-cart-arrow-down:before{content:""}.fa-diamond:before{content:""}.fa-ship:before{content:""}.fa-user-secret:before{content:""}.fa-motorcycle:before{content:""}.fa-street-view:before{content:""}.fa-heartbeat:before{content:""}.fa-venus:before{content:""}.fa-mars:before{content:""}.fa-mercury:before{content:""}.fa-intersex:before,.fa-transgender:before{content:""}.fa-transgender-alt:before{content:""}.fa-venus-double:before{content:""}.fa-mars-double:before{content:""}.fa-venus-mars:before{content:""}.fa-mars-stroke:before{content:""}.fa-mars-stroke-v:before{content:""}.fa-mars-stroke-h:before{content:""}.fa-neuter:before{content:""}.fa-genderless:before{content:""}.fa-facebook-official:before{content:""}.fa-pinterest-p:before{content:""}.fa-whatsapp:before{content:""}.fa-server:before{content:""}.fa-user-plus:before{content:""}.fa-user-times:before{content:""}.fa-bed:before,.fa-hotel:before{content:""}.fa-viacoin:before{content:""}.fa-train:before{content:""}.fa-subway:before{content:""}.fa-medium:before{content:""}.fa-y-combinator:before,.fa-yc:before{content:""}.fa-optin-monster:before{content:""}.fa-opencart:before{content:""}.fa-expeditedssl:before{content:""}.fa-battery-4:before,.fa-battery-full:before,.fa-battery:before{content:""}.fa-battery-3:before,.fa-battery-three-quarters:before{content:""}.fa-battery-2:before,.fa-battery-half:before{content:""}.fa-battery-1:before,.fa-battery-quarter:before{content:""}.fa-battery-0:before,.fa-battery-empty:before{content:""}.fa-mouse-pointer:before{content:""}.fa-i-cursor:before{content:""}.fa-object-group:before{content:""}.fa-object-ungroup:before{content:""}.fa-sticky-note:before{content:""}.fa-sticky-note-o:before{content:""}.fa-cc-jcb:before{content:""}.fa-cc-diners-club:before{content:""}.fa-clone:before{content:""}.fa-balance-scale:before{content:""}.fa-hourglass-o:before{content:""}.fa-hourglass-1:before,.fa-hourglass-start:before{content:""}.fa-hourglass-2:before,.fa-hourglass-half:before{content:""}.fa-hourglass-3:before,.fa-hourglass-end:before{content:""}.fa-hourglass:before{content:""}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:""}.fa-hand-paper-o:before,.fa-hand-stop-o:before{content:""}.fa-hand-scissors-o:before{content:""}.fa-hand-lizard-o:before{content:""}.fa-hand-spock-o:before{content:""}.fa-hand-pointer-o:before{content:""}.fa-hand-peace-o:before{content:""}.fa-trademark:before{content:""}.fa-registered:before{content:""}.fa-creative-commons:before{content:""}.fa-gg:before{content:""}.fa-gg-circle:before{content:""}.fa-tripadvisor:before{content:""}.fa-odnoklassniki:before{content:""}.fa-odnoklassniki-square:before{content:""}.fa-get-pocket:before{content:""}.fa-wikipedia-w:before{content:""}.fa-safari:before{content:""}.fa-chrome:before{content:""}.fa-firefox:before{content:""}.fa-opera:before{content:""}.fa-internet-explorer:before{content:""}.fa-television:before,.fa-tv:before{content:""}.fa-contao:before{content:""}.fa-500px:before{content:""}.fa-amazon:before{content:""}.fa-calendar-plus-o:before{content:""}.fa-calendar-minus-o:before{content:""}.fa-calendar-times-o:before{content:""}.fa-calendar-check-o:before{content:""}.fa-industry:before{content:""}.fa-map-pin:before{content:""}.fa-map-signs:before{content:""}.fa-map-o:before{content:""}.fa-map:before{content:""}.fa-commenting:before{content:""}.fa-commenting-o:before{content:""}.fa-houzz:before{content:""}.fa-vimeo:before{content:""}.fa-black-tie:before{content:""}.fa-fonticons:before{content:""}.fa-reddit-alien:before{content:""}.fa-edge:before{content:""}.fa-credit-card-alt:before{content:""}.fa-codiepie:before{content:""}.fa-modx:before{content:""}.fa-fort-awesome:before{content:""}.fa-usb:before{content:""}.fa-product-hunt:before{content:""}.fa-mixcloud:before{content:""}.fa-scribd:before{content:""}.fa-pause-circle:before{content:""}.fa-pause-circle-o:before{content:""}.fa-stop-circle:before{content:""}.fa-stop-circle-o:before{content:""}.fa-shopping-bag:before{content:""}.fa-shopping-basket:before{content:""}.fa-hashtag:before{content:""}.fa-bluetooth:before{content:""}.fa-bluetooth-b:before{content:""}.fa-percent:before{content:""}.fa-gitlab:before,.icon-gitlab:before{content:""}.fa-wpbeginner:before{content:""}.fa-wpforms:before{content:""}.fa-envira:before{content:""}.fa-universal-access:before{content:""}.fa-wheelchair-alt:before{content:""}.fa-question-circle-o:before{content:""}.fa-blind:before{content:""}.fa-audio-description:before{content:""}.fa-volume-control-phone:before{content:""}.fa-braille:before{content:""}.fa-assistive-listening-systems:before{content:""}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before{content:""}.fa-deaf:before,.fa-deafness:before,.fa-hard-of-hearing:before{content:""}.fa-glide:before{content:""}.fa-glide-g:before{content:""}.fa-sign-language:before,.fa-signing:before{content:""}.fa-low-vision:before{content:""}.fa-viadeo:before{content:""}.fa-viadeo-square:before{content:""}.fa-snapchat:before{content:""}.fa-snapchat-ghost:before{content:""}.fa-snapchat-square:before{content:""}.fa-pied-piper:before{content:""}.fa-first-order:before{content:""}.fa-yoast:before{content:""}.fa-themeisle:before{content:""}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:""}.fa-fa:before,.fa-font-awesome:before{content:""}.fa-handshake-o:before{content:""}.fa-envelope-open:before{content:""}.fa-envelope-open-o:before{content:""}.fa-linode:before{content:""}.fa-address-book:before{content:""}.fa-address-book-o:before{content:""}.fa-address-card:before,.fa-vcard:before{content:""}.fa-address-card-o:before,.fa-vcard-o:before{content:""}.fa-user-circle:before{content:""}.fa-user-circle-o:before{content:""}.fa-user-o:before{content:""}.fa-id-badge:before{content:""}.fa-drivers-license:before,.fa-id-card:before{content:""}.fa-drivers-license-o:before,.fa-id-card-o:before{content:""}.fa-quora:before{content:""}.fa-free-code-camp:before{content:""}.fa-telegram:before{content:""}.fa-thermometer-4:before,.fa-thermometer-full:before,.fa-thermometer:before{content:""}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:""}.fa-thermometer-2:before,.fa-thermometer-half:before{content:""}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:""}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:""}.fa-shower:before{content:""}.fa-bath:before,.fa-bathtub:before,.fa-s15:before{content:""}.fa-podcast:before{content:""}.fa-window-maximize:before{content:""}.fa-window-minimize:before{content:""}.fa-window-restore:before{content:""}.fa-times-rectangle:before,.fa-window-close:before{content:""}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:""}.fa-bandcamp:before{content:""}.fa-grav:before{content:""}.fa-etsy:before{content:""}.fa-imdb:before{content:""}.fa-ravelry:before{content:""}.fa-eercast:before{content:""}.fa-microchip:before{content:""}.fa-snowflake-o:before{content:""}.fa-superpowers:before{content:""}.fa-wpexplorer:before{content:""}.fa-meetup:before{content:""}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.fa,.icon,.rst-content .admonition-title,.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content code.download span:first-child,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink,.rst-content tt.download span:first-child,.wy-dropdown .caret,.wy-inline-validate.wy-inline-validate-danger .wy-input-context,.wy-inline-validate.wy-inline-validate-info .wy-input-context,.wy-inline-validate.wy-inline-validate-success .wy-input-context,.wy-inline-validate.wy-inline-validate-warning .wy-input-context,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li button.toctree-expand{font-family:inherit}.fa:before,.icon:before,.rst-content .admonition-title:before,.rst-content .code-block-caption .headerlink:before,.rst-content .eqno .headerlink:before,.rst-content code.download span:first-child:before,.rst-content dl dt .headerlink:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content p.caption .headerlink:before,.rst-content p .headerlink:before,.rst-content table>caption .headerlink:before,.rst-content tt.download span:first-child:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before,.wy-menu-vertical li button.toctree-expand:before{font-family:FontAwesome;display:inline-block;font-style:normal;font-weight:400;line-height:1;text-decoration:inherit}.rst-content .code-block-caption a .headerlink,.rst-content .eqno a .headerlink,.rst-content a .admonition-title,.rst-content code.download a span:first-child,.rst-content dl dt a .headerlink,.rst-content h1 a .headerlink,.rst-content h2 a .headerlink,.rst-content h3 a .headerlink,.rst-content h4 a .headerlink,.rst-content h5 a .headerlink,.rst-content h6 a .headerlink,.rst-content p.caption a .headerlink,.rst-content p a .headerlink,.rst-content table>caption a .headerlink,.rst-content tt.download a span:first-child,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li a button.toctree-expand,a .fa,a .icon,a .rst-content .admonition-title,a .rst-content .code-block-caption .headerlink,a .rst-content .eqno .headerlink,a .rst-content code.download span:first-child,a .rst-content dl dt .headerlink,a .rst-content h1 .headerlink,a .rst-content h2 .headerlink,a .rst-content h3 .headerlink,a .rst-content h4 .headerlink,a .rst-content h5 .headerlink,a .rst-content h6 .headerlink,a .rst-content p.caption .headerlink,a .rst-content p .headerlink,a .rst-content table>caption .headerlink,a .rst-content tt.download span:first-child,a .wy-menu-vertical li button.toctree-expand{display:inline-block;text-decoration:inherit}.btn .fa,.btn .icon,.btn .rst-content .admonition-title,.btn .rst-content .code-block-caption .headerlink,.btn .rst-content .eqno .headerlink,.btn .rst-content code.download span:first-child,.btn .rst-content dl dt .headerlink,.btn .rst-content h1 .headerlink,.btn .rst-content h2 .headerlink,.btn .rst-content h3 .headerlink,.btn .rst-content h4 .headerlink,.btn .rst-content h5 .headerlink,.btn .rst-content h6 .headerlink,.btn .rst-content p .headerlink,.btn .rst-content table>caption .headerlink,.btn .rst-content tt.download span:first-child,.btn .wy-menu-vertical li.current>a button.toctree-expand,.btn .wy-menu-vertical li.on a button.toctree-expand,.btn .wy-menu-vertical li button.toctree-expand,.nav .fa,.nav .icon,.nav .rst-content .admonition-title,.nav .rst-content .code-block-caption .headerlink,.nav .rst-content .eqno .headerlink,.nav .rst-content code.download span:first-child,.nav .rst-content dl dt .headerlink,.nav .rst-content h1 .headerlink,.nav .rst-content h2 .headerlink,.nav .rst-content h3 .headerlink,.nav .rst-content h4 .headerlink,.nav .rst-content h5 .headerlink,.nav .rst-content h6 .headerlink,.nav .rst-content p .headerlink,.nav .rst-content table>caption .headerlink,.nav .rst-content tt.download span:first-child,.nav .wy-menu-vertical li.current>a button.toctree-expand,.nav .wy-menu-vertical li.on a button.toctree-expand,.nav .wy-menu-vertical li button.toctree-expand,.rst-content .btn .admonition-title,.rst-content .code-block-caption .btn .headerlink,.rst-content .code-block-caption .nav .headerlink,.rst-content .eqno .btn .headerlink,.rst-content .eqno .nav .headerlink,.rst-content .nav .admonition-title,.rst-content code.download .btn span:first-child,.rst-content code.download .nav span:first-child,.rst-content dl dt .btn .headerlink,.rst-content dl dt .nav .headerlink,.rst-content h1 .btn .headerlink,.rst-content h1 .nav .headerlink,.rst-content h2 .btn .headerlink,.rst-content h2 .nav .headerlink,.rst-content h3 .btn .headerlink,.rst-content h3 .nav .headerlink,.rst-content h4 .btn .headerlink,.rst-content h4 .nav .headerlink,.rst-content h5 .btn .headerlink,.rst-content h5 .nav .headerlink,.rst-content h6 .btn .headerlink,.rst-content h6 .nav .headerlink,.rst-content p .btn .headerlink,.rst-content p .nav .headerlink,.rst-content table>caption .btn .headerlink,.rst-content table>caption .nav .headerlink,.rst-content tt.download .btn span:first-child,.rst-content tt.download .nav span:first-child,.wy-menu-vertical li .btn button.toctree-expand,.wy-menu-vertical li.current>a .btn button.toctree-expand,.wy-menu-vertical li.current>a .nav button.toctree-expand,.wy-menu-vertical li .nav button.toctree-expand,.wy-menu-vertical li.on a .btn button.toctree-expand,.wy-menu-vertical li.on a .nav button.toctree-expand{display:inline}.btn .fa-large.icon,.btn .fa.fa-large,.btn .rst-content .code-block-caption .fa-large.headerlink,.btn .rst-content .eqno .fa-large.headerlink,.btn .rst-content .fa-large.admonition-title,.btn .rst-content code.download span.fa-large:first-child,.btn .rst-content dl dt .fa-large.headerlink,.btn .rst-content h1 .fa-large.headerlink,.btn .rst-content h2 .fa-large.headerlink,.btn .rst-content h3 .fa-large.headerlink,.btn .rst-content h4 .fa-large.headerlink,.btn .rst-content h5 .fa-large.headerlink,.btn .rst-content h6 .fa-large.headerlink,.btn .rst-content p .fa-large.headerlink,.btn .rst-content table>caption .fa-large.headerlink,.btn .rst-content tt.download span.fa-large:first-child,.btn .wy-menu-vertical li button.fa-large.toctree-expand,.nav .fa-large.icon,.nav .fa.fa-large,.nav .rst-content .code-block-caption .fa-large.headerlink,.nav .rst-content .eqno .fa-large.headerlink,.nav .rst-content .fa-large.admonition-title,.nav .rst-content code.download span.fa-large:first-child,.nav .rst-content dl dt .fa-large.headerlink,.nav .rst-content h1 .fa-large.headerlink,.nav .rst-content h2 .fa-large.headerlink,.nav .rst-content h3 .fa-large.headerlink,.nav .rst-content h4 .fa-large.headerlink,.nav .rst-content h5 .fa-large.headerlink,.nav .rst-content h6 .fa-large.headerlink,.nav .rst-content p .fa-large.headerlink,.nav .rst-content table>caption .fa-large.headerlink,.nav .rst-content tt.download span.fa-large:first-child,.nav .wy-menu-vertical li button.fa-large.toctree-expand,.rst-content .btn .fa-large.admonition-title,.rst-content .code-block-caption .btn .fa-large.headerlink,.rst-content .code-block-caption .nav .fa-large.headerlink,.rst-content .eqno .btn .fa-large.headerlink,.rst-content .eqno .nav .fa-large.headerlink,.rst-content .nav .fa-large.admonition-title,.rst-content code.download .btn span.fa-large:first-child,.rst-content code.download .nav span.fa-large:first-child,.rst-content dl dt .btn .fa-large.headerlink,.rst-content dl dt .nav .fa-large.headerlink,.rst-content h1 .btn .fa-large.headerlink,.rst-content h1 .nav .fa-large.headerlink,.rst-content h2 .btn .fa-large.headerlink,.rst-content h2 .nav .fa-large.headerlink,.rst-content h3 .btn .fa-large.headerlink,.rst-content h3 .nav .fa-large.headerlink,.rst-content h4 .btn .fa-large.headerlink,.rst-content h4 .nav .fa-large.headerlink,.rst-content h5 .btn .fa-large.headerlink,.rst-content h5 .nav .fa-large.headerlink,.rst-content h6 .btn .fa-large.headerlink,.rst-content h6 .nav .fa-large.headerlink,.rst-content p .btn .fa-large.headerlink,.rst-content p .nav .fa-large.headerlink,.rst-content table>caption .btn .fa-large.headerlink,.rst-content table>caption .nav .fa-large.headerlink,.rst-content tt.download .btn span.fa-large:first-child,.rst-content tt.download .nav span.fa-large:first-child,.wy-menu-vertical li .btn button.fa-large.toctree-expand,.wy-menu-vertical li .nav button.fa-large.toctree-expand{line-height:.9em}.btn .fa-spin.icon,.btn .fa.fa-spin,.btn .rst-content .code-block-caption .fa-spin.headerlink,.btn .rst-content .eqno .fa-spin.headerlink,.btn .rst-content .fa-spin.admonition-title,.btn .rst-content code.download span.fa-spin:first-child,.btn .rst-content dl dt .fa-spin.headerlink,.btn .rst-content h1 .fa-spin.headerlink,.btn .rst-content h2 .fa-spin.headerlink,.btn .rst-content h3 .fa-spin.headerlink,.btn .rst-content h4 .fa-spin.headerlink,.btn .rst-content h5 .fa-spin.headerlink,.btn .rst-content h6 .fa-spin.headerlink,.btn .rst-content p .fa-spin.headerlink,.btn .rst-content table>caption .fa-spin.headerlink,.btn .rst-content tt.download span.fa-spin:first-child,.btn .wy-menu-vertical li button.fa-spin.toctree-expand,.nav .fa-spin.icon,.nav .fa.fa-spin,.nav .rst-content .code-block-caption .fa-spin.headerlink,.nav .rst-content .eqno .fa-spin.headerlink,.nav .rst-content .fa-spin.admonition-title,.nav .rst-content code.download span.fa-spin:first-child,.nav .rst-content dl dt .fa-spin.headerlink,.nav .rst-content h1 .fa-spin.headerlink,.nav .rst-content h2 .fa-spin.headerlink,.nav .rst-content h3 .fa-spin.headerlink,.nav .rst-content h4 .fa-spin.headerlink,.nav .rst-content h5 .fa-spin.headerlink,.nav .rst-content h6 .fa-spin.headerlink,.nav .rst-content p .fa-spin.headerlink,.nav .rst-content table>caption .fa-spin.headerlink,.nav .rst-content tt.download span.fa-spin:first-child,.nav .wy-menu-vertical li button.fa-spin.toctree-expand,.rst-content .btn .fa-spin.admonition-title,.rst-content .code-block-caption .btn .fa-spin.headerlink,.rst-content .code-block-caption .nav .fa-spin.headerlink,.rst-content .eqno .btn .fa-spin.headerlink,.rst-content .eqno .nav .fa-spin.headerlink,.rst-content .nav .fa-spin.admonition-title,.rst-content code.download .btn span.fa-spin:first-child,.rst-content code.download .nav span.fa-spin:first-child,.rst-content dl dt .btn .fa-spin.headerlink,.rst-content dl dt .nav .fa-spin.headerlink,.rst-content h1 .btn .fa-spin.headerlink,.rst-content h1 .nav .fa-spin.headerlink,.rst-content h2 .btn .fa-spin.headerlink,.rst-content h2 .nav .fa-spin.headerlink,.rst-content h3 .btn .fa-spin.headerlink,.rst-content h3 .nav .fa-spin.headerlink,.rst-content h4 .btn .fa-spin.headerlink,.rst-content h4 .nav .fa-spin.headerlink,.rst-content h5 .btn .fa-spin.headerlink,.rst-content h5 .nav .fa-spin.headerlink,.rst-content h6 .btn .fa-spin.headerlink,.rst-content h6 .nav .fa-spin.headerlink,.rst-content p .btn .fa-spin.headerlink,.rst-content p .nav .fa-spin.headerlink,.rst-content table>caption .btn .fa-spin.headerlink,.rst-content table>caption .nav .fa-spin.headerlink,.rst-content tt.download .btn span.fa-spin:first-child,.rst-content tt.download .nav span.fa-spin:first-child,.wy-menu-vertical li .btn button.fa-spin.toctree-expand,.wy-menu-vertical li .nav button.fa-spin.toctree-expand{display:inline-block}.btn.fa:before,.btn.icon:before,.rst-content .btn.admonition-title:before,.rst-content .code-block-caption .btn.headerlink:before,.rst-content .eqno .btn.headerlink:before,.rst-content code.download span.btn:first-child:before,.rst-content dl dt .btn.headerlink:before,.rst-content h1 .btn.headerlink:before,.rst-content h2 .btn.headerlink:before,.rst-content h3 .btn.headerlink:before,.rst-content h4 .btn.headerlink:before,.rst-content h5 .btn.headerlink:before,.rst-content h6 .btn.headerlink:before,.rst-content p .btn.headerlink:before,.rst-content table>caption .btn.headerlink:before,.rst-content tt.download span.btn:first-child:before,.wy-menu-vertical li button.btn.toctree-expand:before{opacity:.5;-webkit-transition:opacity .05s ease-in;-moz-transition:opacity .05s ease-in;transition:opacity .05s ease-in}.btn.fa:hover:before,.btn.icon:hover:before,.rst-content .btn.admonition-title:hover:before,.rst-content .code-block-caption .btn.headerlink:hover:before,.rst-content .eqno .btn.headerlink:hover:before,.rst-content code.download span.btn:first-child:hover:before,.rst-content dl dt .btn.headerlink:hover:before,.rst-content h1 .btn.headerlink:hover:before,.rst-content h2 .btn.headerlink:hover:before,.rst-content h3 .btn.headerlink:hover:before,.rst-content h4 .btn.headerlink:hover:before,.rst-content h5 .btn.headerlink:hover:before,.rst-content h6 .btn.headerlink:hover:before,.rst-content p .btn.headerlink:hover:before,.rst-content table>caption .btn.headerlink:hover:before,.rst-content tt.download span.btn:first-child:hover:before,.wy-menu-vertical li button.btn.toctree-expand:hover:before{opacity:1}.btn-mini .fa:before,.btn-mini .icon:before,.btn-mini .rst-content .admonition-title:before,.btn-mini .rst-content .code-block-caption .headerlink:before,.btn-mini .rst-content .eqno .headerlink:before,.btn-mini .rst-content code.download span:first-child:before,.btn-mini .rst-content dl dt .headerlink:before,.btn-mini .rst-content h1 .headerlink:before,.btn-mini .rst-content h2 .headerlink:before,.btn-mini .rst-content h3 .headerlink:before,.btn-mini .rst-content h4 .headerlink:before,.btn-mini .rst-content h5 .headerlink:before,.btn-mini .rst-content h6 .headerlink:before,.btn-mini .rst-content p .headerlink:before,.btn-mini .rst-content table>caption .headerlink:before,.btn-mini .rst-content tt.download span:first-child:before,.btn-mini .wy-menu-vertical li button.toctree-expand:before,.rst-content .btn-mini .admonition-title:before,.rst-content .code-block-caption .btn-mini .headerlink:before,.rst-content .eqno .btn-mini .headerlink:before,.rst-content code.download .btn-mini span:first-child:before,.rst-content dl dt .btn-mini .headerlink:before,.rst-content h1 .btn-mini .headerlink:before,.rst-content h2 .btn-mini .headerlink:before,.rst-content h3 .btn-mini .headerlink:before,.rst-content h4 .btn-mini .headerlink:before,.rst-content h5 .btn-mini .headerlink:before,.rst-content h6 .btn-mini .headerlink:before,.rst-content p .btn-mini .headerlink:before,.rst-content table>caption .btn-mini .headerlink:before,.rst-content tt.download .btn-mini span:first-child:before,.wy-menu-vertical li .btn-mini button.toctree-expand:before{font-size:14px;vertical-align:-15%}.rst-content .admonition,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning,.wy-alert{padding:12px;line-height:24px;margin-bottom:24px;background:#e7f2fa}.rst-content .admonition-title,.wy-alert-title{font-weight:700;display:block;color:#fff;background:#6ab0de;padding:6px 12px;margin:-12px -12px 12px}.rst-content .danger,.rst-content .error,.rst-content .wy-alert-danger.admonition,.rst-content .wy-alert-danger.admonition-todo,.rst-content .wy-alert-danger.attention,.rst-content .wy-alert-danger.caution,.rst-content .wy-alert-danger.hint,.rst-content .wy-alert-danger.important,.rst-content .wy-alert-danger.note,.rst-content .wy-alert-danger.seealso,.rst-content .wy-alert-danger.tip,.rst-content .wy-alert-danger.warning,.wy-alert.wy-alert-danger{background:#fdf3f2}.rst-content .danger .admonition-title,.rst-content .danger .wy-alert-title,.rst-content .error .admonition-title,.rst-content .error .wy-alert-title,.rst-content .wy-alert-danger.admonition-todo .admonition-title,.rst-content .wy-alert-danger.admonition-todo .wy-alert-title,.rst-content .wy-alert-danger.admonition .admonition-title,.rst-content .wy-alert-danger.admonition .wy-alert-title,.rst-content .wy-alert-danger.attention .admonition-title,.rst-content .wy-alert-danger.attention .wy-alert-title,.rst-content .wy-alert-danger.caution .admonition-title,.rst-content .wy-alert-danger.caution .wy-alert-title,.rst-content .wy-alert-danger.hint .admonition-title,.rst-content .wy-alert-danger.hint .wy-alert-title,.rst-content .wy-alert-danger.important .admonition-title,.rst-content .wy-alert-danger.important .wy-alert-title,.rst-content .wy-alert-danger.note .admonition-title,.rst-content .wy-alert-danger.note .wy-alert-title,.rst-content .wy-alert-danger.seealso .admonition-title,.rst-content .wy-alert-danger.seealso .wy-alert-title,.rst-content .wy-alert-danger.tip .admonition-title,.rst-content .wy-alert-danger.tip .wy-alert-title,.rst-content .wy-alert-danger.warning .admonition-title,.rst-content .wy-alert-danger.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-danger .admonition-title,.wy-alert.wy-alert-danger .rst-content .admonition-title,.wy-alert.wy-alert-danger .wy-alert-title{background:#f29f97}.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .warning,.rst-content .wy-alert-warning.admonition,.rst-content .wy-alert-warning.danger,.rst-content .wy-alert-warning.error,.rst-content .wy-alert-warning.hint,.rst-content .wy-alert-warning.important,.rst-content .wy-alert-warning.note,.rst-content .wy-alert-warning.seealso,.rst-content .wy-alert-warning.tip,.wy-alert.wy-alert-warning{background:#ffedcc}.rst-content .admonition-todo .admonition-title,.rst-content .admonition-todo .wy-alert-title,.rst-content .attention .admonition-title,.rst-content .attention .wy-alert-title,.rst-content .caution .admonition-title,.rst-content .caution .wy-alert-title,.rst-content .warning .admonition-title,.rst-content .warning .wy-alert-title,.rst-content .wy-alert-warning.admonition .admonition-title,.rst-content .wy-alert-warning.admonition .wy-alert-title,.rst-content .wy-alert-warning.danger .admonition-title,.rst-content .wy-alert-warning.danger .wy-alert-title,.rst-content .wy-alert-warning.error .admonition-title,.rst-content .wy-alert-warning.error .wy-alert-title,.rst-content .wy-alert-warning.hint .admonition-title,.rst-content .wy-alert-warning.hint .wy-alert-title,.rst-content .wy-alert-warning.important .admonition-title,.rst-content .wy-alert-warning.important .wy-alert-title,.rst-content .wy-alert-warning.note .admonition-title,.rst-content .wy-alert-warning.note .wy-alert-title,.rst-content .wy-alert-warning.seealso .admonition-title,.rst-content .wy-alert-warning.seealso .wy-alert-title,.rst-content .wy-alert-warning.tip .admonition-title,.rst-content .wy-alert-warning.tip .wy-alert-title,.rst-content .wy-alert.wy-alert-warning .admonition-title,.wy-alert.wy-alert-warning .rst-content .admonition-title,.wy-alert.wy-alert-warning .wy-alert-title{background:#f0b37e}.rst-content .note,.rst-content .seealso,.rst-content .wy-alert-info.admonition,.rst-content .wy-alert-info.admonition-todo,.rst-content .wy-alert-info.attention,.rst-content .wy-alert-info.caution,.rst-content .wy-alert-info.danger,.rst-content .wy-alert-info.error,.rst-content .wy-alert-info.hint,.rst-content .wy-alert-info.important,.rst-content .wy-alert-info.tip,.rst-content .wy-alert-info.warning,.wy-alert.wy-alert-info{background:#e7f2fa}.rst-content .note .admonition-title,.rst-content .note .wy-alert-title,.rst-content .seealso .admonition-title,.rst-content .seealso .wy-alert-title,.rst-content .wy-alert-info.admonition-todo .admonition-title,.rst-content .wy-alert-info.admonition-todo .wy-alert-title,.rst-content .wy-alert-info.admonition .admonition-title,.rst-content .wy-alert-info.admonition .wy-alert-title,.rst-content .wy-alert-info.attention .admonition-title,.rst-content .wy-alert-info.attention .wy-alert-title,.rst-content .wy-alert-info.caution .admonition-title,.rst-content .wy-alert-info.caution .wy-alert-title,.rst-content .wy-alert-info.danger .admonition-title,.rst-content .wy-alert-info.danger .wy-alert-title,.rst-content .wy-alert-info.error .admonition-title,.rst-content .wy-alert-info.error .wy-alert-title,.rst-content .wy-alert-info.hint .admonition-title,.rst-content .wy-alert-info.hint .wy-alert-title,.rst-content .wy-alert-info.important .admonition-title,.rst-content .wy-alert-info.important .wy-alert-title,.rst-content .wy-alert-info.tip .admonition-title,.rst-content .wy-alert-info.tip .wy-alert-title,.rst-content .wy-alert-info.warning .admonition-title,.rst-content .wy-alert-info.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-info .admonition-title,.wy-alert.wy-alert-info .rst-content .admonition-title,.wy-alert.wy-alert-info .wy-alert-title{background:#6ab0de}.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .wy-alert-success.admonition,.rst-content .wy-alert-success.admonition-todo,.rst-content .wy-alert-success.attention,.rst-content .wy-alert-success.caution,.rst-content .wy-alert-success.danger,.rst-content .wy-alert-success.error,.rst-content .wy-alert-success.note,.rst-content .wy-alert-success.seealso,.rst-content .wy-alert-success.warning,.wy-alert.wy-alert-success{background:#dbfaf4}.rst-content .hint .admonition-title,.rst-content .hint .wy-alert-title,.rst-content .important .admonition-title,.rst-content .important .wy-alert-title,.rst-content .tip .admonition-title,.rst-content .tip .wy-alert-title,.rst-content .wy-alert-success.admonition-todo .admonition-title,.rst-content .wy-alert-success.admonition-todo .wy-alert-title,.rst-content .wy-alert-success.admonition .admonition-title,.rst-content .wy-alert-success.admonition .wy-alert-title,.rst-content .wy-alert-success.attention .admonition-title,.rst-content .wy-alert-success.attention .wy-alert-title,.rst-content .wy-alert-success.caution .admonition-title,.rst-content .wy-alert-success.caution .wy-alert-title,.rst-content .wy-alert-success.danger .admonition-title,.rst-content .wy-alert-success.danger .wy-alert-title,.rst-content .wy-alert-success.error .admonition-title,.rst-content .wy-alert-success.error .wy-alert-title,.rst-content .wy-alert-success.note .admonition-title,.rst-content .wy-alert-success.note .wy-alert-title,.rst-content .wy-alert-success.seealso .admonition-title,.rst-content .wy-alert-success.seealso .wy-alert-title,.rst-content .wy-alert-success.warning .admonition-title,.rst-content .wy-alert-success.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-success .admonition-title,.wy-alert.wy-alert-success .rst-content .admonition-title,.wy-alert.wy-alert-success .wy-alert-title{background:#1abc9c}.rst-content .wy-alert-neutral.admonition,.rst-content .wy-alert-neutral.admonition-todo,.rst-content .wy-alert-neutral.attention,.rst-content .wy-alert-neutral.caution,.rst-content .wy-alert-neutral.danger,.rst-content .wy-alert-neutral.error,.rst-content .wy-alert-neutral.hint,.rst-content .wy-alert-neutral.important,.rst-content .wy-alert-neutral.note,.rst-content .wy-alert-neutral.seealso,.rst-content .wy-alert-neutral.tip,.rst-content .wy-alert-neutral.warning,.wy-alert.wy-alert-neutral{background:#f3f6f6}.rst-content .wy-alert-neutral.admonition-todo .admonition-title,.rst-content .wy-alert-neutral.admonition-todo .wy-alert-title,.rst-content .wy-alert-neutral.admonition .admonition-title,.rst-content .wy-alert-neutral.admonition .wy-alert-title,.rst-content .wy-alert-neutral.attention .admonition-title,.rst-content .wy-alert-neutral.attention .wy-alert-title,.rst-content .wy-alert-neutral.caution .admonition-title,.rst-content .wy-alert-neutral.caution .wy-alert-title,.rst-content .wy-alert-neutral.danger .admonition-title,.rst-content .wy-alert-neutral.danger .wy-alert-title,.rst-content .wy-alert-neutral.error .admonition-title,.rst-content .wy-alert-neutral.error .wy-alert-title,.rst-content .wy-alert-neutral.hint .admonition-title,.rst-content .wy-alert-neutral.hint .wy-alert-title,.rst-content .wy-alert-neutral.important .admonition-title,.rst-content .wy-alert-neutral.important .wy-alert-title,.rst-content .wy-alert-neutral.note .admonition-title,.rst-content .wy-alert-neutral.note .wy-alert-title,.rst-content .wy-alert-neutral.seealso .admonition-title,.rst-content .wy-alert-neutral.seealso .wy-alert-title,.rst-content .wy-alert-neutral.tip .admonition-title,.rst-content .wy-alert-neutral.tip .wy-alert-title,.rst-content .wy-alert-neutral.warning .admonition-title,.rst-content .wy-alert-neutral.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-neutral .admonition-title,.wy-alert.wy-alert-neutral .rst-content .admonition-title,.wy-alert.wy-alert-neutral .wy-alert-title{color:#404040;background:#e1e4e5}.rst-content .wy-alert-neutral.admonition-todo a,.rst-content .wy-alert-neutral.admonition a,.rst-content .wy-alert-neutral.attention a,.rst-content .wy-alert-neutral.caution a,.rst-content .wy-alert-neutral.danger a,.rst-content .wy-alert-neutral.error a,.rst-content .wy-alert-neutral.hint a,.rst-content .wy-alert-neutral.important a,.rst-content .wy-alert-neutral.note a,.rst-content .wy-alert-neutral.seealso a,.rst-content .wy-alert-neutral.tip a,.rst-content .wy-alert-neutral.warning a,.wy-alert.wy-alert-neutral a{color:#2980b9}.rst-content .admonition-todo p:last-child,.rst-content .admonition p:last-child,.rst-content .attention p:last-child,.rst-content .caution p:last-child,.rst-content .danger p:last-child,.rst-content .error p:last-child,.rst-content .hint p:last-child,.rst-content .important p:last-child,.rst-content .note p:last-child,.rst-content .seealso p:last-child,.rst-content .tip p:last-child,.rst-content .warning p:last-child,.wy-alert p:last-child{margin-bottom:0}.wy-tray-container{position:fixed;bottom:0;left:0;z-index:600}.wy-tray-container li{display:block;width:300px;background:transparent;color:#fff;text-align:center;box-shadow:0 5px 5px 0 rgba(0,0,0,.1);padding:0 24px;min-width:20%;opacity:0;height:0;line-height:56px;overflow:hidden;-webkit-transition:all .3s ease-in;-moz-transition:all .3s ease-in;transition:all .3s ease-in}.wy-tray-container li.wy-tray-item-success{background:#27ae60}.wy-tray-container li.wy-tray-item-info{background:#2980b9}.wy-tray-container li.wy-tray-item-warning{background:#e67e22}.wy-tray-container li.wy-tray-item-danger{background:#e74c3c}.wy-tray-container li.on{opacity:1;height:56px}@media screen and (max-width:768px){.wy-tray-container{bottom:auto;top:0;width:100%}.wy-tray-container li{width:100%}}button{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;cursor:pointer;line-height:normal;-webkit-appearance:button;*overflow:visible}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}button[disabled]{cursor:default}.btn{display:inline-block;border-radius:2px;line-height:normal;white-space:nowrap;text-align:center;cursor:pointer;font-size:100%;padding:6px 12px 8px;color:#fff;border:1px solid rgba(0,0,0,.1);background-color:#27ae60;text-decoration:none;font-weight:400;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;box-shadow:inset 0 1px 2px -1px hsla(0,0%,100%,.5),inset 0 -2px 0 0 rgba(0,0,0,.1);outline-none:false;vertical-align:middle;*display:inline;zoom:1;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all .1s linear;-moz-transition:all .1s linear;transition:all .1s linear}.btn-hover{background:#2e8ece;color:#fff}.btn:hover{background:#2cc36b;color:#fff}.btn:focus{background:#2cc36b;outline:0}.btn:active{box-shadow:inset 0 -1px 0 0 rgba(0,0,0,.05),inset 0 2px 0 0 rgba(0,0,0,.1);padding:8px 12px 6px}.btn:visited{color:#fff}.btn-disabled,.btn-disabled:active,.btn-disabled:focus,.btn-disabled:hover,.btn:disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:.4;cursor:not-allowed;box-shadow:none}.btn::-moz-focus-inner{padding:0;border:0}.btn-small{font-size:80%}.btn-info{background-color:#2980b9!important}.btn-info:hover{background-color:#2e8ece!important}.btn-neutral{background-color:#f3f6f6!important;color:#404040!important}.btn-neutral:hover{background-color:#e5ebeb!important;color:#404040}.btn-neutral:visited{color:#404040!important}.btn-success{background-color:#27ae60!important}.btn-success:hover{background-color:#295!important}.btn-danger{background-color:#e74c3c!important}.btn-danger:hover{background-color:#ea6153!important}.btn-warning{background-color:#e67e22!important}.btn-warning:hover{background-color:#e98b39!important}.btn-invert{background-color:#222}.btn-invert:hover{background-color:#2f2f2f!important}.btn-link{background-color:transparent!important;color:#2980b9;box-shadow:none;border-color:transparent!important}.btn-link:active,.btn-link:hover{background-color:transparent!important;color:#409ad5!important;box-shadow:none}.btn-link:visited{color:#9b59b6}.wy-btn-group .btn,.wy-control .btn{vertical-align:middle}.wy-btn-group{margin-bottom:24px;*zoom:1}.wy-btn-group:after,.wy-btn-group:before{display:table;content:""}.wy-btn-group:after{clear:both}.wy-dropdown{position:relative;display:inline-block}.wy-dropdown-active .wy-dropdown-menu{display:block}.wy-dropdown-menu{position:absolute;left:0;display:none;float:left;top:100%;min-width:100%;background:#fcfcfc;z-index:100;border:1px solid #cfd7dd;box-shadow:0 2px 2px 0 rgba(0,0,0,.1);padding:12px}.wy-dropdown-menu>dd>a{display:block;clear:both;color:#404040;white-space:nowrap;font-size:90%;padding:0 12px;cursor:pointer}.wy-dropdown-menu>dd>a:hover{background:#2980b9;color:#fff}.wy-dropdown-menu>dd.divider{border-top:1px solid #cfd7dd;margin:6px 0}.wy-dropdown-menu>dd.search{padding-bottom:12px}.wy-dropdown-menu>dd.search input[type=search]{width:100%}.wy-dropdown-menu>dd.call-to-action{background:#e3e3e3;text-transform:uppercase;font-weight:500;font-size:80%}.wy-dropdown-menu>dd.call-to-action:hover{background:#e3e3e3}.wy-dropdown-menu>dd.call-to-action .btn{color:#fff}.wy-dropdown.wy-dropdown-up .wy-dropdown-menu{bottom:100%;top:auto;left:auto;right:0}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu{background:#fcfcfc;margin-top:2px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a{padding:6px 12px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a:hover{background:#2980b9;color:#fff}.wy-dropdown.wy-dropdown-left .wy-dropdown-menu{right:0;left:auto;text-align:right}.wy-dropdown-arrow:before{content:" ";border-bottom:5px solid #f5f5f5;border-left:5px solid transparent;border-right:5px solid transparent;position:absolute;display:block;top:-4px;left:50%;margin-left:-3px}.wy-dropdown-arrow.wy-dropdown-arrow-left:before{left:11px}.wy-form-stacked select{display:block}.wy-form-aligned .wy-help-inline,.wy-form-aligned input,.wy-form-aligned label,.wy-form-aligned select,.wy-form-aligned textarea{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-form-aligned .wy-control-group>label{display:inline-block;vertical-align:middle;width:10em;margin:6px 12px 0 0;float:left}.wy-form-aligned .wy-control{float:left}.wy-form-aligned .wy-control label{display:block}.wy-form-aligned .wy-control select{margin-top:6px}fieldset{margin:0}fieldset,legend{border:0;padding:0}legend{width:100%;white-space:normal;margin-bottom:24px;font-size:150%;*margin-left:-7px}label,legend{display:block}label{margin:0 0 .3125em;color:#333;font-size:90%}input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}.wy-control-group{margin-bottom:24px;max-width:1200px;margin-left:auto;margin-right:auto;*zoom:1}.wy-control-group:after,.wy-control-group:before{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group.wy-control-group-required>label:after{content:" *";color:#e74c3c}.wy-control-group .wy-form-full,.wy-control-group .wy-form-halves,.wy-control-group .wy-form-thirds{padding-bottom:12px}.wy-control-group .wy-form-full input[type=color],.wy-control-group .wy-form-full input[type=date],.wy-control-group .wy-form-full input[type=datetime-local],.wy-control-group .wy-form-full input[type=datetime],.wy-control-group .wy-form-full input[type=email],.wy-control-group .wy-form-full input[type=month],.wy-control-group .wy-form-full input[type=number],.wy-control-group .wy-form-full input[type=password],.wy-control-group .wy-form-full input[type=search],.wy-control-group .wy-form-full input[type=tel],.wy-control-group .wy-form-full input[type=text],.wy-control-group .wy-form-full input[type=time],.wy-control-group .wy-form-full input[type=url],.wy-control-group .wy-form-full input[type=week],.wy-control-group .wy-form-full select,.wy-control-group .wy-form-halves input[type=color],.wy-control-group .wy-form-halves input[type=date],.wy-control-group .wy-form-halves input[type=datetime-local],.wy-control-group .wy-form-halves input[type=datetime],.wy-control-group .wy-form-halves input[type=email],.wy-control-group .wy-form-halves input[type=month],.wy-control-group .wy-form-halves input[type=number],.wy-control-group .wy-form-halves input[type=password],.wy-control-group .wy-form-halves input[type=search],.wy-control-group .wy-form-halves input[type=tel],.wy-control-group .wy-form-halves input[type=text],.wy-control-group .wy-form-halves input[type=time],.wy-control-group .wy-form-halves input[type=url],.wy-control-group .wy-form-halves input[type=week],.wy-control-group .wy-form-halves select,.wy-control-group .wy-form-thirds input[type=color],.wy-control-group .wy-form-thirds input[type=date],.wy-control-group .wy-form-thirds input[type=datetime-local],.wy-control-group .wy-form-thirds input[type=datetime],.wy-control-group .wy-form-thirds input[type=email],.wy-control-group .wy-form-thirds input[type=month],.wy-control-group .wy-form-thirds input[type=number],.wy-control-group .wy-form-thirds input[type=password],.wy-control-group .wy-form-thirds input[type=search],.wy-control-group .wy-form-thirds input[type=tel],.wy-control-group .wy-form-thirds input[type=text],.wy-control-group .wy-form-thirds input[type=time],.wy-control-group .wy-form-thirds input[type=url],.wy-control-group .wy-form-thirds input[type=week],.wy-control-group .wy-form-thirds select{width:100%}.wy-control-group .wy-form-full{float:left;display:block;width:100%;margin-right:0}.wy-control-group .wy-form-full:last-child{margin-right:0}.wy-control-group .wy-form-halves{float:left;display:block;margin-right:2.35765%;width:48.82117%}.wy-control-group .wy-form-halves:last-child,.wy-control-group .wy-form-halves:nth-of-type(2n){margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(odd){clear:left}.wy-control-group .wy-form-thirds{float:left;display:block;margin-right:2.35765%;width:31.76157%}.wy-control-group .wy-form-thirds:last-child,.wy-control-group .wy-form-thirds:nth-of-type(3n){margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n+1){clear:left}.wy-control-group.wy-control-group-no-input .wy-control,.wy-control-no-input{margin:6px 0 0;font-size:90%}.wy-control-no-input{display:inline-block}.wy-control-group.fluid-input input[type=color],.wy-control-group.fluid-input input[type=date],.wy-control-group.fluid-input input[type=datetime-local],.wy-control-group.fluid-input input[type=datetime],.wy-control-group.fluid-input input[type=email],.wy-control-group.fluid-input input[type=month],.wy-control-group.fluid-input input[type=number],.wy-control-group.fluid-input input[type=password],.wy-control-group.fluid-input input[type=search],.wy-control-group.fluid-input input[type=tel],.wy-control-group.fluid-input input[type=text],.wy-control-group.fluid-input input[type=time],.wy-control-group.fluid-input input[type=url],.wy-control-group.fluid-input input[type=week]{width:100%}.wy-form-message-inline{padding-left:.3em;color:#666;font-size:90%}.wy-form-message{display:block;color:#999;font-size:70%;margin-top:.3125em;font-style:italic}.wy-form-message p{font-size:inherit;font-style:italic;margin-bottom:6px}.wy-form-message p:last-child{margin-bottom:0}input{line-height:normal}input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;*overflow:visible}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week]{-webkit-appearance:none;padding:6px;display:inline-block;border:1px solid #ccc;font-size:80%;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;box-shadow:inset 0 1px 3px #ddd;border-radius:0;-webkit-transition:border .3s linear;-moz-transition:border .3s linear;transition:border .3s linear}input[type=datetime-local]{padding:.34375em .625em}input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{padding:0;margin-right:.3125em;*height:13px;*width:13px}input[type=checkbox],input[type=radio],input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus{outline:0;outline:thin dotted\9;border-color:#333}input.no-focus:focus{border-color:#ccc!important}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:thin dotted #333;outline:1px auto #129fea}input[type=color][disabled],input[type=date][disabled],input[type=datetime-local][disabled],input[type=datetime][disabled],input[type=email][disabled],input[type=month][disabled],input[type=number][disabled],input[type=password][disabled],input[type=search][disabled],input[type=tel][disabled],input[type=text][disabled],input[type=time][disabled],input[type=url][disabled],input[type=week][disabled]{cursor:not-allowed;background-color:#fafafa}input:focus:invalid,select:focus:invalid,textarea:focus:invalid{color:#e74c3c;border:1px solid #e74c3c}input:focus:invalid:focus,select:focus:invalid:focus,textarea:focus:invalid:focus{border-color:#e74c3c}input[type=checkbox]:focus:invalid:focus,input[type=file]:focus:invalid:focus,input[type=radio]:focus:invalid:focus{outline-color:#e74c3c}input.wy-input-large{padding:12px;font-size:100%}textarea{overflow:auto;vertical-align:top;width:100%;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif}select,textarea{padding:.5em .625em;display:inline-block;border:1px solid #ccc;font-size:80%;box-shadow:inset 0 1px 3px #ddd;-webkit-transition:border .3s linear;-moz-transition:border .3s linear;transition:border .3s linear}select{border:1px solid #ccc;background-color:#fff}select[multiple]{height:auto}select:focus,textarea:focus{outline:0}input[readonly],select[disabled],select[readonly],textarea[disabled],textarea[readonly]{cursor:not-allowed;background-color:#fafafa}input[type=checkbox][disabled],input[type=radio][disabled]{cursor:not-allowed}.wy-checkbox,.wy-radio{margin:6px 0;color:#404040;display:block}.wy-checkbox input,.wy-radio input{vertical-align:baseline}.wy-form-message-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-input-prefix,.wy-input-suffix{white-space:nowrap;padding:6px}.wy-input-prefix .wy-input-context,.wy-input-suffix .wy-input-context{line-height:27px;padding:0 8px;display:inline-block;font-size:80%;background-color:#f3f6f6;border:1px solid #ccc;color:#999}.wy-input-suffix .wy-input-context{border-left:0}.wy-input-prefix .wy-input-context{border-right:0}.wy-switch{position:relative;display:block;height:24px;margin-top:12px;cursor:pointer}.wy-switch:before{left:0;top:0;width:36px;height:12px;background:#ccc}.wy-switch:after,.wy-switch:before{position:absolute;content:"";display:block;border-radius:4px;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.wy-switch:after{width:18px;height:18px;background:#999;left:-3px;top:-3px}.wy-switch span{position:absolute;left:48px;display:block;font-size:12px;color:#ccc;line-height:1}.wy-switch.active:before{background:#1e8449}.wy-switch.active:after{left:24px;background:#27ae60}.wy-switch.disabled{cursor:not-allowed;opacity:.8}.wy-control-group.wy-control-group-error .wy-form-message,.wy-control-group.wy-control-group-error>label{color:#e74c3c}.wy-control-group.wy-control-group-error input[type=color],.wy-control-group.wy-control-group-error input[type=date],.wy-control-group.wy-control-group-error input[type=datetime-local],.wy-control-group.wy-control-group-error input[type=datetime],.wy-control-group.wy-control-group-error input[type=email],.wy-control-group.wy-control-group-error input[type=month],.wy-control-group.wy-control-group-error input[type=number],.wy-control-group.wy-control-group-error input[type=password],.wy-control-group.wy-control-group-error input[type=search],.wy-control-group.wy-control-group-error input[type=tel],.wy-control-group.wy-control-group-error input[type=text],.wy-control-group.wy-control-group-error input[type=time],.wy-control-group.wy-control-group-error input[type=url],.wy-control-group.wy-control-group-error input[type=week],.wy-control-group.wy-control-group-error textarea{border:1px solid #e74c3c}.wy-inline-validate{white-space:nowrap}.wy-inline-validate .wy-input-context{padding:.5em .625em;display:inline-block;font-size:80%}.wy-inline-validate.wy-inline-validate-success .wy-input-context{color:#27ae60}.wy-inline-validate.wy-inline-validate-danger .wy-input-context{color:#e74c3c}.wy-inline-validate.wy-inline-validate-warning .wy-input-context{color:#e67e22}.wy-inline-validate.wy-inline-validate-info .wy-input-context{color:#2980b9}.rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.mirror{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1)}.mirror.rotate-90{-webkit-transform:scaleX(-1) rotate(90deg);-moz-transform:scaleX(-1) rotate(90deg);-ms-transform:scaleX(-1) rotate(90deg);-o-transform:scaleX(-1) rotate(90deg);transform:scaleX(-1) rotate(90deg)}.mirror.rotate-180{-webkit-transform:scaleX(-1) rotate(180deg);-moz-transform:scaleX(-1) rotate(180deg);-ms-transform:scaleX(-1) rotate(180deg);-o-transform:scaleX(-1) rotate(180deg);transform:scaleX(-1) rotate(180deg)}.mirror.rotate-270{-webkit-transform:scaleX(-1) rotate(270deg);-moz-transform:scaleX(-1) rotate(270deg);-ms-transform:scaleX(-1) rotate(270deg);-o-transform:scaleX(-1) rotate(270deg);transform:scaleX(-1) rotate(270deg)}@media only screen and (max-width:480px){.wy-form button[type=submit]{margin:.7em 0 0}.wy-form input[type=color],.wy-form input[type=date],.wy-form input[type=datetime-local],.wy-form input[type=datetime],.wy-form input[type=email],.wy-form input[type=month],.wy-form input[type=number],.wy-form input[type=password],.wy-form input[type=search],.wy-form input[type=tel],.wy-form input[type=text],.wy-form input[type=time],.wy-form input[type=url],.wy-form input[type=week],.wy-form label{margin-bottom:.3em;display:block}.wy-form input[type=color],.wy-form input[type=date],.wy-form input[type=datetime-local],.wy-form input[type=datetime],.wy-form input[type=email],.wy-form input[type=month],.wy-form input[type=number],.wy-form input[type=password],.wy-form input[type=search],.wy-form input[type=tel],.wy-form input[type=time],.wy-form input[type=url],.wy-form input[type=week]{margin-bottom:0}.wy-form-aligned .wy-control-group label{margin-bottom:.3em;text-align:left;display:block;width:100%}.wy-form-aligned .wy-control{margin:1.5em 0 0}.wy-form-message,.wy-form-message-inline,.wy-form .wy-help-inline{display:block;font-size:80%;padding:6px 0}}@media screen and (max-width:768px){.tablet-hide{display:none}}@media screen and (max-width:480px){.mobile-hide{display:none}}.float-left{float:left}.float-right{float:right}.full-width{width:100%}.rst-content table.docutils,.rst-content table.field-list,.wy-table{border-collapse:collapse;border-spacing:0;empty-cells:show;margin-bottom:24px}.rst-content table.docutils caption,.rst-content table.field-list caption,.wy-table caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.rst-content table.docutils td,.rst-content table.docutils th,.rst-content table.field-list td,.rst-content table.field-list th,.wy-table td,.wy-table th{font-size:90%;margin:0;overflow:visible;padding:8px 16px}.rst-content table.docutils td:first-child,.rst-content table.docutils th:first-child,.rst-content table.field-list td:first-child,.rst-content table.field-list th:first-child,.wy-table td:first-child,.wy-table th:first-child{border-left-width:0}.rst-content table.docutils thead,.rst-content table.field-list thead,.wy-table thead{color:#000;text-align:left;vertical-align:bottom;white-space:nowrap}.rst-content table.docutils thead th,.rst-content table.field-list thead th,.wy-table thead th{font-weight:700;border-bottom:2px solid #e1e4e5}.rst-content table.docutils td,.rst-content table.field-list td,.wy-table td{background-color:transparent;vertical-align:middle}.rst-content table.docutils td p,.rst-content table.field-list td p,.wy-table td p{line-height:18px}.rst-content table.docutils td p:last-child,.rst-content table.field-list td p:last-child,.wy-table td p:last-child{margin-bottom:0}.rst-content table.docutils .wy-table-cell-min,.rst-content table.field-list .wy-table-cell-min,.wy-table .wy-table-cell-min{width:1%;padding-right:0}.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox],.wy-table .wy-table-cell-min input[type=checkbox]{margin:0}.wy-table-secondary{color:grey;font-size:90%}.wy-table-tertiary{color:grey;font-size:80%}.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td,.wy-table-backed,.wy-table-odd td,.wy-table-striped tr:nth-child(2n-1) td{background-color:#f3f6f6}.rst-content table.docutils,.wy-table-bordered-all{border:1px solid #e1e4e5}.rst-content table.docutils td,.wy-table-bordered-all td{border-bottom:1px solid #e1e4e5;border-left:1px solid #e1e4e5}.rst-content table.docutils tbody>tr:last-child td,.wy-table-bordered-all tbody>tr:last-child td{border-bottom-width:0}.wy-table-bordered{border:1px solid #e1e4e5}.wy-table-bordered-rows td{border-bottom:1px solid #e1e4e5}.wy-table-bordered-rows tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal td,.wy-table-horizontal th{border-width:0 0 1px;border-bottom:1px solid #e1e4e5}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-responsive{margin-bottom:24px;max-width:100%;overflow:auto}.wy-table-responsive table{margin-bottom:0!important}.wy-table-responsive table td,.wy-table-responsive table th{white-space:nowrap}a{color:#2980b9;text-decoration:none;cursor:pointer}a:hover{color:#3091d1}a:visited{color:#9b59b6}html{height:100%}body,html{overflow-x:hidden}body{font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;font-weight:400;color:#404040;min-height:100%;background:#edf0f2}.wy-text-left{text-align:left}.wy-text-center{text-align:center}.wy-text-right{text-align:right}.wy-text-large{font-size:120%}.wy-text-normal{font-size:100%}.wy-text-small,small{font-size:80%}.wy-text-strike{text-decoration:line-through}.wy-text-warning{color:#e67e22!important}a.wy-text-warning:hover{color:#eb9950!important}.wy-text-info{color:#2980b9!important}a.wy-text-info:hover{color:#409ad5!important}.wy-text-success{color:#27ae60!important}a.wy-text-success:hover{color:#36d278!important}.wy-text-danger{color:#e74c3c!important}a.wy-text-danger:hover{color:#ed7669!important}.wy-text-neutral{color:#404040!important}a.wy-text-neutral:hover{color:#595959!important}.rst-content .toctree-wrapper>p.caption,h1,h2,h3,h4,h5,h6,legend{margin-top:0;font-weight:700;font-family:Roboto Slab,ff-tisa-web-pro,Georgia,Arial,sans-serif}p{line-height:24px;font-size:16px;margin:0 0 24px}h1{font-size:175%}.rst-content .toctree-wrapper>p.caption,h2{font-size:150%}h3{font-size:125%}h4{font-size:115%}h5{font-size:110%}h6{font-size:100%}hr{display:block;height:1px;border:0;border-top:1px solid #e1e4e5;margin:24px 0;padding:0}.rst-content code,.rst-content tt,code{white-space:nowrap;max-width:100%;background:#fff;border:1px solid #e1e4e5;font-size:75%;padding:0 5px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;color:#e74c3c;overflow-x:auto}.rst-content tt.code-large,code.code-large{font-size:90%}.rst-content .section ul,.rst-content .toctree-wrapper ul,.rst-content section ul,.wy-plain-list-disc,article ul{list-style:disc;line-height:24px;margin-bottom:24px}.rst-content .section ul li,.rst-content .toctree-wrapper ul li,.rst-content section ul li,.wy-plain-list-disc li,article ul li{list-style:disc;margin-left:24px}.rst-content .section ul li p:last-child,.rst-content .section ul li ul,.rst-content .toctree-wrapper ul li p:last-child,.rst-content .toctree-wrapper ul li ul,.rst-content section ul li p:last-child,.rst-content section ul li ul,.wy-plain-list-disc li p:last-child,.wy-plain-list-disc li ul,article ul li p:last-child,article ul li ul{margin-bottom:0}.rst-content .section ul li li,.rst-content .toctree-wrapper ul li li,.rst-content section ul li li,.wy-plain-list-disc li li,article ul li li{list-style:circle}.rst-content .section ul li li li,.rst-content .toctree-wrapper ul li li li,.rst-content section ul li li li,.wy-plain-list-disc li li li,article ul li li li{list-style:square}.rst-content .section ul li ol li,.rst-content .toctree-wrapper ul li ol li,.rst-content section ul li ol li,.wy-plain-list-disc li ol li,article ul li ol li{list-style:decimal}.rst-content .section ol,.rst-content .section ol.arabic,.rst-content .toctree-wrapper ol,.rst-content .toctree-wrapper ol.arabic,.rst-content section ol,.rst-content section ol.arabic,.wy-plain-list-decimal,article ol{list-style:decimal;line-height:24px;margin-bottom:24px}.rst-content .section ol.arabic li,.rst-content .section ol li,.rst-content .toctree-wrapper ol.arabic li,.rst-content .toctree-wrapper ol li,.rst-content section ol.arabic li,.rst-content section ol li,.wy-plain-list-decimal li,article ol li{list-style:decimal;margin-left:24px}.rst-content .section ol.arabic li ul,.rst-content .section ol li p:last-child,.rst-content .section ol li ul,.rst-content .toctree-wrapper ol.arabic li ul,.rst-content .toctree-wrapper ol li p:last-child,.rst-content .toctree-wrapper ol li ul,.rst-content section ol.arabic li ul,.rst-content section ol li p:last-child,.rst-content section ol li ul,.wy-plain-list-decimal li p:last-child,.wy-plain-list-decimal li ul,article ol li p:last-child,article ol li ul{margin-bottom:0}.rst-content .section ol.arabic li ul li,.rst-content .section ol li ul li,.rst-content .toctree-wrapper ol.arabic li ul li,.rst-content .toctree-wrapper ol li ul li,.rst-content section ol.arabic li ul li,.rst-content section ol li ul li,.wy-plain-list-decimal li ul li,article ol li ul li{list-style:disc}.wy-breadcrumbs{*zoom:1}.wy-breadcrumbs:after,.wy-breadcrumbs:before{display:table;content:""}.wy-breadcrumbs:after{clear:both}.wy-breadcrumbs>li{display:inline-block;padding-top:5px}.wy-breadcrumbs>li.wy-breadcrumbs-aside{float:right}.rst-content .wy-breadcrumbs>li code,.rst-content .wy-breadcrumbs>li tt,.wy-breadcrumbs>li .rst-content tt,.wy-breadcrumbs>li code{all:inherit;color:inherit}.breadcrumb-item:before{content:"/";color:#bbb;font-size:13px;padding:0 6px 0 3px}.wy-breadcrumbs-extra{margin-bottom:0;color:#b3b3b3;font-size:80%;display:inline-block}@media screen and (max-width:480px){.wy-breadcrumbs-extra,.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}@media print{.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}html{font-size:16px}.wy-affix{position:fixed;top:1.618em}.wy-menu a:hover{text-decoration:none}.wy-menu-horiz{*zoom:1}.wy-menu-horiz:after,.wy-menu-horiz:before{display:table;content:""}.wy-menu-horiz:after{clear:both}.wy-menu-horiz li,.wy-menu-horiz ul{display:inline-block}.wy-menu-horiz li:hover{background:hsla(0,0%,100%,.1)}.wy-menu-horiz li.divide-left{border-left:1px solid #404040}.wy-menu-horiz li.divide-right{border-right:1px solid #404040}.wy-menu-horiz a{height:32px;display:inline-block;line-height:32px;padding:0 16px}.wy-menu-vertical{width:300px}.wy-menu-vertical header,.wy-menu-vertical p.caption{color:#55a5d9;height:32px;line-height:32px;padding:0 1.618em;margin:12px 0 0;display:block;font-weight:700;text-transform:uppercase;font-size:85%;white-space:nowrap}.wy-menu-vertical ul{margin-bottom:0}.wy-menu-vertical li.divide-top{border-top:1px solid #404040}.wy-menu-vertical li.divide-bottom{border-bottom:1px solid #404040}.wy-menu-vertical li.current{background:#e3e3e3}.wy-menu-vertical li.current a{color:grey;border-right:1px solid #c9c9c9;padding:.4045em 2.427em}.wy-menu-vertical li.current a:hover{background:#d6d6d6}.rst-content .wy-menu-vertical li tt,.wy-menu-vertical li .rst-content tt,.wy-menu-vertical li code{border:none;background:inherit;color:inherit;padding-left:0;padding-right:0}.wy-menu-vertical li button.toctree-expand{display:block;float:left;margin-left:-1.2em;line-height:18px;color:#4d4d4d;border:none;background:none;padding:0}.wy-menu-vertical li.current>a,.wy-menu-vertical li.on a{color:#404040;font-weight:700;position:relative;background:#fcfcfc;border:none;padding:.4045em 1.618em}.wy-menu-vertical li.current>a:hover,.wy-menu-vertical li.on a:hover{background:#fcfcfc}.wy-menu-vertical li.current>a:hover button.toctree-expand,.wy-menu-vertical li.on a:hover button.toctree-expand{color:grey}.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand{display:block;line-height:18px;color:#333}.wy-menu-vertical li.toctree-l1.current>a{border-bottom:1px solid #c9c9c9;border-top:1px solid #c9c9c9}.wy-menu-vertical .toctree-l1.current .toctree-l2>ul,.wy-menu-vertical .toctree-l2.current .toctree-l3>ul,.wy-menu-vertical .toctree-l3.current .toctree-l4>ul,.wy-menu-vertical .toctree-l4.current .toctree-l5>ul,.wy-menu-vertical .toctree-l5.current .toctree-l6>ul,.wy-menu-vertical .toctree-l6.current .toctree-l7>ul,.wy-menu-vertical .toctree-l7.current .toctree-l8>ul,.wy-menu-vertical .toctree-l8.current .toctree-l9>ul,.wy-menu-vertical .toctree-l9.current .toctree-l10>ul,.wy-menu-vertical .toctree-l10.current .toctree-l11>ul{display:none}.wy-menu-vertical .toctree-l1.current .current.toctree-l2>ul,.wy-menu-vertical .toctree-l2.current .current.toctree-l3>ul,.wy-menu-vertical .toctree-l3.current .current.toctree-l4>ul,.wy-menu-vertical .toctree-l4.current .current.toctree-l5>ul,.wy-menu-vertical .toctree-l5.current .current.toctree-l6>ul,.wy-menu-vertical .toctree-l6.current .current.toctree-l7>ul,.wy-menu-vertical .toctree-l7.current .current.toctree-l8>ul,.wy-menu-vertical .toctree-l8.current .current.toctree-l9>ul,.wy-menu-vertical .toctree-l9.current .current.toctree-l10>ul,.wy-menu-vertical .toctree-l10.current .current.toctree-l11>ul{display:block}.wy-menu-vertical li.toctree-l3,.wy-menu-vertical li.toctree-l4{font-size:.9em}.wy-menu-vertical li.toctree-l2 a,.wy-menu-vertical li.toctree-l3 a,.wy-menu-vertical li.toctree-l4 a,.wy-menu-vertical li.toctree-l5 a,.wy-menu-vertical li.toctree-l6 a,.wy-menu-vertical li.toctree-l7 a,.wy-menu-vertical li.toctree-l8 a,.wy-menu-vertical li.toctree-l9 a,.wy-menu-vertical li.toctree-l10 a{color:#404040}.wy-menu-vertical li.toctree-l2 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l3 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l4 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l5 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l6 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l7 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l8 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l9 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l10 a:hover button.toctree-expand{color:grey}.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a,.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a,.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a,.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a,.wy-menu-vertical li.toctree-l6.current li.toctree-l7>a,.wy-menu-vertical li.toctree-l7.current li.toctree-l8>a,.wy-menu-vertical li.toctree-l8.current li.toctree-l9>a,.wy-menu-vertical li.toctree-l9.current li.toctree-l10>a,.wy-menu-vertical li.toctree-l10.current li.toctree-l11>a{display:block}.wy-menu-vertical li.toctree-l2.current>a{padding:.4045em 2.427em}.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a{padding:.4045em 1.618em .4045em 4.045em}.wy-menu-vertical li.toctree-l3.current>a{padding:.4045em 4.045em}.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a{padding:.4045em 1.618em .4045em 5.663em}.wy-menu-vertical li.toctree-l4.current>a{padding:.4045em 5.663em}.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a{padding:.4045em 1.618em .4045em 7.281em}.wy-menu-vertical li.toctree-l5.current>a{padding:.4045em 7.281em}.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a{padding:.4045em 1.618em .4045em 8.899em}.wy-menu-vertical li.toctree-l6.current>a{padding:.4045em 8.899em}.wy-menu-vertical li.toctree-l6.current li.toctree-l7>a{padding:.4045em 1.618em .4045em 10.517em}.wy-menu-vertical li.toctree-l7.current>a{padding:.4045em 10.517em}.wy-menu-vertical li.toctree-l7.current li.toctree-l8>a{padding:.4045em 1.618em .4045em 12.135em}.wy-menu-vertical li.toctree-l8.current>a{padding:.4045em 12.135em}.wy-menu-vertical li.toctree-l8.current li.toctree-l9>a{padding:.4045em 1.618em .4045em 13.753em}.wy-menu-vertical li.toctree-l9.current>a{padding:.4045em 13.753em}.wy-menu-vertical li.toctree-l9.current li.toctree-l10>a{padding:.4045em 1.618em .4045em 15.371em}.wy-menu-vertical li.toctree-l10.current>a{padding:.4045em 15.371em}.wy-menu-vertical li.toctree-l10.current li.toctree-l11>a{padding:.4045em 1.618em .4045em 16.989em}.wy-menu-vertical li.toctree-l2.current>a,.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a{background:#c9c9c9}.wy-menu-vertical li.toctree-l2 button.toctree-expand{color:#a3a3a3}.wy-menu-vertical li.toctree-l3.current>a,.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a{background:#bdbdbd}.wy-menu-vertical li.toctree-l3 button.toctree-expand{color:#969696}.wy-menu-vertical li.current ul{display:block}.wy-menu-vertical li ul{margin-bottom:0;display:none}.wy-menu-vertical li ul li a{margin-bottom:0;color:#d9d9d9;font-weight:400}.wy-menu-vertical a{line-height:18px;padding:.4045em 1.618em;display:block;position:relative;font-size:90%;color:#d9d9d9}.wy-menu-vertical a:hover{background-color:#4e4a4a;cursor:pointer}.wy-menu-vertical a:hover button.toctree-expand{color:#d9d9d9}.wy-menu-vertical a:active{background-color:#2980b9;cursor:pointer;color:#fff}.wy-menu-vertical a:active button.toctree-expand{color:#fff}.wy-side-nav-search{display:block;width:300px;padding:.809em;margin-bottom:.809em;z-index:200;background-color:#2980b9;text-align:center;color:#fcfcfc}.wy-side-nav-search input[type=text]{width:100%;border-radius:50px;padding:6px 12px;border-color:#2472a4}.wy-side-nav-search img{display:block;margin:auto auto .809em;height:45px;width:45px;background-color:#2980b9;padding:5px;border-radius:100%}.wy-side-nav-search .wy-dropdown>a,.wy-side-nav-search>a{color:#fcfcfc;font-size:100%;font-weight:700;display:inline-block;padding:4px 6px;margin-bottom:.809em;max-width:100%}.wy-side-nav-search .wy-dropdown>a:hover,.wy-side-nav-search .wy-dropdown>aactive,.wy-side-nav-search .wy-dropdown>afocus,.wy-side-nav-search>a:hover,.wy-side-nav-search>aactive,.wy-side-nav-search>afocus{background:hsla(0,0%,100%,.1)}.wy-side-nav-search .wy-dropdown>a img.logo,.wy-side-nav-search>a img.logo{display:block;margin:0 auto;height:auto;width:auto;border-radius:0;max-width:100%;background:transparent}.wy-side-nav-search .wy-dropdown>a.icon,.wy-side-nav-search>a.icon{display:block}.wy-side-nav-search .wy-dropdown>a.icon img.logo,.wy-side-nav-search>a.icon img.logo{margin-top:.85em}.wy-side-nav-search>div.switch-menus{position:relative;display:block;margin-top:-.4045em;margin-bottom:.809em;font-weight:400;color:hsla(0,0%,100%,.3)}.wy-side-nav-search>div.switch-menus>div.language-switch,.wy-side-nav-search>div.switch-menus>div.version-switch{display:inline-block;padding:.2em}.wy-side-nav-search>div.switch-menus>div.language-switch select,.wy-side-nav-search>div.switch-menus>div.version-switch select{display:inline-block;margin-right:-2rem;padding-right:2rem;max-width:240px;text-align-last:center;background:none;border:none;border-radius:0;box-shadow:none;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;font-size:1em;font-weight:400;color:hsla(0,0%,100%,.3);cursor:pointer;appearance:none;-webkit-appearance:none;-moz-appearance:none}.wy-side-nav-search>div.switch-menus>div.language-switch select:active,.wy-side-nav-search>div.switch-menus>div.language-switch select:focus,.wy-side-nav-search>div.switch-menus>div.language-switch select:hover,.wy-side-nav-search>div.switch-menus>div.version-switch select:active,.wy-side-nav-search>div.switch-menus>div.version-switch select:focus,.wy-side-nav-search>div.switch-menus>div.version-switch select:hover{background:hsla(0,0%,100%,.1);color:hsla(0,0%,100%,.5)}.wy-side-nav-search>div.switch-menus>div.language-switch select option,.wy-side-nav-search>div.switch-menus>div.version-switch select option{color:#000}.wy-side-nav-search>div.switch-menus>div.language-switch:has(>select):after,.wy-side-nav-search>div.switch-menus>div.version-switch:has(>select):after{display:inline-block;width:1.5em;height:100%;padding:.1em;content:"\f0d7";font-size:1em;line-height:1.2em;font-family:FontAwesome;text-align:center;pointer-events:none;box-sizing:border-box}.wy-nav .wy-menu-vertical header{color:#2980b9}.wy-nav .wy-menu-vertical a{color:#b3b3b3}.wy-nav .wy-menu-vertical a:hover{background-color:#2980b9;color:#fff}[data-menu-wrap]{-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;transition:all .2s ease-in;position:absolute;opacity:1;width:100%;opacity:0}[data-menu-wrap].move-center{left:0;right:auto;opacity:1}[data-menu-wrap].move-left{right:auto;left:-100%;opacity:0}[data-menu-wrap].move-right{right:-100%;left:auto;opacity:0}.wy-body-for-nav{background:#fcfcfc}.wy-grid-for-nav{position:absolute;width:100%;height:100%}.wy-nav-side{position:fixed;top:0;bottom:0;left:0;padding-bottom:2em;width:300px;overflow-x:hidden;overflow-y:hidden;min-height:100%;color:#9b9b9b;background:#343131;z-index:200}.wy-side-scroll{width:320px;position:relative;overflow-x:hidden;overflow-y:scroll;height:100%}.wy-nav-top{display:none;background:#2980b9;color:#fff;padding:.4045em .809em;position:relative;line-height:50px;text-align:center;font-size:100%;*zoom:1}.wy-nav-top:after,.wy-nav-top:before{display:table;content:""}.wy-nav-top:after{clear:both}.wy-nav-top a{color:#fff;font-weight:700}.wy-nav-top img{margin-right:12px;height:45px;width:45px;background-color:#2980b9;padding:5px;border-radius:100%}.wy-nav-top i{font-size:30px;float:left;cursor:pointer;padding-top:inherit}.wy-nav-content-wrap{margin-left:300px;background:#fcfcfc;min-height:100%}.wy-nav-content{padding:1.618em 3.236em;height:100%;max-width:800px;margin:auto}.wy-body-mask{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.2);display:none;z-index:499}.wy-body-mask.on{display:block}footer{color:grey}footer p{margin-bottom:12px}.rst-content footer span.commit tt,footer span.commit .rst-content tt,footer span.commit code{padding:0;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;font-size:1em;background:none;border:none;color:grey}.rst-footer-buttons{*zoom:1}.rst-footer-buttons:after,.rst-footer-buttons:before{width:100%;display:table;content:""}.rst-footer-buttons:after{clear:both}.rst-breadcrumbs-buttons{margin-top:12px;*zoom:1}.rst-breadcrumbs-buttons:after,.rst-breadcrumbs-buttons:before{display:table;content:""}.rst-breadcrumbs-buttons:after{clear:both}#search-results .search li{margin-bottom:24px;border-bottom:1px solid #e1e4e5;padding-bottom:24px}#search-results .search li:first-child{border-top:1px solid #e1e4e5;padding-top:24px}#search-results .search li a{font-size:120%;margin-bottom:12px;display:inline-block}#search-results .context{color:grey;font-size:90%}.genindextable li>ul{margin-left:24px}@media screen and (max-width:768px){.wy-body-for-nav{background:#fcfcfc}.wy-nav-top{display:block}.wy-nav-side{left:-300px}.wy-nav-side.shift{width:85%;left:0}.wy-menu.wy-menu-vertical,.wy-side-nav-search,.wy-side-scroll{width:auto}.wy-nav-content-wrap{margin-left:0}.wy-nav-content-wrap .wy-nav-content{padding:1.618em}.wy-nav-content-wrap.shift{position:fixed;min-width:100%;left:85%;top:0;height:100%;overflow:hidden}}@media screen and (min-width:1100px){.wy-nav-content-wrap{background:rgba(0,0,0,.05)}.wy-nav-content{margin:0;background:#fcfcfc}}@media print{.rst-versions,.wy-nav-side,footer{display:none}.wy-nav-content-wrap{margin-left:0}}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60;*zoom:1}.rst-versions .rst-current-version:after,.rst-versions .rst-current-version:before{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-content .code-block-caption .rst-versions .rst-current-version .headerlink,.rst-content .eqno .rst-versions .rst-current-version .headerlink,.rst-content .rst-versions .rst-current-version .admonition-title,.rst-content code.download .rst-versions .rst-current-version span:first-child,.rst-content dl dt .rst-versions .rst-current-version .headerlink,.rst-content h1 .rst-versions .rst-current-version .headerlink,.rst-content h2 .rst-versions .rst-current-version .headerlink,.rst-content h3 .rst-versions .rst-current-version .headerlink,.rst-content h4 .rst-versions .rst-current-version .headerlink,.rst-content h5 .rst-versions .rst-current-version .headerlink,.rst-content h6 .rst-versions .rst-current-version .headerlink,.rst-content p .rst-versions .rst-current-version .headerlink,.rst-content table>caption .rst-versions .rst-current-version .headerlink,.rst-content tt.download .rst-versions .rst-current-version span:first-child,.rst-versions .rst-current-version .fa,.rst-versions .rst-current-version .icon,.rst-versions .rst-current-version .rst-content .admonition-title,.rst-versions .rst-current-version .rst-content .code-block-caption .headerlink,.rst-versions .rst-current-version .rst-content .eqno .headerlink,.rst-versions .rst-current-version .rst-content code.download span:first-child,.rst-versions .rst-current-version .rst-content dl dt .headerlink,.rst-versions .rst-current-version .rst-content h1 .headerlink,.rst-versions .rst-current-version .rst-content h2 .headerlink,.rst-versions .rst-current-version .rst-content h3 .headerlink,.rst-versions .rst-current-version .rst-content h4 .headerlink,.rst-versions .rst-current-version .rst-content h5 .headerlink,.rst-versions .rst-current-version .rst-content h6 .headerlink,.rst-versions .rst-current-version .rst-content p .headerlink,.rst-versions .rst-current-version .rst-content table>caption .headerlink,.rst-versions .rst-current-version .rst-content tt.download span:first-child,.rst-versions .rst-current-version .wy-menu-vertical li button.toctree-expand,.wy-menu-vertical li .rst-versions .rst-current-version button.toctree-expand{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions .rst-other-versions .rtd-current-item{font-weight:700}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}#flyout-search-form{padding:6px}.rst-content .toctree-wrapper>p.caption,.rst-content h1,.rst-content h2,.rst-content h3,.rst-content h4,.rst-content h5,.rst-content h6{margin-bottom:24px}.rst-content img{max-width:100%;height:auto}.rst-content div.figure,.rst-content figure{margin-bottom:24px}.rst-content div.figure .caption-text,.rst-content figure .caption-text{font-style:italic}.rst-content div.figure p:last-child.caption,.rst-content figure p:last-child.caption{margin-bottom:0}.rst-content div.figure.align-center,.rst-content figure.align-center{text-align:center}.rst-content .section>a>img,.rst-content .section>img,.rst-content section>a>img,.rst-content section>img{margin-bottom:24px}.rst-content abbr[title]{text-decoration:none}.rst-content.style-external-links a.reference.external:after{font-family:FontAwesome;content:"\f08e";color:#b3b3b3;vertical-align:super;font-size:60%;margin:0 .2em}.rst-content blockquote{margin-left:24px;line-height:24px;margin-bottom:24px}.rst-content pre.literal-block{white-space:pre;margin:0;padding:12px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;display:block;overflow:auto}.rst-content div[class^=highlight],.rst-content pre.literal-block{border:1px solid #e1e4e5;overflow-x:auto;margin:1px 0 24px}.rst-content div[class^=highlight] div[class^=highlight],.rst-content pre.literal-block div[class^=highlight]{padding:0;border:none;margin:0}.rst-content div[class^=highlight] td.code{width:100%}.rst-content .linenodiv pre{border-right:1px solid #e6e9ea;margin:0;padding:12px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;user-select:none;pointer-events:none}.rst-content div[class^=highlight] pre{white-space:pre;margin:0;padding:12px;display:block;overflow:auto}.rst-content div[class^=highlight] pre .hll{display:block;margin:0 -12px;padding:0 12px}.rst-content .linenodiv pre,.rst-content div[class^=highlight] pre,.rst-content pre.literal-block{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;font-size:12px;line-height:1.4}.rst-content div.highlight .gp,.rst-content div.highlight span.linenos{user-select:none;pointer-events:none}.rst-content div.highlight span.linenos{display:inline-block;padding-left:0;padding-right:12px;margin-right:12px;border-right:1px solid #e6e9ea}.rst-content .code-block-caption{font-style:italic;font-size:85%;line-height:1;padding:1em 0;text-align:center}@media print{.rst-content .codeblock,.rst-content div[class^=highlight],.rst-content div[class^=highlight] pre{white-space:pre-wrap}}.rst-content .admonition,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning{clear:both}.rst-content .admonition-todo .last,.rst-content .admonition-todo>:last-child,.rst-content .admonition .last,.rst-content .admonition>:last-child,.rst-content .attention .last,.rst-content .attention>:last-child,.rst-content .caution .last,.rst-content .caution>:last-child,.rst-content .danger .last,.rst-content .danger>:last-child,.rst-content .error .last,.rst-content .error>:last-child,.rst-content .hint .last,.rst-content .hint>:last-child,.rst-content .important .last,.rst-content .important>:last-child,.rst-content .note .last,.rst-content .note>:last-child,.rst-content .seealso .last,.rst-content .seealso>:last-child,.rst-content .tip .last,.rst-content .tip>:last-child,.rst-content .warning .last,.rst-content .warning>:last-child{margin-bottom:0}.rst-content .admonition-title:before{margin-right:4px}.rst-content .admonition table{border-color:rgba(0,0,0,.1)}.rst-content .admonition table td,.rst-content .admonition table th{background:transparent!important;border-color:rgba(0,0,0,.1)!important}.rst-content .section ol.loweralpha,.rst-content .section ol.loweralpha>li,.rst-content .toctree-wrapper ol.loweralpha,.rst-content .toctree-wrapper ol.loweralpha>li,.rst-content section ol.loweralpha,.rst-content section ol.loweralpha>li{list-style:lower-alpha}.rst-content .section ol.upperalpha,.rst-content .section ol.upperalpha>li,.rst-content .toctree-wrapper ol.upperalpha,.rst-content .toctree-wrapper ol.upperalpha>li,.rst-content section ol.upperalpha,.rst-content section ol.upperalpha>li{list-style:upper-alpha}.rst-content .section ol li>*,.rst-content .section ul li>*,.rst-content .toctree-wrapper ol li>*,.rst-content .toctree-wrapper ul li>*,.rst-content section ol li>*,.rst-content section ul li>*{margin-top:12px;margin-bottom:12px}.rst-content .section ol li>:first-child,.rst-content .section ul li>:first-child,.rst-content .toctree-wrapper ol li>:first-child,.rst-content .toctree-wrapper ul li>:first-child,.rst-content section ol li>:first-child,.rst-content section ul li>:first-child{margin-top:0}.rst-content .section ol li>p,.rst-content .section ol li>p:last-child,.rst-content .section ul li>p,.rst-content .section ul li>p:last-child,.rst-content .toctree-wrapper ol li>p,.rst-content .toctree-wrapper ol li>p:last-child,.rst-content .toctree-wrapper ul li>p,.rst-content .toctree-wrapper ul li>p:last-child,.rst-content section ol li>p,.rst-content section ol li>p:last-child,.rst-content section ul li>p,.rst-content section ul li>p:last-child{margin-bottom:12px}.rst-content .section ol li>p:only-child,.rst-content .section ol li>p:only-child:last-child,.rst-content .section ul li>p:only-child,.rst-content .section ul li>p:only-child:last-child,.rst-content .toctree-wrapper ol li>p:only-child,.rst-content .toctree-wrapper ol li>p:only-child:last-child,.rst-content .toctree-wrapper ul li>p:only-child,.rst-content .toctree-wrapper ul li>p:only-child:last-child,.rst-content section ol li>p:only-child,.rst-content section ol li>p:only-child:last-child,.rst-content section ul li>p:only-child,.rst-content section ul li>p:only-child:last-child{margin-bottom:0}.rst-content .section ol li>ol,.rst-content .section ol li>ul,.rst-content .section ul li>ol,.rst-content .section ul li>ul,.rst-content .toctree-wrapper ol li>ol,.rst-content .toctree-wrapper ol li>ul,.rst-content .toctree-wrapper ul li>ol,.rst-content .toctree-wrapper ul li>ul,.rst-content section ol li>ol,.rst-content section ol li>ul,.rst-content section ul li>ol,.rst-content section ul li>ul{margin-bottom:12px}.rst-content .section ol.simple li>*,.rst-content .section ol.simple li ol,.rst-content .section ol.simple li ul,.rst-content .section ul.simple li>*,.rst-content .section ul.simple li ol,.rst-content .section ul.simple li ul,.rst-content .toctree-wrapper ol.simple li>*,.rst-content .toctree-wrapper ol.simple li ol,.rst-content .toctree-wrapper ol.simple li ul,.rst-content .toctree-wrapper ul.simple li>*,.rst-content .toctree-wrapper ul.simple li ol,.rst-content .toctree-wrapper ul.simple li ul,.rst-content section ol.simple li>*,.rst-content section ol.simple li ol,.rst-content section ol.simple li ul,.rst-content section ul.simple li>*,.rst-content section ul.simple li ol,.rst-content section ul.simple li ul{margin-top:0;margin-bottom:0}.rst-content .line-block{margin-left:0;margin-bottom:24px;line-height:24px}.rst-content .line-block .line-block{margin-left:24px;margin-bottom:0}.rst-content .topic-title{font-weight:700;margin-bottom:12px}.rst-content .toc-backref{color:#404040}.rst-content .align-right{float:right;margin:0 0 24px 24px}.rst-content .align-left{float:left;margin:0 24px 24px 0}.rst-content .align-center{margin:auto}.rst-content .align-center:not(table){display:block}.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content .toctree-wrapper>p.caption .headerlink,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink{opacity:0;font-size:14px;font-family:FontAwesome;margin-left:.5em}.rst-content .code-block-caption .headerlink:focus,.rst-content .code-block-caption:hover .headerlink,.rst-content .eqno .headerlink:focus,.rst-content .eqno:hover .headerlink,.rst-content .toctree-wrapper>p.caption .headerlink:focus,.rst-content .toctree-wrapper>p.caption:hover .headerlink,.rst-content dl dt .headerlink:focus,.rst-content dl dt:hover .headerlink,.rst-content h1 .headerlink:focus,.rst-content h1:hover .headerlink,.rst-content h2 .headerlink:focus,.rst-content h2:hover .headerlink,.rst-content h3 .headerlink:focus,.rst-content h3:hover .headerlink,.rst-content h4 .headerlink:focus,.rst-content h4:hover .headerlink,.rst-content h5 .headerlink:focus,.rst-content h5:hover .headerlink,.rst-content h6 .headerlink:focus,.rst-content h6:hover .headerlink,.rst-content p.caption .headerlink:focus,.rst-content p.caption:hover .headerlink,.rst-content p .headerlink:focus,.rst-content p:hover .headerlink,.rst-content table>caption .headerlink:focus,.rst-content table>caption:hover .headerlink{opacity:1}.rst-content p a{overflow-wrap:anywhere}.rst-content .wy-table td p,.rst-content .wy-table td ul,.rst-content .wy-table th p,.rst-content .wy-table th ul,.rst-content table.docutils td p,.rst-content table.docutils td ul,.rst-content table.docutils th p,.rst-content table.docutils th ul,.rst-content table.field-list td p,.rst-content table.field-list td ul,.rst-content table.field-list th p,.rst-content table.field-list th ul{font-size:inherit}.rst-content .btn:focus{outline:2px solid}.rst-content table>caption .headerlink:after{font-size:12px}.rst-content .centered{text-align:center}.rst-content .sidebar{float:right;width:40%;display:block;margin:0 0 24px 24px;padding:24px;background:#f3f6f6;border:1px solid #e1e4e5}.rst-content .sidebar dl,.rst-content .sidebar p,.rst-content .sidebar ul{font-size:90%}.rst-content .sidebar .last,.rst-content .sidebar>:last-child{margin-bottom:0}.rst-content .sidebar .sidebar-title{display:block;font-family:Roboto Slab,ff-tisa-web-pro,Georgia,Arial,sans-serif;font-weight:700;background:#e1e4e5;padding:6px 12px;margin:-24px -24px 24px;font-size:100%}.rst-content .highlighted{background:#f1c40f;box-shadow:0 0 0 2px #f1c40f;display:inline;font-weight:700}.rst-content .citation-reference,.rst-content .footnote-reference{vertical-align:baseline;position:relative;top:-.4em;line-height:0;font-size:90%}.rst-content .citation-reference>span.fn-bracket,.rst-content .footnote-reference>span.fn-bracket{display:none}.rst-content .hlist{width:100%}.rst-content dl dt span.classifier:before{content:" : "}.rst-content dl dt span.classifier-delimiter{display:none!important}html.writer-html4 .rst-content table.docutils.citation,html.writer-html4 .rst-content table.docutils.footnote{background:none;border:none}html.writer-html4 .rst-content table.docutils.citation td,html.writer-html4 .rst-content table.docutils.citation tr,html.writer-html4 .rst-content table.docutils.footnote td,html.writer-html4 .rst-content table.docutils.footnote tr{border:none;background-color:transparent!important;white-space:normal}html.writer-html4 .rst-content table.docutils.citation td.label,html.writer-html4 .rst-content table.docutils.footnote td.label{padding-left:0;padding-right:0;vertical-align:top}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.field-list,html.writer-html5 .rst-content dl.footnote{display:grid;grid-template-columns:auto minmax(80%,95%)}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dt{display:inline-grid;grid-template-columns:max-content auto}html.writer-html5 .rst-content aside.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content div.citation{display:grid;grid-template-columns:auto auto minmax(.65rem,auto) minmax(40%,95%)}html.writer-html5 .rst-content aside.citation>span.label,html.writer-html5 .rst-content aside.footnote>span.label,html.writer-html5 .rst-content div.citation>span.label{grid-column-start:1;grid-column-end:2}html.writer-html5 .rst-content aside.citation>span.backrefs,html.writer-html5 .rst-content aside.footnote>span.backrefs,html.writer-html5 .rst-content div.citation>span.backrefs{grid-column-start:2;grid-column-end:3;grid-row-start:1;grid-row-end:3}html.writer-html5 .rst-content aside.citation>p,html.writer-html5 .rst-content aside.footnote>p,html.writer-html5 .rst-content div.citation>p{grid-column-start:4;grid-column-end:5}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.field-list,html.writer-html5 .rst-content dl.footnote{margin-bottom:24px}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dt{padding-left:1rem}html.writer-html5 .rst-content dl.citation>dd,html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dd,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dd,html.writer-html5 .rst-content dl.footnote>dt{margin-bottom:0}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.footnote{font-size:.9rem}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.footnote>dt{margin:0 .5rem .5rem 0;line-height:1.2rem;word-break:break-all;font-weight:400}html.writer-html5 .rst-content dl.citation>dt>span.brackets:before,html.writer-html5 .rst-content dl.footnote>dt>span.brackets:before{content:"["}html.writer-html5 .rst-content dl.citation>dt>span.brackets:after,html.writer-html5 .rst-content dl.footnote>dt>span.brackets:after{content:"]"}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref{text-align:left;font-style:italic;margin-left:.65rem;word-break:break-word;word-spacing:-.1rem;max-width:5rem}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref>a,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref>a{word-break:keep-all}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref>a:not(:first-child):before,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref>a:not(:first-child):before{content:" "}html.writer-html5 .rst-content dl.citation>dd,html.writer-html5 .rst-content dl.footnote>dd{margin:0 0 .5rem;line-height:1.2rem}html.writer-html5 .rst-content dl.citation>dd p,html.writer-html5 .rst-content dl.footnote>dd p{font-size:.9rem}html.writer-html5 .rst-content aside.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content div.citation{padding-left:1rem;padding-right:1rem;font-size:.9rem;line-height:1.2rem}html.writer-html5 .rst-content aside.citation p,html.writer-html5 .rst-content aside.footnote p,html.writer-html5 .rst-content div.citation p{font-size:.9rem;line-height:1.2rem;margin-bottom:12px}html.writer-html5 .rst-content aside.citation span.backrefs,html.writer-html5 .rst-content aside.footnote span.backrefs,html.writer-html5 .rst-content div.citation span.backrefs{text-align:left;font-style:italic;margin-left:.65rem;word-break:break-word;word-spacing:-.1rem;max-width:5rem}html.writer-html5 .rst-content aside.citation span.backrefs>a,html.writer-html5 .rst-content aside.footnote span.backrefs>a,html.writer-html5 .rst-content div.citation span.backrefs>a{word-break:keep-all}html.writer-html5 .rst-content aside.citation span.backrefs>a:not(:first-child):before,html.writer-html5 .rst-content aside.footnote span.backrefs>a:not(:first-child):before,html.writer-html5 .rst-content div.citation span.backrefs>a:not(:first-child):before{content:" "}html.writer-html5 .rst-content aside.citation span.label,html.writer-html5 .rst-content aside.footnote span.label,html.writer-html5 .rst-content div.citation span.label{line-height:1.2rem}html.writer-html5 .rst-content aside.citation-list,html.writer-html5 .rst-content aside.footnote-list,html.writer-html5 .rst-content div.citation-list{margin-bottom:24px}html.writer-html5 .rst-content dl.option-list kbd{font-size:.9rem}.rst-content table.docutils.footnote,html.writer-html4 .rst-content table.docutils.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content aside.footnote-list aside.footnote,html.writer-html5 .rst-content div.citation-list>div.citation,html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.footnote{color:grey}.rst-content table.docutils.footnote code,.rst-content table.docutils.footnote tt,html.writer-html4 .rst-content table.docutils.citation code,html.writer-html4 .rst-content table.docutils.citation tt,html.writer-html5 .rst-content aside.footnote-list aside.footnote code,html.writer-html5 .rst-content aside.footnote-list aside.footnote tt,html.writer-html5 .rst-content aside.footnote code,html.writer-html5 .rst-content aside.footnote tt,html.writer-html5 .rst-content div.citation-list>div.citation code,html.writer-html5 .rst-content div.citation-list>div.citation tt,html.writer-html5 .rst-content dl.citation code,html.writer-html5 .rst-content dl.citation tt,html.writer-html5 .rst-content dl.footnote code,html.writer-html5 .rst-content dl.footnote tt{color:#555}.rst-content .wy-table-responsive.citation,.rst-content .wy-table-responsive.footnote{margin-bottom:0}.rst-content .wy-table-responsive.citation+:not(.citation),.rst-content .wy-table-responsive.footnote+:not(.footnote){margin-top:24px}.rst-content .wy-table-responsive.citation:last-child,.rst-content .wy-table-responsive.footnote:last-child{margin-bottom:24px}.rst-content table.docutils th{border-color:#e1e4e5}html.writer-html5 .rst-content table.docutils th{border:1px solid #e1e4e5}html.writer-html5 .rst-content table.docutils td>p,html.writer-html5 .rst-content table.docutils th>p{line-height:1rem;margin-bottom:0;font-size:.9rem}.rst-content table.docutils td .last,.rst-content table.docutils td .last>:last-child{margin-bottom:0}.rst-content table.field-list,.rst-content table.field-list td{border:none}.rst-content table.field-list td p{line-height:inherit}.rst-content table.field-list td>strong{display:inline-block}.rst-content table.field-list .field-name{padding-right:10px;text-align:left;white-space:nowrap}.rst-content table.field-list .field-body{text-align:left}.rst-content code,.rst-content tt{color:#000;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;padding:2px 5px}.rst-content code big,.rst-content code em,.rst-content tt big,.rst-content tt em{font-size:100%!important;line-height:normal}.rst-content code.literal,.rst-content tt.literal{color:#e74c3c;white-space:normal}.rst-content code.xref,.rst-content tt.xref,a .rst-content code,a .rst-content tt{font-weight:700;color:#404040;overflow-wrap:normal}.rst-content kbd,.rst-content pre,.rst-content samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace}.rst-content a code,.rst-content a tt{color:#2980b9}.rst-content dl{margin-bottom:24px}.rst-content dl dt{font-weight:700;margin-bottom:12px}.rst-content dl ol,.rst-content dl p,.rst-content dl table,.rst-content dl ul{margin-bottom:12px}.rst-content dl dd{margin:0 0 12px 24px;line-height:24px}.rst-content dl dd>ol:last-child,.rst-content dl dd>p:last-child,.rst-content dl dd>table:last-child,.rst-content dl dd>ul:last-child{margin-bottom:0}html.writer-html4 .rst-content dl:not(.docutils),html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple){margin-bottom:24px}html.writer-html4 .rst-content dl:not(.docutils)>dt,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt{display:table;margin:6px 0;font-size:90%;line-height:normal;background:#e7f2fa;color:#2980b9;border-top:3px solid #6ab0de;padding:6px;position:relative}html.writer-html4 .rst-content dl:not(.docutils)>dt:before,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt:before{color:#6ab0de}html.writer-html4 .rst-content dl:not(.docutils)>dt .headerlink,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink{color:#404040;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt{margin-bottom:6px;border:none;border-left:3px solid #ccc;background:#f0f0f0;color:#555}html.writer-html4 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink{color:#404040;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils)>dt:first-child,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt:first-child{margin-top:0}html.writer-html4 .rst-content dl:not(.docutils) code.descclassname,html.writer-html4 .rst-content dl:not(.docutils) code.descname,html.writer-html4 .rst-content dl:not(.docutils) tt.descclassname,html.writer-html4 .rst-content dl:not(.docutils) tt.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descname{background-color:transparent;border:none;padding:0;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils) code.descname,html.writer-html4 .rst-content dl:not(.docutils) tt.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descname{font-weight:700}html.writer-html4 .rst-content dl:not(.docutils) .optional,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .optional{display:inline-block;padding:0 4px;color:#000;font-weight:700}html.writer-html4 .rst-content dl:not(.docutils) .property,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .property{display:inline-block;padding-right:8px;max-width:100%}html.writer-html4 .rst-content dl:not(.docutils) .k,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .k{font-style:italic}html.writer-html4 .rst-content dl:not(.docutils) .descclassname,html.writer-html4 .rst-content dl:not(.docutils) .descname,html.writer-html4 .rst-content dl:not(.docutils) .sig-name,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .sig-name{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;color:#000}.rst-content .viewcode-back,.rst-content .viewcode-link{display:inline-block;color:#27ae60;font-size:80%;padding-left:24px}.rst-content .viewcode-back{display:block;float:right}.rst-content p.rubric{margin-bottom:12px;font-weight:700}.rst-content code.download,.rst-content tt.download{background:inherit;padding:inherit;font-weight:400;font-family:inherit;font-size:inherit;color:inherit;border:inherit;white-space:inherit}.rst-content code.download span:first-child,.rst-content tt.download span:first-child{-webkit-font-smoothing:subpixel-antialiased}.rst-content code.download span:first-child:before,.rst-content tt.download span:first-child:before{margin-right:4px}.rst-content .guilabel,.rst-content .menuselection{font-size:80%;font-weight:700;border-radius:4px;padding:2.4px 6px;margin:auto 2px}.rst-content .guilabel,.rst-content .menuselection{border:1px solid #7fbbe3;background:#e7f2fa}.rst-content :not(dl.option-list)>:not(dt):not(kbd):not(.kbd)>.kbd,.rst-content :not(dl.option-list)>:not(dt):not(kbd):not(.kbd)>kbd{color:inherit;font-size:80%;background-color:#fff;border:1px solid #a6a6a6;border-radius:4px;box-shadow:0 2px grey;padding:2.4px 6px;margin:auto 0}.rst-content .versionmodified{font-style:italic}@media screen and (max-width:480px){.rst-content .sidebar{width:100%}}span[id*=MathJax-Span]{color:#404040}.math{text-align:center}@font-face{font-family:Lato;src:url(fonts/lato-normal.woff2?bd03a2cc277bbbc338d464e679fe9942) format("woff2"),url(fonts/lato-normal.woff?27bd77b9162d388cb8d4c4217c7c5e2a) format("woff");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-bold.woff2?cccb897485813c7c256901dbca54ecf2) format("woff2"),url(fonts/lato-bold.woff?d878b6c29b10beca227e9eef4246111b) format("woff");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-bold-italic.woff2?0b6bb6725576b072c5d0b02ecdd1900d) format("woff2"),url(fonts/lato-bold-italic.woff?9c7e4e9eb485b4a121c760e61bc3707c) format("woff");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-normal-italic.woff2?4eb103b4d12be57cb1d040ed5e162e9d) format("woff2"),url(fonts/lato-normal-italic.woff?f28f2d6482446544ef1ea1ccc6dd5892) format("woff");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:Roboto Slab;font-style:normal;font-weight:400;src:url(fonts/Roboto-Slab-Regular.woff2?7abf5b8d04d26a2cafea937019bca958) format("woff2"),url(fonts/Roboto-Slab-Regular.woff?c1be9284088d487c5e3ff0a10a92e58c) format("woff");font-display:block}@font-face{font-family:Roboto Slab;font-style:normal;font-weight:700;src:url(fonts/Roboto-Slab-Bold.woff2?9984f4a9bda09be08e83f2506954adbe) format("woff2"),url(fonts/Roboto-Slab-Bold.woff?bed5564a116b05148e3b3bea6fb1162a) format("woff");font-display:block} diff --git a/_build/html_zh_CN/_static/css/toggle.css b/_build/html_zh_CN/_static/css/toggle.css new file mode 100644 index 0000000000..d2f278d1a2 --- /dev/null +++ b/_build/html_zh_CN/_static/css/toggle.css @@ -0,0 +1,77 @@ +input[type=checkbox] { + visibility: hidden; + height: 0; + width: 0; + margin: 0; +} + +.rst-versions .rst-current-version { + padding: 10px; + display: flex; + justify-content: space-between; +} + +.rst-versions .rst-current-version .fa-book, +.rst-versions .rst-current-version .fa-v, +.rst-versions .rst-current-version .fa-caret-down { + height: 24px; + line-height: 24px; + vertical-align: middle; +} + +.rst-versions .rst-current-version .fa-element { + width: 80px; + text-align: center; +} + +.rst-versions .rst-current-version .fa-book { + text-align: left; +} + +.rst-versions .rst-current-version .fa-v { + color: #27AE60; + text-align: right; +} + +label { + margin: 0 auto; + display: inline-block; + justify-content: center; + align-items: right; + border-radius: 100px; + position: relative; + cursor: pointer; + text-indent: -9999px; + width: 50px; + height: 21px; + background: #000; +} + +label:after { + border-radius: 50%; + position: absolute; + content: ''; + background: #fff; + width: 15px; + height: 15px; + top: 3px; + left: 3px; + transition: ease-in-out 200ms; +} + +input:checked+label { + background: #3a7ca8; +} + +input:checked+label:after { + left: calc(100% - 5px); + transform: translateX(-100%); +} + +html.transition, +html.transition *, +html.transition *:before, +html.transition *:after { + transition: ease-in-out 200ms !important; + transition-delay: 0 !important; +} diff --git a/_build/html_zh_CN/_static/doctools.js b/_build/html_zh_CN/_static/doctools.js new file mode 100644 index 0000000000..0398ebb9f0 --- /dev/null +++ b/_build/html_zh_CN/_static/doctools.js @@ -0,0 +1,149 @@ +/* + * Base JavaScript utilities for all Sphinx HTML documentation. + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/_build/html_zh_CN/_static/documentation_options.js b/_build/html_zh_CN/_static/documentation_options.js new file mode 100644 index 0000000000..e5f0c463cf --- /dev/null +++ b/_build/html_zh_CN/_static/documentation_options.js @@ -0,0 +1,13 @@ +const DOCUMENTATION_OPTIONS = { + VERSION: '7.13.0', + LANGUAGE: 'zh-CN', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; diff --git a/_build/html_zh_CN/_static/file.png b/_build/html_zh_CN/_static/file.png new file mode 100644 index 0000000000..a858a410e4 Binary files /dev/null and b/_build/html_zh_CN/_static/file.png differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bold.eot b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.eot new file mode 100644 index 0000000000..3361183a41 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.eot differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bold.ttf b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.ttf new file mode 100644 index 0000000000..29f691d5ed Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.ttf differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bold.woff b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.woff new file mode 100644 index 0000000000..c6dff51f06 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.woff differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bold.woff2 b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.woff2 new file mode 100644 index 0000000000..bb195043cf Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bold.woff2 differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.eot b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.eot new file mode 100644 index 0000000000..3d4154936b Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.eot differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.ttf b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.ttf new file mode 100644 index 0000000000..f402040b3e Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.ttf differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.woff b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.woff new file mode 100644 index 0000000000..88ad05b9ff Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.woff differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.woff2 b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.woff2 new file mode 100644 index 0000000000..c4e3d804b5 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-bolditalic.woff2 differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-italic.eot b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.eot new file mode 100644 index 0000000000..3f826421a1 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.eot differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-italic.ttf b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.ttf new file mode 100644 index 0000000000..b4bfc9b24a Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.ttf differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-italic.woff b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.woff new file mode 100644 index 0000000000..76114bc033 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.woff differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-italic.woff2 b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.woff2 new file mode 100644 index 0000000000..3404f37e2e Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-italic.woff2 differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-regular.eot b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.eot new file mode 100644 index 0000000000..11e3f2a5f0 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.eot differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-regular.ttf b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.ttf new file mode 100644 index 0000000000..74decd9ebb Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.ttf differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-regular.woff b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.woff new file mode 100644 index 0000000000..ae1307ff5f Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.woff differ diff --git a/_build/html_zh_CN/_static/fonts/Lato/lato-regular.woff2 b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.woff2 new file mode 100644 index 0000000000..3bf9843328 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/Lato/lato-regular.woff2 differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot new file mode 100644 index 0000000000..79dc8efed3 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf new file mode 100644 index 0000000000..df5d1df273 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff new file mode 100644 index 0000000000..6cb6000018 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 new file mode 100644 index 0000000000..7059e23142 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot new file mode 100644 index 0000000000..2f7ca78a1e Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf new file mode 100644 index 0000000000..eb52a79073 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff new file mode 100644 index 0000000000..f815f63f99 Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff differ diff --git a/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 new file mode 100644 index 0000000000..f2c76e5bda Binary files /dev/null and b/_build/html_zh_CN/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 differ diff --git a/_build/html_zh_CN/_static/jquery.js b/_build/html_zh_CN/_static/jquery.js new file mode 100644 index 0000000000..c4c6022f29 --- /dev/null +++ b/_build/html_zh_CN/_static/jquery.js @@ -0,0 +1,2 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0"),n("table.docutils.footnote").wrap("
"),n("table.docutils.citation").wrap("
"),n(".wy-menu-vertical ul").not(".simple").siblings("a").each((function(){var t=n(this);expand=n(''),expand.on("click",(function(n){return e.toggleCurrent(t),n.stopPropagation(),!1})),t.prepend(expand)}))},reset:function(){var n=encodeURI(window.location.hash)||"#";try{var e=$(".wy-menu-vertical"),t=e.find('[href="'+n+'"]');if(0===t.length){var i=$('.document [id="'+n.substring(1)+'"]').closest("div.section");0===(t=e.find('[href="#'+i.attr("id")+'"]')).length&&(t=e.find('[href="#"]'))}if(t.length>0){$(".wy-menu-vertical .current").removeClass("current").attr("aria-expanded","false"),t.addClass("current").attr("aria-expanded","true"),t.closest("li.toctree-l1").parent().addClass("current").attr("aria-expanded","true");for(let n=1;n<=10;n++)t.closest("li.toctree-l"+n).addClass("current").attr("aria-expanded","true");t[0].scrollIntoView()}}catch(n){console.log("Error expanding nav for anchor",n)}},onScroll:function(){this.winScroll=!1;var n=this.win.scrollTop(),e=n+this.winHeight,t=this.navBar.scrollTop()+(n-this.winPosition);n<0||e>this.docHeight||(this.navBar.scrollTop(t),this.winPosition=n)},onResize:function(){this.winResize=!1,this.winHeight=this.win.height(),this.docHeight=$(document).height()},hashChange:function(){this.linkScroll=!0,this.win.one("hashchange",(function(){this.linkScroll=!1}))},toggleCurrent:function(n){var e=n.closest("li");e.siblings("li.current").removeClass("current").attr("aria-expanded","false"),e.siblings().find("li.current").removeClass("current").attr("aria-expanded","false");var t=e.find("> ul li");t.length&&(t.removeClass("current").attr("aria-expanded","false"),e.toggleClass("current").attr("aria-expanded",(function(n,e){return"true"==e?"false":"true"})))}},"undefined"!=typeof window&&(window.SphinxRtdTheme={Navigation:n.exports.ThemeNav,StickyNav:n.exports.ThemeNav}),function(){for(var n=0,e=["ms","moz","webkit","o"],t=0;t { + document.documentElement.classList.remove('transition'); + }, 1000) + toggleCssMode(this.checked); + }) + +}); diff --git a/_build/html_zh_CN/_static/js/versions.js b/_build/html_zh_CN/_static/js/versions.js new file mode 100644 index 0000000000..f00ad5a691 --- /dev/null +++ b/_build/html_zh_CN/_static/js/versions.js @@ -0,0 +1,228 @@ +const themeFlyoutDisplay = "hidden"; +const themeVersionSelector = true; +const themeLanguageSelector = true; + +if (themeFlyoutDisplay === "attached") { + function renderLanguages(config) { + if (!config.projects.translations.length) { + return ""; + } + + // Insert the current language to the options on the selector + let languages = config.projects.translations.concat(config.projects.current); + languages = languages.sort((a, b) => a.language.name.localeCompare(b.language.name)); + + const languagesHTML = ` +
+
Languages
+ ${languages + .map( + (translation) => ` +
+ ${translation.language.code} +
+ `, + ) + .join("\n")} +
+ `; + return languagesHTML; + } + + function renderVersions(config) { + if (!config.versions.active.length) { + return ""; + } + const versionsHTML = ` +
+
版本
+ ${config.versions.active + .map( + (version) => ` +
+ ${version.slug} +
+ `, + ) + .join("\n")} +
+ `; + return versionsHTML; + } + + function renderDownloads(config) { + if (!Object.keys(config.versions.current.downloads).length) { + return ""; + } + const downloadsNameDisplay = { + pdf: "PDF", + epub: "Epub", + htmlzip: "HTML", + }; + + const downloadsHTML = ` +
+
下载
+ ${Object.entries(config.versions.current.downloads) + .map( + ([name, url]) => ` +
+ ${downloadsNameDisplay[name]} +
+ `, + ) + .join("\n")} +
+ `; + return downloadsHTML; + } + + document.addEventListener("readthedocs-addons-data-ready", function (event) { + const config = event.detail.data(); + + const flyout = ` +
+ + Read the Docs + v: ${config.versions.current.slug} + + +
+
+ ${renderLanguages(config)} + ${renderVersions(config)} + ${renderDownloads(config)} +
+
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+ 下载 +
+
+
+
搜索
+
+
+ +
+
+
+
+ + Hosted by Read the Docs + +
+
+ `; + + // Inject the generated flyout into the body HTML element. + document.body.insertAdjacentHTML("beforeend", flyout); + + // Trigger the Read the Docs Addons Search modal when clicking on the "Search docs" input from inside the flyout. + document + .querySelector("#flyout-search-form") + .addEventListener("focusin", () => { + const event = new CustomEvent("readthedocs-search-show"); + document.dispatchEvent(event); + }); + }) +} + +if (themeLanguageSelector || themeVersionSelector) { + function onSelectorSwitch(event) { + const option = event.target.selectedIndex; + const item = event.target.options[option]; + window.location.href = item.dataset.url; + } + + document.addEventListener("readthedocs-addons-data-ready", function (event) { + const config = event.detail.data(); + + const versionSwitch = document.querySelector( + "div.switch-menus > div.version-switch", + ); + if (themeVersionSelector) { + let versions = config.versions.active; + if (config.versions.current.hidden || config.versions.current.type === "external") { + versions.unshift(config.versions.current); + } + const versionSelect = ` + + `; + + versionSwitch.innerHTML = versionSelect; + versionSwitch.firstElementChild.addEventListener("change", onSelectorSwitch); + } + + const languageSwitch = document.querySelector( + "div.switch-menus > div.language-switch", + ); + + if (themeLanguageSelector) { + if (config.projects.translations.length) { + // Add the current language to the options on the selector + let languages = config.projects.translations.concat( + config.projects.current, + ); + languages = languages.sort((a, b) => + a.language.name.localeCompare(b.language.name), + ); + + const languageSelect = ` + + `; + + languageSwitch.innerHTML = languageSelect; + languageSwitch.firstElementChild.addEventListener("change", onSelectorSwitch); + } + else { + languageSwitch.remove(); + } + } + }); +} + +document.addEventListener("readthedocs-addons-data-ready", function (event) { + // Trigger the Read the Docs Addons Search modal when clicking on "Search docs" input from the topnav. + document + .querySelector("[role='search'] input") + .addEventListener("focusin", () => { + const event = new CustomEvent("readthedocs-search-show"); + document.dispatchEvent(event); + }); +}); diff --git a/_build/html_zh_CN/_static/language_data.js b/_build/html_zh_CN/_static/language_data.js new file mode 100644 index 0000000000..a5ea78e114 --- /dev/null +++ b/_build/html_zh_CN/_static/language_data.js @@ -0,0 +1,191 @@ +/* + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, if available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} diff --git a/_build/html_zh_CN/_static/minus.png b/_build/html_zh_CN/_static/minus.png new file mode 100644 index 0000000000..d96755fdaf Binary files /dev/null and b/_build/html_zh_CN/_static/minus.png differ diff --git a/_build/html_zh_CN/_static/plus.png b/_build/html_zh_CN/_static/plus.png new file mode 100644 index 0000000000..7107cec93a Binary files /dev/null and b/_build/html_zh_CN/_static/plus.png differ diff --git a/_build/html_zh_CN/_static/pygments.css b/_build/html_zh_CN/_static/pygments.css new file mode 100644 index 0000000000..110e5a5155 --- /dev/null +++ b/_build/html_zh_CN/_static/pygments.css @@ -0,0 +1,75 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #eeffcc; } +.highlight .c { color: #408090; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #F00 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666 } /* Operator */ +.highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #408090; background-color: #FFF0F0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +.highlight .gr { color: #F00 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #333 } /* Generic.Output */ +.highlight .gp { color: #C65D09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #04D } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #208050 } /* Literal.Number */ +.highlight .s { color: #4070A0 } /* Literal.String */ +.highlight .na { color: #4070A0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0E84B5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60ADD5 } /* Name.Constant */ +.highlight .nd { color: #555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #D55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287E } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0E84B5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #BB60D5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #BBB } /* Text.Whitespace */ +.highlight .mb { color: #208050 } /* Literal.Number.Bin */ +.highlight .mf { color: #208050 } /* Literal.Number.Float */ +.highlight .mh { color: #208050 } /* Literal.Number.Hex */ +.highlight .mi { color: #208050 } /* Literal.Number.Integer */ +.highlight .mo { color: #208050 } /* Literal.Number.Oct */ +.highlight .sa { color: #4070A0 } /* Literal.String.Affix */ +.highlight .sb { color: #4070A0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070A0 } /* Literal.String.Char */ +.highlight .dl { color: #4070A0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #4070A0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070A0 } /* Literal.String.Double */ +.highlight .se { color: #4070A0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070A0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70A0D0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #C65D09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070A0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #06287E } /* Name.Function.Magic */ +.highlight .vc { color: #BB60D5 } /* Name.Variable.Class */ +.highlight .vg { color: #BB60D5 } /* Name.Variable.Global */ +.highlight .vi { color: #BB60D5 } /* Name.Variable.Instance */ +.highlight .vm { color: #BB60D5 } /* Name.Variable.Magic */ +.highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ diff --git a/_build/html_zh_CN/_static/searchtools.js b/_build/html_zh_CN/_static/searchtools.js new file mode 100644 index 0000000000..91f4be57fc --- /dev/null +++ b/_build/html_zh_CN/_static/searchtools.js @@ -0,0 +1,635 @@ +/* + * Sphinx JavaScript utilities for the full-text search. + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename, kind] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +// Global search result kind enum, used by themes to style search results. +class SearchResultKind { + static get index() { return "index"; } + static get object() { return "object"; } + static get text() { return "text"; } + static get title() { return "title"; } +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms, highlightTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; + + const [docName, title, anchor, descr, score, _filename, kind] = item; + + let listItem = document.createElement("li"); + // Add a class representing the item's type: + // can be used by a theme's CSS selector for styling + // See SearchResultKind for the class names. + listItem.classList.add(`kind-${kind}`); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = contentRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = contentRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) { + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms, anchor) + ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = Documentation.ngettext( + "Search finished, found one page matching the search query.", + "Search finished, found ${resultCount} pages matching the search query.", + resultCount, + ).replace('${resultCount}', resultCount); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms, + highlightTerms, +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms, highlightTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; +// Helper function used by query() to order search results. +// Each input is an array of [docname, title, anchor, descr, score, filename, kind]. +// Order the results by score (in opposite order of appearance, since the +// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. +const _orderResultsByScoreThenName = (a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString, anchor) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + for (const removalQuery of [".headerlink", "script", "style"]) { + htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + } + if (anchor) { + const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + if (anchorContent) return anchorContent.textContent; + + console.warn( + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + ); + } + + // if anchor not specified or not found, fall back to main content + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent) return docContent.textContent; + + console.warn( + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.setAttribute("role", "list"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + _parseQuery: (query) => { + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + return [query, searchTerms, excludedTerms, highlightTerms, objectTerms]; + }, + + /** + * execute search (requires search index to be loaded) + */ + _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // Collect multiple result groups to be sorted separately and then ordered. + // Each is an array of [docname, title, anchor, descr, score, filename, kind]. + const normalResults = []; + const nonMainIndexResults = []; + + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase().trim(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles + normalResults.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score + boost, + filenames[file], + SearchResultKind.title, + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id, isMain] of foundEntries) { + const score = Math.round(100 * queryLower.length / entry.length); + const result = [ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + SearchResultKind.index, + ]; + if (isMain) { + normalResults.push(result); + } else { + nonMainIndexResults.push(result); + } + } + } + } + + // lookup as object + objectTerms.forEach((term) => + normalResults.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) { + normalResults.forEach((item) => (item[4] = Scorer.score(item))); + nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item))); + } + + // Sort each group of results by score and then alphabetically by name. + normalResults.sort(_orderResultsByScoreThenName); + nonMainIndexResults.sort(_orderResultsByScoreThenName); + + // Combine the result groups in (reverse) order. + // Non-main index entries are typically arbitrary cross-references, + // so display them after other results. + let results = [...nonMainIndexResults, ...normalResults]; + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + return results.reverse(); + }, + + query: (query) => { + const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); + const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms, highlightTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + SearchResultKind.object, + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + // find documents, if any, containing the query word in their text/title term indices + // use Object.hasOwnProperty to avoid mismatching against prototype properties + const arr = [ + { files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term }, + { files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + if (!terms.hasOwnProperty(word)) { + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + } + if (!titleTerms.hasOwnProperty(word)) { + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: titleTerms[term], score: Scorer.partialTitle }); + }); + } + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, new Map()); + const fileScores = scoreMap.get(file); + fileScores.set(word, record.score); + }); + }); + + // create the mapping + files.forEach((file) => { + if (!fileMap.has(file)) fileMap.set(file, [word]); + else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w))); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + SearchResultKind.text, + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords, anchor) => { + const text = Search.htmlToText(htmlText, anchor); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/_build/html_zh_CN/_static/sphinx_highlight.js b/_build/html_zh_CN/_static/sphinx_highlight.js new file mode 100644 index 0000000000..8a96c69a19 --- /dev/null +++ b/_build/html_zh_CN/_static/sphinx_highlight.js @@ -0,0 +1,154 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); + parent.insertBefore( + span, + parent.insertBefore( + rest, + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/_build/html_zh_CN/_static/translations.js b/_build/html_zh_CN/_static/translations.js new file mode 100644 index 0000000000..c67c8be829 --- /dev/null +++ b/_build/html_zh_CN/_static/translations.js @@ -0,0 +1,60 @@ +Documentation.addTranslations({ + "locale": "zh_Hans_CN", + "messages": { + "%(filename)s — %(docstitle)s": "%(filename)s — %(docstitle)s", + "© %(copyright_prefix)s %(copyright)s.": "© %(copyright_prefix)s %(copyright)s.", + ", in ": "\uff0c\u5728 ", + "About these documents": "\u5173\u4e8e\u6b64\u6587\u6863", + "Automatically generated list of changes in version %(version)s": "\u81ea\u52a8\u751f\u6210\u7684 %(version)s \u7248\u672c\u53d8\u66f4\u5217\u8868", + "C API changes": "C API \u7684\u53d8\u66f4", + "Changes in Version %(version)s — %(docstitle)s": "\u4e8e\u7248\u672c %(version)s— %(docstitle)s \u53d8\u66f4", + "Collapse sidebar": "\u6298\u53e0\u8fb9\u680f", + "Complete Table of Contents": "\u5b8c\u6574\u76ee\u5f55", + "Contents": "\u76ee\u5f55", + "Copyright": "\u7248\u6743\u6240\u6709", + "Created using Sphinx %(sphinx_version)s.": "\u7531 Sphinx %(sphinx_version)s\u521b\u5efa\u3002", + "Expand sidebar": "\u5c55\u5f00\u8fb9\u680f", + "Full index on one page": "\u5355\u9875\u5168\u7d22\u5f15", + "General Index": "\u603b\u7d22\u5f15", + "Global Module Index": "\u5168\u5c40\u6a21\u5757\u7d22\u5f15", + "Go": "\u63d0\u4ea4", + "Hide Search Matches": "\u9690\u85cf\u641c\u7d22\u7ed3\u679c", + "Index": "\u7d22\u5f15", + "Index – %(key)s": "\u7d22\u5f15 – %(key)s", + "Index pages by letter": "\u5b57\u6bcd\u7d22\u5f15", + "Indices and tables:": "\u7d22\u5f15\u548c\u8868\u683c\uff1a", + "Last updated on %(last_updated)s.": "\u6700\u540e\u66f4\u65b0\u4e8e %(last_updated)s.", + "Library changes": "\u5e93\u7684\u53d8\u66f4", + "Navigation": "\u5bfc\u822a", + "Next topic": "\u4e0b\u4e00\u4e3b\u9898", + "Other changes": "\u5176\u4ed6\u53d8\u66f4", + "Overview": "\u6982\u8ff0", + "Please activate JavaScript to enable the search\n functionality.": "\u8bf7\u6fc0\u6d3b JavaScript \u4ee5\u5f00\u542f\u641c\u7d22\u529f\u80fd\u3002", + "Preparing search...": "\u6b63\u5728\u51c6\u5907\u641c\u7d22\u2026\u2026", + "Previous topic": "\u4e0a\u4e00\u4e3b\u9898", + "Quick search": "\u5feb\u901f\u641c\u7d22", + "Search": "\u641c\u7d22", + "Search Page": "\u641c\u7d22\u9875\u9762", + "Search Results": "\u641c\u7d22\u7ed3\u679c", + "Search finished, found ${resultCount} page(s) matching the search query.": "\u641c\u7d22\u5b8c\u6210\uff0c\u5339\u914d\u5230 ${resultCount} \u9875\u3002", + "Search within %(docstitle)s": "\u5728 %(docstitle)s \u4e2d\u641c\u7d22", + "Searching": "\u6b63\u5728\u641c\u7d22\u4e2d", + "Searching for multiple words only shows matches that contain\n all words.": "\u5f53\u641c\u7d22\u591a\u4e2a\u5173\u952e\u8bcd\u65f6\uff0c\u53ea\u4f1a\u663e\u793a\u540c\u65f6\u5305\u542b\u6240\u6709\u5173\u952e\u8bcd\u7684\u5185\u5bb9\u3002", + "Show Source": "\u663e\u793a\u6e90\u4ee3\u7801", + "Table of Contents": "\u76ee\u5f55", + "This Page": "\u672c\u9875", + "Welcome! This is": "\u6b22\u8fce\uff01", + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories.": "\u60a8\u7684\u641c\u7d22\u6ca1\u6709\u5339\u914d\u5230\u6587\u6863\u3002\u8bf7\u786e\u4fdd\u5173\u952e\u8bcd\u62fc\u5199\u6b63\u786e\uff0c\u5e76\u4e14\u9009\u62e9\u4e86\u5408\u9002\u7684\u5206\u7c7b\u3002", + "all functions, classes, terms": "\u6240\u6709\u51fd\u6570\u3001\u7c7b\u3001\u672f\u8bed\u8bcd\u6c47", + "can be huge": "\u53ef\u80fd\u4f1a\u5927", + "last updated": "\u6700\u540e\u66f4\u65b0\u4e8e", + "lists all sections and subsections": "\u5217\u51fa\u6240\u6709\u7684\u7ae0\u8282\u548c\u90e8\u5206", + "next chapter": "\u4e0b\u4e00\u7ae0", + "previous chapter": "\u4e0a\u4e00\u7ae0", + "quick access to all modules": "\u5feb\u901f\u67e5\u770b\u6240\u6709\u7684\u6a21\u5757", + "search": "\u641c\u7d22", + "search this documentation": "\u641c\u7d22\u6587\u6863", + "the documentation for": "\u672c\u6587\u6863\u5c5e\u4e8e" + }, + "plural_expr": "0" +}); diff --git a/_build/html_zh_CN/banner.css b/_build/html_zh_CN/banner.css new file mode 100644 index 0000000000..939a201285 --- /dev/null +++ b/_build/html_zh_CN/banner.css @@ -0,0 +1,11 @@ +/** + * Styles to display banner under the search box. + */ + +.search-banner-wrapper img { + width: auto; + height: auto; + padding: 0; + border-radius: 0; + margin: 12px 0 0 0; +} diff --git a/_build/html_zh_CN/code_of_conduct.html b/_build/html_zh_CN/code_of_conduct.html new file mode 100644 index 0000000000..71ff391e2d --- /dev/null +++ b/_build/html_zh_CN/code_of_conduct.html @@ -0,0 +1,270 @@ + + + + + + + + + 行为准则 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

行为准则

+
+

我们的承诺

+

In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation.

+
+
+

Our Standards

+

Examples of behavior that contributes to creating a positive environment +include:

+
    +
  • Using welcoming and inclusive language

  • +
  • Being respectful of differing viewpoints and experiences

  • +
  • Gracefully accepting constructive criticism

  • +
  • Focusing on what is best for the community

  • +
  • Showing empathy towards other community members

  • +
+

Examples of unacceptable behavior by participants include:

+
    +
  • The use of sexualized language or imagery and unwelcome sexual attention or +advances

  • +
  • Trolling, insulting/derogatory comments, and personal or political attacks

  • +
  • Public or private harassment

  • +
  • Publishing others' private information, such as a physical or electronic +address, without explicit permission

  • +
  • Other conduct which could reasonably be considered inappropriate in a +professional setting

  • +
+
+
+

Our Responsibilities

+

Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior.

+

Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful.

+
+
+

Scope

+

This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers.

+
+
+

Enforcement

+

Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at snakecharmers@ethereum.org. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately.

+

Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership.

+
+
+

Attribution

+

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/constants.html b/_build/html_zh_CN/constants.html new file mode 100644 index 0000000000..c94a5931e0 --- /dev/null +++ b/_build/html_zh_CN/constants.html @@ -0,0 +1,220 @@ + + + + + + + + + Constants — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Constants

+

The web3.constants module contains commonly used values.

+
+

Strings

+
#The Address Zero, which is 20 bytes (40 nibbles) of zero.
+web3.constants.ADDRESS_ZERO
+
+#The hexadecimal version of Max uint256.
+web3.constants.MAX_INT
+
+#The Hash Zero, which is 32 bytes (64 nibbles) of zero.
+web3.constants.HASH_ZERO
+
+
+
+
+

Int

+
#The amount of Wei in one Ether
+web3.constants.WEI_PER_ETHER
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/contributing.html b/_build/html_zh_CN/contributing.html new file mode 100644 index 0000000000..477ba17932 --- /dev/null +++ b/_build/html_zh_CN/contributing.html @@ -0,0 +1,609 @@ + + + + + + + + + 贡献 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

贡献

+

Thanks for your interest in contributing to web3.py! Read on to learn what +would be helpful and how to go about it. If you get stuck along the way, reach +for help in the Python Discord server.

+
+

How to Help

+

Without code:

+
    +
  • Answer user questions within GitHub issues, Stack Overflow, or the Python Discord server.

  • +
  • Write or record tutorial content.

  • +
  • Improve our documentation (including typo fixes).

  • +
  • Open an issue on GitHub to document a bug. Include as much detail as possible, e.g., how to reproduce the issue and any exception messages.

  • +
+

With code:

+
    +
  • Fix a bug that has been reported in an issue.

  • +
  • Add a feature that has been documented in an issue.

  • +
  • Add a missing test case.

  • +
+
+

警告

+

Before you start: always ask if a change would be desirable or let us know that +you plan to work on something! We don't want to waste your time on changes we can't +accept or duplicated effort.

+
+
+
+

Your Development Environment

+
+

备注

+

Use of a virtual environment is strongly advised for minimizing dependency issues. See +this article +for usage patterns.

+
+

All pull requests are made from a fork of the repository; use the GitHub UI to create a fork. +web3.py depends on submodules, so when you clone +your fork to your local machine, include the --recursive flag:

+
$ git clone --recursive https://github.com/<your-github-username>/web3.py.git
+$ cd web3.py
+
+
+

Finally, install all development dependencies:

+
$ python -m pip install -e ".[dev]"
+$ pre-commit install
+
+
+
+

Using Docker

+

Developing within Docker is not required, but if you prefer that workflow, use +the sandbox container provided in the docker-compose.yml file.

+

To start up the test environment, run:

+
$ docker compose up -d
+
+
+

This will build a Docker container set up with an environment to run the +Python test code.

+

To run the core tests from your local machine:

+
$ docker compose exec sandbox bash -c 'pytest tests/core'
+
+
+

The container does not have go-ethereum installed, so you can exclude those tests +by using the -k "not goethereum" flag.

+
$ docker compose exec sandbox bash -c 'pytest tests/integration -k "not goethereum"'
+
+
+

You can run arbitrary commands inside the Docker container by using the +bash -c prefix.

+
$ docker compose exec sandbox bash -c 'pwd && ls'
+
+
+

Or, if you would like to open a session to the container, run:

+
$ docker compose exec sandbox bash
+
+
+
+
+
+

Running The Tests

+

A great way to explore the code base is to run the tests.

+

First, install the test dependencies:

+
$ python -m pip install -e ".[test]"
+
+
+

You can run all tests with:

+
$ pytest
+
+
+

However, running the entire test suite takes a very long time and is generally impractical. +Typically, you'll just want to run a subset instead, like:

+
$ pytest tests/core/eth-module/test_accounts.py
+
+
+

Linting is also performed by the CI and locally with each commit. You can save yourself +some time by checking for linting errors manually:

+
$ make lint
+
+
+

It is important to understand that each pull request must pass the full test +suite as part of the CI check. This test suite will run in the CI anytime a +pull request is opened or updated.

+
+
+

Writing Tests

+

We strongly encourage contributors to write good tests for their code as +part of the code review process. This helps ensure that your code is doing +what it should be doing.

+

We strongly encourage you to use our existing tests for both guidance and +homogeneity / consistency across our tests. We use pytest for our tests. +For more specific pytest guidance, please refer to the pytest documentation.

+

Within the pytest scope, conftest.py files are used for common code +shared between modules that exist within the same directory as that particular +conftest.py file.

+
+

Unit Testing and eth-tester Tests

+

Our unit tests are grouped together with tests against the eth-tester library, +using the py-evm library as a backend, via the EthereumTesterProvider.

+

These tests live under appropriately named child directories within the +/tests directory. The core of these tests live under /tests/core. +Do your best to follow the existing structure when adding a test and make sure +that its location makes sense.

+
+
+

Integration Testing

+

Our integration test suite setup lives under the /tests/integration directory. +The integration test suite is dependent on what we call "fixtures" (not to be +confused with pytest fixtures). These zip file fixtures, which also live in the +/tests/integration directory, are configured to run the specific client we are +testing against along with a genesis configuration that gives our tests some +pre-determined useful objects (like unlocked, pre-loaded accounts) to be able to +interact with the client when we run our tests.

+

The parent /integration directory houses some common configuration shared across +all client tests, whereas the /go_ethereum directory houses common code to be +shared across geth-specific provider tests. Though the setup and run configurations +exist across the different files within /tests/integration, our integration module +tests are written across different files within /web3/_utils/module_testing.

+
    +
  • common.py files within the client directories contain code that is shared across +all provider tests (http, ipc, and ws). This is mostly used to override tests that span +across all providers.

  • +
  • conftest.py files within each of these directories contain mostly code that +can be used by all test files that exist within the same directory or subdirectories +of the conftest.py file. This is mostly used to house pytest fixtures to be +shared among our tests. Refer to the pytest documentation on fixtures for more +information.

  • +
  • test_{client}_{provider}.py files (e.g. test_goethereum_http.py) are where +client-and-provider-specific test configurations exist. This is mostly used to +override tests specific to the provider type for the respective client.

  • +
+

The integration tests are each run in insolation to prevent muddied contexts. Because +they are run in isolation, they can be parallelized with pytest-xdist in order to +speed up the test suite. To run the tests in parallel, you can use the -n flag +with pytest. For example, to run the tests in parallel with 4 workers, you can +use the following command:

+
$ pytest tests/integration/go_ethereum/path/to/module/or/test -n 4
+
+
+
+
+

Working With Test Contracts

+

Contracts used for testing exist under web3/_utils/contract_sources. These contracts +get compiled via the compile_contracts.py script in the same directory. To use +this script, simply pass the Solidity version to be used to compile the contracts as an +argument at the command line.

+
+
Arguments for the script are:
+
-v or --version Solidity version to be used to compile the contracts. If

blank, the script uses the latest available version from +solcx.

+
+
-f or --filename If left blank, all .sol files will be compiled and the

respective contract data will be generated. Pass in a +specific .sol filename here to compile just one file.

+
+
+
+
+

To run the script, you will need the py-solc-x library for compiling the files +as well as black for code formatting. You can install those with:

+
$ python -m pip install py-solc-x black
+
+
+

The following example compiles all the contracts and generates their respective +contract data that is used across our test files for the test suites. This data gets +generated within the contract_data subdirectory within the contract_sources +folder.

+
$ cd ../web3.py/web3/_utils/contract_sources
+$ python compile_contracts.py -v 0.8.17
+Compiling OffchainLookup
+...
+...
+reformatted ...
+
+
+

To compile and generate contract data for only one .sol file, specify using the +filename with the -f (or --filename) argument flag.

+
$ cd ../web3.py/web3/_utils/contract_sources
+$ python compile_contracts.py -v 0.8.17 -f OffchainLookup.sol
+Compiling OffchainLookup.sol
+reformatted ...
+
+
+

If there is any contract data that is not generated via the script but is important +to pass on to the integration tests, the _custom_contract_data.py file within the +contract_data subdirectory can be used to store that information when appropriate.

+

Be sure to re-generate the integration test fixture after running the script to update +the contract bytecodes for the integration test suite - see the +Generating New Fixtures section below.

+
+
+
+

Manual Testing

+

To import and test an unreleased version of web3.py in another context, +you can install it from your development directory:

+
$ python -m pip install -e ../path/to/web3py
+
+
+
+
+

Code Style

+

We use pre-commit to enforce a consistent code style across +the library. This tool runs automatically with every commit, but you can also run it +manually with:

+
$ make lint
+
+
+

If you need to make a commit that skips the pre-commit checks, you can do so with +git commit --no-verify.

+

We use Black as part of our linting. To ignore the commits that introduced Black in +git history, you can configure your git environment like so:

+
$ git config blame.ignoreRevsFile .git-blame-ignore-revs
+
+
+

This library uses type hints, which are enforced by the mypy tool (part of the +pre-commit checks). All new code is required to land with type hints, with the +exception of code within the tests directory.

+
+
+

Documentation

+

Good documentation will lead to quicker adoption and happier users. Please +check out our guide on how to create documentation for the Python Ethereum +ecosystem.

+

Pull requests generate their own preview of the latest documentation at +https://web3py--<pr-number>.org.readthedocs.build/en/<pr-number>/.

+
+
+

Pull Requests

+

It's a good idea to make pull requests early on. A pull request represents the +start of a discussion, and doesn't necessarily need to be the final, finished +submission.

+

See GitHub's documentation for working on pull requests.

+

Once you've made a pull request take a look at the Circle CI build status in +the GitHub interface and make sure all tests are passing. In general, pull +requests that do not pass the CI build yet won't get reviewed unless explicitly +requested.

+

If the pull request introduces changes that should be reflected in the release +notes, please add a newsfragment file as explained +here.

+

If possible, the change to the release notes file should be included in the +commit that introduces the feature or bugfix.

+
+
+

Generating New Fixtures

+

Our integration tests make use of Geth private networks. +When new versions of the client software are introduced, new fixtures should be +generated.

+

Before generating new fixtures, make sure you have the test dependencies installed:

+
$ python -m pip install -e ".[test]"
+
+
+
+

备注

+

A "fixture" is a pre-synced network. It's the result of configuring and running +a client, deploying the test contracts, and saving the resulting state for +testing web3.py functionality against.

+
+
+

Geth Fixtures

+
    +
  1. Install the desired Geth version on your machine locally. We recommend py-geth for +this purpose, because it enables you to easily manage multiple versions of Geth.

    +

    Note that py-geth will need updating to support each new Geth version as well. +Adding newer Geth versions to py-geth is straightforward; see past commits for a template.

    +

    If py-geth has the Geth version you need, install that version locally. For example:

    +
    $ python -m geth.install v1.16.2
    +
    +
    +
  2. +
  3. Specify the Geth binary and run the fixture creation script (from within the web3.py directory):

    +
    $ GETH_BINARY=~/.py-geth/geth-v1.16.2/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py
    +
    +
    +
  4. +
  5. The output of this script is your fixture, a zip file, which is now stored in /tests/integration/. +The /tests/integration/go_ethereum/conftest.py and +/web3/tools/benchmark/node.py files should be updated automatically to point to this new fixture. +Delete the old fixture.

  6. +
  7. Run the tests. To ensure that the tests run with the correct Geth version locally, +you may again include the GETH_BINARY environment variable.

  8. +
  9. The geth_version and pygeth_version parameter defaults in +/.circleci/config.yml should be automatically updated to match the +go-ethereum version used to generate the test fixture and the py-geth +version that supports installing it.

  10. +
+
+
+

CI Testing With a Nightly Geth Build

+

Occasionally you'll want to have CI run the test suite against an unreleased version of +Geth - e.g. to test upcoming hard fork changes. The workflow described below is for +testing only, as updates will only be merged into main once the Geth release is +published and the test runs are updated to use the new stable version.

+
    +
  1. Configure tests/integration/generate_fixtures/go_ethereum/common.py as needed.

  2. +
  3. Geth automagically compiles new builds for every commit that gets merged into the codebase. +Download the desired build from the develop builds.

  4. +
  5. Build your test fixture, passing in the binary you just downloaded via GETH_BINARY. Don't forget +to update the /tests/integration/go_ethereum/conftest.py file to point to your new fixture.

  6. +
  7. Our CI runs on Ubuntu, so download the corresponding 64-bit Linux +develop build, then +add it to the root of your web3.py directory. Rename the binary custom_geth.

  8. +
  9. In .circleci/config.yml, update the geth_version pipeline parameter to +"custom". This will trigger the custom Geth build to be used in the CI test suite.

  10. +
  11. Create a PR and let CI do its thing.

  12. +
+
+
+
+

Releasing

+

Releases are typically done from the main branch, except when releasing a beta (in +which case the beta is released from main, and the previous stable branch is +released from said branch).

+
+

Final test before each release

+

Before releasing a new version, build and test the package that will be released:

+
$ git checkout main && git pull
+$ make package-test
+
+
+

This will build the package and install it in a temporary virtual environment. Follow +the instructions to activate the venv and test whatever you think is important.

+

Review the documentation that will get published:

+
$ make docs
+
+
+

Validate and preview the release notes:

+
$ make validate-newsfragments
+
+
+
+
+

Build the release notes

+

Before bumping the version number, build the release notes. You must include the part of +the version to bump (see below), which changes how the version number will show in the +release notes.

+
$ make notes bump=$$VERSION_PART_TO_BUMP$$
+
+
+

If there are any errors, be sure to re-run make notes until it works.

+
+
+

Push the release to github & pypi

+

After confirming that the release package looks okay, release a new version:

+
$ make release bump=$$VERSION_PART_TO_BUMP$$
+
+
+

This command will:

+
    +
  • Bump the version number as specified in .pyproject.toml and setup.py.

  • +
  • Create a git commit and tag for the new version.

  • +
  • Build the package.

  • +
  • Push the commit and tag to github.

  • +
  • Push the new package files to pypi.

  • +
+
+
+

Which version part to bump

+

$$VERSION_PART_TO_BUMP$$ must be one of: major, minor, patch, stage, +or devnum.

+

The version format for this repo is {major}.{minor}.{patch} for stable, and +{major}.{minor}.{patch}-{stage}.{devnum} for unstable (stage can be alpha or +beta).

+

If you are in a beta version, make release bump=stage will switch to a stable.

+

To issue an unstable version when the current version is stable, specify the new version +explicitly, like make release bump="--new-version 4.0.0-alpha.1".

+

You can see what the result of bumping any particular version part would be with +bump-my-version show-bump.

+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/dark.css b/_build/html_zh_CN/dark.css new file mode 100644 index 0000000000..da2235b5b0 --- /dev/null +++ b/_build/html_zh_CN/dark.css @@ -0,0 +1,622 @@ +/* links */ + +a, +a:visited { + color: #aaddff; +} + + +/* code directives */ + +.method dt, +.class dt, +.data dt, +.attribute dt, +.function dt, +.classmethod dt, +.exception dt, +.descclassname, +.descname { + background-color: #2d2d2d !important; +} + +.rst-content dl:not(.docutils) dt { + color: #aaddff; + background-color: #2d2d2d; + border-top: solid 3px #525252; + border-left: solid 3px #525252; +} + +em.property { + color: #888888; +} + + +/* tables */ + +.rst-content table.docutils thead { + color: #ddd; +} + +.rst-content table.docutils td { + border: 0px; +} + +.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td { + background-color: #5a5a5a; +} + + +/* inlined code highlights */ + +.xref, +.py-meth, +.rst-content a code { + color: #aaddff !important; + font-weight: normal !important; +} + +.rst-content code { + color: #eee !important; + font-weight: normal !important; +} + +code.literal { + background-color: #2d2d2d !important; + border: 1px solid #6d6d6d !important; +} + +code.docutils.literal.notranslate { + color: #ddd; +} + + +/* notes, warnings, hints */ + +.hint .admonition-title { + background: #2aa87c !important; +} + +.warning .admonition-title { + background: #cc4444 !important; +} + +.admonition-title { + background: #3a7ca8 !important; +} + +.admonition, +.note { + background-color: #2d2d2d !important; +} + + +/* table of contents */ + +.wy-nav-content-wrap { + background-color: rgba(0, 0, 0, 0.6) !important; +} + +.sidebar { + background-color: #191919 !important; +} + +.sidebar-title { + background-color: #2b2b2b !important; +} + +.wy-menu-vertical a { + color: #ddd; +} + +.wy-menu-vertical code.docutils.literal.notranslate { + color: #404040; + background: none !important; + border: none !important; +} + +.wy-nav-content { + background: #3c3c3c; + color: #dddddd; +} + +.wy-menu-vertical li.on a, +.wy-menu-vertical li.current>a { + background: #a3a3a3; + border-bottom: 0px !important; + border-top: 0px !important; +} + +.wy-menu-vertical li.current { + background: #b3b3b3; +} + +.toc-backref { + color: grey !important; +} + +.highlight .hll { + background-color: #49483e +} + +.highlight { + background: #222; + color: #f8f8f2 +} + +.highlight .c { + color: #888 +} + + +/* Comment */ + +.highlight .err { + color: #960050; + background-color: #1e0010 +} + + +/* Error */ + +.highlight .k { + color: #66d9ef +} + + +/* Keyword */ + +.highlight .l { + color: #ae81ff +} + + +/* Literal */ + +.highlight .n { + color: #f8f8f2 +} + + +/* Name */ + +.highlight .o { + color: #f92672 +} + + +/* Operator */ + +.highlight .p { + color: #f8f8f2 +} + + +/* Punctuation */ + +.highlight .ch { + color: #888 +} + + +/* Comment.Hashbang */ + +.highlight .cm { + color: #888 +} + + +/* Comment.Multiline */ + +.highlight .cp { + color: #888 +} + + +/* Comment.Preproc */ + +.highlight .cpf { + color: #888 +} + + +/* Comment.PreprocFile */ + +.highlight .c1 { + color: #888 +} + + +/* Comment.Single */ + +.highlight .cs { + color: #888 +} + + +/* Comment.Special */ + +.highlight .gd { + color: #f92672 +} + + +/* Generic.Deleted */ + +.highlight .ge { + font-style: italic +} + + +/* Generic.Emph */ + +.highlight .gi { + color: #a6e22e +} + + +/* Generic.Inserted */ + +.highlight .gs { + font-weight: bold +} + + +/* Generic.Strong */ + +.highlight .gu { + color: #888 +} + + +/* Generic.Subheading */ + +.highlight .kc { + color: #66d9ef +} + + +/* Keyword.Constant */ + +.highlight .kd { + color: #66d9ef +} + + +/* Keyword.Declaration */ + +.highlight .kn { + color: #f92672 +} + + +/* Keyword.Namespace */ + +.highlight .kp { + color: #66d9ef +} + + +/* Keyword.Pseudo */ + +.highlight .kr { + color: #66d9ef +} + + +/* Keyword.Reserved */ + +.highlight .kt { + color: #66d9ef +} + + +/* Keyword.Type */ + +.highlight .ld { + color: #e6db74 +} + + +/* Literal.Date */ + +.highlight .m { + color: #ae81ff +} + + +/* Literal.Number */ + +.highlight .s { + color: #e6db74 +} + + +/* Literal.String */ + +.highlight .na { + color: #a6e22e +} + + +/* Name.Attribute */ + +.highlight .nb { + color: #f8f8f2 +} + + +/* Name.Builtin */ + +.highlight .nc { + color: #a6e22e +} + + +/* Name.Class */ + +.highlight .no { + color: #66d9ef +} + + +/* Name.Constant */ + +.highlight .nd { + color: #a6e22e +} + + +/* Name.Decorator */ + +.highlight .ni { + color: #f8f8f2 +} + + +/* Name.Entity */ + +.highlight .ne { + color: #a6e22e +} + + +/* Name.Exception */ + +.highlight .nf { + color: #a6e22e +} + + +/* Name.Function */ + +.highlight .nl { + color: #f8f8f2 +} + + +/* Name.Label */ + +.highlight .nn { + color: #f8f8f2 +} + + +/* Name.Namespace */ + +.highlight .nx { + color: #a6e22e +} + + +/* Name.Other */ + +.highlight .py { + color: #f8f8f2 +} + + +/* Name.Property */ + +.highlight .nt { + color: #f92672 +} + + +/* Name.Tag */ + +.highlight .nv { + color: #f8f8f2 +} + + +/* Name.Variable */ + +.highlight .ow { + color: #f92672 +} + + +/* Operator.Word */ + +.highlight .w { + color: #f8f8f2 +} + + +/* Text.Whitespace */ + +.highlight .mb { + color: #ae81ff +} + + +/* Literal.Number.Bin */ + +.highlight .mf { + color: #ae81ff +} + + +/* Literal.Number.Float */ + +.highlight .mh { + color: #ae81ff +} + + +/* Literal.Number.Hex */ + +.highlight .mi { + color: #ae81ff +} + + +/* Literal.Number.Integer */ + +.highlight .mo { + color: #ae81ff +} + + +/* Literal.Number.Oct */ + +.highlight .sa { + color: #e6db74 +} + + +/* Literal.String.Affix */ + +.highlight .sb { + color: #e6db74 +} + + +/* Literal.String.Backtick */ + +.highlight .sc { + color: #e6db74 +} + + +/* Literal.String.Char */ + +.highlight .dl { + color: #e6db74 +} + + +/* Literal.String.Delimiter */ + +.highlight .sd { + color: #e6db74 +} + + +/* Literal.String.Doc */ + +.highlight .s2 { + color: #e6db74 +} + + +/* Literal.String.Double */ + +.highlight .se { + color: #ae81ff +} + + +/* Literal.String.Escape */ + +.highlight .sh { + color: #e6db74 +} + + +/* Literal.String.Heredoc */ + +.highlight .si { + color: #e6db74 +} + + +/* Literal.String.Interpol */ + +.highlight .sx { + color: #e6db74 +} + + +/* Literal.String.Other */ + +.highlight .sr { + color: #e6db74 +} + + +/* Literal.String.Regex */ + +.highlight .s1 { + color: #e6db74 +} + + +/* Literal.String.Single */ + +.highlight .ss { + color: #e6db74 +} + + +/* Literal.String.Symbol */ + +.highlight .bp { + color: #f8f8f2 +} + + +/* Name.Builtin.Pseudo */ + +.highlight .fm { + color: #a6e22e +} + + +/* Name.Function.Magic */ + +.highlight .vc { + color: #f8f8f2 +} + + +/* Name.Variable.Class */ + +.highlight .vg { + color: #f8f8f2 +} + + +/* Name.Variable.Global */ + +.highlight .vi { + color: #f8f8f2 +} + + +/* Name.Variable.Instance */ + +.highlight .vm { + color: #f8f8f2 +} + + +/* Name.Variable.Magic */ + +.highlight .il { + color: #ae81ff +} + + +/* Literal.Number.Integer.Long */ diff --git a/_build/html_zh_CN/ens.html b/_build/html_zh_CN/ens.html new file mode 100644 index 0000000000..6d4be527a9 --- /dev/null +++ b/_build/html_zh_CN/ens.html @@ -0,0 +1,211 @@ + + + + + + + + + ENS API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

ENS API

+

以太坊名称服务 (ENS) has a friendly overview.

+

Continue below for the detailed specs on each method and class in the ens module.

+
+

ens.ens module

+
+
+

ens.async_ens module

+
+
+

ens.exceptions module

+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/ens_overview.html b/_build/html_zh_CN/ens_overview.html new file mode 100644 index 0000000000..9549d16fbc --- /dev/null +++ b/_build/html_zh_CN/ens_overview.html @@ -0,0 +1,515 @@ + + + + + + + + + 以太坊名称服务 (ENS) — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

以太坊名称服务 (ENS)

+

The Ethereum Name Service (ENS) is analogous to the Domain Name Service. It +enables users and developers to use human-friendly names in place of error-prone +hexadecimal addresses, content hashes, and more.

+

The ens module is included with web3.py. It provides an interface to look up +domains and addresses, add resolver records, or get and set metadata.

+
+

Setup

+

Create an ENS object (named ns below) in one of three ways:

+
    +
  1. Automatic detection

  2. +
  3. Specify an instance of a provider

  4. +
  5. From an existing web3.Web3 object

  6. +
+
# automatic detection
+from ens.auto import ns
+
+# or, with a provider
+from web3 import IPCProvider
+from ens import ENS
+
+provider = IPCProvider(...)
+ns = ENS(provider)
+
+# or, with a w3 instance
+# Note: This inherits the w3 middleware from the w3 instance and adds a stalecheck middleware to the middleware onion.
+# It also inherits the provider and codec from the w3 instance, as well as the ``strict_bytes_type_checking`` flag value.
+from ens import ENS
+w3 = Web3(...)
+ns = ENS.from_web3(w3)
+
+
+

Asynchronous support is available via the AsyncENS module:

+
from ens import AsyncENS
+
+ns = AsyncENS(provider)
+
+
+

Note that an ens module instance is also available on the w3 instance. +The first time it's used, web3.py will create the ens instance using +ENS.from_web3(w3) or AsyncENS.from_web3(w3) as appropriate.

+
# instantiate w3 instance
+from web3 import Web3, IPCProvider
+w3 = Web3(IPCProvider(...))
+
+# use the module
+w3.ens.address('ethereum.eth')
+
+
+
+
+ens.strict_bytes_type_checking
+

The ENS instance has a strict_bytes_type_checking flag that toggles the flag +with the same name on the Web3 instance attached to the ENS instance. +You may disable the stricter bytes type checking that is loaded by default using +this flag. For more examples, see Disabling Strict Checks for Bytes Types

+

If instantiating a standalone ENS instance using ENS.from_web3(), the ENS +instance will inherit the value of the flag on the Web3 instance at time of +instantiation.

+
>>> from web3 import Web3, EthereumTesterProvider
+>>> from ens import ENS
+>>> w3 = Web3(EthereumTesterProvider())
+
+>>> assert w3.strict_bytes_type_checking  # assert strict by default
+>>> w3.is_encodable('bytes2', b'1')
+False
+
+>>> w3.strict_bytes_type_checking = False
+>>> w3.is_encodable('bytes2', b'1')  # zero-padded, so encoded to: b'1\x00'
+True
+
+>>> ns = ENS.from_web3(w3)
+>>> # assert inherited from w3 at time of instantiation via ENS.from_web3()
+>>> assert ns.strict_bytes_type_checking is False
+>>> ns.w3.is_encodable('bytes2', b'1')
+True
+
+>>> # assert these are now separate instances
+>>> ns.strict_bytes_type_checking = True
+>>> ns.w3.is_encodable('bytes2', b'1')
+False
+
+>>> # assert w3 flag value remains
+>>> assert w3.strict_bytes_type_checking is False
+>>> w3.is_encodable('bytes2', b'1')
+True
+
+
+

However, if accessing the ENS class via the Web3 instance as a module +(w3.ens), since all modules use the same Web3 object reference +under the hood (the parent w3 object), changing the +strict_bytes_type_checking flag value on w3 also changes the flag state +for w3.ens.w3 and all modules.

+
>>> from web3 import Web3, EthereumTesterProvider
+>>> w3 = Web3(EthereumTesterProvider())
+
+>>> assert w3.strict_bytes_type_checking  # assert strict by default
+>>> w3.is_encodable('bytes2', b'1')
+False
+
+>>> w3.strict_bytes_type_checking = False
+>>> w3.is_encodable('bytes2', b'1')  # zero-padded, so encoded to: b'1\x00'
+True
+
+>>> assert w3 == w3.ens.w3  # assert same object
+>>> assert not w3.ens.w3.strict_bytes_type_checking
+>>> w3.ens.w3.is_encodable('bytes2', b'1')
+True
+
+>>> # sanity check on eth module as well
+>>> assert not w3.eth.w3.strict_bytes_type_checking
+>>> w3.eth.w3.is_encodable('bytes2', b'1')
+True
+
+
+
+ +
+
+

Usage

+
+

Name Info

+
+

Get the Address for an ENS Name

+
from ens.auto import ns
+eth_address = ns.address('ens.eth')
+assert eth_address == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7'
+
+
+

The ENS module has no opinion as to which TLD (Top Level Domain) you can use, +but will not infer a TLD if it is not provided with the name.

+
+
Multichain Address Resolution
+

ENSIP-9 +introduced multichain address resolution, allowing users to resolve addresses from +different chains, specified by the coin type index from +SLIP44. The +address() method on the ENS class supports multichain address resolution via +the coin_type keyword argument.

+
from ens.auto import ns
+eth_address = ns.address('ens.eth', coin_type=60)  # ETH is coin_type 60
+assert eth_address == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7'
+
+
+
+
+
+

Get the ENS Name for an Address

+
domain = ns.name('0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7')
+
+# name() also accepts the bytes version of the address
+assert ns.name(b'\xfe\x89\xccz\xbb,A\x83h:\xb7\x16S\xc4\xcd\xc9\xb0-D\xb7') == domain
+
+# confirm that the name resolves back to the address that you looked up:
+assert ns.address(domain) == '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7'
+
+
+
+

备注

+

For accuracy, and as a recommendation from the ENS documentation on +reverse resolution, +the ENS module now verifies that the forward resolution matches the address with every call to get the +name() for an address. This is the only sure way to know whether the reverse resolution is correct. Anyone can +claim any name, only forward resolution implies that the owner of the name gave their stamp of approval.

+
+
+
+

Get the Owner of a Name

+
eth_address = ns.owner('exchange.eth')
+
+
+
+
+
+
+

Set Up Your Name and Address

+ + +
+
+
+

Text Records

+
+

Set Text Metadata for an ENS Record

+

As the owner of an ENS record, you can add text metadata. +A list of supported fields can be found in the +ENS documentation. +You'll need to setup the address first, and then the text can be set:

+
ns.setup_address('ens.eth', '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7')
+ns.set_text('ens.eth', 'url', 'https://example.com')
+
+
+

A transaction dictionary can be passed as the last argument if desired:

+
transaction_dict = {'from': '0x123...'}
+ns.set_text('ens.eth', 'url', 'https://example.com', transaction_dict)
+
+
+

If the transaction dictionary is not passed, sensible defaults will be used, and if +a transaction dictionary is passed but does not have a from value, +the default will be the owner.

+
+
+

Read Text Metadata for an ENS Record

+

Anyone can read the data from an ENS Record:

+
url = ns.get_text('ens.eth', 'url')
+assert url == 'https://example.com'
+
+
+
+
+
+
+

Working With Resolvers

+
+

Get the Resolver for an ENS Record

+

You can get the resolver for an ENS name via the resolver() method.

+
>>> resolver = ns.resolver('ens.eth')
+>>> resolver.address
+'0x5B2063246F2191f18F2675ceDB8b28102e957458'
+
+
+
+
+
+
+
+

Wildcard Resolution Support

+

The ENS module supports Wildcard Resolution for resolvers that implement the ExtendedResolver interface +as described in ENSIP-10. +Resolvers that implement the extended resolver interface should return True when calling the +supportsInterface() function with the extended resolver interface id "0x9061b923" and should resolve subdomains +to a unique address.

+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/filters.html b/_build/html_zh_CN/filters.html new file mode 100644 index 0000000000..a757759ddd --- /dev/null +++ b/_build/html_zh_CN/filters.html @@ -0,0 +1,1290 @@ + + + + + + + + + 事件和日志 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

事件和日志

+

If you're on this page, you're likely looking for an answer to this question: +How do I know when a specific contract is used? You have several options:

+
    +
  1. Query blocks for transactions that include the contract address in the "to" field. +This contrived example is searching the latest block for any transactions sent to the +WETH contract.

  2. +
+
WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
+
+block = w3.eth.get_block('latest')
+for tx_hash in block.transactions:
+    tx = w3.eth.get_transaction(tx_hash)
+    if tx['to'] == WETH_ADDRESS:
+        print(f'Found interaction with WETH contract! {tx}')
+
+
+
    +
  1. Query for logs emitted by a contract. After instantiating a web3.py Contract object, +you can fetch logs for any event listed in the ABI. In this +example, we query for Transfer events in the latest block and log out the results.

  2. +
+
WETH_ADDRESS = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
+WETH_ABI = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"guy","type":"address"},{"name":"wad","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"src","type":"address"},{"name":"dst","type":"address"},{"name":"wad","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"wad","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"dst","type":"address"},{"name":"wad","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":true,"name":"guy","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":true,"name":"dst","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"dst","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"src","type":"address"},{"indexed":false,"name":"wad","type":"uint256"}],"name":"Withdrawal","type":"event"}]'
+
+weth_contract = w3.eth.contract(address=WETH_ADDRESS, abi=WETH_ABI)
+
+# fetch transfer events in the last block
+logs = weth_contract.events.Transfer().get_logs(from_block=w3.eth.block_number)
+
+for log in logs:
+   print(f"Transfer of {w3.from_wei(log.args.wad, 'ether')} WETH from {log.args.src} to {log.args.dst}")
+
+
+

See an advanced example of fetching log history here.

+
    +
  1. Subscribe to events for real-time updates. When using a persistent connection provider +(WebSocketProvider or +AsyncIPCProvider), the +subscribe() method can be used to establish a new +event subscription. This example subscribes to Transfer events of the WETH contract.

  2. +
+
+
import asyncio
+from web3 import AsyncWeb3, WebSocketProvider
+from eth_abi.abi import decode
+
+WETH_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
+
+
+async def subscribe_to_transfer_events():
+    async with AsyncWeb3(WebSocketProvider("...")) as w3:
+        transfer_event_topic = w3.keccak(text="Transfer(address,address,uint256)")
+        filter_params = {
+            "address": WETH_ADDRESS,
+            "topics": [transfer_event_topic],
+        }
+        subscription_id = await w3.eth.subscribe("logs", filter_params)
+        print(f"Subscribing to transfer events for WETH at {subscription_id}")
+
+        async for payload in w3.socket.process_subscriptions():
+            result = payload["result"]
+
+            from_addr = decode(["address"], result["topics"][1])[0]
+            to_addr = decode(["address"], result["topics"][2])[0]
+            amount = decode(["uint256"], result["data"])[0]
+            print(f"{w3.from_wei(amount, 'ether')} WETH from {from_addr} to {to_addr}")
+
+asyncio.run(subscribe_to_transfer_events())
+
+
+

For more usage examples see the docs on Using Persistent Connection Providers.

+
+
    +
  1. Use a filter.

  2. +
+
+

警告

+

While filters can be a very convenient way to monitor for blocks, transactions, or +events, they are notoriously unreliable. Both remote and locally hosted nodes have +a reputation for occasionally dropping filters, and some remote node providers don't +support filter-related RPC calls at all.

+
+

The web3.eth.Eth.filter() method can be used to set up filters for:

+
    +
  • Pending Transactions: w3.eth.filter("pending")

  • +
  • New Blocks w3.eth.filter("latest")

  • +
  • Event Logs

    +
    +

    Through the contract instance api:

    +
    event_filter = my_contract.events.myEvent.create_filter(from_block='latest', argument_filters={'arg1':10})
    +
    +
    +

    Or built manually by supplying valid filter params:

    +
    event_filter = w3.eth.filter({"address": contract_address})
    +
    +
    +
    +
  • +
  • Attaching to an existing filter

    +
    +
    existing_filter = w3.eth.filter(filter_id="0x0")
    +
    +
    +
    +
  • +
+
+

备注

+

Creating event filters requires that your Ethereum node has an API support enabled for filters. +Note that Infura support for filters does not offer access to pending filters. +To get event logs on other stateless nodes please see web3.contract.ContractEvents.

+
+
+

Filter Class

+
+
+class web3.utils.filters.Filter(web3, filter_id)
+
+ +
+
+Filter.filter_id
+

The filter_id for this filter as returned by the eth_newFilter RPC +method when this filter was created.

+
+ +
+
+Filter.get_new_entries()
+

Retrieve new entries for this filter.

+

Logs will be retrieved using the +web3.eth.Eth.get_filter_changes() which returns only new entries since the last +poll.

+
+ +
+
+Filter.get_all_entries()
+

Retrieve all entries for this filter.

+

Logs will be retrieved using the +web3.eth.Eth.get_filter_logs() which returns all entries that match the given +filter.

+
+ +
+
+Filter.format_entry(entry)
+

Hook for subclasses to modify the format of the log entries this filter +returns, or passes to its callback functions.

+

By default this returns the entry parameter unmodified.

+
+ +
+
+Filter.is_valid_entry(entry)
+

Hook for subclasses to add additional programmatic filtering. The default +implementation always returns True.

+
+ +
+
+

Block and Transaction Filter Classes

+
+
+class web3.utils.filters.BlockFilter(...)
+
+ +

BlockFilter is a subclass of Filter.

+

You can setup a filter for new blocks using web3.eth.filter('latest') which +will return a new BlockFilter object.

+
+
new_block_filter = w3.eth.filter('latest')
+new_block_filter.get_new_entries()
+
+
+
+

备注

+

"safe" and "finalized" block identifiers are not yet supported for +eth_newBlockFilter.

+
+
+
+
+class web3.utils.filters.TransactionFilter(...)
+
+ +

TransactionFilter is a subclass of Filter.

+

You can setup a filter for new blocks using web3.eth.filter('pending') which +will return a new TransactionFilter object.

+
+
new_transaction_filter = w3.eth.filter('pending')
+new_transaction_filter.get_new_entries()
+
+
+
+
+
+

Event Log Filters

+

You can set up a filter for event logs using the web3.py contract api: +web3.contract.Contract.events.your_event_name.create_filter(), which provides some conveniences for +creating event log filters. Refer to the following example:

+
+
event_filter = my_contract.events.<event_name>.create_filter(from_block="latest", argument_filters={'arg1':10})
+event_filter.get_new_entries()
+
+
+
+

See web3.contract.Contract.events.your_event_name.create_filter() documentation for more information.

+

You can set up an event log filter like the one above with web3.eth.filter by supplying a +dictionary containing the standard filter parameters. Assuming that arg1 is indexed, the +equivalent filter creation would look like:

+
+
event_signature_hash = web3.keccak(text="eventName(uint32)").hex()
+event_filter = web3.eth.filter({
+    "address": myContract_address,
+    "topics": [event_signature_hash,
+               "0x000000000000000000000000000000000000000000000000000000000000000a"],
+    })
+
+
+
+

The topics argument is order-dependent. For non-anonymous events, the first item in the topic list is always the keccack hash of the event signature. Subsequent topic items are the hex encoded values for indexed event arguments. In the above example, the second item is the arg1 value 10 encoded to its hex string representation.

+

In addition to being order-dependent, there are a few more points to recognize when specifying topic filters:

+
+

Given a transaction log with topics [A, B], the following topic filters will yield a match:

+
    +
  • [] "anything"

  • +
  • [A] "A in first position (and anything after)"

  • +
  • [None, B] "anything in first position AND B in second position (and anything after)"

  • +
  • [A, B] "A in first position AND B in second position (and anything after)"

  • +
  • [[A, B], [A, B]] "(A OR B) in first position AND (A OR B) in second position (and anything after)"

  • +
+
+

See the JSON-RPC documentation for eth_newFilter more information on the standard filter parameters.

+
+
+

备注

+

Though "finalized" and "safe" block identifiers are not yet part of the +specifications for eth_newFilter, they are supported by web3.py and may or +may not yield expected results depending on the node being accessed.

+
+
+

Creating a log filter by either of the above methods will return a LogFilter instance.

+
+
+class web3.utils.filters.LogFilter(web3, filter_id, log_entry_formatter=None, data_filter_set=None)
+
+ +

The LogFilter class is a subclass of Filter. See the Filter +documentation for inherited methods.

+

LogFilter provides the following additional +methods:

+
+
+LogFilter.set_data_filters(data_filter_set)
+
+ +

Provides a means to filter on the log data, in other words the ability to filter on values from +un-indexed event arguments. The parameter data_filter_set should be a list or set of 32-byte hex encoded values.

+
+
+

Examples: Listening For Events

+
+

Synchronous

+
+
from web3 import Web3, IPCProvider
+import time
+
+# instantiate Web3 instance
+w3 = Web3(IPCProvider(...))
+
+def handle_event(event):
+    print(event)
+
+def log_loop(event_filter, poll_interval):
+    while True:
+        for event in event_filter.get_new_entries():
+            handle_event(event)
+        time.sleep(poll_interval)
+
+def main():
+    block_filter = w3.eth.filter('latest')
+    log_loop(block_filter, 2)
+
+if __name__ == '__main__':
+    main()
+
+
+
+
+
+

Asynchronous Filter Polling

+

Starting with web3 version 4, the watch method was taken out of the web3 filter objects. +There are many decisions to be made when designing a system regarding threading and concurrency. +Rather than force a decision, web3 leaves these choices up to the user. Below are some example +implementations of asynchronous filter-event handling that can serve as starting points.

+
+

Single threaded concurrency with async and await

+

Beginning in python 3.5, the async and await built-in keywords were added. These provide a +shared api for coroutines that can be utilized by modules such as the built-in asyncio. Below is +an example event loop using asyncio, that polls multiple web3 filter object, and passes new +entries to a handler.

+
+
+
from web3 import Web3, IPCProvider
+import asyncio
+
+# instantiate Web3 instance
+w3 = Web3(IPCProvider(...))
+
+def handle_event(event):
+    print(event)
+    # and whatever
+
+async def log_loop(event_filter, poll_interval):
+    while True:
+        for event in event_filter.get_new_entries():
+            handle_event(event)
+        await asyncio.sleep(poll_interval)
+
+def main():
+    block_filter = w3.eth.filter('latest')
+    tx_filter = w3.eth.filter('pending')
+    loop = asyncio.get_event_loop()
+    try:
+        loop.run_until_complete(
+            asyncio.gather(
+                log_loop(block_filter, 2),
+                log_loop(tx_filter, 2)))
+    finally:
+        loop.close()
+
+if __name__ == '__main__':
+    main()
+
+
+
+

Read the asyncio documentation for more information.

+
+
+
+

Running the event loop in a separate thread

+

Here is an extended version of above example, where the event loop is run in a separate thread, +releasing the main function for other tasks.

+
+
from web3 import Web3, IPCProvider
+from threading import Thread
+import time
+
+# instantiate Web3 instance
+w3 = Web3(IPCProvider(...))
+
+def handle_event(event):
+    print(event)
+    # and whatever
+
+
+def log_loop(event_filter, poll_interval):
+    while True:
+        for event in event_filter.get_new_entries():
+            handle_event(event)
+        time.sleep(poll_interval)
+
+
+def main():
+    block_filter = w3.eth.filter('latest')
+    worker = Thread(target=log_loop, args=(block_filter, 5), daemon=True)
+    worker.start()
+        # .. do some other stuff
+
+if __name__ == '__main__':
+    main()
+
+
+
+

Here are some other libraries that provide frameworks for writing asynchronous python:

+
+
+
+
+
+
+

Examples

+
+

Advanced example: Fetching all token transfer events

+

In this example, we show how to fetch all events of a certain event type from the Ethereum blockchain. There are three challenges when working with a large set of events:

+
    +
  • How to incrementally update an existing database of fetched events

  • +
  • How to deal with interruptions in long running processes

  • +
  • How to deal with eth_getLogs JSON-RPC call query limitations

  • +
  • How to handle Ethereum minor chain reorganisations in (near) real-time data

  • +
+
+

eth_getLogs limitations

+

Ethereum JSON-RPC API servers, like Geth, do not provide an easy way to paginate over events, only over blocks. There's no request that can find the first block with an event or how many events occur within a range of blocks. The only feedback the JSON-RPC service will give you is whether the eth_getLogs call failed.

+

In this example script, we provide two kinds of heuristics to deal with this issue. The script scans events in a chunk of blocks (start block number - end block number). Then it uses two methods to find how many events there are likely to be in a block window:

+
    +
  • Dynamically set the block range window size, while never exceeding a threshold (e.g., 10,000 blocks).

  • +
  • In the case of eth_getLogs, the JSON-RPC call gives a timeout error, decrease the end block number and tries again with a smaller block range window.

  • +
+
+
+

Example code

+

The following example code is divided into a reusable EventScanner class and then a demo script that:

+
    +
  • fetches all transfer events for RCC token,

  • +
  • can incrementally run again to check if there are new events,

  • +
  • handles interruptions (e.g., CTRL+C abort) gracefully,

  • +
  • writes all Transfer events in a single file JSON database, so that other process can consume them,

  • +
  • uses the tqdm library for progress bar output in a console,

  • +
  • only supports HTTPS providers, because JSON-RPC retry logic depends on the implementation details of the underlying protocol,

  • +
  • disables the default exception retry configuration because it does not know how to handle the shrinking block range window for eth_getLogs, and

  • +
  • consumes around 20k JSON-RPC API calls.

  • +
+

The script can be run with: python ./eventscanner.py <your JSON-RPC API URL>.

+
"""A stateful event scanner for Ethereum-based blockchains using web3.py.
+
+With the stateful mechanism, you can do one batch scan or incremental scans,
+where events are added wherever the scanner left off.
+"""
+
+import datetime
+import time
+import logging
+from abc import ABC, abstractmethod
+from typing import Tuple, Optional, Callable, List, Iterable, Dict, Any
+
+from web3 import Web3
+from web3.contract import Contract
+from web3.datastructures import AttributeDict
+from web3.exceptions import BlockNotFound
+from eth_abi.codec import ABICodec
+
+# Currently this method is not exposed over official web3 API,
+# but we need it to construct eth_getLogs parameters
+from web3._utils.filters import construct_event_filter_params
+from web3._utils.events import get_event_data
+
+
+logger = logging.getLogger(__name__)
+
+
+class EventScannerState(ABC):
+    """Application state that remembers what blocks we have scanned in the case of crash.
+    """
+
+    @abstractmethod
+    def get_last_scanned_block(self) -> int:
+        """Number of the last block we have scanned on the previous cycle.
+
+        :return: 0 if no blocks scanned yet
+        """
+
+    @abstractmethod
+    def start_chunk(self, block_number: int):
+        """Scanner is about to ask data of multiple blocks over JSON-RPC.
+
+        Start a database session if needed.
+        """
+
+    @abstractmethod
+    def end_chunk(self, block_number: int):
+        """Scanner finished a number of blocks.
+
+        Persistent any data in your state now.
+        """
+
+    @abstractmethod
+    def process_event(self, block_when: datetime.datetime, event: AttributeDict) -> object:
+        """Process incoming events.
+
+        This function takes raw events from Web3, transforms them to your application internal
+        format, then saves them in a database or some other state.
+
+        :param block_when: When this block was mined
+
+        :param event: Symbolic dictionary of the event data
+
+        :return: Internal state structure that is the result of event transformation.
+        """
+
+    @abstractmethod
+    def delete_data(self, since_block: int) -> int:
+        """Delete any data since this block was scanned.
+
+        Purges any potential minor reorg data.
+        """
+
+
+class EventScanner:
+    """Scan blockchain for events and try not to abuse JSON-RPC API too much.
+
+    Can be used for real-time scans, as it detects minor chain reorganisation and rescans.
+    Unlike the easy web3.contract.Contract, this scanner can scan events from multiple contracts at once.
+    For example, you can get all transfers from all tokens in the same scan.
+
+    You *should* disable the default ``exception_retry_configuration`` on your provider for Web3,
+    because it cannot correctly throttle and decrease the `eth_getLogs` block number range.
+    """
+
+    def __init__(self, w3: Web3, contract: Contract, state: EventScannerState, events: List, filters: Dict[str, Any],
+                 max_chunk_scan_size: int = 10000, max_request_retries: int = 30, request_retry_seconds: float = 3.0):
+        """
+        :param contract: Contract
+        :param events: List of web3 Event we scan
+        :param filters: Filters passed to get_logs
+        :param max_chunk_scan_size: JSON-RPC API limit in the number of blocks we query. (Recommendation: 10,000 for mainnet, 500,000 for testnets)
+        :param max_request_retries: How many times we try to reattempt a failed JSON-RPC call
+        :param request_retry_seconds: Delay between failed requests to let JSON-RPC server to recover
+        """
+
+        self.logger = logger
+        self.contract = contract
+        self.w3 = w3
+        self.state = state
+        self.events = events
+        self.filters = filters
+
+        # Our JSON-RPC throttling parameters
+        self.min_scan_chunk_size = 10  # 12 s/block = 120 seconds period
+        self.max_scan_chunk_size = max_chunk_scan_size
+        self.max_request_retries = max_request_retries
+        self.request_retry_seconds = request_retry_seconds
+
+        # Factor how fast we increase the chunk size if results are found
+        # # (slow down scan after starting to get hits)
+        self.chunk_size_decrease = 0.5
+
+        # Factor how fast we increase chunk size if no results are found
+        self.chunk_size_increase = 2.0
+
+    @property
+    def address(self):
+        return self.token_address
+
+    def get_block_timestamp(self, block_num) -> datetime.datetime:
+        """Get Ethereum block timestamp"""
+        try:
+            block_info = self.w3.eth.get_block(block_num)
+        except BlockNotFound:
+            # Block was not mined yet,
+            # minor chain reorganisation?
+            return None
+        last_time = block_info["timestamp"]
+        return datetime.datetime.utcfromtimestamp(last_time)
+
+    def get_suggested_scan_start_block(self):
+        """Get where we should start to scan for new token events.
+
+        If there are no prior scans, start from block 1.
+        Otherwise, start from the last end block minus ten blocks.
+        We rescan the last ten scanned blocks in the case there were forks to avoid
+        misaccounting due to minor single block works (happens once in an hour in Ethereum).
+        These heuristics could be made more robust, but this is for the sake of simple reference implementation.
+        """
+
+        end_block = self.get_last_scanned_block()
+        if end_block:
+            return max(1, end_block - self.NUM_BLOCKS_RESCAN_FOR_FORKS)
+        return 1
+
+    def get_suggested_scan_end_block(self):
+        """Get the last mined block on Ethereum chain we are following."""
+
+        # Do not scan all the way to the final block, as this
+        # block might not be mined yet
+        return self.w3.eth.block_number - 1
+
+    def get_last_scanned_block(self) -> int:
+        return self.state.get_last_scanned_block()
+
+    def delete_potentially_forked_block_data(self, after_block: int):
+        """Purge old data in the case of blockchain reorganisation."""
+        self.state.delete_data(after_block)
+
+    def scan_chunk(self, start_block, end_block) -> Tuple[int, datetime.datetime, list]:
+        """Read and process events between to block numbers.
+
+        Dynamically decrease the size of the chunk if the case JSON-RPC server pukes out.
+
+        :return: tuple(actual end block number, when this block was mined, processed events)
+        """
+
+        block_timestamps = {}
+        get_block_timestamp = self.get_block_timestamp
+
+        # Cache block timestamps to reduce some RPC overhead
+        # Real solution might include smarter models around block
+        def get_block_when(block_num):
+            if block_num not in block_timestamps:
+                block_timestamps[block_num] = get_block_timestamp(block_num)
+            return block_timestamps[block_num]
+
+        all_processed = []
+
+        for event_type in self.events:
+
+            # Callable that takes care of the underlying web3 call
+            def _fetch_events(_start_block, _end_block):
+                return _fetch_events_for_all_contracts(self.w3,
+                                                       event_type,
+                                                       self.filters,
+                                                       from_block=_start_block,
+                                                       to_block=_end_block)
+
+            # Do `n` retries on `eth_getLogs`,
+            # throttle down block range if needed
+            end_block, events = _retry_web3_call(
+                _fetch_events,
+                start_block=start_block,
+                end_block=end_block,
+                retries=self.max_request_retries,
+                delay=self.request_retry_seconds)
+
+            for evt in events:
+                idx = evt["logIndex"]  # Integer of the log index position in the block, null when its pending
+
+                # We cannot avoid minor chain reorganisations, but
+                # at least we must avoid blocks that are not mined yet
+                assert idx is not None, "Somehow tried to scan a pending block"
+
+                block_number = evt["blockNumber"]
+
+                # Get UTC time when this event happened (block mined timestamp)
+                # from our in-memory cache
+                block_when = get_block_when(block_number)
+
+                logger.debug("Processing event %s, block: %s count: %s", evt['event'], block_number, block_number)
+                processed = self.state.process_event(block_when, evt)
+                all_processed.append(processed)
+
+        end_block_timestamp = get_block_when(end_block)
+        return end_block, end_block_timestamp, all_processed
+
+    def estimate_next_chunk_size(self, current_chuck_size: int, event_found_count: int):
+        """Try to figure out optimal chunk size
+
+        Our scanner might need to scan the whole blockchain for all events
+
+        * We want to minimize API calls over empty blocks
+
+        * We want to make sure that one scan chunk does not try to process too many entries once, as we try to control commit buffer size and potentially asynchronous busy loop
+
+        * Do not overload node serving JSON-RPC API by asking data for too many events at a time
+
+        Currently Ethereum JSON-API does not have an API to tell when a first event occurred in a blockchain
+        and our heuristics try to accelerate block fetching (chunk size) until we see the first event.
+
+        These heuristics exponentially increase the scan chunk size depending on if we are seeing events or not.
+        When any transfers are encountered, we are back to scanning only a few blocks at a time.
+        It does not make sense to do a full chain scan starting from block 1, doing one JSON-RPC call per 20 blocks.
+        """
+
+        if event_found_count > 0:
+            # When we encounter first events, reset the chunk size window
+            current_chuck_size = self.min_scan_chunk_size
+        else:
+            current_chuck_size *= self.chunk_size_increase
+
+        current_chuck_size = max(self.min_scan_chunk_size, current_chuck_size)
+        current_chuck_size = min(self.max_scan_chunk_size, current_chuck_size)
+        return int(current_chuck_size)
+
+    def scan(self, start_block, end_block, start_chunk_size=20, progress_callback=Optional[Callable]) -> Tuple[
+        list, int]:
+        """Perform a token balances scan.
+
+        Assumes all balances in the database are valid before start_block (no forks sneaked in).
+
+        :param start_block: The first block included in the scan
+
+        :param end_block: The last block included in the scan
+
+        :param start_chunk_size: How many blocks we try to fetch over JSON-RPC on the first attempt
+
+        :param progress_callback: If this is an UI application, update the progress of the scan
+
+        :return: [All processed events, number of chunks used]
+        """
+
+        assert start_block <= end_block
+
+        current_block = start_block
+
+        # Scan in chunks, commit between
+        chunk_size = start_chunk_size
+        last_scan_duration = last_logs_found = 0
+        total_chunks_scanned = 0
+
+        # All processed entries we got on this scan cycle
+        all_processed = []
+
+        while current_block <= end_block:
+
+            self.state.start_chunk(current_block, chunk_size)
+
+            # Print some diagnostics to logs to try to fiddle with real world JSON-RPC API performance
+            estimated_end_block = min(current_block + chunk_size, end_block)
+            logger.debug(
+                "Scanning token transfers for blocks: %s - %s, chunk size %s, last chunk scan took %s, last logs found %s",
+                current_block, estimated_end_block, chunk_size, last_scan_duration, last_logs_found,
+            )
+
+            start = time.time()
+            actual_end_block, end_block_timestamp, new_entries = self.scan_chunk(current_block, estimated_end_block)
+
+            # Where does our current chunk scan ends - are we out of chain yet?
+            current_end = actual_end_block
+
+            last_scan_duration = time.time() - start
+            all_processed += new_entries
+
+            # Print progress bar
+            if progress_callback:
+                progress_callback(start_block, end_block, current_block, end_block_timestamp, chunk_size, len(new_entries))
+
+            # Try to guess how many blocks to fetch over `eth_getLogs` API next time
+            chunk_size = self.estimate_next_chunk_size(chunk_size, len(new_entries))
+
+            # Set where the next chunk starts
+            current_block = current_end + 1
+            total_chunks_scanned += 1
+            self.state.end_chunk(current_end)
+
+        return all_processed, total_chunks_scanned
+
+
+def _retry_web3_call(func, start_block, end_block, retries, delay) -> Tuple[int, list]:
+    """A custom retry loop to throttle down block range.
+
+    If our JSON-RPC server cannot serve all incoming `eth_getLogs` in a single request,
+    we retry and throttle down block range for every retry.
+
+    For example, Go Ethereum does not indicate what is an acceptable response size.
+    It just fails on the server-side with a "context was cancelled" warning.
+
+    :param func: A callable that triggers Ethereum JSON-RPC, as func(start_block, end_block)
+    :param start_block: The initial start block of the block range
+    :param end_block: The initial start block of the block range
+    :param retries: How many times we retry
+    :param delay: Time to sleep between retries
+    """
+    for i in range(retries):
+        try:
+            return end_block, func(start_block, end_block)
+        except Exception as e:
+            # Assume this is HTTPConnectionPool(host='localhost', port=8545): Read timed out. (read timeout=10)
+            # from Go Ethereum. This translates to the error "context was cancelled" on the server side:
+            # https://github.com/ethereum/go-ethereum/issues/20426
+            if i < retries - 1:
+                # Give some more verbose info than the default middleware
+                logger.warning(
+                    "Retrying events for block range %s - %s (%s) failed with %s , retrying in %s seconds",
+                    start_block, end_block, end_block-start_block, e, delay,
+                )
+                # Decrease the `eth_getBlocks` range
+                end_block = start_block + ((end_block - start_block) // 2)
+                # Let the JSON-RPC to recover e.g. from restart
+                time.sleep(delay)
+                continue
+            else:
+                logger.warning("Out of retries")
+                raise
+
+
+def _fetch_events_for_all_contracts(
+        w3,
+        event,
+        argument_filters: Dict[str, Any],
+        from_block: int,
+        to_block: int) -> Iterable:
+    """Get events using eth_getLogs API.
+
+    This method is detached from any contract instance.
+
+    This is a stateless method, as opposed to create_filter.
+    It can be safely called against nodes which do not provide `eth_newFilter` API, like Infura.
+    """
+
+    if from_block is None:
+        raise Web3TypeError("Missing mandatory keyword argument to get_logs: from_block")
+
+    # Currently no way to poke this using a public web3.py API.
+    # This will return raw underlying ABI JSON object for the event
+    abi = event._get_event_abi()
+
+    # Depending on the Solidity version used to compile
+    # the contract that uses the ABI,
+    # it might have Solidity ABI encoding v1 or v2.
+    # We just assume the default that you set on Web3 object here.
+    # More information here https://eth-abi.readthedocs.io/en/latest/index.html
+    codec: ABICodec = w3.codec
+
+    # Here we need to poke a bit into Web3 internals, as this
+    # functionality is not exposed by default.
+    # Construct JSON-RPC raw filter presentation based on human readable Python descriptions
+    # Namely, convert event names to their keccak signatures
+    # More information here:
+    # https://github.com/ethereum/web3.py/blob/e176ce0793dafdd0573acc8d4b76425b6eb604ca/web3/_utils/filters.py#L71
+    data_filter_set, event_filter_params = construct_event_filter_params(
+        abi,
+        codec,
+        address=argument_filters.get("address"),
+        argument_filters=argument_filters,
+        from_block=from_block,
+        to_block=to_block
+    )
+
+    logger.debug("Querying eth_getLogs with the following parameters: %s", event_filter_params)
+
+    # Call JSON-RPC API on your Ethereum node.
+    # get_logs() returns raw AttributedDict entries
+    logs = w3.eth.get_logs(event_filter_params)
+
+    # Convert raw binary data to Python proxy objects as described by ABI
+    all_events = []
+    for log in logs:
+        # Convert raw JSON-RPC log result to human readable event by using ABI data
+        # More information how process_log works here
+        # https://github.com/ethereum/web3.py/blob/fbaf1ad11b0c7fac09ba34baff2c256cffe0a148/web3/_utils/events.py#L200
+        evt = get_event_data(codec, abi, log)
+        # Note: This was originally yield,
+        # but deferring the timeout exception caused the throttle logic not to work
+        all_events.append(evt)
+    return all_events
+
+
+if __name__ == "__main__":
+    # Simple demo that scans all the token transfers of RCC token (11k).
+    # The demo supports persistent state by using a JSON file.
+    # You will need an Ethereum node for this.
+    # Running this script will consume around 20k JSON-RPC calls.
+    # With locally running Geth, the script takes 10 minutes.
+    # The resulting JSON state file is 2.9 MB.
+    import sys
+    import json
+    from web3.providers.rpc import HTTPProvider
+
+    # We use tqdm library to render a nice progress bar in the console
+    # https://pypi.org/project/tqdm/
+    from tqdm import tqdm
+
+    # RCC has around 11k Transfer events
+    # https://etherscan.io/token/0x9b6443b0fb9c241a7fdac375595cea13e6b7807a
+    RCC_ADDRESS = "0x9b6443b0fb9c241a7fdac375595cea13e6b7807a"
+
+    # Reduced ERC-20 ABI, only Transfer event
+    ABI = """[
+        {
+            "anonymous": false,
+            "inputs": [
+                {
+                    "indexed": true,
+                    "name": "from",
+                    "type": "address"
+                },
+                {
+                    "indexed": true,
+                    "name": "to",
+                    "type": "address"
+                },
+                {
+                    "indexed": false,
+                    "name": "value",
+                    "type": "uint256"
+                }
+            ],
+            "name": "Transfer",
+            "type": "event"
+        }
+    ]
+    """
+
+    class JSONifiedState(EventScannerState):
+        """Store the state of scanned blocks and all events.
+
+        All state is an in-memory dict.
+        Simple load/store massive JSON on start up.
+        """
+
+        def __init__(self):
+            self.state = None
+            self.fname = "test-state.json"
+            # How many second ago we saved the JSON file
+            self.last_save = 0
+
+        def reset(self):
+            """Create initial state of nothing scanned."""
+            self.state = {
+                "last_scanned_block": 0,
+                "blocks": {},
+            }
+
+        def restore(self):
+            """Restore the last scan state from a file."""
+            try:
+                self.state = json.load(open(self.fname, "rt"))
+                print(f"Restored the state, previously {self.state['last_scanned_block']} blocks have been scanned")
+            except (IOError, json.decoder.JSONDecodeError):
+                print("State starting from scratch")
+                self.reset()
+
+        def save(self):
+            """Save everything we have scanned so far in a file."""
+            with open(self.fname, "wt") as f:
+                json.dump(self.state, f)
+            self.last_save = time.time()
+
+        #
+        # EventScannerState methods implemented below
+        #
+
+        def get_last_scanned_block(self):
+            """The number of the last block we have stored."""
+            return self.state["last_scanned_block"]
+
+        def delete_data(self, since_block):
+            """Remove potentially reorganised blocks from the scan data."""
+            for block_num in range(since_block, self.get_last_scanned_block()):
+                if block_num in self.state["blocks"]:
+                    del self.state["blocks"][block_num]
+
+        def start_chunk(self, block_number, chunk_size):
+            pass
+
+        def end_chunk(self, block_number):
+            """Save at the end of each block, so we can resume in the case of a crash or CTRL+C"""
+            # Next time the scanner is started we will resume from this block
+            self.state["last_scanned_block"] = block_number
+
+            # Save the database file for every minute
+            if time.time() - self.last_save > 60:
+                self.save()
+
+        def process_event(self, block_when: datetime.datetime, event: AttributeDict) -> str:
+            """Record a ERC-20 transfer in our database."""
+            # Events are keyed by their transaction hash and log index
+            # One transaction may contain multiple events
+            # and each one of those gets their own log index
+
+            # event_name = event.event # "Transfer"
+            log_index = event.logIndex  # Log index within the block
+            # transaction_index = event.transactionIndex  # Transaction index within the block
+            txhash = event.transactionHash.hex()  # Transaction hash
+            block_number = event.blockNumber
+
+            # Convert ERC-20 Transfer event to our internal format
+            args = event["args"]
+            transfer = {
+                "from": args["from"],
+                "to": args.to,
+                "value": args.value,
+                "timestamp": block_when.isoformat(),
+            }
+
+            # Create empty dict as the block that contains all transactions by txhash
+            if block_number not in self.state["blocks"]:
+                self.state["blocks"][block_number] = {}
+
+            block = self.state["blocks"][block_number]
+            if txhash not in block:
+                # We have not yet recorded any transfers in this transaction
+                # (One transaction may contain multiple events if executed by a smart contract).
+                # Create a tx entry that contains all events by a log index
+                self.state["blocks"][block_number][txhash] = {}
+
+            # Record ERC-20 transfer in our database
+            self.state["blocks"][block_number][txhash][log_index] = transfer
+
+            # Return a pointer that allows us to look up this event later if needed
+            return f"{block_number}-{txhash}-{log_index}"
+
+    def run():
+
+        if len(sys.argv) < 2:
+            print("Usage: eventscanner.py http://your-node-url")
+            sys.exit(1)
+
+        api_url = sys.argv[1]
+
+        # Enable logs to the stdout.
+        # DEBUG is very verbose level
+        logging.basicConfig(level=logging.INFO)
+
+        provider = HTTPProvider(api_url)
+
+        # Disable the default JSON-RPC retry configuration
+        # as it correctly cannot handle eth_getLogs block range
+        provider.exception_retry_configuration = None
+
+        w3 = Web3(provider)
+
+        # Prepare stub ERC-20 contract object
+        abi = json.loads(ABI)
+        ERC20 = w3.eth.contract(abi=abi)
+
+        # Restore/create our persistent state
+        state = JSONifiedState()
+        state.restore()
+
+        # chain_id: int, w3: Web3, abi: Dict, state: EventScannerState, events: List, filters: Dict, max_chunk_scan_size: int=10000
+        scanner = EventScanner(
+            w3=w3,
+            contract=ERC20,
+            state=state,
+            events=[ERC20.events.Transfer],
+            filters={"address": RCC_ADDRESS},
+            # How many maximum blocks at the time we request from JSON-RPC
+            # and we are unlikely to exceed the response size limit of the JSON-RPC server
+            max_chunk_scan_size=10000
+        )
+
+        # Assume we might have scanned the blocks all the way to the last Ethereum block
+        # that mined a few seconds before the previous scan run ended.
+        # Because there might have been a minor Ethereum chain reorganisations
+        # since the last scan ended, we need to discard
+        # the last few blocks from the previous scan results.
+        chain_reorg_safety_blocks = 10
+        scanner.delete_potentially_forked_block_data(state.get_last_scanned_block() - chain_reorg_safety_blocks)
+
+        # Scan from [last block scanned] - [latest ethereum block]
+        # Note that our chain reorg safety blocks cannot go negative
+        start_block = max(state.get_last_scanned_block() - chain_reorg_safety_blocks, 0)
+        end_block = scanner.get_suggested_scan_end_block()
+        blocks_to_scan = end_block - start_block
+
+        print(f"Scanning events from blocks {start_block} - {end_block}")
+
+        # Render a progress bar in the console
+        start = time.time()
+        with tqdm(total=blocks_to_scan) as progress_bar:
+            def _update_progress(start, end, current, current_block_timestamp, chunk_size, events_count):
+                if current_block_timestamp:
+                    formatted_time = current_block_timestamp.strftime("%d-%m-%Y")
+                else:
+                    formatted_time = "no block time available"
+                progress_bar.set_description(f"Current block: {current} ({formatted_time}), blocks in a scan batch: {chunk_size}, events processed in a batch {events_count}")
+                progress_bar.update(chunk_size)
+
+            # Run the scan
+            result, total_chunks_scanned = scanner.scan(start_block, end_block, progress_callback=_update_progress)
+
+        state.save()
+        duration = time.time() - start
+        print(f"Scanned total {len(result)} Transfer events, in {duration} seconds, total {total_chunks_scanned} chunk scans performed")
+
+    run()
+
+
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/gas_price.html b/_build/html_zh_CN/gas_price.html new file mode 100644 index 0000000000..02ff6c9722 --- /dev/null +++ b/_build/html_zh_CN/gas_price.html @@ -0,0 +1,312 @@ + + + + + + + + + Gas Price API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Gas Price API

+
+

警告

+

Gas price strategy is only supported for legacy transactions. The London fork +introduced maxFeePerGas and maxPriorityFeePerGas transaction parameters +which should be used over gasPrice whenever possible.

+
+

For Ethereum (legacy) transactions, gas price is a delicate property. For this reason, +Web3 includes an API for configuring it.

+

The Gas Price API allows you to define Web3's behaviour for populating the gas price. +This is done using a "Gas Price Strategy" - a method which takes the Web3 object and a +transaction dictionary and returns a gas price (denominated in wei).

+
+

Retrieving gas price

+

To retrieve the gas price using the selected strategy simply call +generate_gas_price()

+
>>> web3.eth.generate_gas_price()
+20000000000
+
+
+
+
+

Creating a gas price strategy

+

A gas price strategy is implemented as a python method with the following +signature:

+
def gas_price_strategy(web3, transaction_params=None):
+...
+
+
+

The method must return a positive integer representing the gas price in wei.

+

To demonstrate, here is a rudimentary example of a gas price strategy that +returns a higher gas price when the value of the transaction is higher than +1 Ether.

+
from web3 import Web3
+
+def value_based_gas_price_strategy(web3, transaction_params):
+    if transaction_params['value'] > Web3.to_wei(1, 'ether'):
+        return Web3.to_wei(20, 'gwei')
+    else:
+        return Web3.to_wei(5, 'gwei')
+
+
+
+
+

Selecting the gas price strategy

+

The gas price strategy can be set by calling set_gas_price_strategy().

+
from web3 import Web3
+
+def value_based_gas_price_strategy(web3, transaction_params):
+    ...
+
+w3 = Web3(...)
+w3.eth.set_gas_price_strategy(value_based_gas_price_strategy)
+
+
+
+
+

Available gas price strategies

+
+
+web3.gas_strategies.rpc.rpc_gas_price_strategy(web3, transaction_params=None)
+

Makes a call to the JSON-RPC eth_gasPrice +method which returns +the gas price configured by the connected Ethereum node.

+
+ +
+
+web3.gas_strategies.time_based.construct_time_based_gas_price_strategy(max_wait_seconds, sample_size=120, probability=98, weighted=False)
+

Constructs a strategy which will compute a gas price such that the +transaction will be mined within a number of seconds defined by +max_wait_seconds with a probability defined by probability. The +gas price is computed by sampling sample_size of the most recently +mined blocks. If weighted=True, the block time will be weighted towards +more recently mined blocks.

+
    +
  • max_wait_seconds The desired maximum number of seconds the +transaction should take to mine.

  • +
  • sample_size The number of recent blocks to sample

  • +
  • probability An integer representation of the desired probability that +the transaction will be mined within max_wait_seconds. 0 means 0% +and 100 means 100%.

  • +
+

The following ready to use versions of this strategy are available.

+
    +
  • web3.gas_strategies.time_based.fast_gas_price_strategy: Transaction mined within 60 seconds.

  • +
  • web3.gas_strategies.time_based.medium_gas_price_strategy: Transaction mined within 5 minutes.

  • +
  • web3.gas_strategies.time_based.slow_gas_price_strategy: Transaction mined within 1 hour.

  • +
  • web3.gas_strategies.time_based.glacial_gas_price_strategy: Transaction mined within 24 hours.

  • +
+
+

警告

+

Due to the overhead of sampling the recent blocks it is +recommended that a caching solution be used to reduce the amount of chain +data that needs to be re-fetched for each request.

+
+
from web3 import Web3
+from web3.gas_strategies.time_based import medium_gas_price_strategy
+
+w3 = Web3(...)
+w3.eth.set_gas_price_strategy(medium_gas_price_strategy)
+
+w3.provider.cache_allowed_requests = True
+
+
+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/genindex.html b/_build/html_zh_CN/genindex.html new file mode 100644 index 0000000000..2227a9726b --- /dev/null +++ b/_build/html_zh_CN/genindex.html @@ -0,0 +1,948 @@ + + + + + + + + 索引 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + +

索引

+ +
+ A + | B + | C + | D + | E + | F + | G + | H + | I + | K + | L + | M + | N + | P + | R + | S + | T + | U + | V + | W + +
+

A

+ + + +
+ +

B

+ + + +
+ +

C

+ + + +
+ +

D

+ + + +
+ +

E

+ + + +
+ +

F

+ + + +
+ +

G

+ + + +
+ +

H

+ + + +
+ +

I

+ + + +
+ +

K

+ + +
+ +

L

+ + + +
+ +

M

+ + +
+ +

N

+ + +
+ +

P

+ + + +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

T

+ + + +
+ +

U

+ + + +
+ +

V

+ + +
+ +

W

+ + + +
+ + + +
+
+
+ +
+ +
+

© 版权所有 2016-2025, The Ethereum Foundation。

+
+ + 利用 Sphinx 构建,使用的 + 主题 + 由 Read the Docs 开发. + + +
+
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/index.html b/_build/html_zh_CN/index.html new file mode 100644 index 0000000000..7486885508 --- /dev/null +++ b/_build/html_zh_CN/index.html @@ -0,0 +1,278 @@ + + + + + + + + + + gm(早安) — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

gm(早安)

+横幅图片 +

web3.py 是一个用于与以太坊交互的Python库。

+

它常用于 去中心化应用(dapps),帮助发送交易、与智能合约交互、读取区块数据,以及其他多种用例。

+

获取项目更新,请关注 @EthereumPython 并在 博客 订阅新文章通知。

+
+

快速开始

+
+

备注

+

👋 以太坊新手?

+
    +
  1. 不要独自前行!加入以太坊Python社区

  2. +
  3. 阅读这个 博客系列,轻松了解以太坊区块链的相关概念。

  4. +
  5. 概览 页面将帮助你快速了解 web3.py 的更多功能。

  6. +
  7. 试着构建一些小项目吧!

  8. +
+
+ +
+
+

目录

+
+

介绍

+ +
+ + + +
+
+

索引和表格

+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/internals.html b/_build/html_zh_CN/internals.html new file mode 100644 index 0000000000..ab31054f87 --- /dev/null +++ b/_build/html_zh_CN/internals.html @@ -0,0 +1,826 @@ + + + + + + + + + Web3 内部实现 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Web3 内部实现

+
+

警告

+

This section of the documentation is for advanced users. You should probably stay away from these APIs if you don't know what you are doing.

+
+

The Web3 library has multiple layers of abstraction between the public api +exposed by the web3 object and the backend or node that web3 is connecting to.

+
    +
  • Providers are responsible for the actual communication with the +blockchain such as sending JSON-RPC requests over HTTP or an IPC socket.

  • +
  • Middleware provide hooks for monitoring and modifying requests and +responses to and from the provider.

  • +
  • Managers provide thread safety and primitives to allow for asynchronous usage of web3.

  • +
+

Here are some common things you might want to do with these APIs.

+
    +
  • Redirect certain RPC requests to different providers such as sending all +read operations to a provider backed by a remote node and all write operations +to a local node that you control.

  • +
  • Transparently intercept transactions sent over eth_sendTransaction, sign +them locally, and then send them through eth_sendRawTransaction.

  • +
  • Modify the response from an RPC request so that it is returned in different +format such as converting all integer values to their hexadecimal +representation.

  • +
  • Validate the inputs to RPC requests

  • +
+
+

Request Lifecycle

+

Each web3 RPC call passes through these layers in the following manner.

+
  ***********    ************
+  | Request |    | Response |
+  ***********    ************
+      |                ^
+      v                |
++-----------------------------+
+|           Manager           |
++-----------------------------+
+      |                ^
+      v                |
++-----------------------------+
+|         Middleware          |
++-----------------------------+
+      |                ^
+      v                |
++-----------------------------+
+|          Provider           |
++-----------------------------+
+
+
+

You can visualize this relationship like an onion, with the Provider at the +center. The request originates from the Manager, outside of the onion, passing +down through each layer of the onion until it reaches the Provider at the +center. The Provider then handles the request, producing a response which will +then pass back out from the center of the onion, through each layer until it is +finally returned by the Manager.

+
+
+

Providers

+

A provider is responsible for all direct blockchain interactions. In most +cases this means interacting with the JSON-RPC server for an ethereum node over +HTTP or an IPC socket. There is however nothing which requires providers to be +RPC based, allowing for providers designed for testing purposes which use an +in-memory EVM to fulfill requests.

+
+

Writing your own Provider

+

Writing your own provider requires implementing two required methods as well as +setting the middleware the provider should use.

+
+
+BaseProvider.make_request(method, params)
+

Each provider class must implement this method. This method should +return a JSON object with either a 'result' key in the case of success, +or an 'error' key in the case of failure.

+
    +
  • method This will be a string representing the JSON-RPC method that +is being called such as 'eth_sendTransaction'.

  • +
  • params This will be a list or other iterable of the parameters for +the JSON-RPC method being called.

  • +
+
+ +
+
+BaseProvider.is_connected(show_traceback=False)
+

This function should return True or False depending on whether the +provider should be considered connected. For example, an IPC socket +based provider should return True if the socket is open and False +if the socket is closed.

+

If set to True, the optional show_traceback boolean will raise a +ProviderConnectionError and provide information on why the provider should +not be considered connected.

+
+ +
+
+BaseProvider.middleware
+

This should be an iterable of middleware.

+
+ +

You can set a new list of middleware by assigning to provider.middleware, +with the first middleware that processes the request at the beginning of the list.

+
+
+

Provider Configurations

+
+

Request Caching

+
+

重要

+

Familiarize yourself with the validation logic for request caching before +enabling it. Since this feature often requires making additional requests under the +hood to try to guarantee the validity of the data, it may create unnecessary +overhead for your use case. Validation can be turned off by setting the +request_cache_validation_threshold option to None, caching all allowed +requests, or configured for adjusting performance to your needs.

+
+

Request caching can be configured at the provider level via the following configuration +options on the provider instance:

+
    +
  • cache_allowed_requests: bool = False

  • +
  • cacheable_requests: Optional[Set[RPCEndpoint]]

  • +
  • request_cache_validation_threshold: Optional[Union[RequestCacheValidationThreshold, int]]

  • +
+

For requests that don't rely on block data (e.g., eth_chainId), enabling request +caching by setting the cache_allowed_requests option to True will cache all +responses. This is safe to do.

+

However, for requests that rely on block data (e.g., eth_getBlockByNumber), it is +not safe to always cache their responses because block data can change - during a +chain reorganization or while finality has not been reached, for example. The +request_cache_validation_threshold option allows configuring a safe threshold for +caching responses that depend on block data. By default, this option is configured +to internal values deemed "safe" for the chain id you are connected to. If you are +connected to mainnet Ethereum, this value is set to the finalized block number. +If you are connected to another chain, this value is set to a time interval in seconds, +from the current time, that is deemed "safe" for that chain's finality mechanism.

+

It's important to understand that, in order to perform these validations, extra +requests are sometimes made to the node to get the appropriate information. For a +transaction request, for example, it is necessary to get the block information to +validate the transaction is beyond the safe threshold. This can create overhead, +especially for high-frequency requests. For this reason, it is important to understand +when to turn on caching and how to configure the validation appropriately for your +use case in order to avoid unnecessary overhead.

+

We keep a list of some reasonable values for bigger chains and +use the time interval of 1 hour for everything else. Below is a list of the default +values for internally configured chains:

+
+
    +
  • ETH: RequestCacheValidationThreshold.FINALIZED ("finalized" block)

  • +
  • ARB1: 7 days

  • +
  • ZKSYNC: 1 hour

  • +
  • OETH: 3 minutes

  • +
  • MATIC: 30 minutes

  • +
  • ZKEVM: 1 hour

  • +
  • BASE: 7 days

  • +
  • SCR: 1 hour

  • +
  • GNO: 5 minutes

  • +
  • AVAX: 2 minutes

  • +
  • BNB: 2 minutes

  • +
  • FTM: 1 minute

  • +
+
+

For Ethereum mainnet, for example, this means that a request's response will be cached +if the block number the request relies on is less than or equal to the finalized +block number. If the block number exceeds the finalized block number, the response +won't be cached. For all others, the response will be cached if the block timestamp +related to the data that is being requested is older than or equal to the time interval +configured for that chain. For any chain not on this list, the default value is set to +1 hour (this includes all testnets).

+

This behavior can be modified by setting the request_cache_validation_threshold +option to RequestCacheValidationThreshold.SAFE, which uses the safe block as +the threshold (Ethereum mainnet only), to your own time interval in seconds (for any +chain, including mainnet Ethereum), or to None, which disables any validation and +caches all requests (this is not recommended for non testnet chains). The +RequestCacheValidationThreshold enum, for mainnet finalized and safe values, +is imported from the web3.utils module.

+

Note that the cacheable_requests option can be used to specify a set of RPC +endpoints that are allowed to be cached. By default, this option is set to an internal +list of deemed-safe-to-cache endpoints, excluding endpoints such as eth_call, whose +responses can vary and are not safe to cache. The default list of cacheable requests is +below, with requests validated by the request_cache_validation_threshold option in +bold:

+
+
    +
  • eth_chainId

  • +
  • web3_clientVersion

  • +
  • net_version

  • +
  • eth_getBlockByNumber

  • +
  • eth_getRawTransactionByBlockNumberAndIndex

  • +
  • eth_getBlockTransactionCountByNumber

  • +
  • eth_getUncleByBlockNumberAndIndex

  • +
  • eth_getUncleCountByBlockNumber

  • +
  • eth_getBlockByHash

  • +
  • eth_getTransactionByHash

  • +
  • eth_getTransactionByBlockNumberAndIndex

  • +
  • eth_getTransactionByBlockHashAndIndex

  • +
  • eth_getBlockTransactionCountByHash

  • +
  • eth_getRawTransactionByBlockHashAndIndex

  • +
  • eth_getUncleByBlockHashAndIndex

  • +
  • eth_getUncleCountByBlockHash

  • +
+
+
from web3 import Web3, HTTPProvider
+from web3.utils import RequestCacheValidationThreshold
+
+w3 = Web3(HTTPProvider(
+    endpoint_uri="...",
+
+    # optional flag to turn on cached requests, defaults to ``False``
+    cache_allowed_requests=True,
+
+    # optional, defaults to an internal list of deemed-safe-to-cache endpoints (see above)
+    cacheable_requests={"eth_chainId", "eth_getBlockByNumber"},
+
+    # optional, defaults to a value that is based on the chain id (see above)
+    request_cache_validation_threshold=60 * 60,  # 1 hour
+    # request_cache_validation_threshold=RequestCacheValidationThreshold.SAFE,  # Ethereum mainnet only
+))
+
+
+
+
+

Retry Requests for HTTP Providers

+

HTTPProvider and AsyncHTTPProvider instances retry certain requests by default +on exceptions. This can be configured via the exception_retry_configuration +property on the provider instance, which takes a +ExceptionRetryConfiguration class as its value. The +retry mechanism employs an exponential backoff strategy, starting from the initial +value determined by the backoff_factor, and doubling the delay with each attempt, +up to the retries value. Below is an example showing the default options for the +retry configuration and how to override them.

+
+
+class web3.providers.rpc.utils.ExceptionRetryConfiguration
+
+
+errors
+

A tuple of exceptions that the provider should retry on. The default is +HTTPProvider: (ConnectionError, requests.HTTPError, requests.Timeout) +and AsyncHTTPProvider: (aiohttp.ClientError, asyncio.TimeoutError).

+
+ +
+
+retries
+

The number of retries to attempt. The default is 5.

+
+ +
+
+backoff_factor
+

The initial delay multiplier, which doubles with each retry attempt. The default +is 0.125.

+
+ +
+
+method_allowlist
+

A list of retryable methods. The default is an in-house list of deemed-safe-to- +retry methods.

+
+ +
+ +
from web3 import Web3, HTTPProvider
+from web3.providers.rpc.utils import (
+    REQUEST_RETRY_ALLOWLIST,
+    ExceptionRetryConfiguration,
+)
+
+w3 = Web3(HTTPProvider(
+    endpoint_uri="...",
+    exception_retry_configuration=ExceptionRetryConfiguration(
+        errors=DEFAULT_EXCEPTIONS,
+
+        # number of retries to attempt
+        retries=5,
+
+        # initial delay multiplier, doubles with each retry attempt
+        backoff_factor=0.125,
+
+        # an in-house default list of retryable methods
+        method_allowlist=REQUEST_RETRY_ALLOWLIST,
+    ),
+))
+
+
+

For the different http providers, DEFAULT_EXCEPTIONS is defined as:

+
    +
  • HTTPProvider: (ConnectionError, requests.HTTPError, requests.Timeout)

  • +
  • AsyncHTTPProvider: (ConnectionError, aiohttp.ClientError, asyncio.TimeoutError)

  • +
+

Setting retry_configuration to None will disable retries on exceptions for the +provider instance.

+
from web3 import Web3, HTTPProvider
+
+w3 = Web3(HTTPProvider(endpoint_uri="...", retry_configuration=None)
+
+
+
+
+
+
+

Managers

+

The Manager acts as a gatekeeper for the request/response lifecycle. It is +unlikely that you will need to change the Manager as most functionality can be +implemented in the Middleware layer.

+
+
+

Request Processing for Persistent Connection Providers

+
+
+class web3.providers.persistent.request_processor.RequestProcessor
+
+ +

The RequestProcessor class is responsible for the storing and syncing up of +asynchronous requests to responses for a PersistentConnectionProvider. The +WebSocketProvider and the +AsyncIPCProvider are two persistent connection +providers. In order to send a request and receive a response to that same request, +PersistentConnectionProvider instances have to match request id values to +response id values coming back from the socket connection. Any provider that does +not adhere to the JSON-RPC 2.0 specification +in this way will not work with PersistentConnectionProvider instances. The specifics +of how the request processor handles this are outlined below.

+
+

Listening for Responses

+

Implementations of the PersistentConnectionProvider class have a message listener +background task that is called when the socket connection is established. This task +is responsible for listening for any and all messages coming in over the socket +connection and storing them in the RequestProcessor instance internal to the +PersistentConnectionProvider instance. The RequestProcessor instance is +responsible for storing the messages in the correct cache, either the one-to-one cache +or the one-to-many (subscriptions) queue, depending on whether the message has a +JSON-RPC id value or not.

+
+
+

One-To-One Requests

+

One-to-one requests can be summarized as any request that expects only one response +back. An example is using the eth module API to request the latest block number.

+
>>> async def ws_one_to_one_example():
+...     async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3:
+...         # make a request and expect a single response returned on the same line
+...         latest_block_num = await w3.eth.block_number
+
+>>> asyncio.run(ws_one_to_one_example())
+
+
+

With persistent socket connections, we have to call send() and asynchronously +receive responses via another means, generally by calling recv() or by iterating +on the socket connection for messages. As outlined above, the +PersistentConnectionProvider class has a message listener background task that +handles the receiving of messages.

+

Due to this asynchronous nature of sending and receiving, in order to make one-to-one +request-to-response calls work, we have to save the request information somewhere so +that, when the response is received, we can match it to the original request that was +made (i.e. the request with a matching id to the response that was received). The +stored request information is then used to process the response when it is received, +piping it through the response formatters and middleware internal to the web3.py +library.

+

In order to store the request information, the RequestProcessor class has an +internal RequestInformation cache. The RequestInformation class saves important +information about a request.

+
+
+class web3._utils.caching.RequestInformation
+
+
+method
+

The name of the method - e.g. "eth_subscribe".

+
+ +
+
+params
+

The params used when the call was made - e.g. ("newPendingTransactions", True).

+
+ +
+
+response_formatters
+

The formatters that will be used to process the response.

+
+ +
+
+middleware_response_processors
+

Any middleware that processes responses that is present on the instance at the +time of the request is appended here, in order, so the response may be piped +through that logic when it comes in.

+
+ +
+
+subscription_id
+

If the request is an eth_subscribe request, rather than +popping this information from the cache when the response to the subscription call +comes in (i.e. the subscription id), we save the subscription id with the +request information so that we can correctly process all subscription messages +that come in with that subscription id. For one-to-one request-to-response +calls, this value is always None.

+
+ +
+ +

One-to-one responses, those that include a JSON-RPC id in the response object, are +stored in an internal SimpleCache class, isolated from any one-to-many responses. +When the PersistentConnectionProvider is looking for a response internally, it will +expect the message listener task to store the response in this cache. Since the request +id is used in the cache key generation, it will then look for a cache key that matches +the response id with that of the request id. If the cache key is found, the response +is processed and returned to the user. If the cache key is not found, the operation will +time out and raise a TimeExhausted exception. This timeout can be configured by the +user when instantiating the PersistentConnectionProvider instance via the +response_timeout keyword argument.

+
+
+

One-To-Many Requests

+

One-to-many requests can be summarized by any request that expects many responses as a +result of the initial request. The only current example is the eth_subscribe +request. The initial eth_subscribe request expects only one response, the +subscription id value, but it also expects to receive many eth_subscription +messages if and when the request is successful. For this reason, the original request +is considered a one-to-one request so that a subscription id can be returned to the +user on the same line. The many responses this call will produce can be handled in one +of a few ways.

+

The recommended way to handle one-to-many responses is to use the subscription manager +API. The subscription manager API is a public API on the AsyncWeb3 class, when +connected to a PersistentConnectionProvider instance, that allows the user to +subscribe to a subscription and handle the many responses asynchronously. The +subscription_manager instance is responsible for handling the many responses that +come in over the socket connection, as long as handlers are passed to each subscription +call. The subscription manager can also be used to unsubscribe from a subscription when +the user is done with it.

+
>>> async def new_heads_handler(
+...     handler_context: NewHeadsSubscriptionContext,
+... ) -> None:
+...     result = handler_context.result
+...     print(f"New block header: {result}\n")
+...     if result["number"] > 1234567:
+...         await handler_context.subscription.unsubscribe()
+
+>>> async def ws_subscription_example():
+...     async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3:
+...         # Subscribe to new block headers and receive the subscription_id.
+...         # A one-to-one call with a trigger for many responses
+...         subscription_id = await w3.eth.subscribe("newHeads", handler=new_heads_handler)
+...
+...         # Handle the subscription messages asynchronously using the subscription
+...         # manager. This will continue until no more subscriptions are present in
+...         # the subscription manager, or indefinitely if the `run_forever` flag
+...         # is set to `True`.
+...         await w3.subscription_manager.handle_subscriptions(run_forever=False)
+>>> asyncio.run(ws_subscription_example())
+
+
+

The manager can also subscribe to many subscriptions at one time. The +EthSubscription classes, available via web3.utils.subscriptions, provide a +friendly API for managing subscriptions. Since each connection and provider instance +has its own message listener task and subscription manager instance, you can subscribe +to many subscriptions at once and handle the many responses that come in over the socket +connections via handlers. The handlers contain:

+
    +
  • async_w3: The AsyncWeb3 instance that the subscription was made on.

  • +
  • subscription: The subscription instance that the handler is attached to.

  • +
  • result: The response that came in over the socket connection for the subscription.

  • +
+

Subscriptions also accept a handler_context argument that can be used to pass +additional information to the handler when subscribing to a subscription. This can be +used to pass in an event object, for example, that can be used to parse a log event +when it comes in.

+
>>> from web3 import (
+...     AsyncWeb3,
+...     WebSocketProvider,
+...     AsyncIPCProvider,
+... )
+>>> from web3.utils.subscriptions import (
+...     EthSubscription,
+...     NewHeadsSubscription,
+...     NewHeadsSubscriptionContext,
+...     PendingTxSubscription,
+...     PendingTxSubscriptionContext,
+...     LogsSubscription,
+...     LogsSubscriptionContext,
+... )
+
+>>> async def new_heads_handler(
+...     handler_context: NewHeadsSubscriptionContext,
+... ) -> None:
+...     header = handler_context.result
+...     print(f"New block header: {header}\n")
+...     if header["number"] > 1234567:
+...         await handler_context.subscription.unsubscribe()
+
+>>> async def pending_txs_handler(
+...     handler_context: PendingTxSubscriptionContext,
+... ) -> None:
+...     ...
+
+>>> async def log_handler(
+...     handler_context: LogsSubscriptionContext,
+... ) -> None:
+...     log_receipt = handler_context.result
+...     # event is now available in the handler context, because we pass it to in the
+...     # ``handler_context`` when subscribing to the log
+...     event_data = handler_context.transfer_event.process_log(log_receipt)
+...     print(f"Log event data: {event_data}\n")
+
+>>> async def sub_manager():
+...     local_w3 = await AsyncWeb3(AsyncIPCProvider(LOCAL_IPC))
+...
+...     # subscribe to many subscriptions via the subscription manager with handlers
+...     weth_contract = local_w3.eth.contract(
+...         address=local_w3.to_checksum_address("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
+...         abi=WETH_ABI,
+...     )
+...     transfer_event = weth_contract.events.Transfer()
+...     await local_w3.subscription_manager.subscribe(
+...         [
+...             NewHeadsSubscription(label="new-heads-mainnet", handler=new_heads_handler),
+...             PendingTxSubscription(
+...                 label="pending-tx-mainnet",  # optional label
+...                 full_transactions=True,
+...                 handler=pending_tx_handler,
+...             ),
+...             LogsSubscription(
+...                 label="WETH transfers",  # optional label
+...                 address=weth_contract.address,
+...                 topics=[transfer_event.topic],
+...                 handler=log_handler,
+...                 # optional ``handler_context`` args to help parse a response
+...                 handler_context={"transfer_event": transfer_event},
+...             ),
+...         ]
+...     )
+...
+...     public_w3 = await AsyncWeb3(WebSocketProvider(PUBLIC_PROVIDER_WS))
+...     # subscribe via eth_subscribe, with handler and label (optional)
+...     await public_w3.eth.subscribe("public_newHeads", handler=pending_tx_handler, label="new-heads-public-ws")
+
+>>>     # This will handle all subscriptions until no more subscriptions are present
+...     # in either subscription manager instance. If the `run_forever` flag is set
+...     # to `True` on any manager instance, this will run indefinitely.
+>>>     await asyncio.gather(
+...         public_w3.subscription_manager.handle_subscriptions(),
+...         local_w3.subscription_manager.handle_subscriptions(),
+...     )
+...
+...     # close the connections
+...     await local_w3.provider.disconnect()
+...     await public_w3.provider.disconnect()
+
+>>> asyncio.run(sub_manager())
+
+
+

The process_subscriptions() method on the +PersistentConnection class, the public API for +interacting with the active persistent socket connection, is also set up to receive +eth_subscription responses over an asynchronous iterator pattern. You can use this +method to listen for raw messages and process them as they come in.

+
>>> async def ws_subscription_example():
+...     async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3:
+...         # Subscribe to new block headers and receive the subscription_id.
+...         # A one-to-one call with a trigger for many responses
+...         subscription_id = await w3.eth.subscribe("newHeads")
+...
+...         # Listen to the socket for the many responses utilizing the
+...         # ``w3.socket`` ``PersistentConnection`` public API method
+...         # ``process_subscriptions()``
+...         async for response in w3.socket.process_subscriptions():
+...             # Receive only one-to-many responses here so that we don't
+...             # accidentally return the response for a one-to-one request in this
+...             # block
+...
+...             print(f"{response}\n")
+...
+...             if some_condition:
+...                 # unsubscribe from new block headers, another one-to-one request
+...                 is_unsubscribed = await w3.eth.unsubscribe(subscription_id)
+...                 if is_unsubscribed:
+...                     break
+
+>>> asyncio.run(ws_subscription_example())
+
+
+

One-to-many responses, those that do not include a JSON-RPC id in the response object, +are stored in an internal asyncio.Queue instance, isolated from any one-to-one +responses. When the PersistentConnectionProvider is looking for one-to-many +responses internally, it will expect the message listener task to store these messages +in this queue. Since the order of the messages is important, the queue is a FIFO queue. +The process_subscriptions() method on the PersistentConnection class is set up +to pop messages from this queue as FIFO over an asynchronous iterator pattern.

+

If the stream of messages from the socket is not being interrupted by any other +tasks, the queue will generally be in sync with the messages coming in over the +socket. That is, the message listener will put a message in the queue and the +process_subscriptions() method will pop that message from the queue and yield +control of the loop back to the listener. This will continue until the socket +connection is closed or the user unsubscribes from the subscription. If the stream of +messages lags a bit, or the provider is not consuming messages but has subscribed to +a subscription, this internal queue may fill up with messages until it reaches its max +size and then trigger a waiting asyncio.Event until the provider begins consuming +messages from the queue again. For this reason, it's important to begin consuming +messages from the queue, via the process_subscriptions() method, as soon as a +subscription is made.

+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/middleware.html b/_build/html_zh_CN/middleware.html new file mode 100644 index 0000000000..e0d3d89197 --- /dev/null +++ b/_build/html_zh_CN/middleware.html @@ -0,0 +1,836 @@ + + + + + + + + + 中间件 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

中间件

+

Web3 is instantiated with layers of middleware by default. They sit between the public +Web3 methods and the 提供者, and are used to perform sanity checks, convert data +types, enable ENS support, and more. Each layer can modify the request and/or response. +While several middleware are enabled by default, others are available for optional use, +and you're free to create your own!

+

Each middleware layer gets invoked before the request reaches the provider, and then +processes the result after the provider returns, in reverse order. However, it is +possible for a middleware to return early from a call without the request ever getting +to the provider (or even reaching the middleware that are in deeper layers).

+
+

Configuring Middleware

+

Middleware can be added, removed, replaced, and cleared at runtime. To make that easier, you +can name the middleware for later reference.

+
+

Middleware Order

+

Think of the middleware as being layered in an onion, where you initiate a web3.py request at +the outermost layer of the onion, and the Ethereum node (like geth) receives and responds +to the request inside the innermost layer of the onion. Here is a (simplified) diagram:

+
                            New request from web3.py
+
+                                        |
+                                        |
+                                        v
+
+                                `````Layer 2``````
+                         ```````                  ```````
+                    `````               |                ````
+                 ````                   v                    ````
+              ```                                                ```
+            `.               ````````Layer 1```````                `.`
+          ``             ````                      `````              .`
+        `.            ```               |               ```            `.`
+       .`          ```                  v                  ```           `.
+     `.          `.`                                         ```           .`
+    ``          .`                  `Layer 0`                  ``           .`
+   ``         `.               `````        ``````               .           .`
+  `.         ``             ```         |        ```              .`          .
+  .         ``            `.`           |           ``             .           .
+ .         `.            ``       JSON-RPC call       .`            .          .`
+ .         .            ``              |              .            ``          .
+``         .            .               v               .            .          .
+.         .`           .                                .            .          ``
+.         .            .          Ethereum node         .`           .           .
+.         .            .                                .            .           .
+.         ``           `.               |               .            .           .
+.          .            .`              |              .`            .          .
+`.         .`            .`          Response         .`            .`          .
+ .          .             `.`           |           `.`            `.           .
+ `.          .              ```         |        ````             `.           .
+  .          `.               `````     v     ````               `.           ``
+   .           .`                 ```Layer 0``                  ``           `.
+    .           `.                                            `.`           `.
+     .            `.                    |                   `.`            `.
+      .`            ```                 |                 ```             .`
+       `.              ```              v             ````              `.`
+         ``               ``````                 `````                 .`
+           ``                   `````Layer 1`````                   `.`
+             ```                                                  ```
+               ````                     |                      ```
+                  `````                 v                  ````
+                      ``````                          `````
+                            `````````Layer 2``````````
+
+                                        |
+                                        v
+
+                             Returned value in web3.py
+
+
+

The middleware are maintained in Web3.middleware_onion. See below for the API.

+

When specifying middleware in a list, or retrieving the list of middleware, they will +be returned in the order of outermost layer first and innermost layer last. In the above +example, that means that w3.middleware_onion.middleware would return the middleware +in the order of: [2, 1, 0].

+
+
+

Middleware Stack API

+

To add or remove items in different layers, use the following API:

+
+
+Web3.middleware_onion.add(middleware, name=None)
+

Middleware will be added to the outermost layer. That means the new middleware will modify the +request first, and the response last. You can optionally name it with any hashable object, +typically a string.

+
>>> w3 = Web3(...)
+>>> w3.middleware_onion.add(web3.middleware.GasPriceStrategyMiddleware)
+# or
+>>> w3.middleware_onion.add(web3.middleware.GasPriceStrategyMiddleware, 'gas_price_strategy')
+
+
+
+ +
+
+Web3.middleware_onion.inject(middleware, name=None, layer=None)
+

Inject a named middleware to an arbitrary layer.

+

The current implementation only supports injection at the innermost or +outermost layers. Note that injecting to the outermost layer is equivalent to calling +Web3.middleware_onion.add() .

+
# Either of these will put the gas_price_strategy middleware at the innermost layer
+>>> w3 = Web3(...)
+>>> w3.middleware_onion.inject(web3.middleware.GasPriceStrategyMiddleware, layer=0)
+# or
+>>> w3.middleware_onion.inject(web3.middleware.GasPriceStrategyMiddleware, 'gas_price_strategy', layer=0)
+
+
+
+ +
+
+Web3.middleware_onion.remove(middleware)
+

Middleware will be removed from whatever layer it was in. If you added the middleware with +a name, use the name to remove it. If you added the middleware as an object, use the object +again later to remove it:

+
>>> w3 = Web3(...)
+>>> w3.middleware_onion.remove(web3.middleware.GasPriceStrategyMiddleware)
+# or
+>>> w3.middleware_onion.remove('gas_price_strategy')
+
+
+
+ +
+
+Web3.middleware_onion.replace(old_middleware, new_middleware)
+

Middleware will be replaced from whatever layer it was in. If the middleware was named, it will +continue to have the same name. If it was un-named, then you will now reference it with the new +middleware object.

+
>>> from web3.middleware import GasPriceStrategyMiddleware, AttributeDictMiddleware
+>>> w3 = Web3(provider, middleware=[GasPriceStrategyMiddleware, AttributeDictMiddleware])
+
+>>> w3.middleware_onion.replace(GasPriceStrategyMiddleware, AttributeDictMiddleware)
+# this is now referenced by the new middleware object, so to remove it:
+>>> w3.middleware_onion.remove(AttributeDictMiddleware)
+
+# or, if it was named
+
+>>> w3.middleware_onion.replace('gas_price_strategy', AttributeDictMiddleware)
+# this is still referenced by the original name, so to remove it:
+>>> w3.middleware_onion.remove('gas_price_strategy')
+
+
+
+ +
+
+Web3.middleware_onion.clear()
+

Empty all the middleware, including the default ones.

+
>>> w3 = Web3(...)
+>>> w3.middleware_onion.clear()
+>>> assert len(w3.middleware_onion) == 0
+
+
+
+ +
+
+Web3.middleware_onion.middleware
+

Return all the current middleware for the Web3 instance in the appropriate order for importing into a new +Web3 instance.

+
>>> w3_1 = Web3(...)
+# add uniquely named middleware:
+>>> w3_1.middleware_onion.add(web3.middleware.GasPriceStrategyMiddleware, 'test_middleware')
+# export middleware from first w3 instance
+>>> middleware = w3_1.middleware_onion.middleware
+
+# import into second instance
+>>> w3_2 = Web3(..., middleware=middleware)
+>>> assert w3_1.middleware_onion.middleware == w3_2.middleware_onion.middleware
+>>> assert w3_2.middleware_onion.get('test_middleware')
+
+
+
+ +
+
+

Instantiate with Custom Middleware

+

Instead of working from the default list, you can specify a custom list of +middleware when initializing Web3:

+
Web3(middleware=[my_middleware1, my_middleware2])
+
+
+
+

警告

+

This will replace the default middleware. To keep the default functionality, +either use middleware_onion.add() from above, or add the default middleware to +your list of new middleware.

+
+
+
+
+

Default Middleware

+

The following middleware are included by default:

+
    +
  • gas_price_strategy

  • +
  • ens_name_to_address

  • +
  • attrdict

  • +
  • validation

  • +
  • gas_estimate

  • +
+

The defaults are defined in the get_default_middleware() method in web3/manager.py.

+
+

AttributeDict

+
+
+class web3.middleware.AttributeDictMiddleware
+

This middleware recursively converts any dictionary type in the result of a call +to an AttributeDict. This enables dot-syntax access, like +eth.get_block('latest').number in addition to +eth.get_block('latest')['number'].

+
+

备注

+

Accessing a property via attribute breaks type hinting. For this reason, this +feature is available as a middleware, which may be removed if desired.

+
+
+ +
+
+

ENS Name to Address Resolution

+
+
+class web3.middleware.ENSNameToAddressMiddleware
+

This middleware converts Ethereum Name Service (ENS) names into the +address that the name points to. For example w3.eth.send_transaction will +accept .eth names in the 'from' and 'to' fields.

+
+

备注

+

This middleware only converts ENS names on chains where the proper ENS +contracts are deployed to support this functionality. All other cases will +result in a NameNotFound error.

+
+
+ +
+
+

Gas Price Strategy

+
+
+class web3.middleware.GasPriceStrategyMiddleware
+
+

警告

+

Gas price strategy is only supported for legacy transactions. The London fork +introduced maxFeePerGas and maxPriorityFeePerGas transaction parameters +which should be used over gasPrice whenever possible.

+
+

This adds a gasPrice to transactions if applicable and when a gas price strategy has +been set. See Gas 价格 API for information about how gas price is derived.

+
+ +
+
+

Buffered Gas Estimate

+
+
+class web3.middleware.BufferedGasEstimateMiddleware
+

This adds a gas estimate to transactions if gas is not present in the transaction +parameters. Sets gas to: +min(w3.eth.estimate_gas + gas_buffer, gas_limit) +where the gas_buffer default is 100,000

+
+ +
+
+

Validation

+
+
+class web3.middleware.ValidationMiddleware
+

This middleware includes block and transaction validators which perform validations +for transaction parameters.

+
+ +
+
+
+

Optional Middleware

+

Web3 includes optional middleware for common use cases. Below is a list of available +middleware which are not enabled by default.

+
+

Stalecheck

+
+
+web3.middleware.StalecheckMiddlewareBuilder()
+

This middleware checks how stale the blockchain is, and interrupts calls with a failure +if the blockchain is too old.

+
    +
  • allowable_delay is the length in seconds that the blockchain is allowed to be +behind of time.time()

  • +
+

Because this middleware takes an argument, you must create the middleware +with a method call.

+
two_day_stalecheck = StalecheckMiddlewareBuilder.build(60 * 60 * 24 * 2)
+web3.middleware_onion.add(two_day_stalecheck)
+
+
+

If the latest block in the blockchain is older than 2 days in this example, then the +middleware will raise a StaleBlockchain exception on every call except +web3.eth.get_block().

+
+ +
+
+

Proof of Authority

+
+
+class web3.middleware.ExtraDataToPOAMiddleware
+
+ +
+

重要

+

It is crucial that this middleware is injected at the 0th layer of the +middleware onion, using +w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0), to guarantee +it is the first middleware to process the response and modify the extraData +field. This ensures it processes the field before any other middleware attempts +to validate it.

+
+

ExtraDataToPOAMiddleware is required to connect to geth --dev and may +also be needed for other EVM compatible blockchains like Polygon or BNB Chain +(Binance Smart Chain).

+

If the middleware is not injected at the 0th layer of the middleware onion, you may get +errors like the example below when interacting with your EVM node.

+
web3.exceptions.ExtraDataLengthError: The field extraData is 97 bytes, but should be
+32.  It is quite likely that you are connected to a POA chain. Refer to
+http://web3py.readthedocs.io/en/stable/middleware.html#proof-of-authority
+for more details. The full extraData is: HexBytes('...')
+
+
+

The easiest way to connect to a default geth --dev instance which loads the +middleware is:

+
>>> from web3.auto.gethdev import w3
+
+# confirm that the connection succeeded
+>>> w3.client_version
+'Geth/v1.14.12-stable-4bb3c89d/linux-amd64/go1.22.4'
+
+
+

This example connects to a local geth --dev instance on Linux with a +unique IPC location and loads the middleware:

+
>>> from web3 import Web3, IPCProvider
+
+# connect to the IPC location started with 'geth --dev --datadir ~/mynode'
+>>> w3 = Web3(IPCProvider('~/mynode/geth.ipc'))
+
+>>> from web3.middleware import ExtraDataToPOAMiddleware
+
+# inject the poa compatibility middleware to the innermost layer (0th layer)
+>>> w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)
+
+# confirm that the connection succeeded
+>>> w3.client_version
+'Geth/v1.14.12-stable-4bb3c89d/linux-amd64/go1.22.4'
+
+
+
+

Why is ExtraDataToPOAMiddleware necessary?

+

There is no strong community consensus on a single Proof-of-Authority (PoA) standard yet. +Some nodes have successful experiments running though. One is go-ethereum (geth), +which uses a prototype PoA for its development mode and the Goerli test network.

+

Unfortunately, it does deviate from the yellow paper specification, which constrains the +extraData field in each block to a maximum of 32-bytes. Geth is one such example +where PoA uses more than 32 bytes, so this middleware modifies the block data a bit +before returning it.

+
+
+
+

Locally Managed Log and Block Filters

+
+
+web3.middleware.LocalFilterMiddleware()
+
+ +

This middleware provides an alternative to ethereum node managed filters. When used, Log and +Block filter logic are handled locally while using the same web3 filter api. Filter results are +retrieved using JSON-RPC endpoints that don't rely on server state.

+
>>> from web3 import Web3, EthereumTesterProvider
+>>> w3 = Web3(EthereumTesterProvider())
+>>> from web3.middleware import LocalFilterMiddleware
+>>> w3.middleware_onion.add(LocalFilterMiddleware)
+
+
+
#  Normal block and log filter apis behave as before.
+>>> block_filter = w3.eth.filter("latest")
+
+>>> log_filter = myContract.events.myEvent.build_filter().deploy()
+
+
+
+
+

Signing

+
+
+web3.middleware.SignAndSendRawMiddlewareBuilder()
+
+ +

This middleware automatically captures transactions, signs them, and sends them as raw transactions. +The from field on the transaction, or w3.eth.default_account must be set to the address of the private key for +this middleware to have any effect.

+

The build method for this middleware builder takes a single argument:

+
+
    +
  • private_key_or_account A single private key or a tuple, list or set of private keys.

    +
    +

    Keys can be in any of the following formats:

    +
      +
    • An eth_account.LocalAccount object

    • +
    • An eth_keys.PrivateKey object

    • +
    • A raw private key as a hex string or byte string

    • +
    +
    +
  • +
+
+
+

重要

+

Since this middleware signs transactions, it must always run after any middleware +that modifies the transaction. Therefore, it is recommended to inject the signing +middleware at the 0th layer of the middleware onion using +w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(...), layer=0). +Ensure that any transaction-modifying middleware exists in a higher layer within the +onion so that it runs before the signing middleware.

+
+
+

备注

+

If used with ExtraDataToPOAMiddleware, the injection order doesn't matter, as +the extraData field isn't involved in transaction signing. The key is ensuring +SignAndSendRawMiddlewareBuilder runs after any middleware that modifies the +transaction.

+
+
>>> from web3 import Web3, EthereumTesterProvider
+>>> w3 = Web3(EthereumTesterProvider)
+>>> from web3.middleware import SignAndSendRawMiddlewareBuilder
+>>> from eth_account import Account
+>>> acct = Account.create('KEYSMASH FJAFJKLDSKF7JKFDJ 1530')
+>>> w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct), layer=0)
+>>> w3.eth.default_account = acct.address
+
+
+

Hosted nodes (like Infura or Alchemy) only support signed +transactions. This often results in send_raw_transaction being used repeatedly. +Instead, we can automate this process with +SignAndSendRawMiddlewareBuilder.build(private_key_or_account).

+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.HTTPProvider('HTTP_ENDPOINT'))
+>>> from web3.middleware import SignAndSendRawMiddlewareBuilder
+>>> from eth_account import Account
+>>> import os
+>>> acct = w3.eth.account.from_key(os.environ.get('PRIVATE_KEY'))
+>>> w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct), layer=0)
+>>> w3.eth.default_account = acct.address
+
+>>> # use `eth_sendTransaction` to automatically sign and send the raw transaction
+>>> w3.eth.send_transaction(tx_dict)
+HexBytes('0x09511acf75918fd03de58141d2fd409af4fd6d3dce48eb3aa1656c8f3c2c5c21')
+
+
+

Similarly, with AsyncWeb3:

+
>>> from web3 import AsyncWeb3
+>>> async_w3 = AsyncWeb3(AsyncHTTPProvider('HTTP_ENDPOINT'))
+>>> from web3.middleware import SignAndSendRawMiddlewareBuilder
+>>> from eth_account import Account
+>>> import os
+>>> acct = async_w3.eth.account.from_key(os.environ.get('PRIVATE_KEY'))
+>>> async_w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct), layer=0)
+>>> async_w3.eth.default_account = acct.address
+
+>>> # use `eth_sendTransaction` to automatically sign and send the raw transaction
+>>> await async_w3.eth.send_transaction(tx_dict)
+HexBytes('0x09511acf75918fd03de58141d2fd409af4fd6d3dce48eb3aa1656c8f3c2c5c21')
+
+
+

Now you can send a transaction from acct.address without having to build and sign each raw transaction.

+

When making use of this signing middleware, when sending dynamic fee transactions (recommended over legacy transactions), +the transaction type of 2 (or '0x2') is necessary. This is because transaction signing is validated based +on the transaction type parameter. This value defaults to '0x2' when maxFeePerGas and / or +maxPriorityFeePerGas are present as parameters in the transaction as these params imply a dynamic fee transaction. +Since these values effectively replace the legacy gasPrice value, do not set a gasPrice for dynamic fee transactions. +Doing so will lead to validation issues.

+
# dynamic fee transaction, introduced by EIP-1559:
+>>> dynamic_fee_transaction = {
+...     'type': '0x2',  # optional - defaults to '0x2' when dynamic fee transaction params are present
+...     'from': acct.address,  # optional if w3.eth.default_account was set with acct.address
+...     'to': receiving_account_address,
+...     'value': 22,
+...     'maxFeePerGas': 2000000000,  # required for dynamic fee transactions
+...     'maxPriorityFeePerGas': 1000000000,  # required for dynamic fee transactions
+... }
+>>> w3.eth.send_transaction(dynamic_fee_transaction)
+
+
+

A legacy transaction still works in the same way as it did before EIP-1559 was introduced:

+
>>> legacy_transaction = {
+...     'to': receiving_account_address,
+...     'value': 22,
+...     'gasPrice': 123456,  # optional - if not provided, gas_price_strategy (if exists) or eth_gasPrice is used
+... }
+>>> w3.eth.send_transaction(legacy_transaction)
+
+
+
+
+
+

Creating Custom Middleware

+

To write your own middleware, create a class and extend from the base Web3Middleware +class, then override only the parts of the middleware that make sense for your use case.

+
+

备注

+

The Middleware API borrows from the Django middleware API introduced +in version 1.10.0.

+
+

If all you need is to modify the params before a request is made, you can override +the request_processor method, make the necessary tweaks to the params, and pass the +arguments to the next element in the middleware stack. Need to do some processing on the +response? Override the response_processor method and return the modified response.

+

The pattern:

+
from web3.middleware import Web3Middleware
+
+class CustomMiddleware(Web3Middleware):
+
+    def request_processor(self, method, params):
+        # Pre-request processing goes here before passing to the next middleware.
+        return (method, params)
+
+    def response_processor(self, method, response):
+        # Response processing goes here before passing to the next middleware.
+        return response
+
+    # If your provider is asynchronous, override the async methods instead:
+
+    async def async_request_processor(self, method, params):
+        # Pre-request processing goes here before passing to the next middleware.
+        return (method, params)
+
+    async def async_response_processor(self, method, response):
+        # Response processing goes here before passing to the next middleware.
+        return response
+
+
+

If you wish to prevent making a call under certain conditions, you can override the +wrap_make_request method. This allows for defining pre-request processing, +skipping or making the request under certain conditions, as well as response +processing before passing it to the next middleware.

+
from web3.middleware import Web3Middleware
+
+class CustomMiddleware(Web3Middleware):
+
+    def wrap_make_request(self, make_request):
+        def middleware(method, params):
+            # pre-request processing goes here
+            response = make_request(method, params)  # make the request
+            # response processing goes here
+            return response
+
+        return middleware
+
+    # If your provider is asynchronous, override the async method instead:
+
+    async def async_wrap_make_request(self, make_request):
+        async def middleware(method, params):
+            # pre-request processing goes here
+            response = await make_request(method, params)
+            # response processing goes here
+            return response
+
+        return middleware
+
+
+

Custom middleware can be added to the stack via the class itself, using the +Middleware Stack API. The name kwarg is optional. For example:

+
from web3 import Web3
+from my_module import (
+    CustomMiddleware,
+)
+
+w3 = Web3(HTTPProvider(endpoint_uri="..."))
+
+# add the middleware to the stack as the class
+w3.middleware_onion.add(CustomMiddleware, name="custom_middleware")
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/migration.html b/_build/html_zh_CN/migration.html new file mode 100644 index 0000000000..52e3da62f6 --- /dev/null +++ b/_build/html_zh_CN/migration.html @@ -0,0 +1,937 @@ + + + + + + + + + 迁移指南 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

迁移指南

+
+

Migrating from v6 to v7

+

web3.py follows Semantic Versioning, which means that +version 7 introduced backwards-incompatible changes. If you're upgrading from +web3.py v6 or earlier, you can expect to need to make some changes. Refer +to this guide for a summary of breaking changes when updating from v6 to +v7. If you are more than one major version behind, you should also review +the migration guides for the versions in between.

+
+

Provider Updates

+
+

WebSocketProvider

+

WebsocketProviderV2, introduced in web3.py v6, has taken priority over the +legacy WebsocketProvider. The LegacyWebSocketProvider has been deprecated in +v7 and is slated for removal in the next major version of the library. In summary:

+
    +
  • WebsocketProvider -> LegacyWebSocketProvider (and deprecated)

  • +
  • WebsocketProviderV2 -> WebSocketProvider

  • +
+

If migrating from WebSocketProviderV2 to WebSocketProvider, you can expect the +following changes:

+
    +
  • Instantiation no longer requires the persistent_websocket method:

    +
    # WebsocketsProviderV2:
    +AsyncWeb3.persistent_websocket(WebsocketProviderV2('...'))
    +
    +# WebSocketProvider:
    +AsyncWeb3(WebSocketProvider('...'))
    +
    +
    +
  • +
  • Handling incoming subscription messages now occurs under a more flexible namespace: +socket. The AsyncIPCProvider uses the same API to listen for messages via +an IPC socket.

    +
    # WebsocketsProviderV2:
    +async for message in w3.ws.process_subscriptions():
    +  ...
    +
    +# WebSocketProvider:
    +async for message in w3.socket.process_subscriptions():
    +  ...
    +
    +
    +
  • +
+
+
+

AsyncIPCProvider (non-breaking feature)

+

An asynchronous IPC provider, AsyncIPCProvider, is newly available in v7. +This provider makes use of some of the same internals that the new WebSocketProvider +introduced, allowing it to also support eth_subscription.

+
+
+

EthereumTesterProvider

+

EthereumTesterProvider now returns input instead of data for eth_getTransaction* +calls, as expected.

+
+
+
+

Middlewares -> Middleware

+

All references to middlewares have been replaced with the more grammatically +correct middleware. Notably, this includes when a provider needs to be +instantiated with custom middleware.

+
+
+

Class-Based Middleware Model

+

The middleware model has been changed to a class-based model.

+
# v6 (no longer supported)
+from web3.middleware import pythonic_middleware
+w3.middleware_onion.add(pythonic_middleware)
+
+# v7
+from web3.middleware import PythonicMiddleware
+w3.middleware_onion.add(PythonicMiddleware)
+
+
+

Previously, middleware were defined as functions that tightly wrapped the provider's +make_request function, where transformations could be conditionally applied before +and after the request was made.

+

Now, middleware logic can be separated into request_processor and response_processor +functions that enable pre-request and post-response logic, respectively. This change offers +a simpler, clearer interface for defining middleware, gives more flexibility for +asynchronous operations and also paved the way for supporting Batch Requests.

+

Major changes for migration are highlighted in this section. Consult the +中间件 section of the documentation for specifics and examples on +the new class-based design.

+
+
+

Middleware Builder Classes

+

In v6, certain middleware needed to be constructed with parameters. This was done +by passing the parameters to a constructor method.

+
# v6 (no longer supported)
+from web3.middleware import construct_sign_and_send_raw_middleware
+w3.middleware_onion.add(construct_sign_and_send_raw_middleware(private_key))
+
+
+

In the class-based v7 middleware model, a middleware builder class is instantiated +with the necessary parameters via the build() method.

+
# v7
+from web3.middleware import SignAndSendRawMiddlewareBuilder
+w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(private_key), layer=0)
+
+
+
+
+

Middleware Renaming and Removals

+

The following middleware have been renamed for generalization or clarity:

+
    +
  • name_to_address_middleware -> ENSNameToAddressMiddleware

  • +
  • geth_poa_middleware -> ExtraDataToPOAMiddleware

  • +
+

The following middleware have been removed:

+
+

ABI Middleware

+

abi_middleware is no longer necessary and has been removed. All of the functionality +of the abi_middleware was already handled by web3.py's ABI formatters. For additional +context: a bug in the ENS name-to-address middleware would override the formatters. Fixing +this bug has removed the need for the abi_middleware.

+
+
+

Caching Middleware

+

The following middleware have been removed:

+
    +
  • simple_cache_middleware

  • +
  • latest_block_based_cache_middleware

  • +
  • time_based_cache_middleware

  • +
+

All caching middleware has been removed in favor of a decorator/wrapper around the +make_request methods of providers with configuration options on the provider class. +The configuration options are outlined in the documentation in the +Request Caching section.

+

If desired, the previous caching middleware can be re-created using the new class-based +middleware model overriding the wrap_make_request (or async_wrap_make_request) +method in the middleware class.

+
+
+

Result Generating Middleware

+

The following middleware have been removed:

+
    +
  • fixture_middleware

  • +
  • result_generator_middleware

  • +
+

The fixture_middleware and result_generator_middleware which were used for +testing/mocking purposes have been removed. These have been replaced internally by the +RequestMocker class, utilized for testing via a request_mocker pytest fixture.

+
+
+

HTTP Retry Request Middleware

+

The http_retry_request_middleware has been removed in favor of a configuration +option on the HTTPProvider and AsyncHTTPProvider classes. The configuration +options are outlined in the documentation in the Retry Requests for HTTP Providers section.

+
+
+

Normalize Request Parameters Middleware

+

The normalize_request_parameters middleware was not used anywhere internally and +has been removed.

+
+
+
+

Remaining camelCase -> snake_case Updates

+

The following arguments have been renamed across the library from camelCase to +snake_case in all methods where they are passed in as a kwarg.

+
    +
  • fromBlock -> from_block

  • +
  • toBlock -> to_block

  • +
  • blockHash -> block_hash

  • +
+

Note that if a dictionary is used instead, say to a call such as eth_getLogs, the +keys in the dictionary should be camelCase. This is because the dictionary is passed +directly to the JSON-RPC request, where the keys are expected to be in camelCase.

+
+
+

Changes to Exception Handling

+

All Python standard library exceptions that were raised from within web3.py have +been replaced with custom Web3Exception classes. This change allows for better +control over exception handling, being able to distinguish between exceptions raised +by web3.py and those raised from elsewhere in a codebase. The following exceptions +have been replaced:

+
    +
  • AssertionError -> Web3AssertionError

  • +
  • ValueError -> Web3ValueError

  • +
  • TypeError -> Web3TypeError

  • +
  • AttributeError -> Web3AttributeError

  • +
+

A new MethodNotSupported exception is now raised when a method is not supported by +web3.py. This allows a user to distinguish between when a method is not available on +the current provider, MethodUnavailable, and when a method is not supported by +web3.py under certain conditions, MethodNotSupported.

+

A MismatchedABI exception is now raised instead of a Web3ValidationError in +cases where an ABI is not compatible with the data being passed to it. This change +allows for more specific error handling when using certain ABI types.

+
+

JSON-RPC Error Handling

+

Rather than a ValueError being replaced with a Web3ValueError when a JSON-RPC +response comes back with an error object, a new Web3RPCError exception is +now raised to provide more distinction for JSON-RPC error responses. Some previously +existing exceptions now extend from this class since they too are related to JSON-RPC +errors:

+
    +
  • MethodUnavailable

  • +
  • BlockNotFound

  • +
  • TransactionNotFound

  • +
  • TransactionIndexingInProgress

  • +
+
+
+
+

End of Support and Feature Removals

+
+

Python 3.7 Support Dropped

+

Python 3.7 support has been dropped in favor of Python 3.8+. Python 3.7 is no longer +supported by the Python core team, and we want to focus our efforts on supporting +the latest versions of Python.

+
+
+

EthPM Module Removed

+

The EthPM module has been removed from the library. It was not widely used and has not +been functional since around October 2022. It was deprecated in v6 and has been +completely removed in v7.

+

Types in the +eth_typing.ethpm +module have been deprecated and will be removed from eth-typing in the next major +release.

+
+
+

Geth Miner Namespace Removed

+

The geth.miner namespace, deprecated in v6, has been removed in v7. +The miner namespace was used for managing the concept of a miner in geth. This is +no longer a feature in geth and is planned for complete removal in the future, with +Ethereum having transitioned to proof-of-stake.

+
+
+

Geth Personal Namespace Removed

+

The geth.personal namespace, deprecated in v6, has been removed in v7. +The personal namespace was used for managing accounts and keys and was deprecated +in geth in v1.11.0. Geth has moved to using clef for account and key management.

+
+
+

ABI Types Removed

+

The type definitions for ABIs, deprecated in v6, have been removed in v7. New +types have been introduced in the eth_typing v5 package for ABIs. Improvements have +been made to make required types more explicit and to offer better semantics.

+

The following types from web3.types have been removed: +- ABIEventParams is no longer available. Use ABIComponentIndexed from +eth_typing to represent event input components. +- ABIEvent now resides in eth_typing. ABIEvent.type and ABIEvent.name +are now required fields. +- ABIFunctionComponents and ABIFunctionParams are no longer available. Use +ABIComponent from eth_typing to represent function input components. +- ABIFunction now resides in eth_typing. ABIFunction.type and +ABIFunction.name are now required fields. +- ABIElement now resides in eth_typing and represents a Union of all valid +ABI element types, ABICallable, ABIEvent and ABIError.

+
+
+
+

Miscellaneous Changes

+
    +
  • LRU has been removed from the library and dependency on lru-dict library was +dropped.

  • +
  • CallOverride type was changed to StateOverride since more methods than +eth_call utilize the state override params.

  • +
  • User-Agent header was changed to a more readable format.

  • +
  • BaseContractFunctions iterator now returns instances of ContractFunction rather +than the function names.

  • +
  • BaseContractFunction class attribute function_identifier has been removed in +favor of the abi_element_identifier attribute.

  • +
  • web3.contract.utils.call_contract_function() no longer uses fn_abi as a +parameter. Instead, the abi_callable parameter of type ABICallable is used.

  • +
  • Beacon API filename change: beacon/main.py -> beacon/beacon.py.

  • +
  • The asynchronous version of w3.eth.wait_for_transaction_receipt() changes its +signature to use Optional[float] instead of float since it may be None.

  • +
  • get_default_ipc_path() and get_dev_ipc_path() now return the path value +without checking if the geth.ipc file exists.

  • +
  • Web3.is_address() returns True for non-checksummed addresses.

  • +
  • Contract.encodeABI() has been renamed to Contract.encode_abi(). The fn_name +argument has been changed to abi_element_identifier.

  • +
  • JSON-RPC responses are now more strictly validated against the JSON-RPC 2.0 +specification while providing more informative error messages for invalid responses.

  • +
+
+
+
+

Migrating from v5 to v6

+

web3.py follows Semantic Versioning, which means +that version 6 introduced backwards-incompatible changes. If your +project depends on web3.py v6, then you'll probably need to make some changes.

+

Breaking Changes:

+
+

Strict Bytes Checking by Default

+

web3.py v6 moved to requiring strict bytes checking by default. This means that if an +ABI specifies a bytes4 argument, web3.py will invalidate any entry that is not +encodable as a bytes type with length of 4. This means only 0x-prefixed hex strings with +a length of 4 and bytes types with a length of 4 will be considered valid. This removes +doubt that comes from inferring values and assuming they should be padded.

+

This behavior was previously available in via the w3.enable_strict_bytes_checking() +method. This is now, however, a toggleable flag on the Web3 instance via the +w3.strict_bytes_type_checking property. As outlined above, this property is set to +True by default but can be toggled on and off via the property's setter +(e.g. w3.strict_bytes_type_checking = False).

+
+
+

Snake Case

+

web3.py v6 moved to the more Pythonic convention of snake_casing wherever +possible. There are some exceptions to this pattern:

+
    +
  • Contract methods and events use whatever is listed in the ABI. If the smart contract +convention is to use camelCase for method and event names, web3.py won't do +any magic to convert it to snake_casing.

  • +
  • Arguments to JSON-RPC methods. For example: transaction and filter +parameters still use camelCasing. The reason for +this is primarily due to error messaging. It would be confusing to pass in a +snake_cased parameter and get an error message with a camelCased parameter.

  • +
  • Data that is returned from JSON-RPC methods. For example: +The keys in a transaction receipt will still be returned as camelCase.

  • +
+
+
+

Python 3.10 and 3.11 Support

+

Support for Python 3.10 and 3.11 is here. In order to support Python 3.10, we had to +update the websockets dependency to v10+.

+
+
+

Exceptions

+
+

Exceptions inherit from a base class

+

In v5, some web3.py exceptions inherited from AttributeError, namely:

+
    +
  • NoABIFunctionsFound

  • +
  • NoABIFound

  • +
  • NoABIEventsFound

  • +
+

Others inherited from ValueError, namely:

+
    +
  • InvalidAddress

  • +
  • NameNotFound

  • +
  • LogTopicError

  • +
  • InvalidEventABI

  • +
+

Now web3.py exceptions inherit from the same base Web3Exception.

+

As such, any code that was expecting a ValueError or an AttributeError from +web3.py must update to expecting one of the exceptions listed above, or +Web3Exception.

+

Similarly, exceptions raised in the EthPM and ENS modules inherit from the base +EthPMException and ENSException, respectively.

+
+
+

ValidationError

+

The Python dev tooling ecosystem is moving towards standardizing +ValidationError, so users know that they're catching the correct +ValidationError. The base ValidationError is imported from +eth_utils. However, we also wanted to empower users to catch all errors emitted +by a particular module. So we now have a Web3ValidationError, EthPMValidationError, +and an ENSValidationError that all inherit from the generic +eth_utils.exceptions.ValidationError.

+
+
+
+

Web3 class split into Web3 and AsyncWeb3

+

The Web3 class previously contained both sync and async methods. We've separated +Web3 and AsyncWeb3 functionality to tighten up typing. For example:

+
from web3 import Web3, AsyncWeb3
+
+w3 = Web3(Web3.HTTPProvider(<provider.url>))
+async_w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider(<provider.url>))
+
+
+
+
+

dict to AttributeDict conversion moved to middleware

+

Eth module data returned as key-value pairs was previously automatically converted to +an AttributeDict by result formatters, which could cause problems with typing. This +conversion has been moved to a default attrdict_middleware where it can be easily +removed if necessary. See the Eth module docs for more detail.

+
+
+

Other Misc Changes

+
    +
  • InfuraKeyNotFound exception has been changed to InfuraProjectIdNotFound

  • +
  • SolidityError has been removed in favor of ContractLogicError

  • +
  • When a method is unavailable from a node provider (i.e. a response error +code of -32601 is returned), a MethodUnavailable error is +now raised instead of ValueError

  • +
  • Logs' data field was previously formatted with to_ascii_if_bytes, now formatted to HexBytes

  • +
  • Receipts' type field was previously not formatted, now formatted with to_integer_if_hex

  • +
+
+
+

Removals

+
    +
  • Removed unused IBAN module

  • +
  • Removed WEB3_INFURA_API_KEY environment variable in favor of WEB3_INFURA_PROJECT_ID

  • +
  • Removed Kovan auto provider

  • +
  • Removed deprecated sha3 and soliditySha3 methods in favor of keccak and solidityKeccak

  • +
  • Remove Parity Module and References

  • +
+
+
+

Other notable changes

+
    +
  • The ipfshttpclient library is now opt-in via a web3 install extra. +This only affects the ethpm ipfs backends, which rely on the library.

  • +
+
+
+
+

Migrating from v4 to v5

+

Web3.py follows Semantic Versioning, which means +that version 5 introduced backwards-incompatible changes. If your +project depends on Web3.py v4, then you'll probably need to make some changes.

+

Here are the most common required updates:

+
+

Python 3.5 no longer supported

+

You will need to upgrade to either Python 3.6 or 3.7

+
+
+

eth-abi v1 no longer supported

+

You will need to upgrade the eth-abi dependency to v2

+
+
+

Changes to base API

+
+

JSON-RPC Updates

+

In v4, JSON-RPC calls that looked up transactions or blocks and +didn't find them, returned None. Now if a transaction or +block is not found, a BlockNotFound or a TransactionNotFound +error will be thrown as appropriate. This applies to the +following web3 methods:

+
    +
  • getTransaction() will throw a TransactionNotFound error

  • +
  • getTransactionReceipt() will throw a TransactionNotFound error

  • +
  • getTransactionByBlock() will throw a TransactionNotFound error

  • +
  • getTransactionCount() will throw a BlockNotFound error

  • +
  • getBlock() will throw a BlockNotFound error

  • +
  • getUncleCount() will throw a BlockNotFound error

  • +
  • getUncleByBlock() will throw a BlockNotFound error

  • +
+
+
+

Removed Methods

+
    +
  • contract.buildTransaction was removed for contract.functions.buildTransaction.<method name>

  • +
  • contract.deploy was removed for contract.constructor.transact

  • +
  • contract.estimateGas was removed for contract.functions.<method name>.estimateGas

  • +
  • contract.call was removed for contract.<functions/events>.<method name>.call

  • +
  • contract.transact was removed for contract.<functions/events>.<method name>.transact

  • +
  • contract.eventFilter was removed for contract.events.<event name>.createFilter

  • +
  • middleware_stack was renamed to middleware_onion()

  • +
  • web3.miner.hashrate was a duplicate of hashrate() and was removed.

  • +
  • web3.version.network was a duplicate of version() and was removed.

  • +
  • web3.providers.tester.EthereumTesterProvider and web3.providers.tester.TestRPCProvider have been removed for EthereumTesterProvider()

  • +
  • web3.eth.enableUnauditedFeatures was removed

  • +
  • web3.txpool was moved to txpool()

  • +
  • web3.version.node was removed for web3.clientVersion

  • +
  • web3.version.ethereum was removed for protocolVersion()

  • +
  • Relocated personal RPC endpoints to reflect Parity and Geth implementations:

    +
      +
    • web3.personal.listAccounts was removed for listAccounts() or listAccounts()

    • +
    • web3.personal.importRawKey was removed for importRawKey() or importRawKey()

    • +
    • web3.personal.newAccount was removed for newAccount() or newAccount()

    • +
    • web3.personal.lockAccount was removed for lockAccount()

    • +
    • web3.personal.unlockAccount was removed for unlockAccount() or unlockAccount()

    • +
    • web3.personal.sendTransaction was removed for sendTransaction() or sendTransaction()

    • +
    +
  • +
  • Relocated web3.admin module to web3.geth namespace

  • +
  • Relocated web3.miner module to web3.geth namespace

  • +
+
+
+

Deprecated Methods

+

Expect the following methods to be removed in v6:

+
    +
  • web3.sha3 was deprecated for keccak()

  • +
  • web3.soliditySha3 was deprecated for solidityKeccak()

  • +
  • chainId() was deprecated for chainId(). +Follow issue #1293 for details

  • +
  • web3.eth.getCompilers() was deprecated and will not be replaced

  • +
  • getTransactionFromBlock() was deprecated for getTransactionByBlock()

  • +
+
+
+

Deprecated ConciseContract and ImplicitContract

+

The ConciseContract and ImplicitContract have been deprecated and will be removed in v6.

+

ImplicitContract instances will need to use the verbose syntax. For example:

+

contract.functions.<function name>.transact({})

+

ConciseContract has been replaced with the ContractCaller API. Instead of using the ConciseContract factory, you can now use:

+

contract.caller.<function_name>

+

or the classic contract syntax:

+

contract.functions.<function name>.call().

+

Some more concrete examples can be found in the ContractCaller docs

+
+
+
+

Manager Provider

+

In v5, only a single provider will be allowed. While allowing +multiple providers is a feature we'd like to support in the future, +the way that multiple providers was handled in v4 wasn't ideal. +The only thing they could do was fall back. There was no mechanism for any +round robin, nor was there any control around which provider +was chosen. Eventually, the idea is to expand the Manager API +to support injecting custom logic into the provider selection process.

+

For now, manager.providers has changed to manager.provider. +Similarly, instances of web3.providers have been changed to +web3.provider.

+
+
+

Testnet Changes

+

Web3.py will no longer automatically look up a testnet connection +in IPCProvider.

+
+
+

ENS

+

Web3.py has stopped inferring the .eth TLD on domain names. +If a domain name is used instead of an address, you'll need +to specify the TLD. An InvalidTLD error will be thrown if +the TLD is missing.

+
+
+

Required Infura API Key

+

In order to interact with Infura after March 27, 2019, you'll need to set an +environment variable called WEB3_INFURA_PROJECT_ID. You can get a +project id by visiting https://infura.io/register.

+
+
+
+

Migrating from v3 to v4

+

Web3.py follows Semantic Versioning, which means +that version 4 introduced backwards-incompatible changes. If your +project depends on Web3.py v3, then you'll probably need to make some changes.

+

Here are the most common required updates:

+
+

Python 2 to Python 3

+

Only Python 3 is supported in v4. If you are running in Python 2, +it's time to upgrade. We recommend using 2to3 which can make +most of your code compatible with Python 3, automatically.

+

The most important update, relevant to Web3.py, is the new bytes +type. It is used regularly, throughout the library, whenever dealing with data +that is not guaranteed to be text.

+

Many different methods in Web3.py accept text or binary data, like contract methods, +transaction details, and cryptographic functions. The following example +uses sha3(), but the same pattern applies elsewhere.

+

In v3 & Python 2, you might have calculated the hash of binary data this way:

+
>>> Web3.sha3('I\xe2\x99\xa5SF')
+'0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e'
+
+
+

Or, you might have calculated the hash of text data this way:

+
>>> Web3.sha3(text=u'I♥SF')
+'0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e'
+
+
+

After switching to Python 3, these would instead be executed as:

+
>>> Web3.sha3(b'I\xe2\x99\xa5SF')
+HexBytes('0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e')
+
+>>> Web3.sha3(text='I♥SF')
+HexBytes('0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5e')
+
+
+

Note that the return value is different too: you can treat hexbytes.main.HexBytes +like any other bytes value, but the representation on the console shows you the hex encoding of +those bytes, for easier visual comparison.

+

It takes a little getting used to, but the new py3 types are much better. We promise.

+
+
+

Filters

+

Filters usually don't work quite the way that people want them to.

+

The first step toward fixing them was to simplify them by removing the polling +logic. Now, you must request an update on your filters explicitly. That +means that any exceptions during the request will bubble up into your code.

+

In v3, those exceptions (like "filter is not found") were swallowed silently +in the automated polling logic. Here was the invocation for +printing out new block hashes as they appear:

+
>>> def new_block_callback(block_hash):
+...     print(f"New Block: {block_hash}")
+...
+>>> new_block_filter = web3.eth.filter('latest')
+>>> new_block_filter.watch(new_block_callback)
+
+
+

In v4, that same logic:

+
>>> new_block_filter = web3.eth.filter('latest')
+>>> for block_hash in new_block_filter.get_new_entries():
+...     print(f"New Block: {block_hash}")
+
+
+

The caller is responsible for polling the results from get_new_entries(). +See Asynchronous Filter Polling for examples of filter-event handling with web3 v4.

+
+
+

TestRPCProvider and EthereumTesterProvider

+

These providers are fairly uncommon. If you don't recognize the names, +you can probably skip the section.

+

However, if you were using web3.py for testing contracts, +you might have been using TestRPCProvider or EthereumTesterProvider.

+

In v4 there is a new EthereumTesterProvider, and the old v3 implementation has been +removed. Web3.py v4 uses eth_tester.main.EthereumTester under the hood, instead +of eth-testrpc. While eth-tester is still in beta, many parts are +already in better shape than testrpc, so we decided to replace it in v4.

+

If you were using TestRPC, or were explicitly importing EthereumTesterProvider, like: +from web3.providers.tester import EthereumTesterProvider, then you will need to update.

+

With v4 you should import with from web3 import EthereumTesterProvider. As before, you'll +need to install Web3.py with the tester extra to get these features, like:

+
$ pip install web3[tester]
+
+
+
+
+

Changes to base API convenience methods

+
+

Web3.toDecimal()

+

In v4 Web3.toDecimal() is renamed: toInt() for improved clarity. It does not return a decimal.Decimal, it returns an int.

+
+
+

Removed Methods

+
    +
  • Web3.toUtf8 was removed for toText().

  • +
  • Web3.fromUtf8 was removed for toHex().

  • +
  • Web3.toAscii was removed for toBytes().

  • +
  • Web3.fromAscii was removed for toHex().

  • +
  • Web3.fromDecimal was removed for toHex().

  • +
+
+
+
+

Provider Access

+

In v4, w3.currentProvider was removed, in favor of w3.providers.

+
+
+

Disambiguating String Inputs

+

There are a number of places where an arbitrary string input might be either +a byte-string that has been hex-encoded, or unicode characters in text. +These are named hexstr and text in Web3.py. +You specify which kind of str you have by using the appropriate +keyword argument. See examples in Encoding and Decoding Helpers.

+

In v3, some methods accepted a str as the first positional argument. +In v4, you must pass strings as one of hexstr or text keyword arguments.

+

Notable methods that no longer accept ambiguous strings:

+
    +
  • sha3()

  • +
  • toBytes()

  • +
+
+
+

Contracts

+
    +
  • When a contract returns the ABI type string, Web3.py v4 now returns a str +value by decoding the underlying bytes using UTF-8.

  • +
  • When a contract returns the ABI type bytes (of any length), +Web3.py v4 now returns a bytes value

  • +
+
+
+

Personal API

+

w3.personal.signAndSendTransaction is no longer available. Use +w3.personal.sendTransaction() instead.

+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/objects.inv b/_build/html_zh_CN/objects.inv new file mode 100644 index 0000000000..c6f21349b1 Binary files /dev/null and b/_build/html_zh_CN/objects.inv differ diff --git a/_build/html_zh_CN/overview.html b/_build/html_zh_CN/overview.html new file mode 100644 index 0000000000..2de52a2803 --- /dev/null +++ b/_build/html_zh_CN/overview.html @@ -0,0 +1,506 @@ + + + + + + + + + 概览 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

概览

+

The purpose of this page is to give you a sense of everything web3.py can do +and to serve as a quick reference guide. You'll find a summary of each feature +with links to learn more.

+
+

Configuration

+

After installing web3.py (via pip install web3), you'll need to configure +a provider endpoint and any middleware you want to use beyond the defaults.

+
+

Providers

+

提供者 are how web3.py connects to a blockchain. The library comes with the +following built-in providers:

+
    +
  • HTTPProvider for connecting to http and https based JSON-RPC servers.

  • +
  • IPCProvider for connecting to ipc socket based JSON-RPC servers.

  • +
  • LegacyWebSocketProvider (deprecated) for connecting to websocket based JSON-RPC servers.

  • +
  • AsyncHTTPProvider for connecting to http and https based JSON-RPC servers asynchronously.

  • +
  • AsyncIPCProvider for connecting to ipc socket based JSON-RPC servers asynchronously via a persistent connection.

  • +
  • WebSocketProvider for connecting to websocket based JSON-RPC servers asynchronously via a persistent connection.

  • +
+
+

Examples

+
>>> from web3 import Web3, AsyncWeb3
+
+# IPCProvider:
+>>> w3 = Web3(Web3.IPCProvider('./path/to/filename.ipc'))
+>>> w3.is_connected()
+True
+
+# HTTPProvider:
+>>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545'))
+>>> w3.is_connected()
+True
+
+# AsyncHTTPProvider:
+>>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545'))
+>>> await w3.is_connected()
+True
+
+# -- Persistent Connection Providers -- #
+
+# WebSocketProvider:
+>>> w3 = await AsyncWeb3(AsyncWeb3.WebSocketProvider('ws://127.0.0.1:8546'))
+>>> await w3.is_connected()
+True
+
+# AsyncIPCProvider
+>>> w3 = await AsyncWeb3(AsyncWeb3.AsyncIPCProvider('./path/to/filename.ipc'))
+>>> await w3.is_connected()
+True
+
+
+

For more context, see the 提供者 documentation.

+
+
+
+

Middleware

+

Your web3.py instance may be further configured via 中间件.

+

web3.py middleware is described using an onion metaphor, where each layer of +middleware may affect both the incoming request and outgoing response from your +provider. The documentation includes a visualization +of this idea.

+

Several middleware are included by default. You may add to +(add, inject, +replace) or disable +(remove, +clear) any of these middleware.

+
+
+
+

Accounts and Private Keys

+

Private keys are required to approve any transaction made on your behalf. The manner in +which your key is secured will determine how you create and send transactions in web3.py.

+

A local node, like Geth, may manage your keys for you. +You can reference those keys using the web3.eth.accounts +property.

+

A hosted node, like Infura, will have no knowledge of your keys. +In this case, you'll need to have your private key available locally for signing +transactions.

+

Full documentation on the distinction between keys can be found here. +The separate guide to 交易 may also help clarify how to manage keys.

+
+
+

Base API

+

The Web3 class includes a number of convenient utility functions:

+
+

Encoding and Decoding Helpers

+ +
+
+

Address Helpers

+ +
+
+

Currency Conversions

+ +
+
+

Cryptographic Hashing

+ +
+
+
+

web3.eth API

+

The most commonly used APIs for interacting with Ethereum can be found under the +web3.eth API namespace.

+
+

Fetching Data

+

Viewing account balances (get_balance), transactions +(get_transaction), and block data +(get_block) are some of the most common starting +points in web3.py.

+
+

API

+ +
+
+
+

Sending Transactions

+

The most common use cases will be satisfied with +send_transaction or the combination of +sign_transaction and +send_raw_transaction. For more context, +see the full guide to 交易.

+
+

备注

+

If interacting with a smart contract, a dedicated API exists. See the next +section, Contracts.

+
+
+

API

+ +
+
+
+
+

Contracts

+

web3.py can help you deploy, read from, or execute functions on a deployed contract.

+

Deployment requires that the contract already be compiled, with its bytecode and ABI +available. This compilation step can be done within +Remix or one of the many contract development +frameworks, such as Ape.

+

Once the contract object is instantiated, calling transact on the +constructor method will deploy an +instance of the contract:

+
>>> ExampleContract = w3.eth.contract(abi=abi, bytecode=bytecode)
+>>> tx_hash = ExampleContract.constructor().transact()
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> tx_receipt.contractAddress
+'0x8a22225eD7eD460D7ee3842bce2402B9deaD23D3'
+
+
+

Once a deployed contract is loaded into a Contract object, the functions of that +contract are available on the functions namespace:

+
>>> deployed_contract = w3.eth.contract(address=tx_receipt.contractAddress, abi=abi)
+>>> deployed_contract.functions.myFunction(42).transact()
+
+
+

If you want to read data from a contract (or see the result of transaction locally, +without executing it on the network), you can use the +ContractFunction.call method, or the +more concise ContractCaller syntax:

+
# Using ContractFunction.call
+>>> deployed_contract.functions.getMyValue().call()
+42
+
+# Using ContractCaller
+>>> deployed_contract.caller().getMyValue()
+42
+
+
+

For more, see the full Contracts documentation.

+
+

API

+ +
+
+
+

Events, Logs, and Filters

+

If you want to react to new blocks being mined or specific events being emitted by +a contract, you can leverage get_logs, subscriptions, or filters.

+

See the 事件和日志 guide for more information.

+
+

API

+ +
+
+
+

Net API

+

Some basic network properties are available on the web3.net object:

+ +
+
+

ENS

+

Ethereum Name Service (ENS) provides the infrastructure +for human-readable addresses. If an address is registered with the ENS registry, +the domain name can be used in place of the address itself. For example, the registered domain +name ethereum.eth will resolve to the address +0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe. web3.py has support for ENS, documented +here.

+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/providers.html b/_build/html_zh_CN/providers.html new file mode 100644 index 0000000000..31b89d2e42 --- /dev/null +++ b/_build/html_zh_CN/providers.html @@ -0,0 +1,812 @@ + + + + + + + + + 提供者 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

提供者

+

Using Ethereum requires access to an Ethereum node. If you have the means, you're +encouraged to run your own node. (Note that you do not need to stake ether to +run a node.) If you're unable to run your own node, you can use a remote node.

+

Once you have access to a node, you can connect to it using a provider. +Providers generate JSON-RPC requests and return the response. This is done by submitting +the request to an HTTP, WebSocket, or IPC socket-based server.

+
+

备注

+

web3.py supports one provider per instance. If you have an advanced use case +that requires multiple providers, create and configure a new web3 instance +per connection.

+
+

If you are already happily connected to your Ethereum node, then you +can skip the rest of this providers section.

+
+

Choosing a Provider

+

Most nodes have a variety of ways to connect to them. Most commonly:

+
    +
  1. IPC (uses local filesystem: fastest and most secure)

  2. +
  3. WebSocket (works remotely, faster than HTTP)

  4. +
  5. HTTP (more nodes support it)

  6. +
+

If you're not sure how to decide, choose this way:

+
    +
  • If you have the option of running web3.py on the same machine as the node, choose IPC.

  • +
  • If you must connect to a node on a different computer, use WebSocket.

  • +
  • If your node does not support WebSocket, use HTTP.

  • +
+

Once you have decided how to connect, you'll select and configure the appropriate provider +class:

+ +

Each provider above links to the documentation on how to properly initialize that +provider. Once you have reviewed the relevant documentation for the provider of your +choice, you are ready to get started with web3.py.

+
+

Provider via Environment Variable

+

Alternatively, you can set the environment variable WEB3_PROVIDER_URI +before starting your script, and web3 will look for that provider first.

+

Valid formats for this environment variable are:

+
    +
  • file:///path/to/node/rpc-json/file.ipc

  • +
  • http://192.168.1.2:8545

  • +
  • https://node.ontheweb.com

  • +
  • ws://127.0.0.1:8546

  • +
+
+
+
+

Auto-initialization Provider Shortcuts

+
+

Geth dev Proof of Authority

+

To connect to a geth --dev Proof of Authority instance with +the POA middleware loaded by default:

+
>>> from web3.auto.gethdev import w3
+
+# confirm that the connection succeeded
+>>> w3.is_connected()
+True
+
+
+

Or, connect to an async web3 instance:

+
>>> from web3.auto.gethdev import async_w3
+>>> await async_w3.provider.connect()
+
+# confirm that the connection succeeded
+>>> await async_w3.is_connected()
+True
+
+
+
+
+
+

Built In Providers

+

Web3 ships with the following providers which are appropriate for connecting to +local and remote JSON-RPC servers.

+
+

HTTPProvider

+
+
+class web3.providers.rpc.HTTPProvider(endpoint_uri, request_kwargs={}, session=None, exception_retry_configuration=ExceptionRetryConfiguration())
+

This provider handles interactions with an HTTP or HTTPS based JSON-RPC server.

+
    +
  • endpoint_uri should be the full URI to the RPC endpoint such as +'https://localhost:8545'. For RPC servers behind HTTP connections +running on port 80 and HTTPS connections running on port 443 the port can +be omitted from the URI.

  • +
  • request_kwargs should be a dictionary of keyword arguments which +will be passed onto each http/https POST request made to your node.

  • +
  • session allows you to pass a requests.Session object initialized +as desired.

  • +
  • exception_retry_configuration is an instance of the +ExceptionRetryConfiguration +class which allows you to configure how the provider should handle exceptions +when making certain requests. Setting this to None will disable +exception retries.

  • +
+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545"))
+
+
+

Note that you should create only one HTTPProvider with the same provider URL +per python process, as the HTTPProvider recycles underlying TCP/IP +network connections, for better performance. Multiple HTTPProviders with different +URLs will work as expected.

+

Under the hood, the HTTPProvider uses the python requests library for +making requests. If you would like to modify how requests are made, you can +use the request_kwargs to do so. A common use case for this is increasing +the timeout for each request.

+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", request_kwargs={'timeout': 60}))
+
+
+

To tune the connection pool size, you can pass your own requests.Session.

+
>>> from web3 import Web3
+>>> adapter = requests.adapters.HTTPAdapter(pool_connections=20, pool_maxsize=20)
+>>> session = requests.Session()
+>>> session.mount('http://', adapter)
+>>> session.mount('https://', adapter)
+>>> w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545", session=session))
+
+
+
+ +
+
+

IPCProvider

+
+
+class web3.providers.ipc.IPCProvider(ipc_path=None, timeout=10)
+

This provider handles interaction with an IPC Socket based JSON-RPC +server.

+
    +
  • ipc_path is the filesystem path to the IPC socket:

  • +
+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.IPCProvider("~/Library/Ethereum/geth.ipc"))
+
+
+

If no ipc_path is specified, it will use a default depending on your operating +system.

+
    +
  • On Linux and FreeBSD: ~/.ethereum/geth.ipc

  • +
  • On Mac OS: ~/Library/Ethereum/geth.ipc

  • +
  • On Windows: \\.\pipe\geth.ipc

  • +
+
+ +
+
+

AsyncHTTPProvider

+
+
+class web3.providers.rpc.AsyncHTTPProvider(endpoint_uri, request_kwargs={}, exception_retry_configuration=ExceptionRetryConfiguration())
+

This provider handles interactions with an HTTP or HTTPS based JSON-RPC server asynchronously.

+
    +
  • endpoint_uri should be the full URI to the RPC endpoint such as +'https://localhost:8545'. For RPC servers behind HTTP connections +running on port 80 and HTTPS connections running on port 443 the port can +be omitted from the URI.

  • +
  • request_kwargs should be a dictionary of keyword arguments which +will be passed onto each http/https POST request made to your node.

  • +
  • exception_retry_configuration is an instance of the +ExceptionRetryConfiguration +class which allows you to configure how the provider should handle exceptions +when making certain requests. Setting this to None will disable +exception retries.

  • +
+

The cache_async_session() method allows you to use your own +aiohttp.ClientSession object.

+
>>> from aiohttp import ClientSession
+>>> from web3 import AsyncWeb3, AsyncHTTPProvider
+
+>>> w3 = AsyncWeb3(AsyncHTTPProvider(endpoint_uri))
+
+>>> # If you want to pass in your own session:
+>>> custom_session = ClientSession()
+>>> await w3.provider.cache_async_session(custom_session) # This method is an async method so it needs to be handled accordingly
+>>> # when you're finished, disconnect:
+>>> w3.provider.disconnect()
+
+
+

Under the hood, the AsyncHTTPProvider uses the python +aiohttp library for making requests.

+
+ +
+
+

Persistent Connection Providers

+
+

Persistent Connection Base Class

+
+

备注

+

This class is not meant to be used directly. If your provider class inherits +from this class, look to these docs for additional configuration options.

+
+
+
+class web3.providers.persistent.PersistentConnectionProvider(request_timeout: float = 50.0, subscription_response_queue_size: int = 500, silence_listener_task_exceptions: bool = False     max_connection_retries: int = 5, request_information_cache_size: int = 500)
+

This is a base provider class, inherited by the following providers:

+
+
+

It handles interactions with a persistent connection to a JSON-RPC server. Among +its configuration, it houses all of the +RequestProcessor logic for +handling the asynchronous sending and receiving of requests and responses. See +the Request Processing for Persistent Connection Providers section for more details on +the internals of persistent connection providers.

+
    +
  • request_timeout is the timeout in seconds, used when sending data over the +connection and waiting for a response to be received from the listener task. +Defaults to 50.0.

  • +
  • subscription_response_queue_size is the size of the queue used to store +subscription responses, defaults to 500. While messages are being consumed, +this queue should never fill up as it is a transient queue and meant to handle +asynchronous receiving and processing of responses. When in sync with the +socket stream, this queue should only ever store 1 to a few messages at a time.

  • +
  • silence_listener_task_exceptions is a boolean that determines whether +exceptions raised by the listener task are silenced. Defaults to False, +raising any exceptions that occur in the listener task.

  • +
  • max_connection_retries is the maximum number of times to retry a connection +to the provider when initializing the provider. Defaults to 5.

  • +
  • request_information_cache_size specifies the size of the transient cache for +storing request details, enabling the provider to process responses based on the +original request information. Defaults to 500.

  • +
+
+ +
+
+

AsyncIPCProvider

+
+
+class web3.providers.persistent.AsyncIPCProvider(ipc_path=None, max_connection_retries=5)
+

This provider handles asynchronous, persistent interaction with an IPC Socket based +JSON-RPC server.

+
    +
  • ipc_path is the filesystem path to the IPC socket:

  • +
  • read_buffer_limit is the maximum size of data, in bytes, that can be read +from the socket at one time. Defaults to 20MB (20 * 1024 * 1024). Raises +ReadBufferLimitReached if the limit is reached, suggesting that the buffer +limit be increased.

  • +
+

This provider inherits from the +PersistentConnectionProvider class. Refer to +the PersistentConnectionProvider documentation +for details on additional configuration options available for this provider.

+

If no ipc_path is specified, it will use a default depending on your operating +system.

+
    +
  • On Linux and FreeBSD: ~/.ethereum/geth.ipc

  • +
  • On Mac OS: ~/Library/Ethereum/geth.ipc

  • +
  • On Windows: \\.\pipe\geth.ipc

  • +
+
+ +
+
+

WebSocketProvider

+
+
+class web3.providers.persistent.WebSocketProvider(endpoint_uri: str, websocket_kwargs: Dict[str, Any] = {}, use_text_frames: bool = False)
+

This provider handles interactions with an WS or WSS based JSON-RPC server.

+
    +
  • endpoint_uri should be the full URI to the RPC endpoint such as +'ws://localhost:8546'.

  • +
  • websocket_kwargs this should be a dictionary of keyword arguments which +will be passed onto the ws/wss websocket connection.

  • +
  • use_text_frames will ensure websocket data is sent as text frames +for servers that do not support binary communication.

  • +
+

This provider inherits from the +PersistentConnectionProvider class. Refer to +the PersistentConnectionProvider documentation +for details on additional configuration options available for this provider.

+

Under the hood, the WebSocketProvider uses the python websockets library for +making requests. If you would like to modify how requests are made, you can +use the websocket_kwargs to do so. See the websockets documentation for +available arguments.

+
+ +
+
+

Using Persistent Connection Providers

+

The AsyncWeb3 class may be used as a context manager, utilizing the async with +syntax, when instantiating with a +PersistentConnectionProvider. This will +automatically close the connection when the context manager exits and is the +recommended way to initiate a persistent connection to the provider.

+

A similar example using a websockets connection as an asynchronous context manager +can be found in the websockets connection docs.

+
>>> import asyncio
+>>> from web3 import AsyncWeb3
+>>> from web3.providers.persistent import (
+...     AsyncIPCProvider,
+...     WebSocketProvider,
+... )
+
+>>> LOG = True  # toggle debug logging
+>>> if LOG:
+...     import logging
+...     # logger = logging.getLogger("web3.providers.AsyncIPCProvider")  # for the AsyncIPCProvider
+...     logger = logging.getLogger("web3.providers.WebSocketProvider")  # for the WebSocketProvider
+...     logger.setLevel(logging.DEBUG)
+...     logger.addHandler(logging.StreamHandler())
+
+>>> async def context_manager_subscription_example():
+...     #  async with AsyncWeb3(AsyncIPCProvider("./path/to.filename.ipc") as w3:  # for the AsyncIPCProvider
+...     async with AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")) as w3:  # for the WebSocketProvider
+...         # subscribe to new block headers
+...         subscription_id = await w3.eth.subscribe("newHeads")
+...
+...         async for response in w3.socket.process_subscriptions():
+...             print(f"{response}\n")
+...             # handle responses here
+...
+...             if some_condition:
+...                 # unsubscribe from new block headers and break out of
+...                 # iterator
+...                 await w3.eth.unsubscribe(subscription_id)
+...                 break
+...
+...         # still an open connection, make any other requests and get
+...         # responses via send / receive
+...         latest_block = await w3.eth.get_block("latest")
+...         print(f"Latest block: {latest_block}")
+...
+...         # the connection closes automatically when exiting the context
+...         # manager (the `async with` block)
+
+>>> asyncio.run(context_manager_subscription_example())
+
+
+

The AsyncWeb3 class may also be used as an asynchronous iterator, utilizing the +async for syntax, when instantiating with a +PersistentConnectionProvider. This may be used to +set up an indefinite websocket connection and reconnect automatically if the connection +is lost.

+

A similar example using a websockets connection as an asynchronous iterator can +be found in the websockets connection docs.

+
>>> import asyncio
+>>> import websockets
+>>> from web3 import AsyncWeb3
+>>> from web3.providers.persistent import (
+...     AsyncIPCProvider,
+...     WebSocketProvider,
+... )
+
+>>> async def subscription_iterator_example():
+...     # async for w3 in AsyncWeb3(AsyncIPCProvider("./path/to/filename.ipc")):  # for the AsyncIPCProvider
+...     async for w3 in AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546")):  # for the WebSocketProvider
+...         try:
+...             ...
+...         except websockets.ConnectionClosed:
+...             continue
+
+# run the example
+>>> asyncio.run(subscription_iterator_example())
+
+
+

Awaiting the instantiation with a +PersistentConnectionProvider, or instantiating +and awaiting the connect() method is also possible. Both of these examples are +shown below.

+
>>> async def await_instantiation_example():
+...     # w3 = await AsyncWeb3(AsyncIPCProvider("./path/to/filename.ipc"))  # for the AsyncIPCProvider
+...     w3 = await AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546"))  # for the WebSocketProvider
+...
+...     # some code here
+...
+...     # manual cleanup
+...     await w3.provider.disconnect()
+
+# run the example
+>>> asyncio.run(await_instantiation_example())
+
+
+
>>> async def await_provider_connect_example():
+...     # w3 = AsyncWeb3(AsyncIPCProvider("./path/to/filename.ipc"))  # for the AsyncIPCProvider
+...     w3 = AsyncWeb3(WebSocketProvider(f"ws://127.0.0.1:8546"))  # for the WebSocketProvider
+...     await w3.provider.connect()
+...
+...     # some code here
+...
+...     # manual cleanup
+...     await w3.provider.disconnect()
+
+# run the example
+>>> asyncio.run(await_provider_connect_example())
+
+
+

PersistentConnectionProvider classes use the +RequestProcessor class under the +hood to sync up the receiving of responses and response processing for one-to-one and +one-to-many request-to-response requests. Refer to the +RequestProcessor +documentation for details.

+
+
+

AsyncWeb3 with Persistent Connection Providers

+

When an AsyncWeb3 class is connected to a +PersistentConnectionProvider, some attributes and +methods become available.

+
+
+
+socket
+

The public API for interacting with the websocket connection is available via +the socket attribute of the Asyncweb3 class. This attribute is an +instance of the +PersistentConnection +class and is the main interface for interacting with the socket connection.

+
+ +
+
+
+

Interacting with the Persistent Connection

+
+
+class web3.providers.persistent.persistent_connection.PersistentConnection
+

This class handles interactions with a persistent socket connection. It is available +via the socket attribute on the AsyncWeb3 class. The +PersistentConnection class has the following methods and attributes:

+
+
+subscriptions
+

This attribute returns the current active subscriptions as a dict mapping +the subscription id to a dict of metadata about the subscription +request.

+
+ +
+
+process_subscriptions()
+

This method is available for listening to websocket subscriptions indefinitely. +It is an asynchronous iterator that yields strictly one-to-many +(e.g. eth_subscription responses) request-to-response messages from the +websocket connection. To receive responses for one-to-one request-to-response +calls, use the standard API for making requests via the appropriate module +(e.g. block_num = await w3.eth.block_number)

+

The responses from this method are formatted by web3.py formatters and run +through the middleware that were present at the time of subscription. +Examples on how to use this method can be seen above in the +Using Persistent Connection Providers section.

+
+ +
+
+send(method: RPCEndpoint, params: Sequence[Any])
+

This method is available strictly for sending raw requests to the socket, +if desired. It is not recommended to use this method directly, as the +responses will not be formatted by web3.py formatters or run through the +middleware. Instead, use the methods available on the respective web3 +module. For example, use w3.eth.get_block("latest") instead of +w3.socket.send("eth_getBlockByNumber", ["latest", True]).

+
+ +
+
+recv()
+

The recv() method can be used to receive the next response for a request +from the socket. The response from this method is the raw response. This is not +the recommended way to receive a response for a request, as it is not formatted +by web3.py formatters or run through the middleware. Instead, use the methods +available on the respective web3 module +(e.g. block_num = await w3.eth.block_number) for retrieving responses for +one-to-one request-to-response calls.

+
+ +
+
+make_request(method: RPCEndpoint, params: Sequence[Any])
+

This method is available for making requests to the socket and retrieving the +response. It is not recommended to use this method directly, as the responses +will not be properly formatted by web3.py formatters or run through the +middleware. Instead, use the methods available on the respective web3 module. +For example, use w3.eth.get_block("latest") instead of +w3.socket.make_request("eth_getBlockByNumber", ["latest", True]).

+
+ +
+ +
+
+
+

LegacyWebSocketProvider

+
+

警告

+

LegacyWebSocketProvider is deprecated and is likely to be removed in a +future major release. Please use WebSocketProvider instead.

+
+
+
+class web3.providers.legacy_websocket.LegacyWebSocketProvider(endpoint_uri[, websocket_timeout, websocket_kwargs])
+

This provider handles interactions with an WS or WSS based JSON-RPC server.

+
    +
  • endpoint_uri should be the full URI to the RPC endpoint such as +'ws://localhost:8546'.

  • +
  • websocket_timeout is the timeout in seconds, used when receiving or +sending data over the connection. Defaults to 10.

  • +
  • websocket_kwargs this should be a dictionary of keyword arguments which +will be passed onto the ws/wss websocket connection.

  • +
+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.LegacyWebSocketProvider("ws://127.0.0.1:8546"))
+
+
+

Under the hood, LegacyWebSocketProvider uses the python websockets library for +making requests. If you would like to modify how requests are made, you can +use the websocket_kwargs to do so. See the websockets documentation for +available arguments.

+

Unlike HTTP connections, the timeout for WS connections is controlled by a +separate websocket_timeout argument, as shown below.

+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.LegacyWebSocketProvider("ws://127.0.0.1:8546", websocket_timeout=60))
+
+
+
+ +
+
+

AutoProvider

+

AutoProvider is the default used when initializing +web3.Web3 without any providers. There's rarely a reason to use it +explicitly.

+
+
+

EthereumTesterProvider

+
+

警告

+

Experimental: This provider is experimental. There are still significant +gaps in functionality. However it is being actively developed and supported.

+
+
+
+class web3.providers.eth_tester.EthereumTesterProvider(ethereum_tester=None, api_endpoints=None)
+
+ +
+
+class web3.providers.eth_tester.AsyncEthereumTesterProvider(ethereum_tester=None, api_endpoints=None)
+

This provider integrates with the eth-tester library. The ethereum_tester +constructor argument should be an instance of the EthereumTester +or a subclass of BaseChainBackend class provided +by the eth-tester library. The api_endpoints argument should be a dict +of RPC endpoints. You can see the structure and defaults here. +If you would like a custom eth-tester instance to test with, see the +eth-tester library documentation +for details.

+
>>> from web3 import Web3, EthereumTesterProvider
+>>> w3 = Web3(EthereumTesterProvider())
+
+
+
+ +
+

备注

+

To install the needed dependencies to use EthereumTesterProvider, you can +install the pip extras package that has the correct interoperable versions of the +eth-tester and py-evm dependencies needed: e.g. pip install "web3[tester]"

+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/py-modindex.html b/_build/html_zh_CN/py-modindex.html new file mode 100644 index 0000000000..82ab605a00 --- /dev/null +++ b/_build/html_zh_CN/py-modindex.html @@ -0,0 +1,275 @@ + + + + + + + + Python 模块索引 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + +

Python 模块索引

+ +
+ e | + w +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+ e
+ ens +
 
+ w
+ web3 +
    + web3.contract +
    + web3.eth +
    + web3.gas_strategies.rpc +
    + web3.gas_strategies.time_based +
    + web3.geth +
    + web3.geth.admin +
    + web3.geth.debug +
    + web3.geth.txpool +
    + web3.net +
    + web3.tracing +
    + web3.utils +
    + web3.utils.filters +
+ + +
+
+
+ +
+ +
+

© 版权所有 2016-2025, The Ethereum Foundation。

+
+ + 利用 Sphinx 构建,使用的 + 主题 + 由 Read the Docs 开发. + + +
+
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/quickstart.html b/_build/html_zh_CN/quickstart.html new file mode 100644 index 0000000000..bedc52b576 --- /dev/null +++ b/_build/html_zh_CN/quickstart.html @@ -0,0 +1,360 @@ + + + + + + + + + 快速开始 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

快速开始

+ +
+

备注

+

All code starting with a $ is meant to run on your terminal. +All code starting with a >>> is meant to run in a python interpreter, +like ipython.

+
+
+

安装

+

web3.py can be installed (preferably in a virtualenv) +using pip as follows:

+
$ pip install web3
+
+
+
+

备注

+

If you run into problems during installation, you might have a +broken environment. See the troubleshooting guide to setting up a +clean environment.

+
+
+
+

使用 Web3

+

This library depends on a connection to an Ethereum node. We call these connections +Providers and there are several ways to configure them. The full details can be found +in the Providers documentation. This Quickstart guide will highlight +a couple of the most common use cases.

+
+

Test Provider

+

If you're just learning the ropes or doing some quick prototyping, you can use a test +provider, eth-tester. This provider includes +some accounts prepopulated with test ether and instantly includes each transaction into a block. +web3.py makes this test provider available via EthereumTesterProvider.

+
+

备注

+

The EthereumTesterProvider requires additional dependencies. Install them via +pip install "web3[tester]", then import and instantiate the provider as seen below.

+
+
>>> from web3 import Web3, EthereumTesterProvider
+>>> w3 = Web3(EthereumTesterProvider())
+>>> w3.is_connected()
+True
+
+
+
+
+

Local Providers

+

The hardware requirements are steep, +but the safest way to interact with Ethereum is to run an Ethereum client on your own hardware. +For locally run nodes, an IPC connection is the most secure option, but HTTP and +websocket configurations are also available. By default, the popular Geth client +exposes port 8545 to serve HTTP requests and 8546 for websocket requests. Connecting +to this local node can be done as follows:

+
>>> from web3 import Web3, AsyncWeb3
+
+# IPCProvider:
+>>> w3 = Web3(Web3.IPCProvider('./path/to/filename.ipc'))
+>>> w3.is_connected()
+True
+
+# HTTPProvider:
+>>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545'))
+>>> w3.is_connected()
+True
+
+# AsyncHTTPProvider:
+>>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('http://127.0.0.1:8545'))
+>>> await w3.is_connected()
+True
+
+# -- Persistent Connection Providers -- #
+
+# WebSocketProvider:
+>>> w3 = await AsyncWeb3(AsyncWeb3.WebSocketProvider('ws://127.0.0.1:8546'))
+>>> await w3.is_connected()
+True
+
+# AsyncIPCProvider:
+>>> w3 = await AsyncWeb3(AsyncWeb3.AsyncIPCProvider('./path/to/filename.ipc'))
+>>> await w3.is_connected()
+True
+
+
+
+
+

Remote Providers

+

The quickest way to interact with the Ethereum blockchain is to use a remote node provider. +You can connect to a remote node by specifying the endpoint, just like the previous local node example:

+
>>> from web3 import Web3, AsyncWeb3
+
+>>> w3 = Web3(Web3.HTTPProvider('https://<your-provider-url>'))
+
+>>> w3 = AsyncWeb3(AsyncWeb3.AsyncHTTPProvider('https://<your-provider-url>'))
+
+>>> w3 = await AsyncWeb3(AsyncWeb3.WebSocketProvider('wss://<your-provider-url>'))
+
+
+

This endpoint is provided by the remote node service, typically after you create an account.

+
+
+
+

Getting Blockchain Info

+

It's time to start using web3.py! Once properly configured, the w3 instance will allow you +to interact with the Ethereum blockchain. Try getting all the information about the latest block:

+
>>> w3.eth.get_block('latest')
+{'difficulty': 1,
+ 'gasLimit': 6283185,
+ 'gasUsed': 0,
+ 'hash': HexBytes('0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178291ffeb8750'),
+ 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'),
+ 'miner': '0x0000000000000000000000000000000000000000',
+ 'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'),
+ 'nonce': HexBytes('0x0000000000000000'),
+ 'number': 0,
+ 'parentHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'),
+ 'proofOfAuthorityData': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000dddc391ab2bf6701c74d0c8698c2e13355b2e4150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'),
+ 'receiptsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'),
+ 'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'),
+ 'size': 622,
+ 'stateRoot': HexBytes('0x1f5e460eb84dc0606ab74189dbcfe617300549f8f4778c3c9081c119b5b5d1c1'),
+ 'timestamp': 0,
+ 'totalDifficulty': 1,
+ 'transactions': [],
+ 'transactionsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'),
+ 'uncles': []}
+
+
+

web3.py can help you read block data, sign and send transactions, deploy and interact with contracts, +and a number of other features.

+

A few suggestions from here:

+
    +
  • The 概览 page provides a summary of web3.py's features.

  • +
  • The w3.eth API contains the most frequently used methods.

  • +
  • A guide to Contracts includes deployment and usage examples.

  • +
  • The nuances of 交易 are explained in another guide.

  • +
+
+

备注

+

It is recommended that your development environment have the PYTHONWARNINGS=default +environment variable set. Some deprecation warnings will not show up +without this variable being set.

+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/release_notes.html b/_build/html_zh_CN/release_notes.html new file mode 100644 index 0000000000..00a39efcda --- /dev/null +++ b/_build/html_zh_CN/release_notes.html @@ -0,0 +1,5704 @@ + + + + + + + + + 发布说明 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

发布说明

+
+
v7 Breaking Changes Summary

See the v7 Migration Guide

+
+
+
+

web3.py v7.13.0 (2025-08-04)

+
+

Bugfixes

+
    +
  • Raise BadResponseFormat from within FormattingMiddleware if the raw response is not a dict. (#3735)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix broken link to external eth_gasPrice documentation. (#3717)

  • +
+
+
+

Features

+
    +
  • Support parallelization of subscription handling globally via the subscription manager parallelize flag, and on a per-subscription basis via the parallelize flag on the subscription itself. (#3709)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Update integration test suite fixture to test against geth v1.16.2. (#1162)

  • +
  • Add missing async tests for FormattingMiddleware as a sanity check. (#3735)

  • +
+
+
+
+

web3.py v7.12.1 (2025-07-14)

+
+

Bugfixes

+
    +
  • Fix AutoProvider batching setup by adding a proxy batch request. (#3712)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Update integrations tests to use geth v1.16.0. (#3727)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v7.12.0 (2025-05-22)

+
+

Bugfixes

+
    +
  • Thread safety for batching and better consistency with PersistentConnectionProvider implementations:

    +
    +
      +
    • Make request batching threadsafe by using contextvars.ContextVar rather than a global flag for setting the batching state.

    • +
    • Deterministically match responses with request ids for PersistentConnectionProvider batch requests. (#3705)

    • +
    +
    +
  • +
+
+
+

Deprecations

+
    +
  • Deprecate ens_encode_name in favor of dns_encode_name. (#3700)

  • +
+
+
+

Features

+
    +
  • Introduce ens.utils.dns_encode_name as a rename of the current ens_encode_name, for consistency across other language implementations and with the ENS docs. Returns HexBytes instead of bytes. (#3700)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Update some types in web3._utils.method_formatters (#3669)

  • +
  • Fix issues and start running the core tests with pytest-xdist, effectively reducing the CI test times by ~75-80%. (#3705)

  • +
+
+
+

Performance Improvements

+
    +
  • optimize message formatting for logging (#3643)

  • +
  • Optimize web3._utils.decorators.reject_recursive_repeats (#3668)

  • +
  • optimize Method.method_selector_function (#3696)

  • +
  • optimize map_abi_data (#3697)

  • +
+
+
+
+

web3.py v7.11.1 (2025-05-12)

+
+

Bugfixes

+
    +
  • Fix contract event FilterParams to validate and normalize address parameters. (#3618)

  • +
  • Properly handle PersistentConnectionClosedOK for subscription_manager.handle_subscriptions(). (#3690)

  • +
+
+
+

Deprecations

+
    +
  • Deprecate eth.get_uncle* methods. Will be removed in v8. (#3683)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Re-compile test contracts with new Solidity v0.8.30 and re-generate integration test fixture to test against latest geth v1.15.11. (#3692)

  • +
  • Remove old test fixtures when generating a new test fixture. (#3693)

  • +
  • Address some flaky tests due to a geth bug in state synchronization. (#3695)

  • +
+
+
+
+

web3.py v7.11.0 (2025-04-29)

+
+

Bugfixes

+
    +
  • Checks that PersistentConnectionProvider response cache value is a dict before attempting to access it like one. Also adds checks to make_batch_request to make sure it is in batching mode before being called and is not after. (#3642)

  • +
  • Moves base providers' _is_batching and _batch_request_func_cache from class to instance attrs to help with thread safety. (#3661)

  • +
+
+
+

Features

+
    +
  • Support for Prague network upgrade, mainly requests_hash and authorization_list formatters. Add support for serializing SignedSetCodeTransaction (eth-account pydantic model) directly added to transaction dicts. (#3659)

  • +
  • Allow setting the request_information_cache_size for PersistentConnectionProvider implementations. (#3662)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Update some outdated TODO notes in code & remove old un-tested uncles tests as no longer relevant post-merge. (#3605)

  • +
  • Run each integration test in isolation and parallelize, instead of running them all within a single geth (for example) process. This prevents muddied test contexts. (#3659)

  • +
  • Bound hypothesis integers in some tests to a max of uint256 value (#3665)

  • +
  • AsyncENS tests were xfailing for the wrong reason. (#3675)

  • +
+
+
+

Performance Improvements

+
    +
  • Optimize performance for:

    +
      +
    • web3._utils.utility_methods.all_in_dict

    • +
    • web3._utils.utility_methods.any_in_dict

    • +
    • web3._utils.utility_methods.none_in_dict (#3667)

    • +
    +
  • +
  • optimize web3._utils.rpc_abi.apply_abi_formatters_to_dict (#3671)

  • +
+
+
+
+

web3.py v7.10.0 (2025-03-27)

+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v7.9.0 (2025-03-12)

+
+

Bugfixes

+
    +
  • Prevent mutating list of subscriptions when unsubscribing via the subscription_manager by iterating over a copy of the provided list. (#3604)

  • +
  • Batching can now be used with the AutoProvider (#3607)

  • +
+
+
+

Improved Documentation

+
    +
  • Update and clean up Contributing docs. (#3610)

  • +
+
+
+

Features

+
    +
  • Add use_text_frames flag for WebSocketProvider to work around websocket servers that don't support binary frames (#3619)

  • +
  • Sync and async support for eth_simulateV1 RPC method. (#3622)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Renames a test so pytest finds it. (#3606)

  • +
  • Merge template, replacing bumpversion with bump-my-version. (#3610)

  • +
  • Update integration test fixture to use latest geth version v1.15.5. (#3636)

  • +
  • Use -U to install latest py-geth version for CI geth steps. This is usually a requirement if we're missing the binary for the newly-generated fixture geth version. (#3637)

  • +
  • Re-compile test contracts with newly released Solidity v0.8.29. (#3640)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v7.8.0 (2025-02-03)

+
+

Breaking Changes

+
    +
  • The bugfix to match unsubscribe to subscribe for multiple subscriptions breaks the function signature for unsubscribe, changing the subscription argument to subscriptions. (#3585)

  • +
+
+
+

Bugfixes

+
    +
  • Handle the case when a single RPC error response is returned for a batch request, instead of always expecting a list of responses. (#3585)

  • +
  • Don't raise on non-unique default subscription labels (no label provided). Only raise if a non-unique custom label is explicitly set for a subscription. (#3594)

  • +
  • Fix bugs related to subscription manager: run_forever can start with 0 subscriptions and remains alive, unsubscribe accepts single or multiple subs as objects or hexstrs, subscribe for many subs returns a list of hexstr ids. (#3595)

  • +
  • Fix issue where .values() raised a KeyError in NamedTupledOnion (#3596)

  • +
+
+
+

Improved Documentation

+
    +
  • Include topic attribute in ContractEvent docs. (#3586)

  • +
  • Introduce Event Subscriptions docs guide (#3600)

  • +
+
+
+

Features

+
    +
  • New Beacon and AsyncBeacon endpoints: get_peer_count, get_attester_duties, get_block_proposer_duties, get_sync_committee_duties, and get_attestation_rewards. (#3504)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Move duplicate code into BaseContract class from Contract and AsyncContract. (#3579)

  • +
  • Address flaky tests in CI runs. (#3583)

  • +
  • Update copyright year from 2024 to 2025 in the LICENSE file. (#3592)

  • +
+
+
+

Performance Improvements

+
    +
  • Avoid unnecessary extra call to resolver when resolving an ENS address with no coin_type specified (default). (#3584)

  • +
+
+
+
+

web3.py v7.7.0 (2025-01-15)

+
+

Bugfixes

+
    +
  • Add a disconnect method to the AsyncHTTPProvider that closes all sessions and clears the cache (#3557)

  • +
  • Fix a bug related to building the ipc path for connecting to a geth --dev instance via web3.auto.gethdev. (#3576)

  • +
+
+
+

Features

+
    +
  • Add a subscription manager to persistent connection providers, with support for handler methods for eth_subscribe subscriptions. (#3554)

  • +
  • Implement a topic property for contract events to retrieve the topic for the event. (#3578)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+

Performance Improvements

+
    +
  • Improve AttributeDict.recursive() and AttributeDictMiddleware performance, effectively speeding up response processing for attrdict middleware by nearly 2x. (#3575)

  • +
+
+
+
+

web3.py v7.6.1 (2024-12-18)

+
+

Bugfixes

+
    +
  • Include an end-of-line delimiter when sending messages via IPC with the IPCProvider and AsyncIPCProvider. (#3537)

  • +
  • Contract functions and events no longer initialize for each call. Retrieval of overloaded functions and events is now deterministic. Any ambiguity will result in an exception being raised. (#3540)

  • +
  • Bump the eth-tester version to one that works in the tester dependency extras (#3555)

  • +
+
+
+

Improved Documentation

+
    +
  • Update ENS-related links (#3563)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Upgrade Geth Fixture to 1.14.12 (#3533)

  • +
  • Delete ARCHITECTURE.md as unused (#3547)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v7.6.0 (2024-11-22)

+
+

Bugfixes

+
    +
  • Update the ContractEvents class to raise a NoABIFound exception if the Contract is initialized without an ABI and an attempt to access an event is made. This exception makes ContractEvents consistent with ContractFunctions. (#3491)

  • +
+
+
+

Features

+
    +
  • Contracts with overloaded functions or events are now supported. The Contract initializes functions and events using an identifier to distinguish between them. The identifier is the function or event signature, which consists of the name and the parameter types. (#3491)

  • +
    • +
    • Support for w3.eth.blob_base_fee

    • +
    • Async support for w3.eth.blob_base_fee (#3527)

    • +
    +
  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Pin websockets<14 due to breaking changes (#3529)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v7.5.0 (2024-11-06)

+
+

Improved Documentation

+
    +
  • Polish docs index page (#3522)

  • +
+
+
+

Features

+
    +
  • Add support for Geth Debug traceTransaction. (#3334)

  • +
  • New contract methods to obtain event elements from a contract ABI using a name, signature, selector, or topic. (#3472)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Add python 3.13 support (#3493)

  • +
  • Compile test contracts with newly released Solidity v0.8.28 to ensure compatibility. (#3515)

  • +
+
+
+
+

web3.py v7.4.0 (2024-10-16)

+
+

Bugfixes

+
    +
  • Fix a bug where CCIP-Read expected a {sender} in the url for a POST request. If {data} is missing from the url, assume a POST request is being made regardless of whether {sender} is present. (#3291)

  • +
  • Fix a bug where non-mainnet chains could not cache requests based on missing finalized block number. (#3508)

  • +
  • Send json, not data with CCIP-Read POST requests. (#3512)

  • +
+
+
+

Improved Documentation

+
    +
  • Update the request caching documentation to clarify on when to reach for request caching and how to configure the request validation threshold for certain endpoints. (#3508)

  • +
+
+
+

Features

+
    +
  • Allow a time interval, in seconds, to be used as the request_cache_validation_threshold for request caching. Keep a list of internal default values based on the chain id for some of the bigger chains. (#3508)

  • +
+
+
+
+

web3.py v7.3.1 (2024-10-14)

+
+

Bugfixes

+
    +
  • Properly wrap AsyncBeacon.request_timeout float in a aiohttp.ClientTimeout when making requests. (#3503)

  • +
  • Changes related to an eth-typing bugfix, input types for ABIEvent: ABIComponent -> ABIComponentIndexed. (#3510)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix EthereumTesterProvider signature in docs, added an eth_tester example. (#3500)

  • +
  • Fix pip install -e ".[dev]" command in linux README. (#3505)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Update the ENSIP-15 to the latest spec and update the test suite. (#3501)

  • +
+
+
+
+

web3.py v7.3.0 (2024-09-25)

+
+

Bugfixes

+
    +
  • Base default maxFeePerGas calculation off of existing maxPriorityFeePerGas key instead of separate RPC call (#3052)

  • +
  • Add back dependency extra for 'tester'. (#3480)

  • +
  • Fix a bug where sensitive requests that make use of block data should not be cached until some validation threshold deems it is safe to do so, when request caching is turned on. (#3483)

  • +
+
+
+

Improved Documentation

+
    +
  • Update contract.encode_abi signature in docs and migration guide (#3473)

  • +
  • Update documentation around SignAndSendRawMiddlewareBuilder injection into the middleware onion. It should be injected lower in the stack than any middleware that modifies the transaction, in order to ensure those modified fields are signed. (#3488)

  • +
  • Docs cleanups related to test vs tester install extras. (#3496)

  • +
+
+
+

Features

+
    +
  • Add a configuration for request caching that sets a threshold for validating cached requests that make use of block data. This can be turned off altogether by setting the threshold to None. (#3483)

  • +
  • Add a configuration option for the read_buffer_limit for AsyncIPCProvider in order to control the expected message size limit (defaults to 20MB). Add ReadBufferLimitReached for when the read limit is reached, extend from PersistentConnectionError. (#3492)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Test warning cleanup (#3468)

  • +
  • Re-compile test contracts with recently released Solidity v0.8.27. (#3475)

  • +
  • Re-organize the install extras. Re-define the test extra to always include the tester extra since it's needed for testing. (#3495)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+

Performance Improvements

+
    +
  • Improve logic for reading from the async IPC socket in order to properly handle and adjust the handling of large messages. This improves reading speeds in general. (#3492)

  • +
+
+
+
+

web3.py v7.2.0 (2024-08-29)

+
+

Bugfixes

+
    +
  • Fix a bug with newer hexbytes versions that yield non-0x-prefixed hex for HexBytes: raw_transaction.hex() -> raw_transaction.to_0x_hex(). (#3471)

  • +
+
+
+

Features

+
    +
  • HTTPProvider and AsyncHTTPProvider's get_request_headers is now available on both the class and the instance (#3467)

  • +
+
+
+
+

web3.py v7.1.0 (2024-08-28)

+
+

Bugfixes

+
    +
  • Specify a unique __hash__() for unhashable Web3Middleware types and use this hash as the middleware onion key when a name is not provided for the middleware. This fixes a bug where different middleware were given the same name and therefore raised errors. (#3463)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix bug in filters example code (#3455)

  • +
  • Update v6 -> v7 migration guide with examples for importing and adding middleware, as well as examples on how to use the MiddlewareBuilder classes. (#3462)

  • +
+
+
+

Features

+
    +
  • Add sync and async support for beacon /eth/v1/beacon/blob_sidecars endpoint. (#3407)

  • +
  • Allow user to call ContractFunctions without parentheses (#3444)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Refactor and DRY up CI run setup and reduce surface area for errors. Include pre-releases in CI runs for internally maintained libraries to try and catch any conflicts. (#3452)

  • +
  • Bump py-geth to >=5.0.0 from >=5.0.0b1 now that stable has been released. This only matters for the test install extra (CI and dev purposes). (#3458)

  • +
+
+
+
+

web3.py v7.0.0 (2024-08-21)

+
+

Breaking Changes

+
    +
  • Update eth-utils and eth-typing to latest major versions

    +

    eth-utils v5 and eth-typing v5 (#3450)

    +
  • +
+
+
+

Improved Documentation

+
    +
  • Improve batch request documentation. (#3448)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Fix Release Notes formatting (#3454)

  • +
+
+
+
+

web3.py v7.0.0-beta.9 (2024-08-01)

+
+

Breaking Changes

+
    +
  • Upgrades to use latest ABI utilities and typings from eth-utils and eth-typing.

    +
      +
    • Typings for ABI components are now available in the eth-typing package. ABI types previously in web3.types have been removed.

    • +
    • New versions of existing ABI functions were added to eth-utils and are now exposed in web3.py via web3.utils.abi.

    • +
    • ABI exceptions have been renamed in web3.exceptions. The ABIEventFunctionNotFound and FallbackNotFound exceptions have been removed. Use ABIEventNotFound and ABIFallbackNotFound instead.

    • +
    • MismatchedABI exceptions are raised instead of a Web3ValidationError for ABI related errors.

    • +
    • encode_abi arguments have been updated to use abi_element_name instead of fn_name. (#3408)

    • +
    +
  • +
+
    +
  • Remove Web3ValidationError dependence / inheritance from eth-utils ValidationError. (#3443)

  • +
+
+
+

Improved Documentation

+
    +
  • Use autodoc and update ABI functions with docstrings and doctests. (#3408)

  • +
+
+
+

Features

+
    +
  • Utilities to extract function and event ABI attributes from a contract. Utilities in the web3.utils.abi module parse ABI elements and check encodability of provided arguments. ABI functions in eth-utils are exposed by the web3.utils.abi module.

    +
      +
    • get_abi_element_info returns an ABIElementInfo TypedDict with the abi, selector, and arguments.

    • +
    • get_abi_element returns the ABI of a function, event, or error given the name and arguments.

    • +
    • check_if_arguments_can_be_encoded returns true if the arguments can be encoded with the given ABI.

    • +
    • get_event_abi returns the ABI of an event given the name.

    • +
    • get_event_log_topics returns the log topics of an event given the name.

    • +
    • log_topics_to_bytes returns the log topics as bytes. (#3408)

    • +
    +
  • +
+
    +
  • Add explicit stream kwarg to HTTPProvider so that timeout can be more finely tuned. (#3428)

  • +
  • Implement a RequestTimedOut exception, extending from Web3RPCError, for when requests to the node time out. (#3440)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Run mypy locally using pre-commit hook, instead of within pre-commit container (#3414)

  • +
  • Mitigate inconsistently failing tests for CI runs with appropriate flaky or pytest.mark.xfail() decorators. (#3440)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v7.0.0-beta.8 (2024-07-24)

+
+

Breaking Changes

+
    +
  • Refactor the public socket api for persistent connection providers to properly define send(), recv(), and make_request() (send and wait for response) methods for interacting with the open socket. (#3433)

  • +
  • Format entries in accessList storageKeys to be HexStr instead of HexBytes (#3434)

  • +
+
+
+

Bugfixes

+
    +
  • Handle ConnectionClosedOK case for WebSocketProvider. If a persistent connection is closed gracefully, log and raise a silent PersistentConnectionClosedOK exception, triggering an end to the message listener task and breaking out of the process_subscriptions() iterator. (#3432)

  • +
+
+
+

Features

+
    +
  • Add popitem() functionality to the SimpleCache class as well as an async utility method to wait for the next item, async_await_and_popitem(). (#3433)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Refactor some common logic for persistent connection providers back into the base PersistentConnectionProvider class to reduce code duplication and improve maintainability. (#3433)

  • +
+
+
+
+

web3.py v7.0.0-beta.7 (2024-06-26)

+
+

Bugfixes

+
    +
  • Change the exception_retry_configuration typing on http providers to be an Optional, as setting this property to None effectively turns off retries on exceptions for requests. (#3412)

  • +
  • A bugfix, pre-release, to update the Beacon APIs (sync and async) to properly use the new HTTPSessionManager. (#3421)

  • +
+
+
+

Improved Documentation

+
    +
  • Add an eth_subscribe example to the events guide (#3403)

  • +
+
+
+

Features

+
    +
  • Properly handle InsufficientDataBytes errors when processing receipts (#3388)

  • +
  • Provide explicit __all__ exports for providers in web3/providers/__init__.py; update web3/__init__.py to include all provider classes including base classes. (#3409)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Re-compile test contracts with Solidity v0.8.25 to ensure compatibility. (#3307)

  • +
  • Increase allowable range of eth-tester: 0.11.x and 0.12.x (#3400)

  • +
  • Remove uses of signHash in tests, require eth-account >=0.13.0 in doctests (#3404)

  • +
  • Use a HTTPSessionManager to manage sessions for http providers, rather than have them share a single session manager / cache. (#3412)

  • +
+
+
+
+

web3.py v7.0.0-beta.6 (2024-05-15)

+
+

Bugfixes

+
    +
  • Properly propagate exceptions from the message listener task to the main loop for persistent connection providers. (#3378)

  • +
+
+
+

Improved Documentation

+
    +
  • Prunes the node onboarding text (#3371)

  • +
  • Stale example cleanup (#3374)

  • +
  • Merge migration guides into one page (#3379)

  • +
  • Simplify titles of docs guides (#3381)

  • +
  • Move ABI Types guide into the Troubleshooting page (#3382)

  • +
  • Distribute examples into relevant guides and delete Example page (#3383)

  • +
  • Add subscribe/unsubscribe API (#3386)

  • +
  • Introduces batch request API (#3393)

  • +
+
+
+

Features

+
    +
  • Add support for request batching via w3.batch_requests() context manager (sync and async). (#3370)

  • +
  • Allow request cache configuration on provider __init__() for all provider classes. (#3395)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Merge the python project template, notably adding python 3.12 support (#3363)

  • +
  • Increase python-asyncio dependency to be >=0.21.2,<0.23 (#3369)

  • +
  • Bump to mypy==1.10.0 for pre-commit (#3377)

  • +
  • Move signed.rawTransaction -> signed.raw_transaction in eth module tests (#3380)

  • +
+
+
+
+

web3.py v7.0.0-beta.5 (2024-04-26)

+
+

Breaking Changes

+
    +
  • Snake-case remaining arguments fromBlock, toBlock, and blockHash in contract and filter methods where they are passed in as kwargs. (#3353)

  • +
  • Employ an exponential backoff strategy using the backoff_factor in ExceptionRetryConfiguration for HTTPProvider and AsyncHTTPProvider. Reduce the default initial delay to 0.125 seconds. (#3358)

  • +
  • Validate JSON-RPC responses more strictly against the JSON-RPC 2.0 specifications. BlockNumberOutofRange -> BlockNumberOutOfRange. (#3359)

  • +
+
+
+

Deprecations

+
    +
  • messageHash and rawTransaction from eth-account have been deprecated for snake_case versions (#3348)

  • +
+
+
+

Features

+
    +
  • Raise Web3RPCError on JSON-RPC errors rather than Web3ValueError. Raise MethodNotSupported exception when a method is not supported within web3.py; keep MethodUnavailable for when a method is not available on the current provider (JSON-RPC error). (#3359)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Bump eth-account dependency to >=0.12.2 (#3348)

  • +
+
+
+

Removals

+
    +
  • Remove the deprecated personal namespace and all references to it. (#3350)

  • +
+
+
+
+

web3.py v7.0.0-beta.4 (2024-04-11)

+
+

Bugfixes

+
    +
  • Fix misused call to endpoint_uri for all cases of PersistentConnectionProvider by being able to retrieve either the ipc_path or the endpoint_uri from the base class with endpoint_uri_or_ipc_path property. (#3319)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix eth_createAccessList docs to reflect the correct behavior. (#3327)

  • +
+
+
+

Features

+
    +
  • Use in-house exception wrappers for common Python exceptions, such as ValueError, TypeError, AttributeError, and AssertionError, for better control over exception handling. (#3300)

  • +
  • Add request formatter for maxFeePerBlobGas when sending blob transactions. Add formatters for blobGasPrice and blobGasUsed for eth_getTransactionReceipt. (#3322)

  • +
  • Add formatters to ensure that the result of a eth_createAccessList response can be plugged directly into an accessList in a transaction. (#3327)

  • +
  • Add Cancun support to EthereumTesterProvider; update Cancun-related fields in some internal types. (#3332)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Use pre-commit for linting, run updated lint tools and fix errors (#3297)

  • +
  • Dependency updates: eth-abi>=5.0.1, eth-account>=0.12.0 eth-typing>=4.0.0 and hexbytes>=1.2.0 with relevant changes to support these. (#3298)

  • +
  • Remove code conditionally necessary for python<=3.7 (#3317)

  • +
+
+
+
+

web3.py v7.0.0-beta.3 (2024-03-28)

+
+

Bugfixes

+
    +
  • Fix process_log() when parsing logs for events with indexed and non-indexed inputs. get_event_data() now compares log topics and event ABIs as hex values. (#3289)

  • +
  • Fix process_log for HexStr inputs. Explicit type coercion of entry topics and data values. (#3293)

  • +
  • Fix typing for json data argument to eth_signTypedData. (#3308)

  • +
+
+
+

Improved Documentation

+
    +
  • Add note about middlewares change to v7 migration guide. (#3277)

  • +
  • Rearrange v7 migration guide and include upgrade path from WebsocketProviderV2 (#3310)

  • +
+
+
+

Features

+
    +
  • Add support for eth_getRawTransactionByHash RPC method (#3247)

  • +
  • Add user_message kwarg for human readable Web3Exception messages. (#3263)

  • +
  • Add formatters for type 3 transaction fields maxFeePerBlobGas and blobVersionedHashes. (#3314)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Add a daily CI run (#3272)

  • +
  • Add linting for non-inclusive language with blocklint. (#3275)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+

Performance Improvements

+
    +
  • Importing ens._normalization is deferred until the first call of ens.utils.normalize_name in order to speed up import web3. (#3285)

  • +
  • Utilize async functionality when popping responses from request manager cache for persistent connection providers. (#3306)

  • +
+
+
+

Removals

+
    +
  • Remove Contract.encodeABI() in favor of Contract.encode_abi() to follow standard conventions. (#3281)

  • +
+
+
+
+

web3.py v7.0.0-beta.2 (2024-03-11)

+
+

Breaking Changes

+
    +
  • Move middlewares -> middleware (#3276)

  • +
+
+
+

Bugfixes

+
    +
  • Fix/update methods and decorators in web3/_utils/abi.py to address issues raised by mypy (#3269)

  • +
  • Catch all types of eth-abi DecodingError in EthereumTesterProvider->_make_request() (#3271)

  • +
+
+
+

Improved Documentation

+
    +
  • Remove annual user survey prompt from docs (#3218)

  • +
  • Introduce feedback form banner prompt on docs (#3253)

  • +
  • Refresh of the middleware docs (#3266)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+

Removals

+
    +
  • Remove the ethpm module and related docs, tests, and dependencies (#3261)

  • +
+
+
+
+

web3.py v7.0.0-beta.1 (2024-02-28)

+
+

Breaking Changes

+
    +
  • Refactor the middleware setup so that request processors and response processors are separated. This will allow for more flexibility in the future and aid in the implementation of features such as batched requests. This PR also closes out a few outstanding issues and will be the start of the breaking changes for web3.py v7. Review PR for a full list of changes. (#3169)

  • +
  • Use a message listener background task for WebsocketProviderV2 rather than relying on ws.recv() blocking. Some breaking changes to API, notably listen_to_websocket -> process_subscriptions. (#3179)

  • +
  • Drop dependency on lru-dict library. (#3196)

  • +
  • Drop support for python 3.7 (#3198)

  • +
  • Return iterable of ABIFunction``s from the ``BaseContractFunctions iterator. (#3200)

  • +
  • Name changes internal to the library related to v7: WebsocketProvider -> LegacyWebSocketProvider, WebsocketProviderV2 -> WebSocketProvider (#3225)

  • +
  • CallOverride type change to StateOverride to reflect better the type name for the state override. eth_call is also not the only method with this param, making the name more generic. (#3227)

  • +
  • Rename beacon/main.py -> beacon/beacon.py (#3233)

  • +
  • EthereumTesterProvider now returns input for eth_getTransaction* for better consistency with JSON-RPC spec. (#3235)

  • +
  • Change the signature for the async version of wait_for_transaction_receipt() to use Optional[float] instead of float. (#3237)

  • +
  • get_default_ipc_path() and get_dev_ipc_path() now return the path value without checking if the geth.ipc file exists. (#3245)

  • +
+
+
+

Bugfixes

+
    +
  • Fix return type of AsyncContract.constructor (#3192)

  • +
  • Handle new geth errors related to waiting for a transaction receipt while transactions are still being indexed. (#3216)

  • +
+
+
+

Improved Documentation

+
    +
  • Documentation was updated to reflect early changes to v7 from v6. A v6 -> v7 migration guide was also started and will be added to as v7 breaking changes are introduced. (#3211)

  • +
  • Remove ENS v6 breaking change warning from v7 (#3254)

  • +
+
+
+

Features

+
    +
  • Add AsyncIPCProvider (#2984)

  • +
  • Implement state_override parameter for eth_estimateGas method. (#3164)

  • +
  • Upgrade eth-tester to v0.10.0-b.1 and turn on eth_feeHistory support for EthereumTesterProvider. (#3172)

  • +
  • Add formatters for new Cancun network upgrade block header fields: blobGasUsed, excessBlobGas, and parentBeaconBlockRoot. (#3223)

  • +
  • Contract event get_logs results sorted by each ContractEvent logIndex. (#3228)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Create test fixture for latest geth version. Run tests with geth in --dev mode. (#3191)

  • +
  • Validate geth version used to generate the integration test fixture against the version in the binary that is used to run the tests. (#3193)

  • +
  • Internal change to WebsocketProviderV2 before release: raise exceptions in message listener task by default; opting to silence them via a flag. (#3202)

  • +
  • Compile contracts with and test against new Solidity version v0.8.24. (#3204)

  • +
  • Formatting updates for black==24.1.0. (#3207)

  • +
  • Allow HTTP provider request retry configuration to be turned off appropriately. Internal change since v7 has not yet been released. (#3211)

  • +
  • Upgraded geth fixture version (#3231)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+

Performance Improvements

+
    +
  • Remove call to parse_block_identifier when initializing ContractCaller functions. (#3257)

  • +
+
+
+

Removals

+
    +
  • normalize_request_parameters middleware was in a stale state and not being used or tested. This middleware has been removed. (#3211)

  • +
  • Remove deprecated geth.miner namespace and methods. (#3236)

  • +
+
+
+
+

web3.py v6.14.0 (2024-01-10)

+
+

Bugfixes

+
    +
  • Change fee_history default behavior. If reward_percentiles arg not included, pass it to the provider as an empty list instead of None. (#3185)

  • +
  • Use importlib.metadata for version info if python>=3.8 (#3187)

  • +
+
+
+

Improved Documentation

+
    +
  • Remove docs reference for removed protocol_version RPC method (#3183)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Re-define how async vs sync core test suites are ran. (#3180)

  • +
  • Add basic import and version tests for the web3 module (#3187)

  • +
+
+
+
+

web3.py v6.13.0 (2023-12-20)

+
+

Features

+
    +
  • Implement async eth_createAccessList RPC method to create an EIP-2930 access list. (#3167)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Add flaky async Geth integration tests to CI (#3170)

  • +
  • Fix wrong test reference for EthereumTesterProvider integration test suite. (#3171)

  • +
  • Small fix for integration tests for tox to recognize independent patterns for each test run. (#3173)

  • +
+
+
+
+

web3.py v6.12.0 (2023-12-11)

+
+

Improved Documentation

+
    +
  • Make downloadable versions of docs available in pdf, htmlzip, and epub formats (#3153)

  • +
  • Add 2023 user survey fine art banner in the docs (#3159)

  • +
  • Polish the community resources docs page (#3162)

  • +
+
+
+

Features

+
    +
  • Implement createAccessList RPC endpoint to create an EIP-2930 access list. (#2381)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Run flaky eth-tester tests on CI (#3157)

  • +
  • Pin pytest-asyncio dependency to <0.23 (#3160)

  • +
+
+
+
+

web3.py v6.11.4 (2023-11-27)

+
+

Bugfixes

+
    +
  • Fix collision of w3 variable when initializing contract with function of the same name (#3147)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v6.11.3 (2023-11-08)

+
+

Bugfixes

+
    +
  • When coming back through the middleware onion after a request is made, we have the response id. Use it to match to the cached request information and process the response accordingly. (#3140)

  • +
+
+
+

Improved Documentation

+
    +
  • Adds Discord bot template repo to Resources page (#3143)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Additional contract abi documentation to make it a clear requirement for contract instances. (#2539)

  • +
  • Fix type annotations for web3 constants. (#3138)

  • +
  • Add upper pin to deprecated dependency lru-dict whose new minor version release introduced a typing issue with CI lint builds. (#3144)

  • +
  • Recompile test contracts with new Solidity version v0.8.23 to ensure compatibility. (#3146)

  • +
+
+
+
+

web3.py v6.11.2 (2023-10-30)

+
+

Improved Documentation

+
    +
  • Fix formatting in documentation for creating an account. (#3128)

  • +
  • Fix broken links for Apeworx and Sepolia faucet (#3130)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Speed up the core test suite by splitting up sync and async tests. This reduces the CI build times to ~8min from ~12min. (#3111)

  • +
  • Re-compile test contracts with Solidity v0.8.22 to ensure compatibility with this latest Solidity version. (#3134)

  • +
  • Improvements on yielding to the event loop while searching in response caches and calling recv() on the websocket connection for WebSocketProviderV2. (#3135)

  • +
+
+
+
+

web3.py v6.11.1 (2023-10-18)

+
+

Improved Documentation

+
    +
  • Update WebsocketProviderV2 documentation. Document a general overview of the RequestProcessor class and its internal caches. (#3125)

  • +
+
+
+

Features

+
    +
  • Properly define an __await__() method on the _PersistentConnectionWeb3 class so a persistent connection may be initialized using the await pattern. Integration tests added for initializing the persistent connection using the await pattern. (#3125)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Updates and refactoring for the WebsocketProviderV2 class and its internal supporting classes and logic. Separation of one-to-one and one-to-many request responses. Storing of one-to-many responses in a deque and one-to-one responses in a SimpleCache class. Provide an async lock around the websocket recv(). (#3125)

  • +
  • Add upper pin to hexbytes dependency to due incoming breaking change (#3127)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v6.11.0 (2023-10-11)

+
+

Breaking Changes (to Beta APIs)

+
    +
  • Refactor the async iterator pattern for message streams from the websocket connection for WebsocketProviderV2 to a proper async iterator. This allows for a more natural usage of the iterator pattern and mimics the behavior of the underlying websockets library. (#3116)

  • +
+
+
+

Bugfixes

+
    +
  • Use hashes to compare equality of two AttributeDict classes (#3104)

  • +
  • Fix issues with formatting middleware, such as async_geth_poa_middleware and subscription responses for WebsocketProviderV2. (#3116)

  • +
+
+
+

Improved Documentation

+
    +
  • Change docker-compose to docker compose in the Contributing docs examples. (#3107)

  • +
  • Updates to the WebsocketProviderV2 documentation async iterator example for iterating over a persistent stream of messages from the websocket connection via async for. (#3116)

  • +
  • Update outdated node and private key management verbiage. (#3117)

  • +
+
+
+

Features

+
    +
  • Allow passing in a float for a request_timeout for requests for the Beacon class. Update some Beacon API endpoints (sync and async). (#3106)

  • +
  • Add allow_list kwarg for exception_retry_middleware to allow for a custom list of RPC endpoints. Add a sleep between retries and a customizable backoff_factor to control the sleep time between retry attempts. (#3120)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Refactor logic for the input_munger() method on the Method class. (#2987)

  • +
  • Pin mypy to v1.4.1, the last to support py37 (#3122)

  • +
+
+
+
+

web3.py v6.10.0 (2023-09-21)

+
+

Breaking Changes (to Beta APIs)

+
    +
  • Breaking change to the API for interacting with a persistent websocket connection via AsyncWeb3 and WebsocketProviderV2. This change internalizes the provider.ws property and opts for a w3.ws API achieved via a new WebsocketConnection class. With these changes, eth_subscription messages now return the subscription id as the subscription param and the formatted message as the result param. (#3096)

  • +
+
+
+

Bugfixes

+
    +
  • Return w3.eth.gas_price when calculating time based gas price strategy for an empty chain. (#1149)

  • +
  • Update LogReceipt and TxReceipt declarations. Remove LogReceipt's payload and topic attributes. Refactor LogEntry to LogReceipt. (#3043)

  • +
  • Fixes AsyncEth.max_priority_fee_per_gas. It wasn't falling back to eth_feeHistory since the MethodUnavailable error was introduced. (#3084)

  • +
+
+
+

Improved Documentation

+
    +
  • Update WebsocketProviderV2 documentation to reflect the new public websocket API via the WebsocketConnection class. (#3096)

  • +
+
+
+

Features

+
    +
  • Improved error messaging for exceptions from malformed JSON-RPC responses. (#3053)

  • +
  • Enable filtering by non-indexed arguments for contract event get_logs(). (#3078)

  • +
  • Add eth_maxPriorityFeePerGas to exception_retry_middleware whitelist (#3090)

  • +
  • Sync responses for WebsocketProviderV2 open connections with requests via matching RPC id values. (#3096)

  • +
  • Properly JSON encode AttributeDict, bytes, and HexBytes when sending a JSON-RPC request by utilizing the in-house Web3JsonEncoder class. (#3101)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Fix an issue with an IPC test present only on MacOSX. (#929)

  • +
  • Ignore flake8 rule F401 (unused import) in all __init__.py files (#3097)

  • +
+
+
+
+

web3.py v6.9.0 (2023-08-23)

+
+

Bugfixes

+
    +
  • Fix the type for input in TxData from HexStr -> HexBytes. (#3074)

  • +
  • Fix an issue with WebsocketProviderV2 when responses to a request aren't found in the cache (None values). (#3075)

  • +
  • Re-expose some websockets constants found in web3.providers.websocket.websocket via web3.providers.websocket. (#3076)

  • +
  • Return NotImplemented constant, rather than raising NotImplementedError for NamedElementOnion.__add__(), based on Python standards. (#3080)

  • +
  • Only release async_lock if it's locked to begin with. (#3083)

  • +
+
+
+

Improved Documentation

+
    +
  • Add MEV blocking tutorial to Resources docs page (#3072)

  • +
  • Fix documentation around current state of get_logs() usage and arguments. (#3073)

  • +
  • Add an Ape hackathon kit to Resources documentation page (#3082)

  • +
+
+
+
+

web3.py v6.8.0 (2023-08-02)

+
+

Bugfixes

+
    +
  • Fix the type for the optional param asking for "full transactions" when subscribing to newPendingTransactions via eth_subscribe to bool. (#3067)

  • +
+
+
+

Improved Documentation

+
    +
  • Change docs to reflect AsyncHTTPProvider does accept ENS names now (#3070)

  • +
+
+
+

Features

+
    +
  • Return structured JSON-RPC errors for missing or unimplemented eth-tester methods. (#3061)

  • +
  • ENS name-to-address support for eth_subscribe. (#3066)

  • +
  • Asynchronous iterator support for AsyncWeb3 with WebsocketProviderV2 using async for syntax. (#3067)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Minor fixes to type hinting in the core tests setup fixtures. (#3069)

  • +
+
+
+
+

web3.py v6.7.0 (2023-07-26)

+
+

Bugfixes

+
    +
  • Test wheel build in separate directory and virtualenv (#3046)

  • +
  • Handle case where data gets returned as None in a JSON-RPC error response (#3054)

  • +
  • Fixed default windows IPC provider path to work with python 3.11 (#3058)

  • +
  • Fix return type for rpc_gas_price_strategy to int but also only convert the strategy_based_gas_price to hex if it is an int in the gas_price_strategy_middleware. (#3065)

  • +
+
+
+

Improved Documentation

+
    +
  • Add note to Release Notes about v5 end-of-life and v6.6.0 yank (#3045)

  • +
  • Add documentation for WebsocketProviderV2 (beta). (#3048)

  • +
+
+
+

Features

+
    +
  • Add ENSIP-9 (Multichain Address Resolution) support for address() and setup_address() for ENS and AsyncENS classes. (#3030)

  • +
  • Support for eth_subscribe and eth_unsubscribe methods has been added with the introduction of a new websocket provider, WebsocketProviderV2. (#3048)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Added recursive typing to ABIFunctionComponents type (#3063)

  • +
  • Upgrade eth-tester requirement to v0.9.0-b.1 (#3064)

  • +
+
+
+
+

web3.py v6.6.1 (2023-07-12)

+
+

Bugfixes

+
    +
  • Add ens/specs to MANIFEST.in (#3039)

  • +
+
+
+
+

web3.py v6.6.0 (2023-07-12)

+

Note: This release was missing the required ``ens/specs`` directory, so it was yanked +from Pypi in favor of v6.6.1

+
+

Breaking Changes

+
    +
  • ENS name normalization now uses ENSIP-15 by default. This is technically a breaking change introduced by ENS but, according to ENSIP-15, 99% of existing names should be unaffected. (#3024)

  • +
+
+
+

Bugfixes

+
    +
  • Handle None in the formatting middleware (#2546)

  • +
  • Fix for a possible bug in construct_sign_and_send_raw_middleware where the signed transaction was sent as bytes and expected to be converted to hex by formatting later on. It is now explicitly sent as the hex string hash within the middleware. (#2936)

  • +
  • Fixes max_priority_fee_per_gas. It wasn't falling back to eth_feeHistory since the MethodUnavailable error was introduced. (#3002)

  • +
  • Properly initialize logger in AsyncHTTPProvider. (#3026)

  • +
  • Fix AsyncWeb3.solidity_keccak to match Web3.solidity_keccak. (#3034)

  • +
+
+
+

Improved Documentation

+
    +
  • Replaced transaction examples with unused account addresses. (#2011)

  • +
  • Removed obsolete docs for camelCase miner methods and deploy (#2039)

  • +
  • Update documentation relating to ENS only being available on mainnet. ENS is available on all networks where the ENS contracts are deployed. (#3012)

  • +
  • Add first steps section and tidy up learning resources (#3013)

  • +
  • Replace references to jasoncarver.eth with ens.eth. (#3020)

  • +
  • Adds "Hackathon Helpers" section to Resources page (#3035)

  • +
+
+
+

Features

+
    +
  • Update ENS Resolver ABI (#1839)

  • +
  • async_http_retry_request_middleware, an async http request retry middleware for AsyncHTTPProvider. (#3009)

  • +
  • Add eth_getStorageAt() support for EthereumTesterProvider. (#3011)

  • +
  • Add async support for ENS name-to-address resolution via async_name_to_address_middleware. (#3012)

  • +
  • Add async support for the sign-and-send raw transaction middleware via construct_async_sign_and_send_raw_middleware(). (#3025)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Remove some warnings from test output (#2991)

  • +
  • Introduced the logic for ENSIP-15 ENS name normalization. Originally this was done via a flag in this PR but changed to the default behavior in #3024 before release. (#3000)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+

Removals

+
    +
  • Removed references to deprecated middlewares with new tests to check default middlewares (#2972)

  • +
+
+
+
+

web3.py v6.5.0 (2023-06-15)

+
+

Bugfixes

+
    +
  • Properly create a fresh cache for each instance of simple_cache_middleware if no cache is provided. Fixes a bug when using this middleware with multiple instances of Web3. (#2979)

  • +
  • Fix potential race condition when writing cache entries in simple_cache_middleware (#2981)

  • +
  • Catch UnicodeDecodeError for contract revert messages that cannot be decoded and issue a warning instead, raising a ContractLogicError with the raw data from the response. (#2989)

  • +
+
+
+

Improved Documentation

+
    +
  • Introduces resources page to documentation (#2957)

  • +
  • Completed docstrings for ContractFunction and AsyncContractFunction classes (#2960)

  • +
  • Added 'unsupported by any current clients' note to the Eth.sign_typed_data docs (#2961)

  • +
  • Removed list of AsyncHTTPProvider-supported methods, it supports them all now (#2962)

  • +
  • Modernize the filtering guide, emphasizing get_logs (#2968)

  • +
  • Removed references to defunct providers in IPCProvider docs (#2971)

  • +
  • Update Matomo analytics script to move to cloud services (#2978)

  • +
+
+
+

Features

+
    +
  • Add the sign_typed_data method to the AsyncEth class (#2920)

  • +
  • Add support for Solidity Panic errors, available since Solidity 0.8.0. Raises ContractPanicError with appropriate messaging based on the known panic error codes. (#2986)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • lint-roll - dropped isort --recursive flag, not needed as of their v5, added black (#2930)

  • +
  • Moved ethpm deprecation warning to only show when the module is explicitly enabled (#2983)

  • +
  • Update make release to check remote upstream is pointing to ethereum/web3.py. (#2988)

  • +
  • Removed pluggy from dev requirements (#2992)

  • +
+
+
+

Miscellaneous Changes

+ +
+
+
+

web3.py v6.4.0 (2023-05-15)

+
+

Bugfixes

+
    +
  • fix AttributeDicts unhashable if they contain lists recursively tupleizing them (#2908)

  • +
+
+
+

Deprecations

+
    +
  • add deprecation notice for the ethPM module (#2953)

  • +
+
+
+

Improved Documentation

+
    +
  • remove reference to the ability to specify a list of providers - you can't anymore (#2949)

  • +
  • add deprecation notice for the ethPM module (#2953)

  • +
+
+
+

Features

+
    +
  • Update eth-tester to pull in Shanghai changes and make additional changes to fully support Shanghai with eth-tester. (#2958)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • bump sphinx and readthedocs py versions (#2945)

  • +
  • re-compile test contracts with Solidity v0.8.20 (#2951)

  • +
  • Set towncrier settings in pyproject.toml to match the python project template and change newfragment type "doc" to "docs" (#2959)

  • +
+
+
+
+

v6.3.0 (2023-05-03)

+
+

Features

+
    +
  • Add support for custom revert errors (#2795)

  • +
  • Add the modify_transaction method to the AsyncEth class (#2825)

  • +
  • add show_traceback flag to is_connected to allow user to see connection error reason (#2912)

  • +
  • Add a data attribute on the ContractLogicError class that returns raw data returned by the node. (#2922)

  • +
  • Add support via result formatters for reward type trace actions on tracing calls. (#2929)

  • +
+
+
+

Bugfixes

+
    +
  • Typing was being ignored for the get_ipc_path and get_dev_ipc_path functions because of a missing None return. Those two methods now explicitly return None and have an Optional in their type definition. (#2917)

  • +
  • fix AsyncEventFilterBuilder looking for Web3 instead of AsyncWeb3 (#2931)

  • +
  • Add check for null withdrawal field on get_block response (#2941)

  • +
+
+
+

Improved Documentation

+
    +
  • Add a decision tree guide for sending transactions (#2919)

  • +
  • Update references to master branch (#2933)

  • +
  • Cleanup Quickstart guide and next steps (#2935)

  • +
  • Cleanup Overview page links and context (#2938)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Added build to towncrier commands in Makefile (#2915)

  • +
  • Update win wheel CI builds to use python -m tox -r instead of specifying the tox executable directly. (#2923)

  • +
  • update pip and tox install on CI containers (#2927)

  • +
+
+
+
+

v6.2.0 (2023-04-12)

+
+

Features

+
    +
  • Adds async version of eth_getUncleCount methods (#2822)

  • +
  • Add the sign_transaction method to the AsyncEth class (#2827)

  • +
  • Add the replace_transaction method to the AsyncEth class (#2847)

  • +
+
+
+

Bugfixes

+
    +
  • Use TraceFilterParams instead of FilterParams for trace_filter typing (#2913)

  • +
+
+
+

Improved Documentation

+
    +
  • Add welcome banner for Ethereum newcomers (#2905)

  • +
  • Added breaking changes from pr2448 to v6 migration guide (#2907)

  • +
+
+
+
+

v6.1.0 (2023-04-05)

+
+

Features

+
    +
  • Add tracing functionality back in via the tracing module, add formatters for human-readable input and output, and attach this module to Web3 on init / make it a default module. (#2851)

  • +
  • Add result formatters for withdrawals_root and withdrawals as part of Shanghai hard fork support. (#2868)

  • +
  • add eth_chainId to exception_retry_middleware whitelist (#2892)

  • +
+
+
+

Bugfixes

+
    +
  • Mark test_async_eth_sign with @pytest.mark.asyncio (#2858)

  • +
  • fix readthedocs broken version selector (#2883)

  • +
+
+
+

Improved Documentation

+
    +
  • remove camelCased method deprecation notices from web3.eth docs (#2882)

  • +
  • Add doc blurb about multiple HTTPProviders with the same URL (#2889)

  • +
  • fix styling and external link formatting (#2897)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Bump pytest from 6.2.5 to 7+ because of CI DeprecationWarning (#2863)

  • +
  • Require eth-abi v4 stable (#2886)

  • +
  • remove unused docs dependencies and bump version of remaining (#2890)

  • +
  • Update go-ethereum integration test fixture to use the latest version of geth - v1.11.5. (#2896)

  • +
  • Update geth_steps in CircleCI builds to pip install the proper version of py-geth. (#2898)

  • +
  • Update CircleCI windows orb path since it now uses python 3.11. (#2899)

  • +
  • Bump go version used in CI jobs that install and run go-ethereum and parameterize the version in circleci config file for ease of configuration. (#2900)

  • +
+
+
+

Miscellaneous changes

+ +
+
+
+

v6.0.0 (2023-03-14)

+
+

Bugfixes

+
    +
  • fix dict_to_namedtuple unable to handle empty dict as input (#2867)

  • +
+
+
+
+

v6.0.0-beta.11 (2023-02-24)

+
+

Features

+
    +
  • Add the sign method to the AsyncEth class (#2833)

  • +
+
+
+

Bugfixes

+
    +
  • More accurately define the eth_call return type as HexBytes since the +response is converted to HexBytes in the pythonic formatters and there +are differences between HexBytes and bytes types. (#2842)

  • +
  • Set default block_identifier in ContractFunction.call() to None (#2846)

  • +
+
+
+

Improved Documentation

+
    +
  • Remove unused module lines to instantiate the AsyncHTTPProvider (#2789)

  • +
  • Typos fix in docs (#2817)

  • +
  • Add/cleanup docs for the AsyncHTTPProvider in light of the new +AsyncWeb3 class (#2821)

  • +
  • Remove user survey banner following close of survey (#2831)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Do not invoke setup.py directly; use python -m build where +appropriate. (#2714)

  • +
  • clean up ignored unused imports (#2838)

  • +
  • Recompile test contracts with the new Solidity version 0.8.19. (#2840)

  • +
  • Update py-geth version and re-generate integration test fixture with geth +v1.11.2. (#2841)

  • +
+
+
+

Breaking changes

+
    +
  • Use AsyncWeb3 class and preserve typing for the async api calls. (#2819)

  • +
  • Fix typing for CallOverrideParams and add proper request formatters for +call state overrides. (#2843)

  • +
  • Remove python warning and doc notes related to unstable async providers. +(#2845)

  • +
+
+
+
+

v6.0.0-beta.10 (2023-02-15)

+
+

Features

+
    +
  • add decode_tuples option to contract instantiation (#2799)

  • +
+
+
+

Bugfixes

+
    +
  • Fix ethpm import issues after making ipfshttpclient optional. (#2775)

  • +
  • Fix for recently-broken eth-tester exception message parsing for some +exception cases. (#2783)

  • +
+
+
+

Improved Documentation

+
    +
  • Added a v6 Migraion Guide (#2778)

  • +
  • Rebrand the library to lowercase "web3.py" (#2804)

  • +
  • remove references to Rinkeby or replace with Goerli (#2815)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Organize the eth module into separate files for better readability. +(#2753)

  • +
  • Rename the newly-split eth module files to match convention. (#2772)

  • +
  • Re-compile all test contracts with latest Solidity version. Refactor test +fixtures. Adds a script that compiles all test contracts to the same +directory with selected Solidity version. (#2797)

  • +
  • Updates to isort and black required some formatting changes and isort +config refactoring. (#2802)

  • +
  • Compile test contracts using newly-released Solidity version 0.8.18. +(#2803)

  • +
+
+
+

Breaking changes

+
    +
  • All exceptions inherit from a custom class. EthPM exceptions inherit from +EthPMException, ENS exceptions inherit from ENSException, and all other +web3.py exceptions inherit from Web3Exception (#1478)

  • +
  • Reorganized contract to contract.py, async_contract.py, base_contract.py and +utils.py. In this change there was a small breaking change where the +constructor of BaseContractCaller contract_function_class was defaulting to a +ContractFunction now there is no default. This was done to separate the base +class from the implementation. (#2567)

  • +
  • When calling a contract, use w3.eth.default_block if no block_identifier +is specified instead of latest. (#2777)

  • +
  • Strict bytes type checking is now default for web3.py. This change also +adds a boolean flag on the Web3 class for turning this feature on and +off, as well as a flag on the ENS class for control over a standalone +ENS instance. (#2788)

  • +
  • When a method is not supported by a node provider, raise a MethodUnavailable +error instead of the generic ValueError. (#2796)

  • +
  • dict to AttributeDict conversion is no longer a default result +formatter. This conversion is now done via a default middleware that may be +removed. (#2805)

  • +
  • Removed deprecated manager.request_async and associated methods. (#2810)

  • +
  • removed Rinkeby from list of allowed chains in EthPM (#2815)

  • +
+
+
+
+

v6.0.0-beta.9 (2023-01-03)

+
+

Features

+
    +
  • Add async w3.eth.get_block_transaction_count (#2687)

  • +
  • Support Python 3.11 (#2699)

  • +
  • Load the AsyncHTTPProvider with default async middleware and default +async modules, just as the HTTPProvider. (#2736)

  • +
  • Add support for Nethermind/Gnosis revert reason formatting (#2739)

  • +
  • Added async functionality to filter (#2744)

  • +
  • Get contract address from CREATE and CREATE2 opcodes (#2762)

  • +
+
+
+

Bugfixes

+
    +
  • Fixing abi encoding for multidimensional arrays. (#2764)

  • +
+
+
+

Performance improvements

+
    +
  • Some minor performance improvements to the SimpleCache class and simple +cache middlewares (sync and async). (#2719)

  • +
  • Remove unnecessary await for generate_gas_price() method as it does +not need to be awaited. Move this method to BaseEth to be used directly +by both Eth and AsyncEth modules. (#2735)

  • +
+
+
+

Improved Documentation

+
    +
  • Add user survey to docs banner (#2720)

  • +
  • Document improvements for private key info and account funding. (#2722)

  • +
  • Include eth-tester install note in quickstart (#2755)

  • +
+
+
+

Deprecations and Removals

+
    +
  • Removal of Infura auto provider support. (#2706)

  • +
  • Removal of version module. (#2729)

  • +
  • Remove already-deprecated start_rpc and stop_rpc from the +w3.geth.admin module. (#2731)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Use regex pattern for black command for tox / make lint linting +commands. (#2727)

  • +
  • Use regex pattern for mypy command for tox / make lint linting +commands. (#2734)

  • +
  • Remove internal method apply_formatter_to_array and use the method with +the same name from the eth-utils library. (#2737)

  • +
+
+
+

Miscellaneous changes

+ +
+
+

Breaking changes

+
    +
  • Snakecase the processReceipt, processLog, createFilter, and getLogs methods +(#2709)

  • +
  • Remove Parity module and references. (#2718)

  • +
  • Make the ipfshttpclient library opt-in via a web3 install extra. This +only affects the ethpm ipfs backends, which rely on the library. +(#2730)

  • +
+
+
+
+

v6.0.0-beta.8 (2022-11-14)

+
+

Features

+
    +
  • Async support for caching certain methods via +async_simple_cache_middleware as well as constructing custom async +caching middleware via async_construct_simple_cache_middleware. +SimpleCache class was also added to the public utils module. (#2579)

  • +
  • Remove upper pins on dependencies (#2648)

  • +
  • Async support for beacon api. (#2689)

  • +
  • If the loop for a cached async session is closed, or the session itself was +closed, create a new session at that cache key and properly close and evict +the stale session. (#2713)

  • +
+
+
+

Bugfixes

+
    +
  • bump sphinx_rtd_theme version to fix missing unordered list bullets (#2688)

  • +
  • Fix bug to generate unique cache keys when multi-threading & with unique +event loops for async. (#2690)

  • +
  • Properly release async_lock for session requests if an exception is +raised during a task. (#2695)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • move definition of RTD install requirements file from their dashboard into +.readthedocs.yml, and remove unused sphinx-better-theme from requirements +(#2688)

  • +
+
+
+

Miscellaneous changes

+ +
+
+

Breaking changes

+
    +
  • Remove support for dictionary-based caches, for simple-cache-middleware, in +favor of the internal SimpleCache class. (#2579)

  • +
  • Snakecase the clientVersion method (#2686)

  • +
  • change instances of createFilter to create_filter (#2692)

  • +
  • Remove SolidityError in favor of ContractLogicError (#2697)

  • +
  • Snakecase the solidityKeccak method (#2702)

  • +
  • Snakecase the fromWeb3 method (#2703)

  • +
  • Snakecase the toBytes, toHex, toInt, toJSON, and toText methods (#2707)

  • +
  • Snakecase the toAddress, isChecksumAddress, and toChecksumAddress methods +(#2708)

  • +
+
+
+
+

v6.0.0-beta.7 (2022-10-19)

+
+

Bugfixes

+ +
+
+

Improved Documentation

+
    +
  • Added Chainstack link to quickstart docs. (#2677)

  • +
+
+
+

Deprecations and Removals

+
    +
  • Remove Ropsten auto provider and the relevant references to Ropsten across +the repo (#2672)

  • +
+
+
+

Internal Changes - for web3.py Contributors

+
    +
  • Clean up remaining uses of deprecated eth_abi methods. (#2668)

  • +
+
+
+

Miscellaneous changes

+ +
+
+
+

v6.0.0-beta.6 (2022-09-26)

+
+

Bugfixes

+
    +
  • Protobuf dependency breaks at version 3.20.2 and above; pin to 3.20.1 +for now. (#2657)

  • +
+
+
+

Features

+
    +
  • Add new predefined block identifiers safe and finalized. (#2652)

  • +
+
+
+
+

v6.0.0-beta.5 (2022-09-19)

+
+

Breaking Changes

+
    +
  • Removed IBAN since it was an unused feature (#2537)

  • +
  • Update eth-tester dependency to v0.7.0-beta.1; Update eth-account version to +>=0.7.0,<0.8.0 (#2623)

  • +
  • Remove WEB3_INFURA_API_KEY environment variable in favor of +WEB3_INFURA_PROJECT_ID. Change InfuraKeyNotFound exception to +InfuraProjectIdNotFound (#2634)

  • +
  • Remove Kovan auto provider (#2635)

  • +
  • Snakecase the isConnected method (#2643)

  • +
  • Snakecase the toWei and fromWei methods (#2647)

  • +
+
+
+

Bugfixes

+
    +
  • Fix eth-tester key remapping for logsBloom and receiptsRoot +(#1630)

  • +
  • Improve upon issues with session caching - better support for multithreading +and make sure session eviction from cache does not happen prematurely. +(#2409)

  • +
  • Allow classes to inherit from the Web3 class by attaching modules +appropriately. (#2592)

  • +
  • fixed bug in how async_eth_tester_middleware fills default fields (#2600)

  • +
  • Allow hex for value field when validating via validate_payable() +contracts method (#2602)

  • +
  • Update Beacon API to v2.3.0 (#2616)

  • +
  • Move flaky option to top-level conftest.py (#2642)

  • +
+
+
+

Documentation Updates

+
    +
  • Update Proof of Authority middleware (geth_poa_middleware) documentation +for better clarity. (#2538)

  • +
  • Add some missing supported async middlewares to docs. (#2574)

  • +
  • Introduce AsyncENS and availability on w3 instance in ENS guide. (#2585)

  • +
  • Fix typo in eth.call docs (#2613)

  • +
  • remove section for deleted account.recoverHash method (#2615)

  • +
  • examples docs gave incorrect return type for eth.get_transaction, fixed +(#2617)

  • +
  • minor typo fix in contracts overview (#2628)

  • +
  • fix bug in Deploying new contracts example (#2646)

  • +
+
+
+

Features

+
    +
  • Support for Account class access in AsyncEth via +async_w3.eth.account (#2580)

  • +
  • Expose public abi utility methods: get_abi_output_names() and +get_abi_input_names() (#2596)

  • +
  • update all references to deprecated eth_abi.encode_abi to eth_abi.encode +(#2621)

  • +
  • update all references to deprecated eth_abi.decode_abi to eth_abi.decode +(#2636)

  • +
  • Add Sepolia auto provider (#2639)

  • +
+
+
+

Misc

+ +
+
+
+

v6.0.0-beta.4 (2022-07-13)

+
+

Breaking Changes

+
    +
  • sha3 and soliditySha3 were previously deprecated and now removed (#2479)

  • +
  • Remove deprecated methods from Geth, Parity and Net modules (#2480)

  • +
  • Provide better messaging to wrong arguments for contract functions, +especially for tuple argument types. (#2556)

  • +
+
+
+

Bugfixes

+
    +
  • Properly format block_number for eth_getTransactionCount when using +EthereumTesterProvider (#1801)

  • +
  • removed Optional type hints for passphrase arguments that aren't actually +optional (#2511)

  • +
  • Fix is_dynamic_fee_transaction and TRANSACTION_DEFAULTS when +gas_price_strategy returns zero (#2562)

  • +
+
+
+

Documentation Updates

+
    +
  • Remove deprecated methods from Geth, Parity, and Net modules (#2480)

  • +
  • replace double- with single-quotes to make f-string valid (#2504)

  • +
  • added geth personal_sign and personal_ec_recover documentation (#2511)

  • +
+
+
+

Features

+
    +
  • Add transaction result formatters for type and chainId to convert values +to int if hexadecimal if the field is not null (#2491)

  • +
  • Add a global flag on the provider for enabling / disabling CCIP Read for +calls: global_ccip_read_enabled (defaults to True). (#2499)

  • +
  • Deprecate Geth Admin StartRPC and StopRPC for StartHTTP and StopHTTP (#2507)

  • +
  • Added Async support for ENS (#2547)

  • +
  • support multi-dimensional arrays for ABI tuples types (#2555)

  • +
+
+
+

Misc

+ +
+
+
+

v6.0.0-beta.3 (2022-06-01)

+
+

Breaking Changes

+
    +
  • Removed deprecated methods from eth and geth (#1416)

  • +
+
+
+

Bugfixes

+
    +
  • Fix bug in _is_latest_block_number_request in cache middleware (#2185)

  • +
  • Increase cache size to allow for 20 entries. (#2477)

  • +
  • format receipt.type to int and log.data to HexBytes (#2482)

  • +
  • Only thread lock for methods attempting to access the cache for caching +middleware. (#2496)

  • +
+
+
+

Documentation Updates

+
    +
  • Fix typo in simple_cache_middleware example (#2449)

  • +
  • Fix dict type hints in EventScanner example (#2469)

  • +
  • Add clarification around ValueError and Local Signing middleware (#2474)

  • +
+
+
+

Features

+
    +
  • Add async version of contract functionality (#2270)

  • +
  • ENSIP-10 / wildcard resolution support for ENS module (#2411)

  • +
  • CCIP Read support and finalize implementation of and add tests for ENS +offchain resolution support (#2457)

  • +
+
+
+

Misc

+ +
+
+
+

v6.0.0-beta.2 (2022-04-27)

+
+

Breaking Changes

+
    +
  • Audit .rst and .py files and convert all Web3 instance variable names +to w3 to avoid confusion with the web3 module. (#1183)

  • +
  • Update dependency requirements: - eth-utils - eth-abi - eth-tester - +eth-account - eth-typing (#2342)

  • +
  • Add attach_methods() to Module class to facilitate attaching methods +to modules. (#2383)

  • +
  • Move IOError -> OSError (#2434)

  • +
+
+
+

Documentation Updates

+
    +
  • Clarify info about Infura filters over HTTP (#2322)

  • +
  • Document reading private keys from environment variables (#2380)

  • +
  • Add example for the construct_sign_and_send_raw_middleware when connected +to a hosted node (#2410)

  • +
  • Doc fix: Pending transaction filter returns a TransactionFilter not a +BlockFilter (#2444)

  • +
+
+
+

Features

+
    +
  • Add 'get_text' method to look up ENS text record values (#2286)

  • +
  • For ENS.name(), validate that the forward resolution returns the same +address as provided by the user as per the ENS documentation recommendation +for Reverse Resolution. (#2420)

  • +
  • Add sync chain_id to simple_middleware_cache (#2425)

  • +
+
+
+

Misc

+ +
+
+
+

v6.0.0-beta.1 (2022-02-28)

+
+

Breaking Changes

+
    +
  • Update websockets dependency to v10+ (#2324)

  • +
  • Remove support for the unsupported Python 3.6 Also removes outdated Parity +tests (#2343)

  • +
  • Update Sphinx requirement to >=4.2.0,<5 (#2362)

  • +
+
+
+

Bugfixes

+
    +
  • Fix types for gas, and gasLimit: Wei -> int. Also fix types for +effectiveGasPrice: (int -> Wei) (#2330)

  • +
+
+
+

Features

+
    +
  • Added session caching to the AsyncHTTPProvider (#2016)

  • +
  • Add support for Python 3.10 (#2175)

  • +
  • Added 'Breaking Changes' and 'Deprecations' categories to our release notes +(#2340)

  • +
  • Add async eth.get_storage_at method (#2350)

  • +
  • Upgrade jsonschema version to >=4.0.0<5 (#2361)

  • +
+
+
+

Misc

+ +
+
+
+

v5.28.0 (2022-02-09)

+
+

Features

+
    +
  • Added Async functions for Geth Personal and Admin modules (#1413)

  • +
  • async support for formatting, validation, and geth poa middlewares (#2098)

  • +
  • Calculate a default maxPriorityFeePerGas using eth_feeHistory when +eth_maxPriorityFeePerGas is not available, since the latter is not a part +of the Ethereum JSON-RPC specs and only supported by certain clients. (#2259)

  • +
  • Allow NamedTuples in ABI inputs (#2312)

  • +
  • Add async eth.syncing method (#2331)

  • +
+
+
+

Bugfixes

+
    +
  • remove ens.utils.dict_copy decorator (#1423)

  • +
  • The exception retry middleware whitelist was missing a comma between +txpool and testing (#2327)

  • +
  • Properly initialize external modules that do not inherit from the +web3.module.Module class (#2328)

  • +
+
+
+
+

v5.27.0 (2022-01-31)

+
+

Features

+
    +
  • Added Async functions for Geth TxPool (#1413)

  • +
  • external modules are no longer required to inherit from the +web3.module.Module class (#2304)

  • +
  • Add async eth.get_logs method (#2310)

  • +
  • add Async access to default_account and default_block (#2315)

  • +
  • Update eth-tester and eth-account dependencies to pull in bugfix from +eth-keys (#2320)

  • +
+
+
+

Bugfixes

+
    +
  • Fixed issues with parsing tuples and nested tuples in event logs (#2211)

  • +
  • In ENS the contract function to resolve an ENS address was being called twice +in error. One of those calls was removed. (#2318)

  • +
  • to_hexbytes block formatters no longer throw when value is None +(#2321)

  • +
+
+
+

Improved Documentation

+
    +
  • fix typo in eth.account docs (#2111)

  • +
  • explicitly add output_values to contracts example (#2293)

  • +
  • update imports for AsyncHTTPProvider sample code (#2302)

  • +
  • fixed broken link to filter schema (#2303)

  • +
  • add github link to the main docs landing page (#2313)

  • +
  • fix typos and update referenced geth version (#2326)

  • +
+
+
+

Misc

+ +
+
+
+

v5.26.0 (2022-01-06)

+
+

Features

+
    +
  • Add middlewares property to NamedElementOnion / +web3.middleware_onion. Returns current middlewares in proper order for +importing into a new Web3 instance (#2239)

  • +
  • Add async eth.hashrate method (#2243)

  • +
  • Add async eth.chain_id method (#2251)

  • +
  • Add async eth.mining method (#2252)

  • +
  • Add async eth.get_transaction_receipt and +eth.wait_for_transaction_receipt methods (#2265)

  • +
  • Add async eth.accounts method (#2284)

  • +
  • Support for attaching external modules to the Web3 instance when +instantiating the Web3 instance, via the external_modules argument, +or via the new attach_modules() method (#2288)

  • +
+
+
+

Bugfixes

+
    +
  • Fixed doctest that wasn't running in docs/contracts.rst (#2213)

  • +
  • Key mapping fix to eth-tester middleware for access list storage keys (#2224)

  • +
  • Inherit Web3 instance middlewares when instantiating ENS with +ENS.fromWeb3() method (#2239)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix example docs to show a TransactionNotFound error, instead of None (#2199)

  • +
  • fix typo in ethpm.rst (#2277)

  • +
  • Clarify provider usage in Quickstart docs (#2287)

  • +
  • Address common BSC usage question (#2289)

  • +
+
+
+

Misc

+ +
+
+
+

v5.25.0 (2021-11-19)

+
+

Features

+
    +
  • Support for w3.eth.get_raw_transaction_by_block, and async support for +w3.eth.get_raw_transaction_by_block (#2209)

  • +
+
+
+

Bugfixes

+
    +
  • BadResponseFormat error thrown instead of KeyError when a response gets sent +back without a result key. (#2188)

  • +
+
+
+

Improved Documentation

+
    +
  • Correct link to Websocket library documentation (#2173)

  • +
  • Doc update to make it clearer that enable_unstable_package_management() +method is on the web3 instance (#2208)

  • +
+
+
+

Misc

+ +
+
+
+

v5.24.0 (2021-09-27)

+
+

Features

+
    +
  • Add async eth.send_raw_transaction method (#2135)

  • +
  • Updated eth-account version to v0.5.6 - adds support for signing typed +transactions without needing to explicitly set the transaction type and now +accepts correct JSON-RPC structure for accessList for typed transactions +(#2157)

  • +
+
+
+

Bugfixes

+
    +
  • Encode block_count as hex before making eth_feeHistory RPC call (#2117)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix typo in AsyncHTTPProvider docs (#2131)

  • +
  • Update AsyncHTTPProvider doc Supported Methods to include +web3.eth.send_raw_transaction(). (#2135)

  • +
  • Improve messaging around usage and implementation questions, directing users +to the appropriate channel (#2138)

  • +
  • Clarify some contract ValueError error messages. (#2146)

  • +
  • Updated docs for w3.eth.account.sign_transaction to reflect that transaction +type is no longer needed to successfully sign typed transactions and to +illustrate how to structure an optional accessList parameter in a typed +transaction (#2157)

  • +
+
+
+

Misc

+ +
+
+
+

v5.23.1 (2021-08-27)

+
+

Features

+
    +
  • Add constants for the zero address, zero hash, max int, and wei per ether. (#2109)

  • +
+
+
+

Improved Documentation

+
    +
  • Renamed "1559 transaction" to "dynamic fee transaction" where appropriate to keep consistency among the general code base for 1559 transaction (type=2) naming (#2118)

  • +
  • Update AsyncHTTPProvider doc example to include modules and middlewares keyword arguments (#2123)

  • +
+
+
+

Misc

+ +
+
+
+

v5.23.0 (2021-08-12)

+
+

Features

+
    +
  • Add support for eth_feeHistory RPC method (#2038)

  • +
  • Add support for eth_maxPriorityFeePerGas RPC method (#2100)

  • +
+
+
+

Bugfixes

+
    +
  • Hot fix for string interpolation issue with contract function call decoding exception to facilitate extracting a meaningful message from the eth_call response (#2096)

  • +
  • Bypass adding a gasPrice via the gas price strategy, if one is set, when EIP-1559 transaction params are used for send_transaction (#2099)

  • +
+
+
+

Improved Documentation

+
    +
  • Update feeHistory docs (#2104)

  • +
+
+
+
+

v5.22.0 (2021-08-02)

+
+

Features

+
    +
  • Add support for eth_getRawTransactionByHash RPC method (#2039)

  • +
  • Add AsyncNet module (#2044)

  • +
  • Add async eth.get_balance, eth.get_code, eth.get_transaction_count methods. (#2056)

  • +
  • eth_signTransaction support for eip-1559 params 'maxFeePerGas' and 'maxPriorityFeePerGas' (#2082)

  • +
  • Add support for async w3.eth.call. (#2083)

  • +
+
+
+

Bugfixes

+
    +
  • If a transaction hash was passed as a string rather than a HexByte to w3.eth.wait_for_transaction_receipt, and the time was exhausted before the transaction is in the chain, the error being raised was a TypeError instead of the correct TimeExhausted error. This is because the to_hex method in the TimeExhausted error message expects a primitive as the first argument, and a string doesn't qualify as a primitive. Fixed by converting the transaction_hash to HexBytes instead. (#2068)

  • +
  • Hot fix for a string interpolation issue in message when BadFunctionCallOutput is raised for call_contract_function() (#2069)

  • +
  • fill_transaction_defaults() no longer sets a default gasPrice if 1559 fees are present in the transaction parameters. This fixes sign-and-send middleware issues with 1559 fees. (#2092)

  • +
+
+
+

Improved Documentation

+
    +
  • Clarify that send_transaction, modify_transaction, and replace_transaction return HexByte objects instead of strings. (#2058)

  • +
  • Added troubleshooting section for Microsoft Visual C++ error on Windows machines (#2077)

  • +
  • Updated the sign-and-send middleware docs to include EIP-1559 as well as legacy transaction examples (#2092)

  • +
+
+
+

Misc

+ +
+
+
+

v5.21.0 (2021-07-12)

+
+

Features

+
    +
  • Adds support for EIP 1559 transaction keys: maxFeePerGas and maxPriorityFeePerGas (#2060)

  • +
+
+
+

Bugfixes

+
    +
  • Bugfix where an error response got passed to a function expecting a block identifier.

    +

    Split out null result formatters from the error formatters and added some tests. (#2022)

    +
  • +
  • Fix broken tests and use the new 1559 params for most of our test transactions. (#2053)

  • +
  • Set a default maxFeePerGas value consistent with Geth (#2055)

  • +
  • Fix bug in geth PoA middleware where a None response should throw a BlockNotFound error, but was instead throwing an AttributeError (#2064)

  • +
+
+
+

Improved Documentation

+
    +
  • Added general documentation on unit and integration testing and how to contribute to our test suite. (#2053)

  • +
+
+
+
+

v5.20.1 (2021-07-01)

+
+

Bugfixes

+
    +
  • Have the geth dev IPC auto connection check for the WEB3_PROVIDER_URI environment variable. (#2023)

  • +
+
+
+

Improved Documentation

+
    +
  • Remove reference to allowing multiple providers in docs (#2018)

  • +
  • Update "Contract Deployment Example" docs to use py-solc-x as solc is no longer maintained. (#2020)

  • +
  • Detail using unreleased Geth builds in CI (#2037)

  • +
  • Clarify that a missing trie node error could occur when using block_identifier with .call() +on a node that isn't running in archive mode (#2048)

  • +
+
+
+

Misc

+ +
+
+
+

v5.20.0 (2021-06-09)

+
+

Features

+
    +
  • Add new AsyncHTTPProvider. No middleware or session caching support yet.

    +

    Also adds async w3.eth.gas_price, and async w3.isConnected() methods. (#1978)

    +
  • +
  • Add ability for AsyncHTTPProvider to accept middleware

    +

    Also adds async gas_price_strategy middleware, and moves gas estimate to middleware.

    +

    AsyncEthereumTesterProvider now inherits from AsyncBase (#1999)

    +
  • +
  • Support state_override in contract function call. (#2005)

  • +
+
+
+

Bugfixes

+
    +
  • Test ethpm caching + bump Sphinx version. (#1977)

  • +
+
+
+

Improved Documentation

+
    +
  • Clarify solidityKeccak documentation. (#1971)

  • +
  • Improve contributor documentation context and ordering. (#2008)

  • +
  • Add docs for unstable AsyncHTTPProvider (#2017)

  • +
+
+
+

Misc

+ +
+
+
+

v5.19.0 (2021-04-28)

+
+

Features

+
    +
  • Handle optional eth_call state override param. (#1921)

  • +
  • Add list_storage_keys deprecate listStorageKeys (#1944)

  • +
  • Add net_peers deprecate netPeers (#1946)

  • +
  • Add trace_replay_transaction deprecate traceReplayTransaction (#1949)

  • +
  • Add add_reserved_peer deprecate addReservedPeer (#1951)

  • +
  • Add parity.set_mode, deprecate parity.setMode (#1954)

  • +
  • Add parity.trace_raw_transaction, deprecate parity.traceRawTransaction (#1955)

  • +
  • Add parity.trace_call, deprecate parity.traceCall (#1957)

  • +
  • Add trace_filter deprecate traceFilter (#1960)

  • +
  • Add trace_block, deprecate traceBlock (#1961)

  • +
  • Add trace_replay_block_transactions, deprecate traceReplayBlockTransactions (#1962)

  • +
  • Add parity.trace_transaction, deprecate parity.traceTransaction (#1963)

  • +
+
+
+

Improved Documentation

+
    +
  • Document eth_call state overrides. (#1965)

  • +
+
+
+

Misc

+ +
+
+
+

v5.18.0 (2021-04-08)

+
+

Features

+
    +
  • Add w3.eth.modify_transaction deprecate w3.eth.modifyTransaction (#1886)

  • +
  • Add w3.eth.get_transaction_receipt, deprecate w3.eth.getTransactionReceipt (#1893)

  • +
  • Add w3.eth.wait_for_transaction_receipt deprecate w3.eth.waitForTransactionReceipt (#1896)

  • +
  • Add w3.eth.set_contract_factory deprecate w3.eth.setContractFactory (#1900)

  • +
  • Add w3.eth.generate_gas_price deprecate w3.eth.generateGasPrice (#1905)

  • +
  • Add w3.eth.set_gas_price_strategy deprecate w3.eth.setGasPriceStrategy (#1906)

  • +
  • Add w3.eth.estimate_gas deprecate w3.eth.estimateGas (#1913)

  • +
  • Add w3.eth.sign_typed_data deprecate w3.eth.signTypedData (#1915)

  • +
  • Add w3.eth.get_filter_changes deprecate w3.eth.getFilterChanges (#1916)

  • +
  • Add eth.get_filter_logs, deprecate eth.getFilterLogs (#1919)

  • +
  • Add eth.uninstall_filter, deprecate eth.uninstallFilter (#1920)

  • +
  • Add w3.eth.get_logs deprecate w3.eth.getLogs (#1925)

  • +
  • Add w3.eth.submit_hashrate deprecate w3.eth.submitHashrate (#1926)

  • +
  • Add w3.eth.submit_work deprecate w3.eth.submitWork (#1927)

  • +
  • Add w3.eth.get_work, deprecate w3.eth.getWork (#1934)

  • +
  • Adds public get_block_number method. (#1937)

  • +
+
+
+

Improved Documentation

+
    +
  • Add ABI type examples to docs (#1890)

  • +
  • Promote the new Ethereum Python Discord server on the README. (#1898)

  • +
  • Escape reserved characters in install script of Contributing docs. (#1909)

  • +
  • Add detailed event filtering examples. (#1910)

  • +
  • Add docs example for tuning log levels. (#1928)

  • +
  • Add some performance tips in troubleshooting docs. (#1929)

  • +
  • Add existing contract interaction to docs examples. (#1933)

  • +
  • Replace Gitter links with the Python Discord server. (#1936)

  • +
+
+
+

Misc

+ +
+
+
+

v5.17.0 (2021-02-24)

+
+

Features

+
    +
  • Added get_transaction_count, and deprecated getTransactionCount (#1844)

  • +
  • Add w3.eth.send_transaction, deprecate w3.eth.sendTransaction (#1878)

  • +
  • Add web3.eth.sign_transaction, deprecate web3.eth.signTransaction (#1879)

  • +
  • Add w3.eth.send_raw_transaction, deprecate w3.eth.sendRawTransaction (#1880)

  • +
  • Add w3.eth.replace_transaction deprecate w3.eth.replaceTransaction (#1882)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix return type of send_transaction in docs. (#686)

  • +
+
+
+
+

v5.16.0 (2021-02-04)

+
+

Features

+
    +
  • Added get_block_transaction_count, and deprecated getBlockTransactionCount (#1841)

  • +
  • Move defaultAccount to default_account. Deprecate defaultAccount. (#1848)

  • +
  • Add eth.default_block, deprecate eth.defaultBlock. +Also adds parity.default_block, and deprecates parity.defaultBlock. (#1849)

  • +
  • Add eth.gas_price, deprecate eth.gasPrice (#1850)

  • +
  • Added eth.block_number property. Deprecated eth.blockNumber (#1851)

  • +
  • Add eth.chain_id, deprecate eth.chainId (#1852)

  • +
  • Add eth.protocol_version, deprecate eth.protocolVersion (#1853)

  • +
  • Add eth.get_code, deprecate eth.getCode (#1856)

  • +
  • Deprecate eth.getProof, add eth.get_proof (#1857)

  • +
  • Add eth.get_transaction, deprecate eth.getTransaction (#1858)

  • +
  • Add eth.get_transaction_by_block, deprecate eth.getTransactionByBlock (#1859)

  • +
  • Add get_uncle_by_block, deprecate getUncleByBlock (#1862)

  • +
  • Add get_uncle_count, deprecate getUncleCount (#1863)

  • +
+
+
+

Bugfixes

+
    +
  • Fix event filter creation if the event ABI contains a values key. (#1807)

  • +
+
+
+

Improved Documentation

+
    +
  • Remove v5 breaking changes link from the top of the release notes. (#1837)

  • +
  • Add account creation troubleshooting docs. (#1855)

  • +
  • Document passing a struct into a contract function. (#1860)

  • +
  • Add instance configuration troubleshooting docs. (#1865)

  • +
  • Clarify nonce lookup in sendRawTransaction docs. (#1866)

  • +
  • Updated docs for web3.eth methods: eth.getTransactionReceipt and eth.waitForTransactionReceipt (#1868)

  • +
+
+
+
+

v5.15.0 (2021-01-15)

+
+

Features

+
    +
  • Add get_storage_at method and deprecate getStorageAt. (#1828)

  • +
  • Add eth.get_block method and deprecate eth.getBlock. (#1829)

  • +
+
+
+

Bugfixes

+
    +
  • PR #1585 changed the error that was coming back from eth-tester when the Revert opcode was called, +which broke some tests in downstream libraries. This PR reverts back to raising the original error. (#1813)

  • +
  • Added a new ContractLogicError for when a contract reverts a transaction. +ContractLogicError will replace SolidityError, in v6. (#1814)

  • +
+
+
+

Improved Documentation

+
    +
  • Introduce Beacon API documentation (#1836)

  • +
+
+
+

Misc

+ +
+
+
+

v5.14.0 (2021-01-05)

+
+

Bugfixes

+
    +
  • Remove docs/web3.* from the gitignore to allow for the beacon docs to be added to git, +and add beacon to the default web3 modules that get loaded. (#1824)

  • +
  • Remove auto-documenting from the Beacon API (#1825)

  • +
+
+
+

Features

+
    +
  • Introduce experimental Ethereum 2.0 beacon node API (#1758)

  • +
  • Add new get_balance method on Eth class. Deprecated getBalance. (#1806)

  • +
+
+
+

Misc

+ +
+
+
+

v5.13.1 (2020-12-03)

+
+

Bugfixes

+
    +
  • Handle revert reason parsing for Ganache (#1794)

  • +
+
+
+

Improved Documentation

+
    +
  • Document Geth and Parity/OpenEthereum fixture generation (#1787)

  • +
+
+
+

Misc

+ +
+
+
+

v5.13.0 (2020-10-29)

+
+

Features

+
    +
  • Raise SolidityError exceptions that contain the revert reason when a call fails. (#941)

  • +
+
+
+

Bugfixes

+
    +
  • Update eth-tester dependency to fix tester environment install version conflict. (#1782)

  • +
+
+
+

Misc

+ +
+
+
+

v5.12.3 (2020-10-21)

+
+

Misc

+ +
+
+
+

v5.12.2 (2020-10-12)

+
+

Bugfixes

+
    +
  • Address the use of multiple providers in the docs (#1701)

  • +
  • Remove stale connection errors from docs (#1737)

  • +
  • Allow ENS name resolution for methods that use the Method class (#1749)

  • +
+
+
+

Misc

+ +
+
+
+

v5.12.1 (2020-09-02)

+
+

Misc

+ +
+
+
+

v5.12.0 (2020-07-16)

+
+

Features

+
    +
  • Update web3.pm and ethpm module to EthPM v3 specification. (#1652)

  • +
  • Allow consumer to initialize HttpProvider with their own requests.Session. This allows the HttpAdapter connection pool to be tuned as desired. (#1469)

  • +
+
+
+

Improved Documentation

+
    +
  • Use ethpm v3 packages in examples documentation. (#1683)

  • +
  • Modernize the deploy contract example. (#1679)

  • +
  • Add contribution guidelines and a code of conduct. (#1691)

  • +
+
+
+

Misc

+ +
+
+
+

v5.12.0-beta.3 (2020-07-15)

+
+

Bugfixes

+
    +
  • Include ethpm-spec solidity examples in distribution. (#1686)

  • +
+
+
+
+

v5.12.0-beta.2 (2020-07-14)

+
+

Bugfixes

+
    +
  • Support ethpm-spec submodule in distributions. (#1682)

  • +
+
+
+

Improved Documentation

+
    +
  • Modernize the deploy contract example. (#1679)

  • +
  • Use ethpm v3 packages in examples documentation. (#1683)

  • +
+
+
+
+

v5.12.0-beta.1 (2020-07-09)

+
+

Features

+
    +
  • Allow consumer to initialize HttpProvider with their own requests.Session. This allows the HttpAdapter connection pool to be tuned as desired. (#1469)

  • +
  • Update web3.pm and ethpm module to EthPM v3 specification. (#1652)

  • +
+
+
+

Bugfixes

+
    +
  • Update outdated reference url in ethpm docs and tests. (#1680)

  • +
+
+
+

Improved Documentation

+
    +
  • Add a getBalance() example and provide more context for using the fromWei and toWei utility methods. (#1676)

  • +
  • Overhaul the Overview documentation to provide a tour of major features. (#1681)

  • +
+
+
+
+

v5.11.1 (2020-06-17)

+
+

Bugfixes

+
    +
  • Added formatter rules for eth_tester middleware to allow getBalance() by using integer block numbers (#1660)

  • +
  • Fix type annotations within the eth.py module. Several arguments that defaulted to None were not declared Optional. (#1668)

  • +
  • Fix type annotation warning when using string URI to instantiate an HTTP or WebsocketProvider. (#1669)

  • +
  • Fix type annotations within the web3 modules. Several arguments that defaulted to None were not declared Optional. (#1670)

  • +
+
+
+

Improved Documentation

+
    +
  • Breaks up links into three categories (Intro, Guides, and API) and adds content to the index page: a lib introduction and some "Getting Started" links. (#1671)

  • +
  • Fills in some gaps in the Quickstart guide and adds provider connection details for local nodes. (#1673)

  • +
+
+
+
+

v5.11.0 (2020-06-03)

+
+

Features

+
    +
  • Accept a block identifier in the Contract.estimateGas method. Includes a related upgrade of eth-tester to v0.5.0-beta.1. (#1639)

  • +
  • Introduce a more specific validation error, ExtraDataLengthError. This enables tools to detect when someone may be connected to a POA network, for example, and provide a smoother developer experience. (#1666)

  • +
+
+
+

Bugfixes

+
    +
  • Correct the type annotations of FilterParams.address (#1664)

  • +
+
+
+

Improved Documentation

+
    +
  • Corrects the return value of getTransactionReceipt, description of caching middleware, and deprecated method names. (#1663)

  • +
  • Corrects documentation of websocket timeout configuration. (#1665)

  • +
+
+
+
+

v5.10.0 (2020-05-18)

+
+

Features

+
    +
  • An update of eth-tester includes a change of the default fork from Constantinople to Muir Glacier. #1636

  • +
+
+
+

Bugfixes

+
    +
  • my_contract.events.MyEvent was incorrectly annotated so that MyEvent was marked as a ContractEvent instance. Fixed to be a class type, i.e., Type[ContractEvent]. (#1646)

  • +
  • IPCProvider correctly handled pathlib.Path input, but warned against its type. Fixed to permit Path objects in addition to strings. (#1647)

  • +
+
+
+

Misc

+ +
+
+
+

v5.9.0 (2020-04-30)

+
+

Features

+
    +
  • Upgrade eth-account to use v0.5.2+. eth-account 0.5.2 adds support for hd accounts

    +

    Also had to pin eth-keys to get dependencies to resolve. (#1622)

    +
  • +
+
+
+

Bugfixes

+
    +
  • Fix local_filter_middleware new entries bug (#1514)

  • +
  • ENS name and ENS address can return None. Fixes return types. (#1633)

  • +
+
+
+
+

v5.8.0 (2020-04-23)

+
+

Features

+
    +
  • Introduced list_wallets method to the GethPersonal class. (#1516)

  • +
  • Added block_identifier parameter to ContractConstructor.estimateGas method. (#1588)

  • +
  • Add snake_case methods to Geth and Parity Personal Modules.

    +

    Deprecate camelCase methods. (#1589)

    +
  • +
  • Added new weighted keyword argument to the time based gas price strategy.

    +

    If True, it will more give more weight to more recent block times. (#1614)

    +
  • +
  • Adds support for Solidity's new(ish) receive function.

    +

    Adds a new contract API that mirrors the existing fallback API: contract.receive (#1623)

    +
  • +
+
+
+

Bugfixes

+
    +
  • Fixed hasattr overloader method in the web3.ContractEvent, web3.ContractFunction, +and web3.ContractCaller classes by implementing a try/except handler +that returns False if an exception is raised in the __getattr__ overloader method +(since __getattr__ HAS to be called in every __hasattr__ call).

    +

    Created two new Exception classes, 'ABIEventFunctionNotFound' and 'ABIFunctionNotFound', +which inherit from both AttributeError and MismatchedABI, and replaced the MismatchedABI +raises in ContractEvent, ContractFunction, and ContractCaller with a raise to the created class +in the __getattr__ overloader method of the object. (#1594)

    +
  • +
  • Change return type of rpc_gas_price_strategy from int to Wei (#1612)

  • +
+
+
+

Improved Documentation

+
    +
  • Fix typo in "Internals" docs. Changed asyncronous --> asynchronous (#1607)

  • +
  • Improve documentation that introduces and troubleshoots Providers. (#1609)

  • +
  • Add documentation for when to use each transaction method. (#1610)

  • +
  • Remove incorrect web3 for w3 in doc example (#1615)

  • +
  • Add examples for using web3.contract via the ethpm module. (#1617)

  • +
  • Add dark mode to documentation. Also fixes a bunch of formatting issues in docs. (#1626)

  • +
+
+
+

Misc

+ +
+
+
+

v5.7.0 (2020-03-16)

+
+

Features

+
    +
  • Add snake_case methods for the net module

    +

    Also moved net module to use ModuleV2 instead of Module (#1592)

    +
  • +
+
+
+

Bugfixes

+
    +
  • Fix return type of eth_getCode. Changed from Hexstr to HexBytes. (#1601)

  • +
+
+
+

Misc

+ +
+
+
+

v5.6.0 (2020-02-26)

+
+

Features

+
    +
  • Add snake_case methods to Geth Miner class, deprecate camelCase methods (#1579)

  • +
  • Add snake_case methods for the net module, deprecate camelCase methods (#1581)

  • +
  • Add PEP561 type marker (#1583)

  • +
+
+
+

Bugfixes

+
    +
  • Increase replacement tx minimum gas price bump

    +

    Parity/OpenEthereum requires a replacement transaction's +gas to be a minimum of 12.5% higher than the original +(vs. Geth's 10%). (#1570)

    +
  • +
+
+
+
+

v5.5.1 (2020-02-10)

+
+

Improved Documentation

+
    +
  • Documents the getUncleCount method. (#1534)

  • +
+
+
+

Misc

+ +
+
+
+

v5.5.0 (2020-02-03)

+
+

Features

+
    +
  • ENS had to release a new registry to push a bugfix. See +this article +for background information. web3.py uses the new registry for all default ENS interactions, now. (#1573)

  • +
+
+
+

Bugfixes

+
    +
  • Minor bugfix in how ContractCaller looks up abi functions. (#1552)

  • +
  • Update modules to use compatible typing-extensions import. (#1554)

  • +
  • Make 'from' and 'to' fields checksum addresses in returned transaction receipts (#1562)

  • +
  • Use local Trinity's IPC socket if it is available, for newer versions of Trinity. (#1563)

  • +
+
+
+

Improved Documentation

+
    +
  • Add Matomo Tracking to Docs site.

    +

    Matomo is an Open Source web analytics platform that allows us +to get better insights and optimize for our audience without +the negative consequences of other compareable platforms.

    +

    Read more: https://matomo.org/why-matomo/ (#1541)

    +
  • +
  • Fix web3 typo in docs (#1559)

  • +
+
+
+

Misc

+ +
+
+
+

v5.4.0 (2019-12-06)

+
+

Features

+
    +
  • Add __str__ to IPCProvider (#1536)

  • +
+
+
+

Bugfixes

+
    +
  • Add required typing-extensions library to setup.py (#1544)

  • +
+
+
+
+

v5.3.1 (2019-12-05)

+
+

Bugfixes

+
    +
  • Only apply hexbytes formatting to r and s values in transaction if present (#1531)

  • +
  • Update eth-utils dependency which contains mypy bugfix. (#1537)

  • +
+
+
+

Improved Documentation

+
    +
  • Update Contract Event documentation to show correct example (#1515)

  • +
  • Add documentation to methods that raise an error in v5 instead of returning None (#1527)

  • +
+
+
+

Misc

+ +
+
+
+

v5.3.0 (2019-11-14)

+
+

Features

+
    +
  • Support handling ENS domains in ERC1319 URIs. (#1489)

  • +
+
+
+

Bugfixes

+
    +
  • Make local block filter return empty list when when no blocks mined (#1255)

  • +
  • Google protobuf dependency was updated to 3.10.0 (#1493)

  • +
  • Infura websocket provider works when no secret key is present (#1501)

  • +
+
+
+

Improved Documentation

+
    +
  • Update Quickstart instructions to use the auto Infura module instead of the more complicated web3 auto module (#1482)

  • +
  • Remove outdated py.test command from readme (#1483)

  • +
+
+
+

Misc

+ +
+
+
+

v5.2.2 (2019-10-21)

+
+

Features

+
    +
  • Add poll_latency to waitForTransactionReceipt (#1453)

  • +
+
+
+

Bugfixes

+
    +
  • Fix flaky Parity whisper module test (#1473)

  • +
+
+
+

Misc

+ +
+
+
+

v5.2.1 (2019-10-17)

+
+

Improved Documentation

+
    +
  • Update documentation for unlock account duration (#1464)

  • +
  • Clarify module installation command for OSX>=10.15 (#1467)

  • +
+
+
+

Misc

+ +
+
+
+

v5.2.0 (2019-09-26)

+
+

Features

+
    +
  • Add enable_strict_bytes_type_checking flag to web3 instance (#1419)

  • +
  • Move Geth Whisper methods to snake case and deprecate camel case methods (#1433)

  • +
+
+
+

Bugfixes

+
    +
  • Add null check to logsbloom formatter (#1445)

  • +
+
+
+

Improved Documentation

+
    +
  • Reformat autogenerated towncrier release notes (#1460)

  • +
+
+
+
+

Web3 5.1.0 (2019-09-18)

+
+

Features

+
    +
  • Add contract_types property to Package class. (#1440)

  • +
+
+
+

Bugfixes

+
    +
  • Fix flaky parity integration test in the whisper module (#1147)

  • +
+
+
+

Improved Documentation

+
    +
  • Remove whitespace, move topics key -> topic in Geth docs (#1425)

  • +
  • Enforce stricter doc checking, turning warnings into errors to fail CI builds +to catch issues quickly.

    +

    Add missing web3.tools.rst to the table of contents and fix incorrectly formatted +JSON example. (#1437)

    +
  • +
  • Add example using Geth POA Middleware with Infura Rinkeby Node (#1444)

  • +
+
+
+

Misc

+ +
+
+
+

v5.0.2

+

Released August 22, 2019

+
    +
  • Bugfixes

    +
      +
    • [ethPM] Fix bug in package id and release id fetching strategy +- #1427

    • +
    +
  • +
+
+
+

v5.0.1

+

Released August 15, 2019

+
    +
  • Bugfixes

    +
      +
    • [ethPM] Add begin/close chars to package name regex +- #1418

    • +
    • [ethPM] Update deployments to work when only abi available +- #1417

    • +
    • Fix tuples handled incorrectly in decode_function_input +- #1410

    • +
    +
  • +
  • Misc

    +
      +
    • Eliminate signTransaction warning +- #1404

    • +
    +
  • +
+
+
+

v5.0.0

+

Released August 1, 2019

+
    +
  • Features

    +
      +
    • web3.eth.chainId now returns an integer instead of hex +- #1394

    • +
    +
  • +
  • Bugfixes

    +
      +
    • Deprecation Warnings now show for methods that have a +@combomethod decorator +- #1401

    • +
    +
  • +
  • Misc

    +
      +
    • [ethPM] Add ethPM to the docker file +- #1405

    • +
    +
  • +
  • Docs

    +
      +
    • Docs are updated to use checksummed addresses +- #1390

    • +
    • Minor doc formatting fixes +- #1338 & +#1345

    • +
    +
  • +
+
+
+

v5.0.0-beta.5

+

Released July 31, 2019

+

This is intended to be the final release before the stable v5 release.

+
    +
  • Features

    +
      +
    • Parity operating mode can be read and set +- #1355

    • +
    • Process a single event log, instead of a whole transaction +receipt +- #1354

    • +
    +
  • +
  • Docs

    +
      +
    • Remove doctest dependency on ethtoken +- #1395

    • +
    +
  • +
  • Bugfixes

    +
      +
    • [ethPM] Bypass IPFS validation for large files +- #1393

    • +
    +
  • +
  • Misc

    +
      +
    • [ethPM] Update default Registry solidity contract +- #1400

    • +
    • [ethPM] Update web3.pm to use new simple Registry implementation +- #1398

    • +
    • Update dependency requirement formatting for releasing +- #1403

    • +
    +
  • +
+
+
+

v5.0.0-beta.4

+

Released July 18,2019

+
    +
  • Features

    +
      +
    • [ethPM] Update registry uri to support basic uris w/o package id +- #1389

    • +
    +
  • +
  • Docs

    +
      +
    • Clarify in docs the return of Eth.sendRawTransaction() as +a HexBytes object, not a string. +- #1384

    • +
    +
  • +
  • Misc

    +
      +
    • [ethPM] Migrate tests over from pytest-ethereum +- #1385

    • +
    +
  • +
+
+
+

v5.0.0-beta.3

+

Released July 15, 2019

+
    +
  • Features

    +
      +
    • Add eth_getProof support +- #1185

    • +
    • Implement web3.pm.get_local_package() +- #1372

    • +
    • Update registry URIs to support chain IDs +- #1382

    • +
    • Add error flags to event.processReceipt +- #1366

    • +
    +
  • +
  • Bugfixes

    +
      +
    • Remove full IDNA processing in favor of UTS46 +- #1364

    • +
    +
  • +
  • Misc

    +
      +
    • Migrate py-ethpm library to web3/ethpm +- #1379

    • +
    • Relax canonical address requirement in ethPM +- #1380

    • +
    • Replace ethPM's infura strategy with web3's native infura support +- #1383

    • +
    • Change combine_argument_formatters to apply_formatters_to_sequence +- #1360

    • +
    • Move pytest.xfail instances to @pytest.mark.xfail +- #1376

    • +
    • Change net.version to eth.chainId in default +transaction params +- #1378

    • +
    +
  • +
+
+
+

v5.0.0-beta.2

+

Released May 13, 2019

+
    +
  • Features

    +
      +
    • Mark deprecated sha3 method as static +- #1350

    • +
    • Upgrade to eth-account v0.4.0 +- #1348

    • +
    +
  • +
  • Docs

    +
      +
    • Add note about web3[tester] in documentation +- #1325

    • +
    +
  • +
  • Misc

    +
      +
    • Replace web3._utils.toolz imports with eth_utils.toolz +- #1317

    • +
    +
  • +
+
+
+

v5.0.0-beta.1

+

Released May 6, 2019

+
    +
  • Features

    +
      +
    • Add support for tilda in provider IPC Path +- #1049

    • +
    • EIP 712 Signing Supported +- #1319

    • +
    +
  • +
  • Docs

    +
      +
    • Update contract example to use compile_standard +- #1263

    • +
    • Fix typo in middleware docs +- #1339

    • +
    +
  • +
+
+
+

v5.0.0-alpha.11

+

Released April 24, 2019

+
    +
  • Docs

    +
      +
    • Add documentation for web3.py unit tests +- #1324

    • +
    +
  • +
  • Misc

    +
      +
    • Update deprecated collections.abc imports +- #1334

    • +
    • Fix documentation typo +- #1335

    • +
    • Upgrade eth-tester version +- #1332

    • +
    +
  • +
+
+
+

v5.0.0-alpha.10

+

Released April 15, 2019

+
    +
  • Features

    +
      +
    • Add getLogs by blockHash +- #1269

    • +
    • Implement chainId endpoint +- #1295

    • +
    • Moved non-standard JSON-RPC endpoints to applicable +Parity/Geth docs. Deprecated web3.version for web3.api +- #1290

    • +
    • Moved Whisper endpoints to applicable Geth or Parity namespace +- #1308

    • +
    • Added support for Goerli provider +- #1286

    • +
    • Added addReservedPeer to Parity module +- #1311

    • +
    +
  • +
  • Bugfixes

    +
      +
    • Cast gas price values to integers in gas strategies +- #1297

    • +
    • Missing constructor function no longer ignores constructor args +- #1316

    • +
    +
  • +
  • Misc

    +
      +
    • Require eth-utils >= 1.4, downgrade Go version for integration tests +- #1310

    • +
    • Fix doc build warnings +- #1331

    • +
    • Zip Fixture data +- #1307

    • +
    • Update Geth version for integration tests +- #1301

    • +
    • Remove unneeded testrpc +- #1322

    • +
    • Add ContractCaller docs to v5 migration guide +- #1323

    • +
    +
  • +
+
+
+

v5.0.0-alpha.9

+

Released March 26, 2019

+
    +
  • Breaking Changes

    +
      +
    • Raise error if there is no Infura API Key +- #1294 & +- #1299

    • +
    +
  • +
  • Misc

    +
      +
    • Upgraded Parity version for integration testing +- #1292

    • +
    +
  • +
+
+
+

v5.0.0-alpha.8

+

Released March 20, 2019

+
    +
  • Breaking Changes

    +
      +
    • Removed web3/utils directory in favor of web3/_utils +- #1282

    • +
    • Relocated personal RPC endpoints to Parity and Geth class +- #1211

    • +
    • Deprecated web3.net.chainId(), web3.eth.getCompilers(), +and web3.eth.getTransactionFromBlock(). Removed web3.eth.enableUnauditedFeatures() +- #1270

    • +
    • Relocated eth_protocolVersion and web3_clientVersion +- #1274

    • +
    • Relocated web3.txpool to web3.geth.txpool +- #1275

    • +
    • Relocated admin module to Geth namespace +- #1288

    • +
    • Relocated miner module to Geth namespace +- #1287

    • +
    +
  • +
  • Features

    +
      +
    • Implement eth_submitHashrate and eth_submitWork JSONRPC endpoints. +- #1280

    • +
    • Implement web3.eth.signTransaction +- #1277

    • +
    +
  • +
  • Docs

    +
      +
    • Added v5 migration docs +- #1284

    • +
    +
  • +
+
+
+

v5.0.0-alpha.7

+

Released March 11, 2019

+
    +
  • Breaking Changes

    +
      +
    • Updated JSON-RPC calls that lookup txs or blocks to raise +an error if lookup fails +- #1218 and +#1268

    • +
    +
  • +
  • Features

    +
      +
    • Tuple ABI support +- #1235

    • +
    +
  • +
  • Bugfixes

    +
      +
    • One last middleware_stack was still hanging on. +Changed to middleware_onion +- #1262

    • +
    +
  • +
+
+
+

v5.0.0-alpha.6

+

Released February 25th, 2019

+
    +
  • Features

    +
      +
    • New NoABIFound error for cases where there is no ABI +- #1247

    • +
    +
  • +
  • Misc

    +
      +
    • Interact with Infura using an API Key. Key will be required after March 27th. +- #1232

    • +
    • Remove process_type utility function in favor of +eth-abi functionality +- #1249

    • +
    +
  • +
+
+
+

v5.0.0-alpha.5

+

Released February 13th, 2019

+
    +
  • Breaking Changes

    +
      +
    • Remove deprecated buildTransaction, call, deploy, +estimateGas, and transact methods +- #1232

    • +
    +
  • +
  • Features

    +
      +
    • Adds Web3.toJSON method +- #1173

    • +
    • Contract Caller API Implemented +- #1227

    • +
    • Add Geth POA middleware to use Rinkeby with Infura Auto +- #1234

    • +
    • Add manifest and input argument validation to pm.release_package() +- #1237

    • +
    +
  • +
  • Misc

    +
      +
    • Clean up intro and block/tx sections in Filter docs +- #1223

    • +
    • Remove unnecessary EncodingError exception catching +- #1224

    • +
    • Improvements to merge_args_and_kwargs utility function +- #1228

    • +
    • Update vyper registry assets +- #1242

    • +
    +
  • +
+
+
+

v5.0.0-alpha.4

+

Released January 23rd, 2019

+
    +
  • Breaking Changes

    +
      +
    • Rename middleware_stack to middleware_onion +- #1210

    • +
    • Drop already deprecated web3.soliditySha3 +- #1217

    • +
    • ENS: Stop inferring .eth TLD on domain names +- #1205

    • +
    +
  • +
  • Bugfixes

    +
      +
    • Validate ethereum_tester class in EthereumTesterProvider +- #1217

    • +
    • Support getLogs() method without creating filters +- #1192

    • +
    +
  • +
  • Features

    +
      +
    • Stablize the PM module +- #1125

    • +
    • Implement async Version module +- #1166

    • +
    +
  • +
  • Misc

    +
      +
    • Update .gitignore to ignore .DS_Store and .mypy_cache/ +- #1215

    • +
    • Change CircleCI badge link to CircleCI project +- #1214

    • +
    +
  • +
+
+
+

v5.0.0-alpha.3

+

Released January 15th, 2019

+
    +
  • Breaking Changes

    +
      +
    • Remove web3.miner.hashrate and web3.version.network +- #1198

    • +
    • Remove web3.providers.tester.EthereumTesterProvider +and web3.providers.tester.TestRPCProvider +- #1199

    • +
    • Change manager.providers from list to single manager.provider +- #1200

    • +
    • Replace deprecated web3.sha3 method with web3.keccak method +- #1207

    • +
    • Drop auto detect testnets for IPCProvider +- #1206

    • +
    +
  • +
  • Bugfixes

    +
      +
    • Add check to make sure blockHash exists +- #1158

    • +
    +
  • +
  • Misc

    +
      +
    • Remove some unreachable code in providers/base.py +- #1160

    • +
    • Migrate tester provider results from middleware to defaults +- #1188

    • +
    • Fix doc formatting for build_filter method +- #1187

    • +
    • Add ERC20 example in docs +- #1178

    • +
    • Code style improvements +- #1194 +& #1191

    • +
    • Convert Web3 instance variables to w3 +- #1186

    • +
    • Update eth-utils dependencies and clean up other dependencies +- #1195

    • +
    +
  • +
+
+
+

v5.0.0-alpha.2

+

Released December 20th, 2018

+
    +
  • Breaking Changes

    +
      +
    • Remove support for python3.5, drop support for eth-abi v1 +- #1163

    • +
    +
  • +
  • Features

    +
      +
    • Support for custom ReleaseManager was fixed +- #1165

    • +
    +
  • +
  • Misc

    +
      +
    • Fix doctest nonsense with unicorn token +- 3b2047

    • +
    • Docs for installing web3 in FreeBSD +- #1156

    • +
    • Use latest python in readthedocs +- #1162

    • +
    • Use twine in release script +- #1164

    • +
    • Upgrade eth-tester, for eth-abi v2 support +- #1168

    • +
    +
  • +
+
+
+

v5.0.0-alpha.1

+

Released December 13th, 2018

+
    +
  • Features

    +
      +
    • Add Rinkeby and Kovan Infura networks; made mainnet the default +- #1150

    • +
    • Add parity-specific listStorageKeys RPC +- #1145

    • +
    • Deprecated Web3.soliditySha3; use Web3.solidityKeccak instead. +- #1139

    • +
    • Add default trinity locations to IPC path guesser +- #1121

    • +
    • Add wss to AutoProvider +- #1110

    • +
    • Add timeout for WebsocketProvider +- #1109

    • +
    • Receipt timeout raises TimeExhausted +- #1070

    • +
    • Allow specification of block number for eth_estimateGas +- #1046

    • +
    +
  • +
  • Misc

    +
      +
    • Removed web3._utils.six support +- #1116

    • +
    • Upgrade eth-utils to 1.2.0 +- #1104

    • +
    • Require Python version 3.5.3 or greater +- #1095

    • +
    • Bump websockets version to 7.0.0 +- #1146

    • +
    • Bump parity test binary to 1.11.11 +- #1064

    • +
    +
  • +
+
+
+

v4.8.2

+

Released November 15, 2018

+
    +
  • Misc

    +
      +
    • Reduce unneeded memory usage +- #1138

    • +
    +
  • +
+
+
+

v4.8.1

+

Released October 28, 2018

+
    +
  • Features

    +
      +
    • Add timeout for WebsocketProvider +- #1119

    • +
    • Reject transactions that send ether to non-payable contract functions +- #1115

    • +
    • Add Auto Infura Ropsten support: from web3.auto.infura.ropsten import w3 +- #1124

    • +
    • Auto-detect trinity IPC file location +- #1129

    • +
    +
  • +
  • Misc

    +
      +
    • Require Python >=3.5.3 +- #1107

    • +
    • Upgrade eth-tester and eth-utils +- #1085

    • +
    • Configure readthedocs dependencies +- #1082

    • +
    • soliditySha3 docs fixup +- #1100

    • +
    • Update ropsten faucet links in troubleshooting docs

    • +
    +
  • +
+
+
+

v4.7.2

+

Released September 25th, 2018

+
    +
  • Bugfixes

    +
      +
    • IPC paths starting with ~ are appropriately resolved to the home directory +- #1072

    • +
    • You can use the local signing middleware with bytes-type addresses +- #1069

    • +
    +
  • +
+
+
+

v4.7.1

+

Released September 11th, 2018

+
    +
  • Bugfixes

    +
      +
    • old pip bug used during +release made it impossible for non-windows users to install 4.7.0.

    • +
    +
  • +
+
+
+

v4.7.0

+

Released September 10th, 2018

+
    +
  • Features

    +
      +
    • Add traceFilter method to the parity module. +- #1051

    • +
    • Move datastructures to public namespace datastructures +to improve support for type checking. +- #1038

    • +
    • Optimization to contract calls +- #944

    • +
    +
  • +
  • Bugfixes

    +
      +
    • ENS name resolution only attempted on mainnet by default. +- #1037

    • +
    • Fix attribute access error when attributedict middleware is not used. +- #1040

    • +
    +
  • +
  • Misc +- Upgrade eth-tester to 0.1.0-beta.32, and remove integration tests for py-ethereum. +- Upgrade eth-hash to 0.2.0 with pycryptodome 3.6.6 which resolves a vulnerability.

  • +
+
+
+

v4.6.0

+

Released Aug 24, 2018

+
    +
  • Features

    + +
  • +
  • Bugfixes

    +
      +
    • Fix crash in time-based gas strategies with small number of transactions - #983

    • +
    • Fx crash when passing multiple addresses to w3.eth.getLogs() - +#1005

    • +
    +
  • +
  • Misc

    +
      +
    • Disallow configuring filters with both manual and generated topic lists - #976

    • +
    • Add support for the upcoming eth-abi v2, which does ABI string decoding differently - #974

    • +
    • Add a lot more filter tests - #997

    • +
    • Add more tests for filtering with None. Note that geth & parity differ here. - #985

    • +
    • Follow-up on Parity bug that we reported upstream (parity#7816): they resolved in 1.10. We +removed xfail on that test. - #992

    • +
    • Docs: add an example of interacting with an ERC20 contract - #995

    • +
    • A couple doc typo fixes

      +
      +
      +
      +
    • +
    +
  • +
+
+
+

v4.5.0

+

Released July 30, 2018

+
    +
  • Features

    +
      +
    • Accept addresses supplied in bytes format (which does not provide checksum validation)

    • +
    • Improve estimation of gas prices

    • +
    +
  • +
  • Bugfixes

    + +
  • +
  • Misc

    +
      +
    • Test Parity 1.11.7

    • +
    • Parity integration tests upgrade to use sha256 instead of md5

    • +
    • Fix some filter docs

    • +
    • eth-account upgrade to v0.3.0

    • +
    • eth-tester upgrade to v0.1.0-beta.29

    • +
    +
  • +
+
+
+

v4.4.1

+

Released June 29, 2018

+
    +
  • Bugfixes

    +
      +
    • eth-pm package was renamed (old one deleted) which broke the web3 release. +eth-pm was removed from the web3.py install until it's stable.

    • +
    +
  • +
  • Misc

    +
      +
    • IPCProvider now accepts a pathlib.Path +argument for the IPC path

    • +
    • Docs explaining the new custom autoproviders in web3

    • +
    +
  • +
+
+
+

v4.4.0

+

Released June 21, 2018

+
    +
  • Features

    +
      +
    • Add support for https in WEB3_PROVIDER_URI environment variable

    • +
    • Can send websocket connection parameters in WebsocketProvider

    • +
    • Two new auto-initialization options:

      +
        +
      • from web3.auto.gethdev import w3

      • +
      • from web3.auto.infura import w3 +(After setting the INFURA_API_KEY environment variable)

      • +
      +
    • +
    • Alpha support for a new package management tool based on ethpm-spec

    • +
    +
  • +
  • Bugfixes

    +
      +
    • Can now receive large responses in WebsocketProvider by +specifying a large max_size in the websocket connection parameters.

    • +
    +
  • +
  • Misc

    +
      +
    • Websockets dependency upgraded to v5

    • +
    • Raise deprecation warning on getTransactionFromBlock()

    • +
    • Fix docs for waitForTransactionReceipt()

    • +
    • Developer Dockerfile now installs testing dependencies

    • +
    +
  • +
+
+
+

v4.3.0

+

Released June 6, 2018

+
    +
  • Features

    +
      +
    • Support for the ABI types like: fixedMxN +which is used by Vyper.

    • +
    • In-flight transaction-signing middleware: Use local keys as if they were hosted keys +using the new sign_and_send_raw_middleware

    • +
    • New getUncleByBlock() API

    • +
    • New name getTransactionByBlock(), which replaces the deprecated +getTransactionFromBlock()

    • +
    • Add several new Parity trace functions

    • +
    • New API to resolve ambiguous function calls, for example:

      +
        +
      • Two functions with the same name that accept similar argument types, like +myfunc(uint8) and myfunc(int8), and you want to call +contract.functions.myfunc(1).call()

      • +
      • See how to use it at: Invoke Ambiguous Contract Functions

      • +
      +
    • +
    +
  • +
  • Bugfixes

    +
      +
    • Gas estimation doesn't crash, when 0 blocks are available. (ie~ on the genesis block)

    • +
    • Close out all HTTPProvider sessions, to squash warnings on exit

    • +
    • Stop adding Contract address twice to the filter. It was making some nodes unhappy

    • +
    +
  • +
  • Misc

    +
      +
    • Friendlier json encoding/decoding failure error messages

    • +
    • Performance improvements, when the responses from the node are large +(by reducing the number of times we evaluate if the response is valid json)

    • +
    • Parity CI test fixes (ugh, environment setup hell, thanks to the +community for cleaning this up!)

    • +
    • Don't crash when requesting a transaction that was created with the parity bug +(which allowed an unsigned transaction to be included, so publicKey is None)

    • +
    • Doc fixes: addresses must be checksummed (or ENS names on mainnet)

    • +
    • Enable local integration testing of parity on non-Debian OS

    • +
    • README:

      +
        +
      • Testing setup for devs

      • +
      • Change the build badge from Travis to Circle CI

      • +
      +
    • +
    • Cache the parity binary in Circle CI, to reduce the impact of their binary API going down

    • +
    • Dropped the dot: py.test -> pytest

    • +
    +
  • +
+
+
+

v4.2.1

+

Released May 9, 2018

+
    +
  • Bugfixes

    +
      +
    • When getting a transaction +with data attached and trying to modify it +(say, to increase the gas price), the data was not being reattached in +the new transaction.

    • +
    • web3.personal.sendTransaction() was crashing when using a transaction +generated with buildTransaction()

    • +
    +
  • +
  • Misc

    +
      +
    • Improved error message when connecting to a geth-style PoA network

    • +
    • Improved error message when address is not checksummed

    • +
    • Started in on support for fixedMxN ABI arguments

    • +
    • Lots of documentation upgrades, including:

      +
        +
      • Guide for understanding nodes/networks/connections

      • +
      • Simplified Quickstart with notes for common issues

      • +
      • A new Troubleshooting section

      • +
      +
    • +
    • Potential pypy performance improvements (use toolz instead of cytoolz)

    • +
    • eth-tester upgraded to beta 24

    • +
    +
  • +
+
+
+

v4.2.0

+

Released Apr 25, 2018

+
    +
  • Removed audit warning and opt-in requirement for w3.eth.account. See more in: +Accounts

  • +
  • Added an API to look up contract functions: fn = contract.functions['function_name_here']

  • +
  • Upgrade Whisper (shh) module to use v6 API

  • +
  • Bugfix: set 'to' field of transaction to empty when using +transaction = contract.constructor().buildTransaction()

  • +
  • You can now specify nonce in buildTransaction()

  • +
  • Distinguish between chain id and network id -- currently always return None for +chainId

  • +
  • Better error message when trying to use a contract function that has 0 or >1 matches

  • +
  • Better error message when trying to install on a python version <3.5

  • +
  • Installs pypiwin32 during pip install, for a better Windows experience

  • +
  • Cleaned up a lot of test warnings by upgrading from deprecated APIs, especially +from the deprecated contract.deploy(txn_dict, args=contract_args) +to the new contract.constructor(*contract_args).transact(txn_dict)

  • +
  • Documentation typo fixes

  • +
  • Better template for Pull Requests

  • +
+
+
+

v4.1.0

+

Released Apr 9, 2018

+
    +
  • New WebsocketProvider. +If you're looking for better performance than HTTP, check out websockets.

  • +
  • New w3.eth.waitForTransactionReceipt()

  • +
  • Added name collision detection to ConciseContract and ImplicitContract

  • +
  • Bugfix to allow fromBlock set to 0 in createFilter, like +contract.events.MyEvent.createFilter(fromBlock=0, ...)

  • +
  • Bugfix of ENS automatic connection

  • +
  • eth-tester support for Byzantium

  • +
  • New migration guide for v3 -> v4 upgrade

  • +
  • Various documentation updates

  • +
  • Pinned eth-account to older version

  • +
+
+
+

v4.0.0

+

Released Apr 2, 2018

+
    +
  • Marked beta.13 as stable

  • +
  • Documentation tweaks

  • +
+
+
+

v4.0.0-beta.13

+

Released Mar 27, 2018

+

This is intended to be the final release before the stable v4 release.

+
    +
  • Add support for geth 1.8 (fixed error on getTransactionReceipt())

  • +
  • You can now call a contract method at a specific block +with the block_identifier keyword argument, see: +call()

  • +
  • In preparation for stable release, disable w3.eth.account by default, +until a third-party audit is complete & resolved.

  • +
  • New API for contract deployment, which enables gas estimation, local signing, etc. +See constructor().

  • +
  • Find contract events with contract.events.$my_event.createFilter()

  • +
  • Support auto-complete for contract methods.

  • +
  • Upgrade most dependencies to stable

    +
      +
    • eth-abi

    • +
    • eth-utils

    • +
    • hexbytes

    • +
    • not included: eth-tester and eth-account

    • +
    +
  • +
  • Switch the default EthereumTesterProvider backend from eth-testrpc to eth-tester: +web3.providers.eth_tester.EthereumTesterProvider

  • +
  • A lot of documentation improvements

  • +
  • Test node integrations over a variety of providers

  • +
  • geth 1.8 test suite

  • +
+
+
+

v4.0.0-beta.12

+

A little hiccup on release. Skipped.

+
+
+

v4.0.0-beta.11

+

Released Feb 28, 2018

+
    +
  • New methods to modify or replace pending transactions

  • +
  • A compatibility option for connecting to geth --dev -- see Proof of Authority

  • +
  • A new web3.net.chainId

  • +
  • Create a filter object from an existing filter ID.

  • +
  • eth-utils v1.0.1 (stable) compatibility

  • +
+
+
+

v4.0.0-beta.10

+

Released Feb 21, 2018

+
    +
  • bugfix: Compatibility with eth-utils v1-beta2 +(the incompatibility was causing fresh web3.py installs to fail)

  • +
  • bugfix: crash when sending the output of contract.functions.myFunction().buildTransaction() +to sendTransaction(). Now, having a chainID key does not crash +sendTransaction.

  • +
  • bugfix: a TypeError when estimating gas like: +contract.functions.myFunction().estimateGas() is fixed

  • +
  • Added parity integration tests to the continuous integration suite!

  • +
  • Some py3 and docs cleanup

  • +
+
+
+

v4.0.0-beta.9

+

Released Feb 8, 2018

+
    +
  • Access event log parameters as attributes

  • +
  • Support for specifying nonce in eth-tester

  • +
  • Bugfix +dependency conflicts between eth-utils, eth-abi, and eth-tester

  • +
  • Clearer error message when invalid keywords provided to contract constructor function

  • +
  • New docs for working with private keys + set up doctests

  • +
  • First parity integration tests

  • +
  • replace internal implementation of w3.eth.account with +eth_account.account.Account

  • +
+
+
+

v4.0.0-beta.8

+

Released Feb 7, 2018, then recalled. It added 32MB of test data to git history, +so the tag was deleted, as well as the corresponding release. +(Although the release would not have contained that test data)

+
+
+

v4.0.0-beta.7

+

Released Jan 29, 2018

+
    +
  • Support for web3.eth.Eth.getLogs() in eth-tester with py-evm

  • +
  • Process transaction receipts with Event ABI, using +Contract.events.myEvent(*args, **kwargs).processReceipt(transaction_receipt) +see Event Log Object for the new type.

  • +
  • Add timeout parameter to web3.providers.ipc.IPCProvider

  • +
  • bugfix: make sure idna package is always installed

  • +
  • Replace ethtestrpc with py-evm, in all tests

  • +
  • Dockerfile fixup

  • +
  • Test refactoring & cleanup

  • +
  • Reduced warnings during tests

  • +
+
+
+

v4.0.0-beta.6

+

Released Jan 18, 2018

+
    +
  • New contract function call API: my_contract.functions.my_func().call() is preferred over the now +deprecated my_contract.call().my_func() API.

  • +
  • A new, sophisticated gas estimation algorithm, based on the https://ethgasstation.info approach. +You must opt-in to the new approach, because it's quite slow. We recommend using the new caching middleware. +See web3.gas_strategies.time_based.construct_time_based_gas_price_strategy()

  • +
  • New caching middleware that can cache based on time, block, or indefinitely.

  • +
  • Automatically retry JSON-RPC requests over HTTP, a few times.

  • +
  • ConciseContract now has the address directly

  • +
  • Many eth-tester fixes. web3.providers.eth_tester.main.EthereumTesterProvider is now a +legitimate alternative to web3.providers.tester.EthereumTesterProvider.

  • +
  • ethtest-rpc removed from testing. Tests use eth-tester only, on pyethereum. Soon it will be +eth-tester with py-evm.

  • +
  • Bumped several dependencies, like eth-tester

  • +
  • Documentation updates

  • +
+
+
+

v4.0.0-beta.5

+

Released Dec 28, 2017

+
    +
  • Improvements to working with eth-tester, using EthereumTesterProvider:

    +
      +
    • Bugfix the key names in event logging

    • +
    • Add support for sendRawTransaction()

    • +
    +
  • +
  • IPCProvider now automatically retries on a broken connection, like when you restart your node

  • +
  • New gas price engine API, laying groundwork for more advanced gas pricing strategies

  • +
+
+
+

v4.0.0-beta.4

+

Released Dec 7, 2017

+
    +
  • New buildTransaction() method to prepare contract transactions, offline

  • +
  • New automatic provider detection, for w3 = Web3() initialization

  • +
  • Set environment variable WEB3_PROVIDER_URI to suggest a provider for automatic detection

  • +
  • New API to set providers like: w3.providers = [IPCProvider()]

  • +
  • Crashfix: web3.eth.Eth.filter() when retrieving logs with the argument 'latest'

  • +
  • Bump eth-tester to v0.1.0-beta.5, with bugfix for filtering by topic

  • +
  • Removed GPL lib pylru, now believed to be in full MIT license compliance.

  • +
+
+
+

v4.0.0-beta.3

+

Released Dec 1, 2017

+
    +
  • Fix encoding of ABI types: bytes[] and string[]

  • +
  • Windows connection error bugfix

  • +
  • Bugfix message signatures that were broken ~1% of the time (zero-pad r and s)

  • +
  • Autoinit web3 now produces None instead of raising an exception on from web3.auto import w3

  • +
  • Clearer errors on formatting failure (includes field name that failed)

  • +
  • Python modernization, removing Py2 compatibility cruft

  • +
  • Update dependencies with changed names, now:

    +
      +
    • eth-abi

    • +
    • eth-keyfile

    • +
    • eth-keys

    • +
    • eth-tester

    • +
    • eth-utils

    • +
    +
  • +
  • Faster Travis CI builds, with cached geth binary

  • +
+
+
+

v4.0.0-beta.2

+

Released Nov 22, 2017

+

Bug Fixes:

+
    +
  • sendRawTransaction() accepts raw bytes

  • +
  • contract() accepts an ENS name as contract address

  • +
  • signTransaction() returns the expected hash (after signing the transaction)

  • +
  • Account methods can all be called statically, like: Account.sign(...)

  • +
  • getTransactionReceipt() returns the status field as an int

  • +
  • Web3.soliditySha3() looks up ENS names if they are supplied with an "address" ABI

  • +
  • If running multiple threads with the same w3 instance, ValueError: Recursively called ... is no longer raised

  • +
+

Plus, various python modernization code cleanups, and testing against geth 1.7.2.

+
+
+

v4.0.0-beta.1

+
    +
  • Python 3 is now required

  • +
  • ENS names can be used anywhere that a hex address can

  • +
  • Sign transactions and messages with local private keys

  • +
  • New filter mechanism: get_all_entries() and get_new_entries()

  • +
  • Quick automatic initialization with from web3.auto import w3

  • +
  • All addresses must be supplied with an EIP-55 checksum

  • +
  • All addresses are returned with a checksum

  • +
  • Renamed Web3.toDecimal() to toInt(), see: Encoding and Decoding Helpers

  • +
  • All filter calls are synchronous, gevent integration dropped

  • +
  • Contract eventFilter() has replaced both Contract.on() and Contract.pastEvents()

  • +
  • Contract arguments of bytes ABI type now accept hex strings.

  • +
  • Contract arguments of string ABI type now accept python str.

  • +
  • Contract return values of string ABI type now return python str.

  • +
  • Many methods now return a bytes-like object where they used to return a hex string, like in Web3.sha3()

  • +
  • IPC connection left open and reused, rather than opened and closed on each call

  • +
  • A number of deprecated methods from v3 were removed

  • +
+
+
+

3.16.1

+
    +
  • Addition of ethereum-tester as a dependency

  • +
+
+
+

3.16.0

+
    +
  • Addition of named middlewares for easier manipulation of middleware stack.

  • +
  • Provider middlewares can no longer be modified during runtime.

  • +
  • Experimental custom ABI normalization API for Contract objects.

  • +
+
+
+

3.15.0

+
    +
  • Change docs to use RTD theme

  • +
  • Experimental new EthereumTesterProvider for the ethereum-tester library.

  • +
  • Bugfix for function type abi encoding via ethereum-abi-utils upgrade to v0.4.1

  • +
  • Bugfix for Web3.toHex to conform to RPC spec.

  • +
+
+
+

3.14.2

+
    +
  • Fix PyPi readme text.

  • +
+
+
+

3.14.1

+
    +
  • Fix PyPi readme text.

  • +
+
+
+

3.14.0

+
    +
  • New stalecheck_middleware

  • +
  • Improvements to Web3.toHex and Web3.toText.

  • +
  • Improvements to Web3.sha3 signature.

  • +
  • Bugfixes for Web3.eth.sign api

  • +
+
+
+

3.13.5

+
    +
  • Add experimental fixture_middleware

  • +
  • Various bugfixes introduced in middleware API introduction and migration to +formatter middleware.

  • +
+
+
+

3.13.4

+
    +
  • Bugfix for formatter handling of contract creation transaction.

  • +
+
+
+

3.13.3

+
    +
  • Improved testing infrastructure.

  • +
+
+
+

3.13.2

+
    +
  • Bugfix for retrieving filter changes for both new block filters and pending +transaction filters.

  • +
+
+
+

3.13.1

+
    +
  • Fix mispelled attrdict_middleware (was spelled attrdict_middlware).

  • +
+
+
+

3.13.0

+
    +
  • New Middleware API

  • +
  • Support for multiple providers

  • +
  • New web3.soliditySha3

  • +
  • Remove multiple functions that were never implemented from the original web3.

  • +
  • Deprecated web3.currentProvider accessor. Use web3.provider now instead.

  • +
  • Deprecated password prompt within web3.personal.newAccount.

  • +
+
+
+

3.12.0

+
    +
  • Bugfix for abi filtering to correctly handle constructor and fallback type abi entries.

  • +
+
+
+

3.11.0

+
    +
  • All web3 apis which accept address parameters now enforce checksums if the address looks like it is checksummed.

  • +
  • Improvements to error messaging with when calling a contract on a node that may not be fully synced

  • +
  • Bugfix for web3.eth.syncing to correctly handle False

  • +
+
+
+

3.10.0

+
    +
  • Web3 now returns web3.utils.datastructures.AttributeDict in places where it previously returned a normal dict.

  • +
  • web3.eth.contract now performs validation on the address parameter.

  • +
  • Added web3.eth.getWork API

  • +
+
+
+

3.9.0

+
    +
  • Add validation for the abi parameter of eth

  • +
  • Contract return values of bytes, bytesXX and string are no longer converted to text types and will be returned in their raw byte-string format.

  • +
+
+
+

3.8.1

+
    +
  • Bugfix for eth_sign double hashing input.

  • +
  • Removed deprecated DelegatedSigningManager

  • +
  • Removed deprecate PrivateKeySigningManager

  • +
+
+
+

3.8.0

+
    +
  • Update pyrlp dependency to >=0.4.7

  • +
  • Update eth-testrpc dependency to >=1.2.0

  • +
  • Deprecate DelegatedSigningManager

  • +
  • Deprecate PrivateKeySigningManager

  • +
+
+
+

3.7.1

+
    +
  • upstream version bump for bugfix in eth-abi-utils

  • +
+
+
+

3.7.0

+
    +
  • deprecate eth.defaultAccount defaulting to the coinbase account.

  • +
+
+
+

3.6.2

+
    +
  • Fix error message from contract factory creation.

  • +
  • Use ethereum-utils for utility functions.

  • +
+
+
+

3.6.1

+
    +
  • Upgrade ethereum-abi-utils dependency for upstream bugfix.

  • +
+
+
+

3.6.0

+
    +
  • Deprecate Contract.code: replaced by Contract.bytecode

  • +
  • Deprecate Contract.code_runtime: replaced by Contract.bytecode_runtime

  • +
  • Deprecate abi, code, code_runtime and source as arguments for the Contract object.

  • +
  • Deprecate source as a property of the Contract object

  • +
  • Add Contract.factory() API.

  • +
  • Deprecate the construct_contract_factory helper function.

  • +
+
+
+

3.5.3

+
    +
  • Bugfix for how requests library is used. Now reuses session.

  • +
+
+
+

3.5.2

+
    +
  • Bugfix for construction of request_kwargs within HTTPProvider

  • +
+
+
+

3.5.1

+
    +
  • Allow HTTPProvider to be imported from web3 module.

  • +
  • make HTTPProvider accessible as a property of web3 instances.

  • +
+
+
+

3.5.0

+
    +
  • Deprecate web3.providers.rpc.RPCProvider

  • +
  • Deprecate web3.providers.rpc.KeepAliveRPCProvider

  • +
  • Add new web3.providers.rpc.HTTPProvider

  • +
  • Remove hard dependency on gevent.

  • +
+
+
+

3.4.4

+
    +
  • Bugfix for web3.eth.getTransaction when the hash is unknown.

  • +
+
+
+

3.4.3

+
    +
  • Bugfix for event log data decoding to properly handle dynamic sized values.

  • +
  • New web3.tester module to access extra RPC functionality from eth-testrpc

  • +
+
+
+

3.4.2

+
    +
  • Fix package so that eth-testrpc is not required.

  • +
+
+
+

3.4.1

+ +
+
+

3.4.0

+
    +
  • Bugfix for contract instances to respect web3.eth.defaultAccount

  • +
  • Better error reporting when ABI decoding fails for contract method response.

  • +
+
+
+

3.3.0

+
    +
  • New EthereumTesterProvider now available. Faster test runs than TestRPCProvider

  • +
  • Updated underlying eth-testrpc requirement.

  • +
+
+
+

3.2.0

+
    +
  • web3.shh is now implemented.

  • +
  • Introduced KeepAliveRPCProvider to correctly recycle HTTP connections and use HTTP keep alive

  • +
+
+
+

3.1.1

+
    +
  • Bugfix for contract transaction sending not respecting the +web3.eth.defaultAccount configuration.

  • +
+
+
+

3.1.0

+
    +
  • New DelegatedSigningManager and PrivateKeySigningManager classes.

  • +
+
+
+

3.0.2

+
    +
  • Bugfix or IPCProvider not handling large JSON responses well.

  • +
+
+
+

3.0.1

+
    +
  • Better RPC compliance to be compatable with the Parity JSON-RPC server.

  • +
+
+
+

3.0.0

+
    +
  • Filter objects now support controlling the interval through which they poll +using the poll_interval property

  • +
+
+
+

2.9.0

+
    +
  • Bugfix generation of event topics.

  • +
  • Web3.Iban now allows access to Iban address tools.

  • +
+
+
+

2.8.1

+
    +
  • Bugfix for geth.ipc path on linux systems.

  • +
+
+
+

2.8.0

+
    +
  • +
    Changes to the Contract API:
      +
    • Contract.deploy() parameter arguments renamed to args

    • +
    • Contract.deploy() now takes args and kwargs parameters to allow +constructing with keyword arguments or positional arguments.

    • +
    • Contract.pastEvents now allows you to specify a fromBlock or +``toBlock. Previously these were forced to be 'earliest' and +web3.eth.blockNumber respectively.

    • +
    • Contract.call, Contract.transact and Contract.estimateGas are now +callable as class methods as well as instance methods. When called this +way, an address must be provided with the transaction parameter.

    • +
    • Contract.call, Contract.transact and Contract.estimateGas now allow +specifying an alternate address for the transaction.

    • +
    +
    +
    +
  • +
  • +
    RPCProvider now supports the following constructor arguments.
      +
    • ssl for enabling SSL

    • +
    • connection_timeout and network_timeout for controlling the timeouts +for requests.

    • +
    +
    +
    +
  • +
+
+
+

2.7.1

+
    +
  • Bugfix: Fix KeyError in merge_args_and_kwargs helper fn.

  • +
+
+
+

2.7.0

+
    +
  • Bugfix for usage of block identifiers 'latest', 'earliest', 'pending'

  • +
  • Sphinx documentation

  • +
  • Non-data transactions now default to 90000 gas.

  • +
  • Web3 object now has helpers set as static methods rather than being set at +initialization.

  • +
  • RPCProvider now takes a path parameter to allow configuration for requests +to go to paths other than /.

  • +
+
+
+

2.6.0

+
    +
  • TestRPCProvider no longer dumps logging output to stdout and stderr.

  • +
  • Bugfix for return types of address[]

  • +
  • Bugfix for event data types of address

  • +
+
+
+

2.5.0

+
    +
  • All transactions which contain a data element will now have their gas +automatically estimated with 100k additional buffer. This was previously +only true with transactions initiated from a Contract object.

  • +
+
+
+

2.4.0

+
    +
  • Contract functions can now be called using keyword arguments.

  • +
+
+
+

2.3.0

+
    +
  • Upstream fixes for filters

  • +
  • Filter APIs on and pastEvents now callable as both instance and class methods.

  • +
+
+
+

2.2.0

+
    +
  • The filters that come back from the contract on and pastEvents methods +now call their callbacks with the same data format as web3.js.

  • +
+
+
+

2.1.1

+
    +
  • Cast RPCProvider port to an integer.

  • +
+
+
+

2.1.0

+
    +
  • Remove all monkeypatching

  • +
+
+
+

2.0.0

+
    +
  • Pull in downstream updates to proper gevent usage.

  • +
  • Fix eth_sign

  • +
  • Bugfix with contract operations mutating the transaction object that is passed in.

  • +
  • More explicit linting ignore statements.

  • +
+
+
+

1.9.0

+
    +
  • BugFix: fix for python3 only json.JSONDecodeError handling.

  • +
+
+
+

1.8.0

+
    +
  • BugFix: RPCProvider not sending a content-type header

  • +
  • Bugfix: web3.toWei now returns an integer instead of a decimal.Decimal

  • +
+
+
+

1.7.1

+
    +
  • TestRPCProvider can now be imported directly from web3

  • +
+
+
+

1.7.0

+
    +
  • Add eth.admin interface.

  • +
  • Bugfix: Format the return value of web3.eth.syncing

  • +
  • Bugfix: IPCProvider socket interactions are now more robust.

  • +
+
+
+

1.6.0

+
    +
  • Downstream package upgrades for eth-testrpc and ethereum-tester-client to +handle configuration of the Homestead and DAO fork block numbers.

  • +
+
+
+

1.5.0

+
    +
  • Rename web3.contract._Contract to web3.contract.Contract +to expose it for static analysis and auto completion tools

  • +
  • Allow passing string parameters to functions

  • +
  • Automatically compute gas requirements for contract deployment and

  • +
  • transactions.

  • +
  • Contract Filters

  • +
  • Block, Transaction, and Log filters

  • +
  • web3.eth.txpool interface

  • +
  • web3.eth.mining interface

  • +
  • Fixes for encoding.

  • +
+
+
+

1.4.0

+
    +
  • Bugfix to allow address types in constructor arguments.

  • +
+
+
+

1.3.0

+
    +
  • Partial implementation of the web3.eth.contract interface.

  • +
+
+
+

1.2.0

+
    +
  • Restructure project modules to be more flat

  • +
  • Add ability to run test suite without the slow tests.

  • +
  • Breakup encoding utils into smaller modules.

  • +
  • Basic pep8 formatting.

  • +
  • Apply python naming conventions to internal APIs

  • +
  • Lots of minor bugfixes.

  • +
  • Removal of dead code left behind from 1.0.0 refactor.

  • +
  • Removal of web3/solidity module.

  • +
+
+
+

1.1.0

+
    +
  • Add missing isConnected() method.

  • +
  • Add test coverage for setProvider()

  • +
+
+
+

1.0.1

+
    +
  • Specify missing pyrlp and gevent dependencies

  • +
+
+
+

1.0.0

+
    +
  • Massive refactor to the majority of the app.

  • +
+
+
+

0.1.0

+
    +
  • Initial release

  • +
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/resources.html b/_build/html_zh_CN/resources.html new file mode 100644 index 0000000000..985631a785 --- /dev/null +++ b/_build/html_zh_CN/resources.html @@ -0,0 +1,297 @@ + + + + + + + + + 资源和学习材料 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

资源和学习材料

+

web3.py and the Ethereum Python ecosystem have an active community of developers and educators. +Here you'll find libraries, tutorials, examples, courses and other learning material.

+
+

警告

+

Links on this page are community submissions and are not vetted by the team that maintains +web3.py. As always, DYOR (Do Your Own Research).

+
+
+

First Steps

+

Resources for those brand new to Ethereum:

+ +
+
+

Courses

+ +
+
+

Tutorials

+ +
+
+

Conference Presentations and Videos

+ +
+
+

Smart Contract Programming Languages

+
    +
  • Vyper - Contract-oriented, pythonic programming language that targets EVM

  • +
+
+
+

Frameworks and Tooling

+
    +
  • Ape - The Ethereum development framework for Python Developers, Data Scientists, and Security Professionals

  • +
  • Titanoboa - A Vyper interpreter and testing framework

  • +
  • Wake - A Python-based development and testing framework for Solidity

  • +
  • Brownie - [No longer actively maintained] A Python-based development and testing framework for smart contracts targeting EVM

  • +
+
+
+

Libraries

+
    +
  • Web3 Ethereum DeFi - Library for DeFi trading and protocols (Uniswap, PancakeSwap, Sushi, Aave, Chainlink)

  • +
  • lighter-v1-python - Lighter.xyz DEX client for Python

  • +
  • uniswap-python - Library lets you easily retrieve prices and make trades on all Uniswap versions.

  • +
  • pyWalletConnect - WalletConnect implementation for wallets in Python

  • +
  • dydx-v3-python - Python client for dYdX v3

  • +
  • Lido Python SDK - Library with which you can get all Lido validator's signatures and check their validity

  • +
+
+
+

Applications

+ +
+
+

Hackathon Helpers

+
    +
  • ape-hackathon-kit - Ape project template with a web front-end (Next.js, Tailwind, RainbowKit, wagmi)

  • +
  • eth-flogger - Sample web app utilizing async web3.py, Flask, SQLite, Sourcify

  • +
  • Temo - Sample terminal app utilizing async web3py, Textual, Anvil

  • +
  • web3py-discord-bot - Sample Discord bot utilizing websockets, eth_subscribe, and discord.py

  • +
  • py-signer - Demo of typed data message signing (EIP-712) with eth-account and Ape

  • +
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/search.html b/_build/html_zh_CN/search.html new file mode 100644 index 0000000000..0f148b6ddf --- /dev/null +++ b/_build/html_zh_CN/search.html @@ -0,0 +1,206 @@ + + + + + + + + 搜索 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + + + +
+ +
+ +
+
+
+ +
+ +
+

© 版权所有 2016-2025, The Ethereum Foundation。

+
+ + 利用 Sphinx 构建,使用的 + 主题 + 由 Read the Docs 开发. + + +
+
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + + + + + + diff --git a/_build/html_zh_CN/searchindex.js b/_build/html_zh_CN/searchindex.js new file mode 100644 index 0000000000..b4ca3f09f5 --- /dev/null +++ b/_build/html_zh_CN/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles":{"0.1.0":[[14,"id567"]],"1.) The subscription_manager":[[16,"the-subscription-manager"]],"1.0.0":[[14,"id566"]],"1.0.1":[[14,"id565"]],"1.1.0":[[14,"id564"]],"1.2.0":[[14,"id563"]],"1.3.0":[[14,"id562"]],"1.4.0":[[14,"id561"]],"1.5.0":[[14,"id560"]],"1.6.0":[[14,"id559"]],"1.7.0":[[14,"id558"]],"1.7.1":[[14,"id557"]],"1.8.0":[[14,"id556"]],"1.9.0":[[14,"id555"]],"2.) Subscription types":[[16,"subscription-types"]],"2.0.0":[[14,"id554"]],"2.1.0":[[14,"id553"]],"2.1.1":[[14,"id552"]],"2.2.0":[[14,"id551"]],"2.3.0":[[14,"id550"]],"2.4.0":[[14,"id549"]],"2.5.0":[[14,"id548"]],"2.6.0":[[14,"id547"]],"2.7.0":[[14,"id546"]],"2.7.1":[[14,"id545"]],"2.8.0":[[14,"id544"]],"2.8.1":[[14,"id543"]],"2.9.0":[[14,"id542"]],"3.) Handlers":[[16,"handlers"]],"3.0.0":[[14,"id541"]],"3.0.1":[[14,"id540"]],"3.0.2":[[14,"id539"]],"3.1.0":[[14,"id538"]],"3.1.1":[[14,"id537"]],"3.10.0":[[14,"id517"]],"3.11.0":[[14,"id516"]],"3.12.0":[[14,"id515"]],"3.13.0":[[14,"id514"]],"3.13.1":[[14,"id513"]],"3.13.2":[[14,"id512"]],"3.13.3":[[14,"id511"]],"3.13.4":[[14,"id510"]],"3.13.5":[[14,"id509"]],"3.14.0":[[14,"id508"]],"3.14.1":[[14,"id507"]],"3.14.2":[[14,"id506"]],"3.15.0":[[14,"id505"]],"3.16.0":[[14,"id504"]],"3.16.1":[[14,"id503"]],"3.2.0":[[14,"id536"]],"3.3.0":[[14,"id535"]],"3.4.0":[[14,"id534"]],"3.4.1":[[14,"id533"]],"3.4.2":[[14,"id532"]],"3.4.3":[[14,"id531"]],"3.4.4":[[14,"id530"]],"3.5.0":[[14,"id529"]],"3.5.1":[[14,"id528"]],"3.5.2":[[14,"id527"]],"3.5.3":[[14,"id526"]],"3.6.0":[[14,"id525"]],"3.6.1":[[14,"id524"]],"3.6.2":[[14,"id523"]],"3.7.0":[[14,"id522"]],"3.7.1":[[14,"id521"]],"3.8.0":[[14,"id520"]],"3.8.1":[[14,"id519"]],"3.9.0":[[14,"id518"]],"4.) handle_subscriptions":[[16,"handle-subscriptions"]],"5.) Unsubscribing":[[16,"unsubscribing"]],"ABI":[[28,"abi"]],"ABI Middleware":[[10,"abi-middleware"]],"ABI Types Removed":[[10,"abi-types-removed"]],"API":[[7,null],[11,"api"],[11,"id2"],[11,"id3"],[11,"id4"],[17,null]],"Accounts and Private Keys":[[11,"accounts-and-private-keys"]],"Address":[[28,"address"]],"Address Helpers":[[11,"address-helpers"]],"Addresses":[[19,"addresses"],[25,"addresses"]],"Advanced example: Fetching all token transfer events":[[5,"advanced-example-fetching-all-token-transfer-events"]],"An example":[[16,"an-example"]],"An introduction to subscriptions":[[16,"an-introduction-to-subscriptions"]],"Applications":[[15,"applications"]],"Async Batch Requests":[[25,"async-batch-requests"]],"AsyncHTTPProvider":[[12,"asynchttpprovider"]],"AsyncIPCProvider":[[12,"asyncipcprovider"]],"AsyncIPCProvider (non-breaking feature)":[[10,"asyncipcprovider-non-breaking-feature"]],"AsyncWeb3 with Persistent Connection Providers":[[12,"asyncweb3-with-persistent-connection-providers"]],"Asynchronous Filter Polling":[[5,"asynchronous-filter-polling"]],"AttributeDict":[[9,"attributedict"]],"Attributes":[[21,"attributes"],[21,"id5"],[25,"attributes"]],"Attribution":[[0,"attribution"]],"Auto-initialization Provider Shortcuts":[[12,"auto-initialization-provider-shortcuts"]],"AutoProvider":[[12,"autoprovider"]],"Available gas price strategies":[[6,"module-web3.gas_strategies.rpc"]],"Base API":[[11,"base-api"]],"Batch Requests":[[25,"batch-requests"]],"Beacon API":[[20,null]],"Block and Transaction Filter Classes":[[5,"block-and-transaction-filter-classes"]],"Booleans":[[19,"booleans"]],"Breaking Changes":[[14,"breaking-changes"],[14,"id57"],[14,"id60"],[14,"id65"],[14,"id77"],[14,"id92"],[14,"id97"],[14,"id144"],[14,"id203"],[14,"id206"],[14,"id211"],[14,"id216"],[14,"id220"]],"Breaking Changes (to Beta APIs)":[[14,"breaking-changes-to-beta-apis"],[14,"id128"]],"Breaking changes":[[14,"id178"],[14,"id183"],[14,"id190"],[14,"id195"]],"Buffered Gas Estimate":[[9,"buffered-gas-estimate"]],"Bugfixes":[[14,"bugfixes"],[14,"id1"],[14,"id3"],[14,"id6"],[14,"id9"],[14,"id14"],[14,"id19"],[14,"id24"],[14,"id28"],[14,"id32"],[14,"id39"],[14,"id42"],[14,"id45"],[14,"id51"],[14,"id53"],[14,"id66"],[14,"id69"],[14,"id73"],[14,"id81"],[14,"id85"],[14,"id93"],[14,"id98"],[14,"id105"],[14,"id113"],[14,"id115"],[14,"id124"],[14,"id129"],[14,"id133"],[14,"id135"],[14,"id139"],[14,"id143"],[14,"id145"],[14,"id151"],[14,"id156"],[14,"id162"],[14,"id166"],[14,"id169"],[14,"id173"],[14,"id175"],[14,"id180"],[14,"id185"],[14,"id192"],[14,"id196"],[14,"id201"],[14,"id204"],[14,"id207"],[14,"id212"],[14,"id221"],[14,"id225"],[14,"id227"],[14,"id231"],[14,"id235"],[14,"id239"],[14,"id246"],[14,"id249"],[14,"id253"],[14,"id255"],[14,"id259"],[14,"id271"],[14,"id274"],[14,"id277"],[14,"id280"],[14,"id284"],[14,"id287"],[14,"id293"],[14,"id294"],[14,"id297"],[14,"id299"],[14,"id302"],[14,"id305"],[14,"id308"],[14,"id310"],[14,"id314"],[14,"id317"],[14,"id321"],[14,"id325"],[14,"id326"],[14,"id330"],[14,"id334"],[14,"id339"],[14,"id342"]],"Build the release notes":[[2,"build-the-release-notes"]],"Built In Providers":[[12,"built-in-providers"]],"Bytes":[[19,"bytes"]],"Bytes vs Text":[[19,"bytes-vs-text"]],"CCIP Read support for offchain lookup":[[21,"ccip-read-support-for-offchain-lookup"]],"CI Testing With a Nightly Geth Build":[[2,"ci-testing-with-a-nightly-geth-build"]],"Caching":[[28,"caching"]],"Caching Middleware":[[10,"caching-middleware"]],"Changes to Exception Handling":[[10,"changes-to-exception-handling"]],"Changes to base API":[[10,"changes-to-base-api"]],"Changes to base API convenience methods":[[10,"changes-to-base-api-convenience-methods"]],"Chapter 0: w3.eth.send_transaction with eth-tester":[[18,"chapter-0-w3-eth-send-transaction-with-eth-tester"]],"Chapter 1: w3.eth.send_transaction + signer middleware":[[18,"chapter-1-w3-eth-send-transaction-signer-middleware"]],"Chapter 2: w3.eth.send_raw_transaction":[[18,"chapter-2-w3-eth-send-raw-transaction"]],"Chapter 3: Contract transactions":[[18,"chapter-3-contract-transactions"]],"Check Encodability":[[25,"check-encodability"]],"Choosing a Provider":[[12,"choosing-a-provider"]],"Class-Based Middleware Model":[[10,"class-based-middleware-model"]],"Code Style":[[2,"code-style"]],"Conference Presentations and Videos":[[15,"conference-presentations-and-videos"]],"Configuration":[[11,"configuration"]],"Configuring Middleware":[[9,"configuring-middleware"]],"Constants":[[1,null]],"Contract Deployment Example":[[21,"contract-deployment-example"]],"Contract Events":[[21,"contract-events"]],"Contract Factories":[[21,"contract-factories"]],"Contract Functions":[[21,"contract-functions"]],"Contract Unit Tests in Python":[[21,"contract-unit-tests-in-python"]],"ContractCaller":[[21,"contractcaller"]],"Contracts":[[10,"contracts"],[11,"contracts"],[22,"contracts"]],"Courses":[[15,"courses"]],"Creating Custom Middleware":[[9,"creating-custom-middleware"]],"Creating a Private Key":[[23,"creating-a-private-key"]],"Creating a gas price strategy":[[6,"creating-a-gas-price-strategy"]],"Creating an approval for external transfers":[[21,"creating-an-approval-for-external-transfers"]],"Creating the contract factory":[[21,"creating-the-contract-factory"]],"Cryptographic Hashing":[[11,"cryptographic-hashing"],[25,"cryptographic-hashing"]],"Currency Conversions":[[11,"currency-conversions"],[25,"currency-conversions"]],"Custom Methods":[[25,"custom-methods"]],"Default Middleware":[[9,"default-middleware"]],"Deprecated ConciseContract and ImplicitContract":[[10,"deprecated-concisecontract-and-implicitcontract"]],"Deprecated Methods":[[10,"deprecated-methods"]],"Deprecations":[[14,"deprecations"],[14,"id7"],[14,"id78"],[14,"id157"]],"Deprecations and Removals":[[14,"deprecations-and-removals"],[14,"id198"]],"Disabling Strict Bytes Type Checking":[[19,"disabling-strict-bytes-type-checking"]],"Disabling Strict Checks for Bytes Types":[[21,"disabling-strict-checks-for-bytes-types"]],"Disambiguating String Inputs":[[10,"disambiguating-string-inputs"]],"Documentation":[[2,"documentation"]],"Documentation Updates":[[14,"documentation-updates"],[14,"id208"],[14,"id213"],[14,"id217"]],"ENS":[[10,"ens"],[11,"ens"]],"ENS API":[[3,null]],"ENS Name to Address Resolution":[[9,"ens-name-to-address-resolution"]],"Encoding and Decoding Helpers":[[11,"encoding-and-decoding-helpers"],[25,"encoding-and-decoding-helpers"]],"End of Support and Feature Removals":[[10,"end-of-support-and-feature-removals"]],"Enforcement":[[0,"enforcement"]],"EthPM Module Removed":[[10,"ethpm-module-removed"]],"Ethereum Addresses":[[19,"ethereum-addresses"]],"EthereumTesterProvider":[[10,"ethereumtesterprovider"],[12,"ethereumtesterprovider"]],"Event Log Filters":[[5,"event-log-filters"]],"Event Log Object":[[21,"event-log-object"]],"Events, Logs, and Filters":[[11,"events-logs-and-filters"]],"Example code":[[5,"example-code"]],"Examples":[[5,"examples"],[11,"examples"],[21,"examples"]],"Examples: Listening For Events":[[5,"examples-listening-for-events"]],"Exception Handling":[[28,"exception-handling"]],"Exceptions":[[10,"exceptions"]],"Exceptions inherit from a base class":[[10,"exceptions-inherit-from-a-base-class"]],"External Modules":[[25,"external-modules"]],"Extract private key from geth keyfile":[[23,"extract-private-key-from-geth-keyfile"]],"FAQ":[[16,"faq"]],"Fallback Function":[[21,"fallback-function"]],"Features":[[14,"features"],[14,"id4"],[14,"id10"],[14,"id16"],[14,"id21"],[14,"id25"],[14,"id33"],[14,"id37"],[14,"id41"],[14,"id47"],[14,"id52"],[14,"id55"],[14,"id62"],[14,"id67"],[14,"id71"],[14,"id75"],[14,"id79"],[14,"id83"],[14,"id87"],[14,"id100"],[14,"id108"],[14,"id111"],[14,"id121"],[14,"id126"],[14,"id131"],[14,"id137"],[14,"id141"],[14,"id147"],[14,"id153"],[14,"id159"],[14,"id161"],[14,"id165"],[14,"id168"],[14,"id174"],[14,"id179"],[14,"id184"],[14,"id191"],[14,"id202"],[14,"id205"],[14,"id209"],[14,"id214"],[14,"id218"],[14,"id222"],[14,"id224"],[14,"id226"],[14,"id230"],[14,"id234"],[14,"id238"],[14,"id242"],[14,"id245"],[14,"id248"],[14,"id252"],[14,"id258"],[14,"id262"],[14,"id265"],[14,"id268"],[14,"id270"],[14,"id273"],[14,"id278"],[14,"id283"],[14,"id290"],[14,"id296"],[14,"id301"],[14,"id304"],[14,"id307"],[14,"id309"],[14,"id313"],[14,"id316"],[14,"id320"],[14,"id324"],[14,"id329"],[14,"id333"],[14,"id338"],[14,"id341"]],"Fetching Data":[[11,"fetching-data"]],"Filter Class":[[5,"filter-class"]],"Filters":[[10,"filters"],[22,"filters"]],"Final test before each release":[[2,"final-test-before-each-release"]],"First Steps":[[15,"first-steps"]],"Frameworks and Tooling":[[15,"frameworks-and-tooling"]],"Funding a New Account":[[23,"funding-a-new-account"]],"Gas Price API":[[6,null]],"Gas Price Strategy":[[9,"gas-price-strategy"]],"Generating New Fixtures":[[2,"generating-new-fixtures"]],"Get the Address for an ENS Name":[[4,"get-the-address-for-an-ens-name"]],"Get the ENS Name for an Address":[[4,"get-the-ens-name-for-an-address"]],"Get the Owner of a Name":[[4,"get-the-owner-of-a-name"]],"Get the Resolver for an ENS Record":[[4,"get-the-resolver-for-an-ens-record"]],"Geth API":[[24,null]],"Geth Fixtures":[[2,"geth-fixtures"]],"Geth Miner Namespace Removed":[[10,"geth-miner-namespace-removed"]],"Geth Personal Namespace Removed":[[10,"geth-personal-namespace-removed"]],"Geth dev Proof of Authority":[[12,"geth-dev-proof-of-authority"]],"GethAdmin API":[[24,"gethadmin-api"]],"GethDebug API":[[24,"gethdebug-api"]],"GethTxPool API":[[24,"gethtxpool-api"]],"Getting Blockchain Info":[[13,"getting-blockchain-info"]],"HTTP Retry Request Middleware":[[10,"http-retry-request-middleware"]],"HTTPProvider":[[12,"httpprovider"]],"Hackathon Helpers":[[15,"hackathon-helpers"]],"Hexadecimal Representations":[[19,"hexadecimal-representations"]],"How can I optimize Ethereum JSON-RPC API access?":[[19,"how-can-i-optimize-ethereum-json-rpc-api-access"]],"How can I subscribe to additional events once my application is running?":[[16,"how-can-i-subscribe-to-additional-events-once-my-application-is-running"]],"How do I adjust the log levels?":[[19,"how-do-i-adjust-the-log-levels"]],"How do I conform to ABI types?":[[19,"how-do-i-conform-to-abi-types"]],"How do I convert currency denominations?":[[19,"how-do-i-convert-currency-denominations"]],"How do I create an account?":[[19,"how-do-i-create-an-account"]],"How do I get ether for my test network?":[[19,"how-do-i-get-ether-for-my-test-network"]],"How do I use my MetaMask accounts from web3.py?":[[19,"how-do-i-use-my-metamask-accounts-from-web3-py"]],"How to Help":[[2,"how-to-help"]],"IPCProvider":[[12,"ipcprovider"]],"Improved Documentation":[[14,"improved-documentation"],[14,"id15"],[14,"id20"],[14,"id29"],[14,"id36"],[14,"id40"],[14,"id43"],[14,"id46"],[14,"id54"],[14,"id58"],[14,"id61"],[14,"id70"],[14,"id74"],[14,"id82"],[14,"id86"],[14,"id94"],[14,"id99"],[14,"id106"],[14,"id110"],[14,"id116"],[14,"id118"],[14,"id120"],[14,"id125"],[14,"id130"],[14,"id134"],[14,"id136"],[14,"id140"],[14,"id146"],[14,"id152"],[14,"id158"],[14,"id163"],[14,"id167"],[14,"id170"],[14,"id176"],[14,"id181"],[14,"id187"],[14,"id197"],[14,"id228"],[14,"id232"],[14,"id236"],[14,"id240"],[14,"id243"],[14,"id247"],[14,"id250"],[14,"id254"],[14,"id256"],[14,"id260"],[14,"id263"],[14,"id266"],[14,"id269"],[14,"id272"],[14,"id275"],[14,"id281"],[14,"id291"],[14,"id295"],[14,"id298"],[14,"id300"],[14,"id303"],[14,"id311"],[14,"id318"],[14,"id322"],[14,"id327"],[14,"id331"],[14,"id336"],[14,"id340"],[14,"id343"]],"Instantiate with Custom Middleware":[[9,"instantiate-with-custom-middleware"]],"Int":[[1,"int"]],"Integration Testing":[[2,"integration-testing"]],"Interacting with deployed contracts":[[21,"interacting-with-deployed-contracts"]],"Interacting with the Persistent Connection":[[12,"interacting-with-the-persistent-connection"]],"Internal Changes - for web3.py Contributors":[[14,"internal-changes-for-web3-py-contributors"],[14,"id2"],[14,"id5"],[14,"id8"],[14,"id11"],[14,"id17"],[14,"id22"],[14,"id30"],[14,"id34"],[14,"id38"],[14,"id44"],[14,"id48"],[14,"id56"],[14,"id59"],[14,"id63"],[14,"id68"],[14,"id72"],[14,"id76"],[14,"id80"],[14,"id84"],[14,"id88"],[14,"id101"],[14,"id107"],[14,"id109"],[14,"id112"],[14,"id117"],[14,"id119"],[14,"id122"],[14,"id127"],[14,"id132"],[14,"id138"],[14,"id142"],[14,"id148"],[14,"id154"],[14,"id160"],[14,"id164"],[14,"id171"],[14,"id177"],[14,"id182"],[14,"id188"],[14,"id193"],[14,"id199"]],"Invalid byte and hex strings with strict (default) bytes4 type checking":[[21,"id9"]],"Invoke Ambiguous Contract Functions":[[21,"invoke-ambiguous-contract-functions"]],"JSON-RPC Error Handling":[[10,"json-rpc-error-handling"]],"JSON-RPC Updates":[[10,"json-rpc-updates"]],"LegacyWebSocketProvider":[[12,"legacywebsocketprovider"]],"Libraries":[[15,"libraries"]],"Link a Name to an Address":[[4,"link-a-name-to-an-address"]],"Link an Address to a Name":[[4,"link-an-address-to-a-name"]],"Listening for Responses":[[8,"listening-for-responses"]],"Local Providers":[[13,"local-providers"]],"Local vs Hosted Keys":[[23,"local-vs-hosted-keys"]],"Local vs Hosted Nodes":[[23,"local-vs-hosted-nodes"]],"Locally Managed Log and Block Filters":[[9,"locally-managed-log-and-block-filters"]],"Manager Provider":[[10,"manager-provider"]],"Managers":[[8,"managers"]],"Manual Testing":[[2,"manual-testing"]],"Methods":[[20,"methods"],[21,"methods"],[21,"id3"],[21,"id6"],[22,"methods"]],"Middleware":[[11,"middleware"]],"Middleware Builder Classes":[[10,"middleware-builder-classes"]],"Middleware Order":[[9,"middleware-order"]],"Middleware Renaming and Removals":[[10,"middleware-renaming-and-removals"]],"Middleware Stack API":[[9,"middleware-stack-api"]],"Middlewares -> Middleware":[[10,"middlewares-middleware"]],"Migrating from v3 to v4":[[10,"migrating-from-v3-to-v4"]],"Migrating from v4 to v5":[[10,"migrating-from-v4-to-v5"]],"Migrating from v5 to v6":[[10,"migrating-from-v5-to-v6"]],"Migrating from v6 to v7":[[10,"migrating-from-v6-to-v7"]],"Misc":[[14,"misc"],[14,"id210"],[14,"id215"],[14,"id219"],[14,"id223"],[14,"id229"],[14,"id233"],[14,"id237"],[14,"id241"],[14,"id244"],[14,"id251"],[14,"id257"],[14,"id261"],[14,"id264"],[14,"id267"],[14,"id276"],[14,"id279"],[14,"id282"],[14,"id285"],[14,"id286"],[14,"id288"],[14,"id289"],[14,"id292"],[14,"id306"],[14,"id312"],[14,"id315"],[14,"id319"],[14,"id323"],[14,"id328"],[14,"id332"],[14,"id335"],[14,"id337"],[14,"id344"]],"Miscellaneous Changes":[[10,"miscellaneous-changes"],[14,"miscellaneous-changes"],[14,"id13"],[14,"id18"],[14,"id26"],[14,"id31"],[14,"id35"],[14,"id49"],[14,"id64"],[14,"id89"],[14,"id95"],[14,"id102"],[14,"id114"],[14,"id123"],[14,"id149"],[14,"id155"]],"Miscellaneous changes":[[14,"id172"],[14,"id189"],[14,"id194"],[14,"id200"]],"Multichain Address Resolution":[[4,"multichain-address-resolution"]],"Multichain Address Support":[[4,"multichain-address-support"]],"Name Info":[[4,"name-info"]],"Net API":[[11,"net-api"],[26,null]],"Normalize Request Parameters Middleware":[[10,"normalize-request-parameters-middleware"]],"One-To-Many Requests":[[8,"one-to-many-requests"]],"One-To-One Requests":[[8,"one-to-one-requests"]],"Optional Middleware":[[9,"optional-middleware"]],"Other Misc Changes":[[10,"other-misc-changes"]],"Other notable changes":[[10,"other-notable-changes"]],"Our Responsibilities":[[0,"our-responsibilities"]],"Our Standards":[[0,"our-standards"]],"Parallelizing subscriptions":[[16,"parallelizing-subscriptions"]],"Performance Improvements":[[14,"performance-improvements"],[14,"id12"],[14,"id23"],[14,"id27"],[14,"id50"],[14,"id90"],[14,"id103"]],"Performance improvements":[[14,"id186"]],"Performing an external transfer":[[21,"performing-an-external-transfer"]],"Persistent Connection Base Class":[[12,"persistent-connection-base-class"]],"Persistent Connection Providers":[[12,"persistent-connection-providers"]],"Personal API":[[10,"personal-api"]],"Prepare message for ecrecover in Solidity":[[23,"prepare-message-for-ecrecover-in-solidity"]],"Proof of Authority":[[9,"proof-of-authority"]],"Properties":[[21,"properties"],[22,"properties"],[26,"properties"]],"Provider Access":[[10,"provider-access"]],"Provider Configurations":[[8,"provider-configurations"]],"Provider Updates":[[10,"provider-updates"]],"Provider via Environment Variable":[[12,"provider-via-environment-variable"]],"Providers":[[8,"providers"],[11,"providers"],[25,"providers"]],"Pull Requests":[[2,"pull-requests"]],"Push the release to github & pypi":[[2,"push-the-release-to-github-pypi"]],"Python 2 to Python 3":[[10,"python-2-to-python-3"]],"Python 3.10 and 3.11 Support":[[10,"python-3-10-and-3-11-support"]],"Python 3.5 no longer supported":[[10,"python-3-5-no-longer-supported"]],"Python 3.7 Support Dropped":[[10,"python-3-7-support-dropped"]],"Query account balances":[[21,"query-account-balances"]],"Querying token metadata":[[21,"querying-token-metadata"]],"RPC API Modules":[[25,"rpc-api-modules"]],"Read Text Metadata for an ENS Record":[[4,"read-text-metadata-for-an-ens-record"]],"Reading a Private Key from an Environment Variable":[[23,"reading-a-private-key-from-an-environment-variable"]],"Releasing":[[2,"releasing"]],"Remaining camelCase -> snake_case Updates":[[10,"remaining-camelcase-snake-case-updates"]],"Remote Providers":[[13,"remote-providers"]],"Removals":[[10,"removals"],[14,"removals"],[14,"id91"],[14,"id96"],[14,"id104"],[14,"id150"]],"Removed Methods":[[10,"removed-methods"],[10,"id5"]],"Request Caching":[[8,"request-caching"]],"Request Lifecycle":[[8,"request-lifecycle"]],"Request Processing for Persistent Connection Providers":[[8,"request-processing-for-persistent-connection-providers"]],"Required Infura API Key":[[10,"required-infura-api-key"]],"Result Generating Middleware":[[10,"result-generating-middleware"]],"Retrieving gas price":[[6,"retrieving-gas-price"]],"Retry Requests for HTTP Providers":[[8,"retry-requests-for-http-providers"]],"Running The Tests":[[2,"running-the-tests"]],"Running the event loop in a separate thread":[[5,"running-the-event-loop-in-a-separate-thread"]],"Scope":[[0,"scope"]],"Selecting the gas price strategy":[[6,"selecting-the-gas-price-strategy"]],"Sending Transactions":[[11,"sending-transactions"]],"Sending tokens":[[21,"sending-tokens"]],"Set Text Metadata for an ENS Record":[[4,"set-text-metadata-for-an-ens-record"]],"Set Up Your Name and Address":[[4,"set-up-your-name-and-address"]],"Set up a clean environment":[[19,"set-up-a-clean-environment"]],"Setup":[[4,"setup"]],"Sign a Contract Transaction":[[23,"sign-a-contract-transaction"]],"Sign a Message":[[23,"sign-a-message"]],"Sign a Transaction":[[23,"sign-a-transaction"]],"Signed Integers":[[19,"signed-integers"]],"Signing":[[9,"signing"]],"Single threaded concurrency with async and await":[[5,"single-threaded-concurrency-with-async-and-await"]],"Smart Contract Programming Languages":[[15,"smart-contract-programming-languages"]],"Snake Case":[[10,"snake-case"]],"Some Common Uses for Local Private Keys":[[23,"some-common-uses-for-local-private-keys"]],"Stalecheck":[[9,"stalecheck"]],"Strict Bytes Checking by Default":[[10,"strict-bytes-checking-by-default"]],"Strings":[[1,"strings"]],"Structs":[[19,"structs"]],"Synchronous":[[5,"synchronous"]],"Test Provider":[[13,"test-provider"]],"TestRPCProvider and EthereumTesterProvider":[[10,"testrpcprovider-and-ethereumtesterprovider"]],"Testnet Changes":[[10,"testnet-changes"]],"Text Records":[[4,"text-records"]],"Tracing API":[[27,null]],"Tutorials":[[15,"tutorials"]],"Types by Example":[[19,"types-by-example"]],"Unit Testing and eth-tester Tests":[[2,"unit-testing-and-eth-tester-tests"]],"Unsigned Integers":[[19,"unsigned-integers"]],"Usage":[[4,"usage"]],"Using Docker":[[2,"using-docker"]],"Using Persistent Connection Providers":[[12,"using-persistent-connection-providers"]],"Using a struct as a function argument":[[21,"using-a-struct-as-a-function-argument"]],"Utils":[[21,"utils"],[28,null]],"Valid byte and hex strings for a non-strict bytes4 type":[[21,"id10"]],"Validation":[[9,"validation"]],"ValidationError":[[10,"validationerror"]],"Verify a Message":[[23,"verify-a-message"]],"Verify a message with ecrecover in Solidity":[[23,"verify-a-message-with-ecrecover-in-solidity"]],"Web3 5.1.0 (2019-09-18)":[[14,"web3-5-1-0-2019-09-18"]],"Web3 API":[[25,null]],"Web3 class split into Web3 and AsyncWeb3":[[10,"web3-class-split-into-web3-and-asyncweb3"]],"Web3 \u5185\u90e8\u5b9e\u73b0":[[8,null]],"Web3.toDecimal()":[[10,"web3-todecimal"]],"WebSocketProvider":[[10,"websocketprovider"],[12,"websocketprovider"]],"Which version part to bump":[[2,"which-version-part-to-bump"]],"Why am I getting Visual C++ or Cython not installed error?":[[19,"why-am-i-getting-visual-c-or-cython-not-installed-error"]],"Why can't I use a particular function?":[[19,"why-can-t-i-use-a-particular-function"]],"Why doesn't my transaction work on another network?":[[19,"why-doesn-t-my-transaction-work-on-another-network"]],"Why is ExtraDataToPOAMiddleware necessary?":[[9,"why-is-extradatatopoamiddleware-necessary"]],"Why isn't my web3 instance connecting to the network?":[[19,"why-isn-t-my-web3-instance-connecting-to-the-network"]],"Wildcard Resolution Support":[[4,"wildcard-resolution-support"]],"Working With Resolvers":[[4,"working-with-resolvers"]],"Working With Test Contracts":[[2,"working-with-test-contracts"]],"Working with an ERC-20 Token Contract":[[21,"working-with-an-erc-20-token-contract"]],"Writing Tests":[[2,"writing-tests"]],"Writing your own Provider":[[8,"writing-your-own-provider"]],"Your Development Environment":[[2,"your-development-environment"]],"dict to AttributeDict conversion moved to middleware":[[10,"dict-to-attributedict-conversion-moved-to-middleware"]],"ens.async_ens module":[[3,"ens-async-ens-module"]],"ens.ens module":[[3,"ens-ens-module"]],"ens.exceptions module":[[3,"ens-exceptions-module"]],"eth-abi v1 no longer supported":[[10,"eth-abi-v1-no-longer-supported"]],"eth_getLogs limitations":[[5,"eth-getlogs-limitations"]],"gm\uff08\u65e9\u5b89\uff09":[[7,null]],"v4.0.0":[[14,"v4-0-0"]],"v4.0.0-beta.1":[[14,"v4-0-0-beta-1"]],"v4.0.0-beta.10":[[14,"v4-0-0-beta-10"]],"v4.0.0-beta.11":[[14,"v4-0-0-beta-11"]],"v4.0.0-beta.12":[[14,"v4-0-0-beta-12"]],"v4.0.0-beta.13":[[14,"v4-0-0-beta-13"]],"v4.0.0-beta.2":[[14,"v4-0-0-beta-2"]],"v4.0.0-beta.3":[[14,"v4-0-0-beta-3"]],"v4.0.0-beta.4":[[14,"v4-0-0-beta-4"]],"v4.0.0-beta.5":[[14,"v4-0-0-beta-5"]],"v4.0.0-beta.6":[[14,"v4-0-0-beta-6"]],"v4.0.0-beta.7":[[14,"v4-0-0-beta-7"]],"v4.0.0-beta.8":[[14,"v4-0-0-beta-8"]],"v4.0.0-beta.9":[[14,"v4-0-0-beta-9"]],"v4.1.0":[[14,"v4-1-0"]],"v4.2.0":[[14,"v4-2-0"]],"v4.2.1":[[14,"v4-2-1"]],"v4.3.0":[[14,"v4-3-0"]],"v4.4.0":[[14,"v4-4-0"]],"v4.4.1":[[14,"v4-4-1"]],"v4.5.0":[[14,"v4-5-0"]],"v4.6.0":[[14,"v4-6-0"]],"v4.7.0":[[14,"v4-7-0"]],"v4.7.1":[[14,"v4-7-1"]],"v4.7.2":[[14,"v4-7-2"]],"v4.8.1":[[14,"v4-8-1"]],"v4.8.2":[[14,"v4-8-2"]],"v5.0.0":[[14,"v5-0-0"]],"v5.0.0-alpha.1":[[14,"v5-0-0-alpha-1"]],"v5.0.0-alpha.10":[[14,"v5-0-0-alpha-10"]],"v5.0.0-alpha.11":[[14,"v5-0-0-alpha-11"]],"v5.0.0-alpha.2":[[14,"v5-0-0-alpha-2"]],"v5.0.0-alpha.3":[[14,"v5-0-0-alpha-3"]],"v5.0.0-alpha.4":[[14,"v5-0-0-alpha-4"]],"v5.0.0-alpha.5":[[14,"v5-0-0-alpha-5"]],"v5.0.0-alpha.6":[[14,"v5-0-0-alpha-6"]],"v5.0.0-alpha.7":[[14,"v5-0-0-alpha-7"]],"v5.0.0-alpha.8":[[14,"v5-0-0-alpha-8"]],"v5.0.0-alpha.9":[[14,"v5-0-0-alpha-9"]],"v5.0.0-beta.1":[[14,"v5-0-0-beta-1"]],"v5.0.0-beta.2":[[14,"v5-0-0-beta-2"]],"v5.0.0-beta.3":[[14,"v5-0-0-beta-3"]],"v5.0.0-beta.4":[[14,"v5-0-0-beta-4"]],"v5.0.0-beta.5":[[14,"v5-0-0-beta-5"]],"v5.0.1":[[14,"v5-0-1"]],"v5.0.2":[[14,"v5-0-2"]],"v5.10.0 (2020-05-18)":[[14,"v5-10-0-2020-05-18"]],"v5.11.0 (2020-06-03)":[[14,"v5-11-0-2020-06-03"]],"v5.11.1 (2020-06-17)":[[14,"v5-11-1-2020-06-17"]],"v5.12.0 (2020-07-16)":[[14,"v5-12-0-2020-07-16"]],"v5.12.0-beta.1 (2020-07-09)":[[14,"v5-12-0-beta-1-2020-07-09"]],"v5.12.0-beta.2 (2020-07-14)":[[14,"v5-12-0-beta-2-2020-07-14"]],"v5.12.0-beta.3 (2020-07-15)":[[14,"v5-12-0-beta-3-2020-07-15"]],"v5.12.1 (2020-09-02)":[[14,"v5-12-1-2020-09-02"]],"v5.12.2 (2020-10-12)":[[14,"v5-12-2-2020-10-12"]],"v5.12.3 (2020-10-21)":[[14,"v5-12-3-2020-10-21"]],"v5.13.0 (2020-10-29)":[[14,"v5-13-0-2020-10-29"]],"v5.13.1 (2020-12-03)":[[14,"v5-13-1-2020-12-03"]],"v5.14.0 (2021-01-05)":[[14,"v5-14-0-2021-01-05"]],"v5.15.0 (2021-01-15)":[[14,"v5-15-0-2021-01-15"]],"v5.16.0 (2021-02-04)":[[14,"v5-16-0-2021-02-04"]],"v5.17.0 (2021-02-24)":[[14,"v5-17-0-2021-02-24"]],"v5.18.0 (2021-04-08)":[[14,"v5-18-0-2021-04-08"]],"v5.19.0 (2021-04-28)":[[14,"v5-19-0-2021-04-28"]],"v5.2.0 (2019-09-26)":[[14,"v5-2-0-2019-09-26"]],"v5.2.1 (2019-10-17)":[[14,"v5-2-1-2019-10-17"]],"v5.2.2 (2019-10-21)":[[14,"v5-2-2-2019-10-21"]],"v5.20.0 (2021-06-09)":[[14,"v5-20-0-2021-06-09"]],"v5.20.1 (2021-07-01)":[[14,"v5-20-1-2021-07-01"]],"v5.21.0 (2021-07-12)":[[14,"v5-21-0-2021-07-12"]],"v5.22.0 (2021-08-02)":[[14,"v5-22-0-2021-08-02"]],"v5.23.0 (2021-08-12)":[[14,"v5-23-0-2021-08-12"]],"v5.23.1 (2021-08-27)":[[14,"v5-23-1-2021-08-27"]],"v5.24.0 (2021-09-27)":[[14,"v5-24-0-2021-09-27"]],"v5.25.0 (2021-11-19)":[[14,"v5-25-0-2021-11-19"]],"v5.26.0 (2022-01-06)":[[14,"v5-26-0-2022-01-06"]],"v5.27.0 (2022-01-31)":[[14,"v5-27-0-2022-01-31"]],"v5.28.0 (2022-02-09)":[[14,"v5-28-0-2022-02-09"]],"v5.3.0 (2019-11-14)":[[14,"v5-3-0-2019-11-14"]],"v5.3.1 (2019-12-05)":[[14,"v5-3-1-2019-12-05"]],"v5.4.0 (2019-12-06)":[[14,"v5-4-0-2019-12-06"]],"v5.5.0 (2020-02-03)":[[14,"v5-5-0-2020-02-03"]],"v5.5.1 (2020-02-10)":[[14,"v5-5-1-2020-02-10"]],"v5.6.0 (2020-02-26)":[[14,"v5-6-0-2020-02-26"]],"v5.7.0 (2020-03-16)":[[14,"v5-7-0-2020-03-16"]],"v5.8.0 (2020-04-23)":[[14,"v5-8-0-2020-04-23"]],"v5.9.0 (2020-04-30)":[[14,"v5-9-0-2020-04-30"]],"v6.0.0 (2023-03-14)":[[14,"v6-0-0-2023-03-14"]],"v6.0.0-beta.1 (2022-02-28)":[[14,"v6-0-0-beta-1-2022-02-28"]],"v6.0.0-beta.10 (2023-02-15)":[[14,"v6-0-0-beta-10-2023-02-15"]],"v6.0.0-beta.11 (2023-02-24)":[[14,"v6-0-0-beta-11-2023-02-24"]],"v6.0.0-beta.2 (2022-04-27)":[[14,"v6-0-0-beta-2-2022-04-27"]],"v6.0.0-beta.3 (2022-06-01)":[[14,"v6-0-0-beta-3-2022-06-01"]],"v6.0.0-beta.4 (2022-07-13)":[[14,"v6-0-0-beta-4-2022-07-13"]],"v6.0.0-beta.5 (2022-09-19)":[[14,"v6-0-0-beta-5-2022-09-19"]],"v6.0.0-beta.6 (2022-09-26)":[[14,"v6-0-0-beta-6-2022-09-26"]],"v6.0.0-beta.7 (2022-10-19)":[[14,"v6-0-0-beta-7-2022-10-19"]],"v6.0.0-beta.8 (2022-11-14)":[[14,"v6-0-0-beta-8-2022-11-14"]],"v6.0.0-beta.9 (2023-01-03)":[[14,"v6-0-0-beta-9-2023-01-03"]],"v6.1.0 (2023-04-05)":[[14,"v6-1-0-2023-04-05"]],"v6.2.0 (2023-04-12)":[[14,"v6-2-0-2023-04-12"]],"v6.3.0 (2023-05-03)":[[14,"v6-3-0-2023-05-03"]],"web3.eth API":[[11,"web3-eth-api"],[22,null]],"web3.py v6.10.0 (2023-09-21)":[[14,"web3-py-v6-10-0-2023-09-21"]],"web3.py v6.11.0 (2023-10-11)":[[14,"web3-py-v6-11-0-2023-10-11"]],"web3.py v6.11.1 (2023-10-18)":[[14,"web3-py-v6-11-1-2023-10-18"]],"web3.py v6.11.2 (2023-10-30)":[[14,"web3-py-v6-11-2-2023-10-30"]],"web3.py v6.11.3 (2023-11-08)":[[14,"web3-py-v6-11-3-2023-11-08"]],"web3.py v6.11.4 (2023-11-27)":[[14,"web3-py-v6-11-4-2023-11-27"]],"web3.py v6.12.0 (2023-12-11)":[[14,"web3-py-v6-12-0-2023-12-11"]],"web3.py v6.13.0 (2023-12-20)":[[14,"web3-py-v6-13-0-2023-12-20"]],"web3.py v6.14.0 (2024-01-10)":[[14,"web3-py-v6-14-0-2024-01-10"]],"web3.py v6.4.0 (2023-05-15)":[[14,"web3-py-v6-4-0-2023-05-15"]],"web3.py v6.5.0 (2023-06-15)":[[14,"web3-py-v6-5-0-2023-06-15"]],"web3.py v6.6.0 (2023-07-12)":[[14,"web3-py-v6-6-0-2023-07-12"]],"web3.py v6.6.1 (2023-07-12)":[[14,"web3-py-v6-6-1-2023-07-12"]],"web3.py v6.7.0 (2023-07-26)":[[14,"web3-py-v6-7-0-2023-07-26"]],"web3.py v6.8.0 (2023-08-02)":[[14,"web3-py-v6-8-0-2023-08-02"]],"web3.py v6.9.0 (2023-08-23)":[[14,"web3-py-v6-9-0-2023-08-23"]],"web3.py v7.0.0 (2024-08-21)":[[14,"web3-py-v7-0-0-2024-08-21"]],"web3.py v7.0.0-beta.1 (2024-02-28)":[[14,"web3-py-v7-0-0-beta-1-2024-02-28"]],"web3.py v7.0.0-beta.2 (2024-03-11)":[[14,"web3-py-v7-0-0-beta-2-2024-03-11"]],"web3.py v7.0.0-beta.3 (2024-03-28)":[[14,"web3-py-v7-0-0-beta-3-2024-03-28"]],"web3.py v7.0.0-beta.4 (2024-04-11)":[[14,"web3-py-v7-0-0-beta-4-2024-04-11"]],"web3.py v7.0.0-beta.5 (2024-04-26)":[[14,"web3-py-v7-0-0-beta-5-2024-04-26"]],"web3.py v7.0.0-beta.6 (2024-05-15)":[[14,"web3-py-v7-0-0-beta-6-2024-05-15"]],"web3.py v7.0.0-beta.7 (2024-06-26)":[[14,"web3-py-v7-0-0-beta-7-2024-06-26"]],"web3.py v7.0.0-beta.8 (2024-07-24)":[[14,"web3-py-v7-0-0-beta-8-2024-07-24"]],"web3.py v7.0.0-beta.9 (2024-08-01)":[[14,"web3-py-v7-0-0-beta-9-2024-08-01"]],"web3.py v7.1.0 (2024-08-28)":[[14,"web3-py-v7-1-0-2024-08-28"]],"web3.py v7.10.0 (2025-03-27)":[[14,"web3-py-v7-10-0-2025-03-27"]],"web3.py v7.11.0 (2025-04-29)":[[14,"web3-py-v7-11-0-2025-04-29"]],"web3.py v7.11.1 (2025-05-12)":[[14,"web3-py-v7-11-1-2025-05-12"]],"web3.py v7.12.0 (2025-05-22)":[[14,"web3-py-v7-12-0-2025-05-22"]],"web3.py v7.12.1 (2025-07-14)":[[14,"web3-py-v7-12-1-2025-07-14"]],"web3.py v7.13.0 (2025-08-04)":[[14,"web3-py-v7-13-0-2025-08-04"]],"web3.py v7.2.0 (2024-08-29)":[[14,"web3-py-v7-2-0-2024-08-29"]],"web3.py v7.3.0 (2024-09-25)":[[14,"web3-py-v7-3-0-2024-09-25"]],"web3.py v7.3.1 (2024-10-14)":[[14,"web3-py-v7-3-1-2024-10-14"]],"web3.py v7.4.0 (2024-10-16)":[[14,"web3-py-v7-4-0-2024-10-16"]],"web3.py v7.5.0 (2024-11-06)":[[14,"web3-py-v7-5-0-2024-11-06"]],"web3.py v7.6.0 (2024-11-22)":[[14,"web3-py-v7-6-0-2024-11-22"]],"web3.py v7.6.1 (2024-12-18)":[[14,"web3-py-v7-6-1-2024-12-18"]],"web3.py v7.7.0 (2025-01-15)":[[14,"web3-py-v7-7-0-2025-01-15"]],"web3.py v7.8.0 (2025-02-03)":[[14,"web3-py-v7-8-0-2025-02-03"]],"web3.py v7.9.0 (2025-03-12)":[[14,"web3-py-v7-9-0-2025-03-12"]],"web3.py's subscription_manager":[[16,"web3-py-s-subscription-manager"]],"\u4e2d\u95f4\u4ef6":[[9,null]],"\u4e8b\u4ef6\u548c\u65e5\u5fd7":[[5,null]],"\u4e8b\u4ef6\u8ba2\u9605":[[16,null]],"\u4ea4\u6613":[[18,null]],"\u4ecb\u7ecd":[[7,null],[17,null]],"\u4ee5\u592a\u574a\u540d\u79f0\u670d\u52a1 (ENS)":[[4,null]],"\u4f7f\u7528 Web3":[[13,"using-web3"]],"\u53d1\u5e03\u8bf4\u660e":[[14,null]],"\u5408\u7ea6":[[21,null]],"\u5b89\u88c5":[[13,"installation"]],"\u5feb\u901f\u5f00\u59cb":[[7,"getting-started"],[13,null]],"\u6211\u4eec\u7684\u627f\u8bfa":[[0,"our-pledge"]],"\u6307\u5357":[[7,null],[17,null]],"\u63d0\u4f9b\u8005":[[12,null]],"\u6545\u969c\u6392\u9664":[[19,null]],"\u6982\u89c8":[[11,null]],"\u76ee\u5f55":[[7,"table-of-contents"],[17,null]],"\u793e\u533a":[[7,null],[17,null]],"\u7d22\u5f15\u548c\u8868\u683c":[[7,"indices-and-tables"],[17,"indices-and-tables"]],"\u884c\u4e3a\u51c6\u5219":[[0,null]],"\u8d21\u732e":[[2,null]],"\u8d26\u6237":[[23,null]],"\u8d44\u6e90\u548c\u5b66\u4e60\u6750\u6599":[[15,null]],"\u8fc1\u79fb\u6307\u5357":[[10,null]]},"docnames":["code_of_conduct","constants","contributing","ens","ens_overview","filters","gas_price","index","internals","middleware","migration","overview","providers","quickstart","release_notes","resources","subscriptions","toc","transactions","troubleshooting","web3.beacon","web3.contract","web3.eth","web3.eth.account","web3.geth","web3.main","web3.net","web3.tracing","web3.utils"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1},"filenames":["code_of_conduct.rst","constants.rst","contributing.rst","ens.rst","ens_overview.rst","filters.rst","gas_price.rst","index.rst","internals.rst","middleware.rst","migration.rst","overview.rst","providers.rst","quickstart.rst","release_notes.rst","resources.rst","subscriptions.rst","toc.rst","transactions.rst","troubleshooting.rst","web3.beacon.rst","web3.contract.rst","web3.eth.rst","web3.eth.account.rst","web3.geth.rst","web3.main.rst","web3.net.rst","web3.tracing.rst","web3.utils.rst"],"indexentries":{"async_handle_offchain_lookup() \uff08web3.utils.utils \u65b9\u6cd5\uff09":[[28,"web3.utils.utils.async_handle_offchain_lookup",false]],"ens":[[3,"module-ens",false]],"get_create2_address() \uff08web3.utils.utils \u65b9\u6cd5\uff09":[[28,"web3.utils.utils.get_create2_address",false]],"get_create_address() \uff08web3.utils.utils \u65b9\u6cd5\uff09":[[28,"web3.utils.utils.get_create_address",false]],"handle_offchain_lookup() \uff08web3.utils.utils \u65b9\u6cd5\uff09":[[28,"web3.utils.utils.handle_offchain_lookup",false]],"module":[[3,"module-ens",false],[28,"module-web3.utils",false]],"utils.simplecache\uff08web3.utils \u4e2d\u7684\u7c7b\uff09":[[28,"web3.utils.utils.SimpleCache",false]],"web3.utils":[[28,"module-web3.utils",false]]},"objects":{"":[[3,2,0,"-","ens"],[12,1,1,"","socket"],[25,2,0,"-","web3"]],"BaseProvider":[[8,0,1,"","is_connected"],[8,0,1,"","make_request"],[8,1,1,"","middleware"]],"Beacon":[[20,0,1,"","get_attestations"],[20,0,1,"","get_attester_slashings"],[20,0,1,"","get_beacon_heads"],[20,0,1,"","get_beacon_state"],[20,0,1,"","get_blob_sidecars"],[20,0,1,"","get_block"],[20,0,1,"","get_block_attestations"],[20,0,1,"","get_block_header"],[20,0,1,"","get_block_headers"],[20,0,1,"","get_block_root"],[20,0,1,"","get_deposit_contract"],[20,0,1,"","get_epoch_committees"],[20,0,1,"","get_finality_checkpoint"],[20,0,1,"","get_fork_data"],[20,0,1,"","get_fork_schedule"],[20,0,1,"","get_genesis"],[20,0,1,"","get_hash_root"],[20,0,1,"","get_health"],[20,0,1,"","get_node_identity"],[20,0,1,"","get_peer"],[20,0,1,"","get_peers"],[20,0,1,"","get_proposer_slashings"],[20,0,1,"","get_spec"],[20,0,1,"","get_syncing"],[20,0,1,"","get_validator"],[20,0,1,"","get_validator_balances"],[20,0,1,"","get_validators"],[20,0,1,"","get_version"],[20,0,1,"","get_voluntary_exits"]],"Web3.middleware_onion":[[9,0,1,"","add"],[9,0,1,"","clear"],[9,0,1,"","inject"],[9,1,1,"","middleware"],[9,0,1,"","remove"],[9,0,1,"","replace"]],"ens":[[4,1,1,"","strict_bytes_type_checking"]],"web3":[[25,3,1,"","Web3"],[21,2,0,"-","contract"],[22,2,0,"-","eth"],[24,2,0,"-","geth"],[26,2,0,"-","net"],[27,2,0,"-","tracing"],[28,2,0,"-","utils"]],"web3.Web3":[[25,1,1,"","HTTPProvider"],[25,1,1,"","IPCProvider"],[25,1,1,"","api"],[25,0,1,"","batch_requests"],[25,1,1,"","client_version"],[25,1,1,"","eth"],[25,0,1,"","from_wei"],[25,1,1,"","geth"],[25,0,1,"","is_address"],[25,0,1,"","is_checksum_address"],[25,0,1,"","keccak"],[25,0,1,"","solidity_keccak"],[25,0,1,"","to_bytes"],[25,0,1,"","to_checksum_address"],[25,0,1,"","to_hex"],[25,0,1,"","to_int"],[25,0,1,"","to_json"],[25,0,1,"","to_text"],[25,0,1,"","to_wei"]],"web3._utils.caching":[[8,3,1,"","RequestInformation"]],"web3._utils.caching.RequestInformation":[[8,1,1,"","method"],[8,1,1,"","middleware_response_processors"],[8,1,1,"","params"],[8,1,1,"","response_formatters"],[8,1,1,"","subscription_id"]],"web3.contract":[[21,3,1,"","Contract"],[21,3,1,"","ContractCaller"],[21,3,1,"","ContractEvent"],[21,3,1,"","ContractFunction"]],"web3.contract.Contract":[[21,1,1,"","abi"],[21,1,1,"","address"],[21,0,1,"","all_events"],[21,0,1,"","all_functions"],[21,1,1,"","bytecode"],[21,1,1,"","bytecode_runtime"],[21,0,1,"","constructor"],[21,0,1,"","decode_function_input"],[21,1,1,"","decode_tuples"],[21,0,1,"","encode_abi"],[21,1,1,"","events"],[21,0,1,"","find_events_by_name"],[21,0,1,"","find_events_by_selector"],[21,0,1,"","find_events_by_topic"],[21,0,1,"","find_functions_by_args"],[21,0,1,"","find_functions_by_name"],[21,1,1,"","functions"],[21,0,1,"","get_event_by_name"],[21,0,1,"","get_event_by_selector"],[21,0,1,"","get_event_by_signature"],[21,0,1,"","get_event_by_topic"],[21,0,1,"","get_function_by_args"],[21,0,1,"","get_function_by_name"],[21,0,1,"","get_function_by_selector"],[21,0,1,"","get_function_by_signature"]],"web3.contract.Contract.events.your_event_name":[[21,0,1,"","build_filter"],[21,0,1,"","create_filter"]],"web3.contract.Contract.fallback":[[21,0,1,"","build_transaction"],[21,0,1,"","call"],[21,0,1,"","estimate_gas"],[21,0,1,"","transact"]],"web3.contract.ContractEvent":[[21,0,1,"","process_log"]],"web3.contract.ContractFunction":[[21,0,1,"","build_transaction"],[21,0,1,"","call"],[21,0,1,"","estimate_gas"],[21,0,1,"","transact"]],"web3.eth":[[22,3,1,"","Eth"]],"web3.eth.Eth":[[22,1,1,"","accounts"],[22,0,1,"","blob_base_fee"],[22,1,1,"","block_number"],[22,0,1,"","call"],[22,1,1,"","chain_id"],[22,0,1,"","contract"],[22,0,1,"","create_access_list"],[22,1,1,"","default_account"],[22,1,1,"","default_block"],[22,0,1,"","estimate_gas"],[22,0,1,"","fee_history"],[22,0,1,"","filter"],[22,1,1,"","gas_price"],[22,0,1,"","generate_gas_price"],[22,0,1,"","get_balance"],[22,0,1,"","get_block"],[22,0,1,"","get_block_number"],[22,0,1,"","get_block_transaction_count"],[22,0,1,"","get_code"],[22,0,1,"","get_filter_changes"],[22,0,1,"","get_filter_logs"],[22,0,1,"","get_logs"],[22,0,1,"","get_proof"],[22,0,1,"","get_raw_transaction"],[22,0,1,"","get_raw_transaction_by_block"],[22,0,1,"","get_storage_at"],[22,0,1,"","get_transaction"],[22,0,1,"","get_transaction_by_block"],[22,0,1,"","get_transaction_count"],[22,0,1,"","get_transaction_receipt"],[22,0,1,"","get_uncle_by_block"],[22,0,1,"","get_uncle_count"],[22,1,1,"","max_priority_fee"],[22,0,1,"","modify_transaction"],[22,0,1,"","replace_transaction"],[22,0,1,"","send_raw_transaction"],[22,0,1,"","send_transaction"],[22,0,1,"","set_contract_factory"],[22,0,1,"","set_gas_price_strategy"],[22,0,1,"","sign"],[22,0,1,"","sign_transaction"],[22,0,1,"","sign_typed_data"],[22,0,1,"","simulateV1"],[22,0,1,"","subscribe"],[22,1,1,"","syncing"],[22,0,1,"","uninstall_filter"],[22,0,1,"","unsubscribe"],[22,0,1,"","wait_for_transaction_receipt"]],"web3.gas_strategies":[[6,2,0,"-","rpc"],[6,2,0,"-","time_based"]],"web3.gas_strategies.rpc":[[6,0,1,"","rpc_gas_price_strategy"]],"web3.gas_strategies.time_based":[[6,0,1,"","construct_time_based_gas_price_strategy"]],"web3.geth":[[24,2,0,"-","admin"],[24,2,0,"-","debug"],[24,2,0,"-","txpool"]],"web3.geth.admin":[[24,0,1,"","add_peer"],[24,0,1,"","datadir"],[24,0,1,"","node_info"],[24,0,1,"","peers"],[24,0,1,"","start_http"],[24,0,1,"","start_ws"],[24,0,1,"","stop_http"],[24,0,1,"","stop_ws"]],"web3.geth.debug.Debug":[[24,0,1,"","trace_transaction"]],"web3.geth.txpool.TxPool":[[24,0,1,"","content"],[24,0,1,"","inspect"],[24,0,1,"","status"]],"web3.middleware":[[9,3,1,"","AttributeDictMiddleware"],[9,3,1,"","BufferedGasEstimateMiddleware"],[9,3,1,"","ENSNameToAddressMiddleware"],[9,3,1,"","ExtraDataToPOAMiddleware"],[9,3,1,"","GasPriceStrategyMiddleware"],[9,0,1,"","LocalFilterMiddleware"],[9,0,1,"","SignAndSendRawMiddlewareBuilder"],[9,0,1,"","StalecheckMiddlewareBuilder"],[9,3,1,"","ValidationMiddleware"]],"web3.net":[[26,0,1,"","listening"],[26,0,1,"","peer_count"],[26,0,1,"","version"]],"web3.providers.eth_tester":[[12,3,1,"","AsyncEthereumTesterProvider"],[12,3,1,"","EthereumTesterProvider"]],"web3.providers.ipc":[[12,3,1,"","IPCProvider"]],"web3.providers.legacy_websocket":[[12,3,1,"","LegacyWebSocketProvider"]],"web3.providers.persistent":[[12,3,1,"","AsyncIPCProvider"],[12,3,1,"","PersistentConnectionProvider"],[12,3,1,"","WebSocketProvider"]],"web3.providers.persistent.persistent_connection":[[12,3,1,"","PersistentConnection"]],"web3.providers.persistent.persistent_connection.PersistentConnection":[[12,0,1,"","make_request"],[12,0,1,"","process_subscriptions"],[12,0,1,"","recv"],[12,0,1,"","send"],[12,1,1,"","subscriptions"]],"web3.providers.persistent.request_processor":[[8,3,1,"","RequestProcessor"]],"web3.providers.rpc":[[12,3,1,"","AsyncHTTPProvider"],[12,3,1,"","HTTPProvider"]],"web3.providers.rpc.utils":[[8,3,1,"","ExceptionRetryConfiguration"]],"web3.providers.rpc.utils.ExceptionRetryConfiguration":[[8,1,1,"","backoff_factor"],[8,1,1,"","errors"],[8,1,1,"","method_allowlist"],[8,1,1,"","retries"]],"web3.tracing":[[27,0,1,"","trace_block"],[27,0,1,"","trace_call"],[27,0,1,"","trace_filter"],[27,0,1,"","trace_raw_transaction"],[27,0,1,"","trace_replay_block_transactions"],[27,0,1,"","trace_replay_transaction"],[27,0,1,"","trace_transaction"]],"web3.utils":[[5,2,0,"-","filters"]],"web3.utils.filters":[[5,3,1,"","BlockFilter"],[5,3,1,"","Filter"],[5,3,1,"","LogFilter"],[5,3,1,"","TransactionFilter"]],"web3.utils.filters.Filter":[[5,1,1,"","filter_id"],[5,0,1,"","format_entry"],[5,0,1,"","get_all_entries"],[5,0,1,"","get_new_entries"],[5,0,1,"","is_valid_entry"]],"web3.utils.filters.LogFilter":[[5,0,1,"","set_data_filters"]],"web3.utils.utils":[[28,3,1,"","SimpleCache"],[28,0,1,"","async_handle_offchain_lookup"],[28,0,1,"","get_create2_address"],[28,0,1,"","get_create_address"],[28,0,1,"","handle_offchain_lookup"]],"web3.w3":[[25,0,1,"","attach_modules"],[25,0,1,"","is_encodable"],[25,1,1,"","strict_bytes_type_checking"]]},"objnames":{"0":["py","method","Python \u65b9\u6cd5"],"1":["py","attribute","Python \u5c5e\u6027"],"2":["py","module","Python \u6a21\u5757"],"3":["py","class","Python \u7c7b"]},"objtypes":{"0":"py:method","1":"py:attribute","2":"py:module","3":"py:class"},"terms":{"000":[5,9],"0000":22,"000000005":19,"000f":25,"0018512333048507866":22,"0036988514889990873":22,"007390479689642084":22,"00741217041320997":22,"024":22,"0b1":14,"0th":[9,25],"0x":[10,14,19,21,22,23,24,25],"0x0":[5,21,22,24,25],"0x00":22,"0x00000000":[20,21],"0x0000000000000000":[13,20,22],"0x0000000000000000000000000000000000000000":[13,18,19,21,22,24],"0x000000000000000000000000000000000000000000000000":22,"0x0000000000000000000000000000000000000000000000000000000000000000":[13,20,22,24],"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000":22,"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000":[13,22],"0x0000000000000000000000000000000000000000000000000000000000000000dddc391ab2bf6701c74d0c8698c2e13355b2e4150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000":13,"0x0000000000000000000000000000000000000000000000000000000000000001":[22,24],"0x0000000000000000000000000000000000000000000000000000000000000003":[22,23],"0x0000000000000000000000000000000000000000000000000000000000000007":[22,23],"0x000000000000000000000000000000000000000000000000000000000000000a":5,"0x0000000000000000000000000000000000000000000000000000000000003039":21,"0x00000000000000000000000000000000000000000000000000000ed18fcc7811":24,"0x00000000000000000000000000000000000000000000000000120a0b063499d4":22,"0x00000000000000000000000000000000000000000000000053f53dfc545d56a6":24,"0x00000000000000000000000000000000000000000000000053f54ccde429ceb70000000000000000000000000000000000000000001635eb93ecdb339a7dc022000000000000000000000000000000000000000000000000000000006641f6cf":24,"0x0000000000000000000000000000000000000001":21,"0x0000000000000000000000000000000000000002":21,"0x000000000000000000000000000000000000007e37d4560e547e265a1a7dc022":24,"0x000000000000000000000000000000000000dead":22,"0x000000000000000000000000754c50465885f1ed1fa1a55b95ee8ecf3f1f4324":22,"0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":24,"0x00002009":20,"0x000f":25,"0x0080020004000000008208000102000905":20,"0x00f338cfdb0c22bb85beed9042bd19fff58ad6421c8a833f8bc902b7cca06f5f":20,"0x01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529":21,"0x0216d5032f356960cd3749c31ab34eeff21b3395":24,"0x022c0d9f00000000000000000000000000000000000000000000000053f53dfc545d56a600000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000":24,"0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c":22,"0x02f8b00180843b9aca0084773594008301117094fb6916095ca1df60bb79ce92ce3ea74c37c5d35980b844a9059cbb000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000001c001a0cec4150e52898cf1295cc4020ac0316cbf186071e7cdc5ec44eeb7cdda05afa2a06b0b3a09c7fb0112123c0bef1fd6334853a9dcf3cb5bab3ccd1f5baae926d449":23,"0x02f8e20180843b9aca008477359400831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca0080f872f85994de0b295669a9fd93d5f28d9ec85e40f4cb697baef842a00000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000007d694bb9bc244d798123fde783fcc1c72d3bb8c189413c001a0b9ec671ccee417ff79e06e9e52bfa82b37cf1145affde486006072ca7a11cf8da0484a9beea46ff6a90ac76e7bbf3718db16a8b4b09cef477fb86cf4e123d98fd":23,"0x041e14603f35a82f6023802fec96ef760433292434a39787514f140950597e5":22,"0x05000000":20,"0x0902f1ac":24,"0x09511acf75918fd03de58141d2fd409af4fd6d3dce48eb3aa1656c8f3c2c5c21":9,"0x095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000000000000000007e37be2022c0914b2680000000":24,"0x095ea7b30000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf000000000000000000000000000000000000000000000000000000000000000a":21,"0x0f":20,"0x0f6000de1578619320aba5e392706b131fb1de6f":24,"0x1":25,"0x10b72dc28":22,"0x10b780340":22,"0x10b7803d8":22,"0x123":4,"0x1234":25,"0x139b148094c50f4d20b01caf21b85edb711574db":24,"0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750":23,"0x15f90":24,"0x17dd9ca0af":22,"0x19a99f0cf456000":24,"0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401":22,"0x1ab7c0b0a2a4bbb5a1495da8c142150891fc64e0c321e1feb70bd5f881951f7":22,"0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505":20,"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347":[13,22],"0x1f161421c8e0000":24,"0x1f5e460eb84dc0606ab74189dbcfe617300549f8f4778c3c9081c119b5b5d1c1":13,"0x1f9840a85d5af5bf1d1762f925bdaddc4201f988":21,"0x2":[9,23,24],"0x22":24,"0x233002c671295529bcc50b76a2ef2b0de2dac2d93945fca745255de1a9e4017":25,"0x23b872dd000000000000000000000000a0457775a08b175cbb444ed923556dc67ec5dc1100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d000000000000000000000000000000000000007e37be2022c0914b2680000000":24,"0x24a461f25ee6a318bdef7f33de634a67bb67ac9d":24,"0x24d407e5a0b506e1cb2fae163100b5de01f5193c":24,"0x26588a9301b0428d95e6fc3a5024fce8bec12d51":24,"0x27c8f899bb69e1501bbb96d09d7477a2a7518918":23,"0x2910543af39aba0cd09dbb2d50200b3e800a63d2":24,"0x296c7fb6ccafa3e689950b947c2895b07357c95b066d5cdccd58c301f41359a3":22,"0x2a65aca4d5fc5b5c859090a6c34d164135398226":24,"0x2b5ad5c4795c026514f8317c7a215e218dccd6cf":21,"0x2e1a7d4d00000000000000000000000000000000000000000000000053f53dfc545d56a6":24,"0x2fefd8":22,"0x2ff37b5607484cd4eecf6d13292e22bd6e5401eaffcc07e279583bc742c68882":25,"0x3":24,"0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d":20,"0x31323334":21,"0x326":24,"0x3375ee30428b2a71c428afa5e89e427905f95f7":24,"0x346fb27de7e7370008f5da379f74dd49f5f2f80f":24,"0x34e8a230f11536ab2ec56a0956e1f3b3fd703861f96d4695877eaa48fbacc241":20,"0x36f0548a77bfb1d5935483d25cc40633b46e2f4d":24,"0x3a3c0698552eec2455ed3190eac3996feccc806970a4a056106deaf6ceb1e5e3":24,"0x3b05c6d5524209f1":22,"0x3b9aca00":24,"0x3dcb4c90477a4b8ff7190b79b524773cbe3be661":24,"0x3e2a7fe169c8f8eee251bb00d9fb6d304ce07d3a":24,"0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8c":23,"0x40c51804800dee88e14e69826cfe51bc5f25f61935331e8aa6d8d7771fb36350":21,"0x4177e670ec6431606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1528989":22,"0x44c72":24,"0x45e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a":22,"0x468569500925d53e06dd0993014ad166fd7dd381":24,"0x476574682f686261722f76312e302e312f6c696e75782f676f312e342e32":22,"0x477a5c98":22,"0x480c4aec9fa":23,"0x48656c6c6f00000000000000000000000000000000000000000000000000000a":22,"0x48b3bd66770b0d1eecefce090dafee36257538a":24,"0x499ba555e8e8be639dd84be1be6d54409738facefc662f37d97065aa91a1a8d4":20,"0x49e299a55346":23,"0x49eddd3769c0712032808d86597b84ac5c2f5614":25,"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318":23,"0x4cb06c43fcdabea22541fcf1f856a6a296448b6c":22,"0x4dc0a72959803a84ee0231160b05dda76a91b8f8b77220b4cfc7db160840b8a8":20,"0x4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45":25,"0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd":[21,22],"0x4e910ac762815c13e316e72506141f5b6b441d58af8e0a049cd3341c25728752":20,"0x4ff4a38b278ab49f7739d3a4ed4e12714386a9fdf72192f2e8f7da7822f10b4d":21,"0x50a826df121f4d076a3686d74558f40082a8e70b3469d8e9a16ceb2a79102e5":10,"0x5208":24,"0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178291ffeb8750":13,"0x551332d96d085185ab4019ad8bcf89c45321e136c261eb6271e574a2edf1461f":22,"0x55c6a972":22,"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421":[13,22],"0x56feb11b000000000000000000000000ec4cf8dcb526080792bc98e1ef41fb4775777b6b000000000000000000000000000000000000007e37be2022c0914b2680000000":24,"0x576f25199d60982a8f31a8dff4da8acb982e6aba":24,"0x5798fbc45e3b63832abc4984b0f3574a13545f415dd672cd8540cd71f735db56":21,"0x57b30c59fc39a50e1cba90e3099286dfa5aaf60294a629240b5bbec6e2e66576":24,"0x57ebf07eb9ed1137d41447020a25e51d30a0c272b5896571499c82c33ecb7288":22,"0x582ac4d8929f58c217d4a52add361ae470a8a4cd":[21,22],"0x5b2063246f2191f18f2675cedb8b28102e957458":4,"0x5b30608c678e1ac464a8994c3b33e5cdf3497112":24,"0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060":22,"0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12":23,"0x5d2b7e3f1af09995":22,"0x5df9b87991262f6ba471f09758cde1c0fc1de734":22,"0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2":25,"0x6":24,"0x6060604052361561027c5760e060020a60003504630199":22,"0x60803251d43f072904dc3a2d6a084701cd35b4985790baaf8a8f76696041b272":24,"0x608060806080608155":22,"0x612e45a3000000000000000000000000b656b2a9c3b2416437a811e07466ca712f5a5b5a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000116c6f6e656c792c20736f206c6f6e656c7900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000":21,"0x61626364":21,"0x6162636464":21,"0x61c808d82a3ac53231750dadc13c777b59310bd9":22,"0x6368f3f8c2b42435d6c136757382e4a59436a681":24,"0x636f776dc3b6":25,"0x685b2226cbf6e1f890211010aa192bf16f0a0cba9534264a033b023d7367b845":22,"0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87":20,"0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b":22,"0x6dfef5bc94b031407ffe71ae8076ca0fbf190963":24,"0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d":24,"0x70a082310000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d":24,"0x71d32db179a1291de86b5f7fa15224292ef9ee6ebb3fa62484896601d9f20d5f":22,"0x7320785200f74861b69c49e4ab32399a71b34f1a":24,"0x736f6d652d746578742d74c3b62d7369676e":22,"0x74656b752f76302e31322e31342b34342d673863656562663600000000000000":20,"0x747874":25,"0x748db062639a45e519dba934fce09c367c92043867409160c9989673439dc817":23,"0x77359400":24,"0x77517b1491a0299a44d668473411676f94e97e34":24,"0x7773ed5a7e944c6238cd0a5c32170663ef2be9efc594fb43ad0f07ecf4c09d2b":20,"0x781f0166e34c361ce2c88070c1389145abba2836edcb446338a2ca2b0054826":20,"0x791ac947000000000000000000000000000000000000007e37be2022c0914b2680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000e11418f9961248da36b1008b1090235f680ae8f5000000000000000000000000000000000000000000000000000000006641fe7f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ec4cf8dcb526080792bc98e1ef41fb4775777b6b000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":24,"0x79af0c7688afba7588c32a61565fd488c422da7b5773f95b242ea66d3d20afda":22,"0x7a250d5630b4cf539739df2c5dacb4c659f2488d":24,"0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005":21,"0x7e5f4552091a69125d5dfcb7b8c2659029395bdf":21,"0x7f69a91a3cf4be60020fb58b893b7cbb65376db8":24,"0x7fb0a12d11ffe8a48c2ff80dca17adbcc1da5f6aadaaef2b338717dcdeecf6dab9fd7c4e4265cfbc097cd31dcb19e836":20,"0x7fe3e4c21bde162214b715aabce05391301e9f5b":24,"0x8383534d0bcd0186d326c993031311c0ac0d9b2d":24,"0x84aea4a7aad5c5899bd5cfc7f309cc379009d30179316a2a7baa4a2ea4a438ac":22,"0x86fbfe56cce542ff0a2a2716c31675a0c9c43701725c4a751d20ee2ddf8a733d":22,"0x87b549448d36e5e8b1783944b5511a05f34bb78ad3fcbf71a1adb346eed363d46e50d51ac53cd23bd03d0107d064e05913a6ef10f465f9171aba3b2b8a7a4d621c9e18d5f148813295a2d5aa5053029ccbd88cec72130833de2b4b7addf7faca":20,"0x885d2b7e3f1af09995":22,"0x88ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0":22,"0x89cb78044843805fb4dab8abd743fc96c2b8e955c58f9b7224d468d85ef57130":20,"0x8a22225ed7ed460d7ee3842bce2402b9dead23d3":11,"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925":21,"0x8c5fecdc472e27bc447696f431e425d02dd46a8c":20,"0x8ce2b1bf8e25a06a8ca34c647ff5fd0fa48ac725cc07f657ae1645ab8ef68c91":22,"0x8db7b4e0ecb095fbd01dffa62010801296a9ac78":24,"0x8e245a52a0a680fcfe789013e123880c321f237de10cad108dc55dd47290d7cfe50cdaa003c6f783405efdac48cef44e152493abba40d9f9815a060dd6151cb0635906c9e3c1ad4859cada73ccd2d6b8747e4aeeada7d75d454bcc8672afa813":20,"0x9061b923":4,"0x913c99ea930c78868f1535d34cd705ab85929b2eaaf70fcd09677ecd6e5d75e9":25,"0x9174e688d7de157c5c0583df424eaab2676ac162":24,"0x91fe3039271d43d3f8479f60cc5293bc8a461b75":24,"0x9202a9d5d2d129cb400a40e00ac822a53ed81167":23,"0x92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a":21,"0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a":20,"0x9436e8a630e3162b7ed4f449b12b8a5a368a4b95bc46b941ae65c11613bfa4c1":20,"0x958c1fa64b34db746925c6f8a3dd81128e40355":24,"0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3":24,"0x967dd2946358db7e426ed19d4576bc75123520ef6a489ca50002222070ee4611f9cef394e5e3071236a93b825f18a4ad07f1d5a1405e6c984f1d71e03f535d13a2156d6ba22cb0c2b148df23a7b8a7293315d6e74b9a26b64283e8393f2ad4c5":20,"0x96dbad955b166f5119793815c36f11ffa909859bbfeb64b735cca37cbf10bef1":22,"0x976a3fc5d6f7d259ebfb4cc2ae75115475e9867c":24,"0x9773547e27f8303c87089dc42d9288aa2b9d8f06":24,"0x9987754077fe6100a60c75d81a51b1ef457d019404d1546a66f4f5d6c23fae45":20,"0x99d37d1f7dd15859995330f75c158346f86d298e2ffeedfbf1b38dcf3df89a7dbd1b34815f3bcd1b2a5588592a35b783":20,"0x9b11bf0459b0c4b2f87f8cebca4cfc26f294b63a":24,"0x9b6443b0fb9c241a7fdac375595cea13e6b7807a":5,"0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678":21,"0xa0041e14603f35a82f6023802fec96ef760433292434a39787514f140950597e5":22,"0xa0457775a08b175cbb444ed923556dc67ec5dc11":24,"0xa1e4380a3b1f749673e270229993ee55f35663b4":22,"0xa30d70b3e62ff776fe97f7f8b3472194af66849238a958880510e698ec3b8a470916680b1a82f9d4753c023153fbe6db10c464ac532c1c9c8919adb242b05ef7152ba3e6cd08b730eac2154b9802203ead6079c8dfb87f1e900595e6c00b4a9a":20,"0xa3873e7b1e0bcc7c59013340cfea59dff16e42e79825e7b8ab6c243dbafd4fe0":20,"0xa6bc01d7707e94b62dccb8d097df1db25d6b44fad35463ecc99c9e5822e7aa5f":22,"0xa9059cbb0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000053f53dfc545d56a6":24,"0xa9059cbb000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000001":23,"0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796":24,"0xab":21,"0xad5c4648":24,"0xaf6c4695da477f8c663ea2d8b768ad82cb6a8522":24,"0xaf953a2d01f55cfe080c0c94150a60105e8ac3d51153058a1f03dd239dd08586":24,"0xb18f9d01323e150096650ab989cfecd39d757aec":24,"0xb2916c870cf66967b6510b76c07e9d13a5d23514":24,"0xb2dba64c905dea42e940d67b8e0f44019f4a61c4833a9cba99c426b748d9e1a4":22,"0xb31f174d27b99cdae8e746bd138a01ce60d8dd7b224f7c60845914def05ecc58":22,"0xb5b8b853af32226755a65ba0602f7ed0e8be2211516153b75e9ed640a7d359f":24,"0xb61d27f600000000000000000000000024d407e5a0b506e1cb2fae163100b5de01f5193c00000000000000000000000000000000000000000000000053444835ec580000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000":24,"0xb656b2a9c3b2416437a811e07466ca712f5a5b5a":21,"0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0":22,"0xbb399fda70617a6f198b3d9f1c1cdbd70077677231b84f34e58568c9dc903558":20,"0xbb9bc244d798123fde783fcc1c72d3bb8c189413":[22,23,24],"0xbbbe846b616911d13780f58f500f8948e0878ba6f55cae7432da915cab3ba2b6":22,"0xbbcd1e45eae3b859203a04be7d6e1d7b03b222ec1d66dfcc8011dd39794b147":24,"0xbc0ca4f217e052753614d6b019948824d0d8688b":24,"0xbd63bb89e7475591a0a6fc9014307bc4":22,"0xbe4532e1b1db5c913cf553be76180c1777055403":22,"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2":[5,8,16,24],"0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6":22,"0xc100000000000000000000000000000000000000":22,"0xc305c901078781c232a2a521c2af7980f8385ee9":22,"0xc32558881dbb791ef045c48e3709a0978dc445abee4ae34d30df600eb5fbbb3d":20,"0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef":22,"0xc78c35720d930f9ef34b4e6fb9d02ffec936f9b02a8f0fa858456e4afd4d5614":22,"0xca609fb606a04ce6aaec76415cd0b9d8c2bc83ad2a4d17db7fd403ee7d97bf40":22,"0xcb95151142ea56dbf2753d70388aef202a7bb5a1e323d448bc19f1d2e1fe3dc9":21,"0xcc30e8a9b15c548d5bf113c834143a8f0e1909fbfea96b2a208dc154293a78cf":22,"0xcd79c72690750f079ae6ab6ccd7e7aedc03c7720":24,"0xce4c4f0a0b810b":22,"0xcf888cc4fae8a3d774e574ef8c6a261958287d04":24,"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2":20,"0xd2593d3445a9f0f4c776715f5206fbf4ca6a0475":24,"0xd3cda913deb6f67967b99d67acdfa1712c293601":[22,25],"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3":24,"0xd7278090a36507640ea6b7a0034b69b0d240766fa3f98e3722be93c613b29d2":25,"0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68":21,"0xdb5e":22,"0xdc3a9db694bcdd55ebae4a89b22ac6d12b3f0c24":22,"0xdd62ed3":21,"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef":16,"0xde0b295669a9fd93d5f28d9ec85e40f4cb697ba":[11,22,23],"0xe11418f9961248da36b1008b1090235f680ae8f5":24,"0xe39c55ead9f997f7fa20ebe40fb4649943d7db66":24,"0xe4b883e5bda9e7a59ee4bb99e9b1bc":22,"0xe65b00b698ba37c614af350761c735c5f4a82b4ab365a1f1022d49d9dfc8e930":22,"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331":22,"0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3":23,"0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb33e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce1c":23,"0xe85ce7efa52c16cb5c469c7bde54fbd4911639fdfde08003f65525a85076d915":23,"0xe8ad537a261e6fff80d551d8d087ee0f2202da9b09b64d172a5f45e818eb472a":22,"0xea674fdde714fd979de3edf0f56aa9716b898ec8":24,"0xebe866f5f0a06000":24,"0xebec21ee1da40000":24,"0xec4cf8dcb526080792bc98e1ef41fb4775777b6b":24,"0xec6434e6701771606e55d6b4ca35a1a6b75ee3d73315145a921026d15299d05":22,"0xec7ef54f1fd81bada8170dd0cb6be8216f8ee2f445e6936f95f5c6894a4a3b38":20,"0xf":25,"0xf0109fc8df283027b6285cc889f5aa624eac1f55":[22,23],"0xf2e246bb76df876cef8b38ae84130f4f55de395b":21,"0xf5":21,"0xf70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb15":21,"0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa":22,"0xf843a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563a1a048656c6c6f00000000000000000000000000000000000000000000000000000a":22,"0xf86907843b9aca0082520894dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd018086eecac466e115a0f9db4e25484b28f486b247a372708d4cd0643fc63e604133afac577f4cc1eab8a044841d84e799d4dc18ba146816a937e8a0be8bc296bd8bb8aea126de5e627e06":22,"0xf869a020d13b52a61d3c1325ce3626a51418adebd6323d4840f1bdd93906359d11c933b846f8440180a01ab7c0b0a2a4bbb5a1495da8c142150891fc64e0c321e1feb70bd5f881951f7ea0551332d96d085185ab4019ad8bcf89c45321e136c261eb6271e574a2edf1461f":22,"0xf891808080a0c7d094301e0c54da37b696d85f72de5520b224ab2cf4f045d8db1a3374caf0488080a0fc5581783bfe27fab9423602e1914d719fd71433e9d7dd63c95fe7e58d10c9c38080a0c64f346fc7a21f6679cba8abdf37ca2de8c4fcd8f8bcaedb261b5f77627c93908080808080a0ddef2936a67a3ac7d3d4ff15a935a45f2cc4976c8f0310aed85daf763780e2b480":22,"0xf90151a097b17a89fd2c03ee98cb6459c08f51b269da5cee46650e84470f62bf83b43efe80a03b269d284a4c3cf8f8deacafb637c6d77f607eec8d75e8548d778e629612310480a01403217a7f1416830c870087c524dabade3985271f6f369a12b010883c71927aa0f592ac54c879817389663be677166f5022943e2fe1b52617a1d15c2f353f27dda0ac8d015a9e668f5877fcc391fae33981c00577096f0455b42df4f8e8089ece24a003ba34a13e2f2fb4bf7096540b42d4955c5269875b9cf0f7b87632585d44c9a580a0b179e3230b07db294473ae57f0170262798f8c551c755b5665ace1215cee10ca80a0552d24252639a6ae775aa1df700ffb92c2411daea7286f158d44081c8172d072a0772a87d08cf38c4c68bfde770968571abd16fd3835cb902486bd2e515d53c12d80a0413774f3d900d2d2be7a3ad999ffa859a471dc03a74fb9a6d8275455f5496a548080":22,"0xf9019180a01ace80e7bed79fbadbe390876bd1a7d9770edf9462049ef8f4b555d05715d53ea049347a3c2eac6525a3fd7e3454dab19d73b4adeb9aa27d29493b9843f3f88814a085079b4abcd07fd4a5d6c52d35f4c4574aecc85830e90c478ca8c18fcbe590de80a02e3f8ad7ea29e784007f51852b9c3e470aef06b11bac32586a8b691134e4c27da064d2157a14bc31f195f73296ea4dcdbe7698edbf3ca81c44bf7730179d98d94ca09e7dc2597c9b7f72ddf84d7eebb0fe2a2fa2ab54fe668cd14fee44d9b40b1a53a0aa5d4acc7ac636d16bc9655556770bc325e1901fb62dc53770ef9110009e080380a0d5fde962bd2fb5326ddc7a9ca7fe0ee47c5bb3227f838b6d73d3299c22457596a08691410eff46b88f929ef649ea25025f62a5362ca8dc8876e5e1f4fc8e79256d80a0673e88d3a8a4616f676793096b5ae87cff931bd20fb8dd466f97809a1126aad8a08b774a45c2273553e2daf4bbc3a8d44fb542ea29b6f125098f79a4d211b3309ca02fed3139c1791269acb9365eddece93e743900eba6b42a6a8614747752ba268f80":22,"0xf90211a03841a7ddd65c70c94b8efa79190d00f0ab134b26f18dcad508f60a7e74559d0ba0464b07429a05039e22931492d6c6251a860c018ea390045d596b1ac11b5c7aa7a011f4b89823a03c9c4b5a8ab079ee1bc0e2a83a508bb7a5dc7d7fb4f2e95d3186a0b5f7c51c3b2d51d97f171d2b38a4df1a7c0acc5eb0de46beeff4d07f5ed20e19a0b591a2ce02367eda31cf2d16eca7c27fd44dbf0864b64ea8259ad36696eb2a04a02b646a7552b8392ae94263757f699a27d6e9176b4c06b9fc0a722f893b964795a02df05d68bceb88eebf68aafde61d10ab942097afc1c58b8435ffd3895358a742a0c2f16143c4d1db03276c433696dddb3e9f3b113bcd854b127962262e98f43147a0828820316cc02bfefd899aba41340659fd06df1e0a0796287ec2a4110239f6d2a050496598670b04df7bbff3718887fa36437d6d8c7afb4eff86f76c5c7097dcc4a0c14e9060c6b3784e35b9e6ae2ad2984142a75910ccc89eb89dc1e2f44b6c58c2a009804db571d0ce07913e1cbacc4f1dc4fb8265c936f5c612e3a47e91c64d8e9fa063d96f38b3cb51b1665c6641e25ffe24803f2941e5df79942f6a53b7169647e4a0899f71abb18c6c956118bf567fac629b75f7e9526873e429d3d8abb6dbb58021a00fd717235298742623c0b3cafb3e4bd86c0b5ab1f71097b4dd19f3d6925d758da0096437146c16097f2ccc1d3e910d65a4132803baee2249e72c8bf0bcaaeb37e580":22,"0xf9a951af55470000":24,"0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359":23,"0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa":21,"0xfd801060af398c615f1ffb61586604aaf4fc688615cb1ff088531638a9b9e8e6":22,"0xfe1289fd3915794b99702202f65eea2e424b2f083a12749d29b4dd51f6dce40d":22,"0xfe89cc7abb2c4183683ab71653c4cdc9b02d44b7":4,"10":[4,5,9,12,21,22,24],"100":[6,9,21],"1000":[19,22],"10000":[5,21],"100000":[22,24],"1000000":[19,21,22,24],"1000000000":[9,18,19,21,22,23],"1000000000000":19,"1000000000000000":19,"1000000000000000000":[19,24,25],"1000000000000000000000":19,"1000000000000000000000000":[19,21],"1000000000000000000000000000":19,"1000000000000000000000000000000":19,"1000100":22,"1000767667434026200":24,"1005":14,"100596":20,"1006":14,"1008":14,"100k":14,"1010":14,"1014":28,"1024":[12,22],"1037":14,"1038":14,"1040":14,"104389933075820307925104709181714897380569894203213074526835978196648170704563":23,"1046":14,"1047859050000000000":24,"1047965690000000000":24,"1048126690000000000":24,"1048367260000000000":24,"1048598530000000000":24,"1049":14,"1050544770000000000":24,"1050828950000000000":24,"1051":14,"1051190740000000000":24,"1051546810000000000":24,"1064":14,"1069":14,"1070":14,"1072":14,"1082":14,"1085":14,"1095":14,"10d17f24":21,"10th":14,"11":[22,24,25],"1100":14,"110278":20,"110280":20,"1104":14,"1107":14,"1109":14,"1110":14,"1115":14,"1116":14,"1119":14,"1121":14,"1124":14,"1125":14,"1129":14,"1138":14,"1139":14,"1145":14,"1146":14,"1147":14,"1149":14,"115":24,"1150":14,"1156":14,"115792089237316195423570985008687907853269984665640564039457583959368602105927":24,"115792089237316195423570985008687907853269984665640564039457583973451623990927":24,"115792089237316195423570985008687907853269984665640564039457584007913129639927":24,"1158":14,"1160":14,"1162":14,"1163":14,"1164":14,"1165":14,"1166":14,"1168":14,"1171602790622":24,"1173":14,"1178":14,"1183":14,"1185":14,"1186":14,"1187":14,"1188":14,"119":24,"1191":14,"1192":14,"1194":14,"119442408":22,"1195":14,"1198":14,"1199":14,"11k":5,"11th":14,"12":[5,9,20,25],"120":[5,6,22],"1200":14,"1205":14,"1206":14,"1207":14,"1210":14,"1211":14,"121167":24,"1214":14,"1215":14,"1217":14,"1218":14,"122013":24,"1223":14,"1224":14,"1227":14,"1228":14,"123":[19,25],"123123123123123":18,"1232":14,"1234":[14,21,25],"12345":[21,22],"123456":9,"1234567":8,"12345678":22,"1235":14,"1237":14,"1242":14,"1247":14,"1249":14,"125":[8,14,21,22],"125270":24,"1255":14,"1262":14,"1263":14,"1268":14,"1269":14,"127":[8,11,12,13,20,24],"1270":14,"1274":14,"1275":14,"1277":14,"128":19,"1280":14,"1282":14,"1284":14,"1286":14,"1287":14,"1288":14,"1290":14,"1292":14,"1293":10,"1294":14,"1295":14,"1297":14,"1299":14,"12min":14,"13":21,"1301":14,"1307":14,"1308":14,"1310":14,"1311":14,"131277322940537":21,"1316":14,"1317":14,"1319":14,"1322":14,"1323":14,"1324":14,"1325":14,"1331":14,"1332":14,"1334":14,"1335":14,"1337":21,"1338":14,"1339":14,"1345":14,"1348":14,"1350":14,"1354":14,"1355":14,"1360":14,"136217133":22,"1364":14,"1366":14,"1372":14,"1376":14,"1378":14,"1379":14,"1380":14,"1382":14,"1383":14,"1384":14,"1385":14,"1389":14,"1390":14,"1393":14,"1394":14,"1395":14,"1398":14,"13th":14,"14":[9,19],"1400":14,"140000000000000000":24,"1401":14,"1403":14,"1404":14,"1405":14,"1410":14,"1413":14,"1416":14,"1417":14,"1418":14,"1419":14,"1423":14,"1425":14,"1427":14,"1433":14,"1437":14,"1440":14,"144300":24,"1444":14,"1445":14,"1446":14,"1451":14,"1453":14,"1460":14,"1461":14,"1464":14,"1467":14,"1468":14,"1469":14,"146e8e3e2460f1e18939a5da37c4a79f149c8b9837240d49c7d94c122f30064e07e4a42ae2c2992d0f8e7e6f68a30e7e9ad31d524349ec9d17effd2426a37b40":24,"1470173578":22,"1471":14,"1472":14,"1473":14,"1474":[14,24],"1475":14,"1476":14,"1478":14,"1479":14,"1482":14,"1483":14,"1488":14,"1489":14,"1492":14,"1493":14,"1498":14,"15":[15,20,25],"1501":14,"150633":24,"1514":14,"1515":14,"1516":14,"1518":14,"1521":14,"1527":14,"1530":9,"1531":14,"1532":14,"1534":14,"1536":14,"1537":14,"154003":24,"1541":14,"1544":14,"1545":14,"1546":14,"155":22,"1552":14,"1554":14,"155594425":22,"1559":[9,14,19,22],"1562":14,"1563":14,"1570":14,"1571":14,"1573":14,"1576":14,"1579":14,"1581":14,"1583":14,"1585":14,"1588":14,"1589":14,"1590":14,"1592":14,"1594":14,"15th":14,"16":2,"1601":14,"1602":14,"1605700807":20,"1607":14,"1609":14,"1610":14,"1612":14,"1614":14,"1615":14,"1617":14,"1622":14,"1623":14,"162367":20,"1626":14,"1630":14,"1633":14,"163587":20,"1636":14,"1639":14,"1646":14,"1647":14,"1652":14,"1660":14,"1663":14,"1664":14,"1665":14,"1666":14,"1668":14,"1669":14,"167":24,"1670":14,"1671":14,"1673":14,"1676":14,"1679":14,"168":12,"1680":14,"1681":14,"1682":14,"1683":14,"1686":14,"1687":14,"1690":14,"1691":14,"16998950000000000000":24,"16uiu2hakw1yvqf3rtmcbhmbklzbnhfgctudd6uo4x3wfzphgvnqv":20,"16uiu2hamejhiczgs8gwieylym3d148mzvz9izzsz8yqaywvpanmg":20,"16uiu2hamlz1cyvfkpa3wwn4cnknzqosum8hx3ghdhupeulqc9ix":20,"17":[2,18],"17000000000000000000":24,"1701":14,"1708":14,"1709":14,"1715":14,"17179869184":24,"1722":14,"1724":14,"1727":14,"1728":14,"1729":14,"1733":14,"1735":14,"1737":14,"1739921487":22,"1741":14,"1746":14,"1748":14,"1749":14,"175":21,"1752":14,"1753":14,"1757":14,"1758":14,"1759":14,"1767":14,"1768":14,"1773":14,"1774":14,"1775":14,"177634473":22,"1778":14,"1780":14,"1782":14,"1787":14,"1790":14,"17900000000000000000":24,"1791":14,"1794":14,"1796":14,"17990000000000000000":24,"18":[21,22],"180":21,"1801":14,"1805":14,"1806":14,"1807":14,"1813":14,"1814":14,"1815":14,"1816":14,"1824":14,"1825":14,"1827":14,"1828":14,"1829":14,"1831":14,"1833":14,"1834":14,"1836":14,"1837":14,"1839":14,"1841":14,"1844":14,"18446744073709551615":20,"1848":14,"1849":14,"1850":14,"1851":14,"1852":14,"1853":14,"1855":14,"185574":24,"1856":14,"1857":14,"1858":14,"1859":14,"1860":14,"1862":14,"1863":14,"1865":14,"1866":14,"1868":14,"1878":14,"1879":14,"1880":14,"1882":14,"1886":14,"1887":14,"1890":14,"1893":14,"1896":14,"1898":14,"19":23,"1900":14,"1905":14,"1906":14,"1907":14,"190861":20,"1909":14,"1910":14,"1913":14,"1915":14,"1916":14,"1917":14,"1919":14,"192":12,"1920":14,"1921":14,"1925":14,"1926":14,"1927":14,"1928":14,"1929":14,"1930":14,"1933":14,"1934":14,"1935":14,"1936":14,"1937":14,"1938":14,"1941":14,"19432":24,"1944":14,"1945":14,"1946":14,"1949":14,"1951":14,"1954":14,"1955":14,"1957":14,"1960":14,"1961":14,"1962":14,"1963":14,"1964":14,"1965":14,"1971":14,"1977":14,"1978":14,"1979":14,"1980":14,"1993":14,"1999":14,"1gb":23,"1st":25,"20":[1,5,6,12,19,22],"200":[20,21],"2000":22,"200000":18,"2000000":[22,23],"2000000000":[9,18,21,22,23],"20000000000":[6,22,24],"2002":14,"2005":14,"2008":14,"2011":14,"2015":[14,23],"2016":14,"2017":14,"2018":14,"2019":[10,15],"2022":[10,15],"202583058":22,"2028":14,"2029":14,"2035":14,"2037":14,"2038":14,"20382":24,"2039":14,"20426":5,"2044":14,"2048":14,"205":24,"2053":14,"2055":14,"2056":14,"2058":14,"2060":14,"2064":14,"2068":14,"2069":14,"2073":14,"2077":14,"208":24,"2080":14,"2082":14,"2083":14,"2085":14,"2092":14,"2096":14,"2098":14,"2099":14,"20k":5,"20mb":[12,14],"20th":14,"21":21,"2100":14,"21000":[22,24],"21000000000":24,"2102":14,"2104":14,"2105":14,"2109":14,"2110":14,"2111":14,"2117":14,"2118":14,"2122":14,"2123":14,"2131":14,"2135":14,"2138":14,"2146":14,"2157":14,"2173":14,"21736":22,"2175":14,"2177365":22,"2177557":22,"2179":14,"2185":14,"2188":14,"2191":14,"2199":14,"22":[9,21],"220":22,"2201":14,"2205":14,"2206939":22,"2208":14,"2209":14,"2211":14,"2211611":22,"2212":14,"2213":14,"221600":20,"2217":14,"2217196":22,"222270":20,"2224":14,"2233":14,"2239":14,"2242":14,"2243":14,"2251":14,"2252":14,"2259":14,"2260":14,"2261":14,"2265":14,"2270":14,"2277":14,"2283":14,"2284":14,"2286":14,"2287":14,"2288":14,"2289":14,"2293":14,"23":20,"2300":24,"2302":14,"2303":14,"2304":14,"2310":14,"2312":14,"2313":14,"2315":14,"2318":14,"2320":14,"2321":14,"2322":14,"2324":14,"2326":14,"2327":14,"2328":14,"2330":14,"2331":14,"2337":21,"2340":14,"2342":14,"2343":14,"2345":14,"2350":14,"2353":14,"2361":14,"2362":14,"2365":14,"2369":14,"237":24,"2372":14,"2380":14,"2381":14,"2383":14,"23rd":14,"24":[6,9,21],"240":20,"2409":14,"2410":14,"2411":14,"2418":14,"2420":14,"2425":14,"2434":14,"2444":14,"2449":14,"2450":14,"2454":14,"2457":14,"2462":14,"24678":24,"2469":14,"2471":14,"2474":14,"2477":14,"2478":14,"2479":14,"2480":14,"2482":14,"2483":14,"2491":14,"2496":14,"2499":14,"25":20,"250":22,"2504":[14,24],"2505":14,"2507":14,"2511":14,"2513":14,"2514":14,"2515":14,"2516":14,"2518":14,"2520":14,"2521":14,"2522":14,"2523":14,"2524":14,"2525":14,"2527":14,"2530":14,"2531":14,"2534":14,"2537":14,"2538":14,"2539":14,"2542":14,"2544":14,"2546":14,"2547":14,"255":[19,24],"2550":14,"2551":14,"2555":14,"2556":14,"2559":14,"256":[19,23,25],"2562":14,"2567":14,"2574":14,"2579":14,"2580":14,"2585":14,"2592":14,"2596":14,"25s":19,"25th":14,"2600":14,"26000000000000000000":24,"2602":14,"2603":14,"2613":14,"2615":14,"2616":14,"2617":14,"2621":14,"2622":14,"2623":14,"2628":14,"2630":14,"2634":14,"2635":14,"2636":14,"2638":14,"2639":14,"2642":14,"2643":14,"2646":14,"2647":14,"2648":14,"2652":14,"2657":14,"2666":14,"2668":14,"2671":14,"2672":14,"2677":14,"2682":14,"2686":14,"2687":14,"2688":14,"2689":14,"2690":14,"2692":14,"2694":14,"2695":14,"2697":14,"2699":14,"27":10,"2702":14,"2703":14,"2706":14,"2707":14,"2708":14,"2709":14,"2713":14,"2714":14,"2718":14,"2719":14,"2720":14,"2722":14,"2727":14,"2729":14,"2730":14,"2731":14,"2734":14,"2735":14,"2736":14,"2737":14,"2739":14,"2744":14,"275":24,"27504":24,"2751":14,"2753":14,"2755":14,"2762":14,"2764":14,"2772":14,"2775":14,"2777":14,"2778":14,"2783":14,"2788":14,"2789":14,"2795":14,"2796":14,"2797":14,"2799":14,"27th":14,"28":[22,23],"2802":14,"2803":14,"2804":14,"2805":14,"2810":14,"2815":14,"2817":14,"2819":14,"28205917190874851400050446352651915501321657673772411533993420917949420456142":23,"2821":14,"2822":14,"2825":14,"2827":14,"2831":14,"2833":14,"2838":14,"2840":14,"2841":14,"2842":14,"2843":14,"2845":14,"2846":14,"2847":14,"2851":14,"2858":14,"2863":14,"2867":14,"2868":14,"2882":14,"2883":14,"2886":14,"2887":14,"2889":14,"2890":14,"2892":14,"2896":14,"2897":14,"2898":14,"2899":14,"2900":14,"2905":14,"2907":14,"2908":14,"2912":14,"2913":14,"2915":14,"2917":14,"2919":14,"2920":14,"2922":14,"2923":14,"2927":14,"2929":14,"2930":[14,22],"2931":14,"2933":14,"2935":14,"2936":14,"2938":14,"2941":14,"2945":14,"2949":14,"2951":14,"2953":14,"2957":14,"2958":14,"2959":14,"2960":14,"2961":14,"2962":14,"2964":14,"2965":14,"2968":14,"2971":14,"2972":14,"2978":14,"2979":14,"2981":14,"2983":14,"2984":14,"2986":14,"2987":14,"2988":14,"2989":14,"2991":14,"2992":14,"29962":24,"2997":14,"2to3":10,"2x":14,"30":[5,8],"3000":14,"3000000000":22,"30000000000000000000":24,"3002":14,"3009":14,"3011":14,"3012":14,"3013":14,"3020":14,"3023":14,"3024":14,"3025":14,"3026":14,"3030":14,"30303":24,"3034":14,"3035":14,"3037":14,"3039":14,"3043":14,"3045":14,"3046":14,"3048":14,"3052":14,"3053":14,"3054":14,"3058":14,"3061":14,"3063":14,"3064":14,"3065":14,"3066":14,"3067":14,"3069":14,"3070":14,"3072":14,"3073":14,"3074":14,"3075":14,"3076":14,"3078":14,"3080":14,"3082":14,"3083":14,"3084":14,"3090":14,"3096":14,"3097":14,"3101":14,"3104":14,"3106":14,"3107":14,"3111":14,"3114":14,"3116":14,"3117":14,"3120":14,"3122":14,"3125":14,"3127":14,"3128":14,"3129":14,"3130":14,"31337":22,"3134":14,"3135":14,"3138":14,"3140":14,"3143":14,"3144":14,"3146":14,"3147":14,"3148":14,"3153":14,"3157":14,"3159":14,"3160":14,"3162":14,"3164":14,"3167":14,"3169":14,"3170":14,"3171":14,"3172":14,"3173":14,"3179":14,"3180":14,"31813":24,"3183":14,"3185":14,"3187":14,"3191":14,"3192":14,"3193":14,"3196":14,"3198":14,"32":[1,5,9,14,20,21,22,23],"3200":14,"32000000000":20,"3202":14,"3204":14,"3207":14,"3211":14,"3216":14,"3218":14,"3223":14,"3225":14,"3227":14,"3228":14,"3231":14,"3233":14,"3235":14,"3236":14,"3237":14,"3245":14,"3247":14,"3248":14,"3253":14,"3254":14,"3257":14,"3259":14,"32601":10,"32602":21,"3261":14,"3262":14,"3263":14,"3266":14,"3269":14,"32698347985257114675470251181312399332782188326270244072370350491677872459742":23,"3271":14,"3272":14,"3275":14,"3276":14,"3277":14,"3281":14,"3285":14,"3289":14,"3291":14,"3293":14,"3297":14,"3298":14,"32mb":14,"3300":14,"3304":14,"3306":14,"3307":14,"3308":14,"3310":14,"3314":14,"3317":14,"3319":14,"3322":14,"3327":14,"3332":14,"3333333333":18,"3334":14,"3348":14,"3350":14,"3353":[14,24],"3358":14,"3359":14,"3363":14,"3369":14,"3370":14,"3371":14,"3374":14,"3377":14,"3378":14,"3379":14,"3380":14,"3381":14,"3382":14,"3383":14,"3386":14,"3388":14,"3391":22,"3393":14,"3395":14,"34":24,"340":22,"3400":14,"3403":14,"3404":14,"3407":14,"3408":14,"3409":14,"3412":14,"3414":14,"3421":14,"3428":14,"3432":14,"3433":14,"3434":14,"3440":14,"3443":14,"3444":14,"3445":14,"3448":14,"3450":14,"3452":14,"3454":14,"3455":14,"3458":14,"3462":14,"3463":14,"3467":14,"3468":14,"3471":14,"3472":14,"3473":14,"3475":14,"3480":14,"3483":14,"3488":14,"3490":14,"3491":14,"3492":14,"3493":14,"3495":14,"3496":14,"3500":14,"3501":14,"3503":14,"3504":14,"3505":14,"3508":14,"3510":14,"3512":14,"3515":14,"3522":14,"3525":14,"3527":14,"3529":14,"3533":14,"3537":14,"3540":14,"3546":14,"3547":14,"3554":14,"3555":14,"3557":14,"3563":14,"3575":14,"3576":14,"3578":14,"3579":14,"3583":14,"3584":14,"3585":14,"3586":14,"3592":14,"3594":14,"3595":14,"3596":14,"3600":14,"3604":14,"3605":14,"3606":14,"3607":14,"360894980500000001":19,"3610":14,"3618":14,"3619":14,"3622":14,"3623":14,"3636":14,"3637":14,"3640":14,"3642":14,"3643":14,"3653":14,"3659":14,"3661":14,"3662":14,"3665":14,"3667":14,"3668":[14,21,22],"3669":14,"3671":14,"3675":14,"36829":20,"3683":14,"3690":14,"3692":14,"3693":14,"3695":14,"3696":14,"3697":14,"3698":14,"3700":14,"3705":14,"3709":14,"3710":14,"3712":14,"3717":14,"3727":14,"3735":14,"3841357":19,"3841357360894980500000001":19,"39233":24,"3b2047":14,"40":1,"40164":24,"4022281":22,"4022282":22,"42":[11,21],"42000":24,"420000":21,"42012345":16,"42650":21,"43":21,"43242":21,"44010101827705409388":22,"443":12,"46147":22,"4712388":22,"48417310681110102814014302147799665717176259465062324746227758019974374282313":23,"49824742724615":22,"4bb3c89d":9,"4bytetrac":24,"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45":25,"50":[12,22],"500":[5,12],"50000":24,"500000":24,"500000000":22,"5000000000":19,"50000000000":24,"50000000000000":22,"50000000000000000000":24,"50233":20,"5024":20,"5025":20,"5029":20,"5051":20,"51":20,"52":24,"534":24,"537070730":22,"54321":21,"55":[14,19],"550":22,"56160":22,"563662":24,"563663":24,"563664":24,"563665":24,"563666":24,"563667":24,"563668":24,"563669":24,"563670":24,"5736":20,"5737":20,"57631175724744612603":24,"5ce9454909639d2d17a3f753ce7d93fa0b9ab12":23,"5f55d95a":24,"5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2":25,"60":[4,5,6,8,9,12,24],"6000213":22,"604800":21,"6049809828398585510":24,"6060604052341561000c57fe5b604051602080610acb833981016040528080519060200190919050505b620f42408114151561003b5760006000fd5b670de0b6b3a76400008102600281905550600254600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b610a27806100a46000396000f30060606040523615610097576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610099578063095ea7b31461013257806318160ddd1461018957806323b872dd146101af578063313ce5671461022557806370a082311461025157806395d89b411461029b578063a9059cbb14610334578063dd62ed3e1461038b575bfe5b34156100a157fe5b6100a96103f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b61016f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061042e565b604051808215151515815260200191505060405180910390f35b341561019157fe5b610199610521565b6040518082815260200191505060405180910390f35b34156101b757fe5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610527565b604051808215151515815260200191505060405180910390f35b341561022d57fe5b610235610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561025957fe5b610285600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610796565b6040518082815260200191505060405180910390f35b34156102a357fe5b6102ab6107e0565b60405180806020018281038252838181518152602001915080519060200190808383600083146102fa575b8051825260208311156102fa576020820191506020810190506020830392506102d6565b505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033c57fe5b610371600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061081a565b604051808215151515815260200191505060405180910390f35b341561039357fe5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610973565b6040518082815260200191505060405180910390f35b604060405190810160405280600981526020017f54657374546f6b656e000000000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410806105f1575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b156105fc5760006000fd5b81600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b604060405190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156108695760006000fd5b81600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058205071371ee2a4a1be3c96e77d939cdc26161a256fdd638efc08bd33dfc65d3b850029":21,"6080":21,"608060405234801561001057600080fd5b506040805190810160405280600b81526020017f68656c6c6f20776f726c640000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b6103bb806101166000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c01000000000000000000000000000000000000000000000000000000009004806397bc14aa14610058578063febb0f7e14610113575b600080fd5b6101116004803603602081101561006e57600080fd5b810190808035906020019064010000000081111561008b57600080fd5b82018360208201111561009d57600080fd5b803590602001918460018302840111640100000000831117156100bf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610196565b005b61011b61024c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015b578082015181840152602081019050610140565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b80600090805190602001906101ac9291906102ea565b507f5f71ad82e16f082de5ff496b140e2fbc8621eeb37b36d59b185c3f1364bbd529816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561020f5780820151818401526020810190506101f4565b50505050905090810190601f16801561023c5780820380516001836020036101000a031916815260200191505b509250505060405180910390a150565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e25780601f106102b7576101008083540402835291602001916102e2565b820191906000526020600020905b8154815290600101906020018083116102c557829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061032b57805160ff1916838001178555610359565b82800160010185558215610359579182015b8281111561035857825182559160200191906001019061033d565b5b509050610366919061036a565b5090565b61038c91905b80821115610388576000816000905550600101610370565b5090565b9056fea165627a7a72305820ae6ca683d45ee8a71bba45caee29e4815147cd308f772c853a20dfe08214dbb50029":21,"60806040523480156200001157600080fd5b5060":18,"61":22,"61090":20,"62":24,"621":24,"622":13,"626":22,"6283185":13,"63":24,"63000":24,"636f776dc3b6":25,"64":[1,2,23],"64478":24,"64784":24,"64940":24,"650":22,"664971":21,"683":23,"686":14,"69198":20,"70000":23,"70148":24,"70279":24,"71":24,"712":[14,15,23],"7145389":22,"719":23,"72":24,"747874":25,"75":[14,21],"76cb6cd3354be081923a90dfd4cda40aa78b307cc3cf4d5733dc32cc171d00f7c08356e9eb2ea47eab5aad7a15a3419b859139e3f762e1e1ebf5a04f530dcef7":24,"77320681768999138915":22,"777":24,"7816":14,"80":[12,14],"806":24,"83":24,"84095564551732371065849105252408326384410939276686534847013731510862163857293":23,"84635":20,"84769":24,"85000":24,"8545":[5,11,12,13,19,24],"8546":[8,11,12,13,24],"86926":24,"88":20,"899000":21,"89911":24,"8996":26,"8min":14,"8s":19,"90":[20,22],"9000":20,"90000":[14,24],"9000000000000000000":24,"916":14,"92":24,"9223":24,"929":14,"93522894155654168208483453926995743737629589441154283159505514235904280342434":23,"941":14,"944":14,"97":[9,25],"974":14,"976":14,"98":[6,25],"983":14,"983527531":22,"985":14,"99":[14,25],"991":14,"992":14,"995":14,"996":14,"997":14,"999999999999999999999900":21,"__add__":14,"__all__":14,"__await__":14,"__getattr__":14,"__hasattr__":14,"__hash__":14,"__init__":[5,14,25],"__main__":5,"__name__":[5,21],"__str__":14,"_account":22,"_amount":21,"_bar":21,"_batch_request_func_cach":14,"_bytes2valu":21,"_contract":14,"_custom_contract_data":2,"_debatingperiod":21,"_descript":21,"_end_block":5,"_fast_decode_rpc_respons":19,"_fetch_ev":5,"_fetch_events_for_all_contract":5,"_from":21,"_get_event_abi":5,"_greet":21,"_hash_eip191_messag":23,"_is_batch":14,"_is_latest_block_number_request":14,"_make_request":14,"_messag":18,"_newcur":21,"_normal":14,"_owner":21,"_persistentconnectionweb3":14,"_recipi":21,"_requests_info":25,"_retry_web3_cal":5,"_spender":21,"_start_block":5,"_to":21,"_totalsuppli":21,"_transactiondata":21,"_type":25,"_update_progress":5,"_util":[2,5,8,14,22],"_valu":21,"a1":21,"a2":21,"aa":21,"aav":15,"ab":21,"abandon":25,"abc":[5,14],"abcd":21,"abi":[5,8,11,14,18,21,22,23,25],"abi_cal":10,"abi_element_identifi":[10,21],"abi_element_nam":14,"abi_middlewar":10,"abi_typ":25,"abical":10,"abicodec":5,"abicompon":[10,14],"abicomponentindex":[10,14],"abidecodednamedtupl":21,"abiel":10,"abielementinfo":14,"abierror":10,"abiev":[10,14],"abieventfunctionnotfound":14,"abieventnotfound":14,"abieventparam":10,"abifallbacknotfound":14,"abifunct":[10,14],"abifunctioncompon":[10,14],"abifunctionnotfound":14,"abifunctionparam":10,"abil":[5,14],"abl":[2,10,14,21,22],"abort":5,"about":[2,5,8,9,12,13,14,21,22,24],"abov":[5,8,9,10,12,14,16,19,22,23,25,28],"abstract":[8,22],"abstractmethod":5,"abus":[0,5],"acc":[22,23],"acceler":5,"accept":[0,2,4,5,8,9,10,14,21,22,25],"access":[4,5,9,12,14,16,21,22,25],"accesslist":[14,22,23],"accessor":14,"accident":8,"accomplish":[16,21],"accord":[12,14,19,22,24,25],"account":[0,2,4,9,10,13,14,15,18,22],"account_test_script":23,"accountproof":22,"acct":9,"acct1":18,"acct2":18,"accur":[14,22],"accuraci":4,"achiev":14,"across":[2,10,14],"act":[0,8,22,23],"action":[0,14],"activ":[2,8,12,15,19,26],"activation_eligibility_epoch":20,"activation_epoch":20,"actual":[5,8,14,22],"actual_end_block":5,"adapt":[0,12],"add":[2,4,5,9,10,11,14,18,21,22,23,24,25],"add_map":25,"add_peer":24,"add_reserved_p":14,"addhandl":12,"addit":[5,8,9,10,12,13,14,21,22,25],"addr":[19,21],"addreservedp":14,"address":[0,1,5,8,10,14,15,16,18,20,21,22,23],"address_zero":1,"addrstruct":19,"adher":8,"adjust":[8,14],"admin":[10,14,24],"admin_":24,"admin_addp":24,"admin_datadir":24,"admin_nodeinfo":24,"admin_p":24,"admin_starthttp":24,"admin_startw":24,"admin_stophttp":24,"admin_stopw":24,"adopt":[2,23],"adoptopenjdk":20,"advanc":[0,8,12,14],"advis":2,"af48a03b":23,"affect":[10,11,14],"after":[2,5,9,10,11,13,14,18,19,21,22,25],"after_block":5,"again":[2,5,8,9],"against":[2,5,10,14,21],"age":0,"agent":10,"aggregation_bit":20,"ago":5,"ah":21,"aid":[14,16],"aiohttp":[8,12,14],"alchemi":9,"algorithm":14,"alia":[21,22],"alic":21,"align":0,"aliv":14,"all":[0,2,4,8,9,10,12,13,14,15,16,18,19,21,22,23,24],"all_ev":[5,21],"all_funct":21,"all_in_dict":14,"all_process":5,"allow":[4,5,6,8,9,10,12,13,14,16,19,21,22,25],"allow_empti":22,"allow_list":14,"allowable_delay":9,"along":[2,16,21],"alpha":[2,23],"alreadi":[4,10,11,12,14,19,21,22],"also":[2,4,8,9,10,11,12,13,14,16,18,19,21,22,23,25],"altern":[9,12,14,19,21,22],"although":14,"altogeth":[14,22],"alway":[2,5,8,9,14,15,19,21,22,23],"ambigu":[10,14],"ambiguous_contract":21,"ambiguousduo":21,"amd64":9,"among":[2,12,14],"amount":[1,5,6,19,21,22,23],"an":[0,2,5,6,8,9,10,11,12,13,14,15,18,22,25,28],"analog":4,"analysi":14,"analyt":14,"and":[0,3,6,8,12,13,16,18,19,20,22,23,24,27,28],"ani":[0,2,4,5,8,9,10,11,12,14,16,21,22,23,25],"annot":14,"annual":14,"anonym":[5,21],"anoth":[2,8,13,23],"answer":[2,5],"anvil":[15,23],"any_in_dict":14,"anymor":14,"anyon":4,"anyth":5,"anytim":2,"anywher":[10,14,23],"ape":[11,14,15],"apeworx":14,"api":[5,8,12,13,21],"api_endpoint":12,"api_url":5,"app":[14,15],"appear":[0,10],"append":[5,8,22],"appli":[0,10,14,16,18,21,22],"applic":[5,9,14,19,21,22,23],"apply_abi_formatters_to_dict":14,"apply_formatter_to_array":14,"apply_formatters_to_sequ":14,"appoint":0,"approach":[14,16,23],"appropri":[0,2,4,8,9,10,12,14,19,21,22,25],"approv":[4,5,11,16],"approval_handl":16,"apr":14,"april":14,"arb1":8,"arbitrari":[2,9,10],"arbitrarili":4,"architectur":14,"archiv":[14,21],"are":[0,2,4,5,6,8,9,10,11,12,13,14,15,16,18,19,21,22,23,24,25,26,27],"area":14,"aren":14,"arg":[5,8,14,16,21],"arg1":5,"argument":[2,4,5,8,9,10,12,14,19,22,23,25],"argument_filt":[5,21],"argument_nam":21,"argument_typ":21,"argv":5,"arm64":19,"around":[5,10,14,23,24],"array":[14,21,22,25],"arrays_contract":21,"arrays_contract_inst":21,"arrayscontract":21,"art":14,"articl":[2,14],"as":[0,2,4,5,6,8,9,10,11,12,13,14,15,16,18,19,22,23,24,25],"ascend":22,"ask":[2,5,14],"asm":22,"assembl":22,"assert":[4,5,9,16,18,21,22,23,25],"assertionerror":[10,14],"asset":14,"assign":[8,21],"associ":[14,22],"assum":[4,5,10,14,21],"assumpt":25,"ast":22,"async":[8,9,10,12,14,15,16,21,28],"async_await_and_popitem":14,"async_construct_simple_cache_middlewar":14,"async_contract":14,"async_eth_test":21,"async_eth_tester_middlewar":14,"async_execut":25,"async_foo_contract":21,"async_geth_poa_middlewar":14,"async_handle_offchain_lookup":28,"async_http_retry_request_middlewar":14,"async_lock":14,"async_name_to_address_middlewar":14,"async_request_processor":9,"async_response_processor":9,"async_simple_cache_middlewar":14,"async_w3":[8,9,10,12,14,16,21],"async_wrap_make_request":[9,10],"asyncbas":14,"asyncbeacon":14,"asynccontract":14,"asynccontractfunct":14,"asyncen":[4,14],"asynceth":14,"asyncethereumtesterprovid":[12,14,21],"asynceventfilterbuild":14,"asynchron":[4,8,9,10,11,12,14,15,25],"asynchttpprovid":[8,9,10,11,13,14],"asyncio":[5,8,12,14,16,21,25],"asyncipcprovid":[5,8,11,13,14,16,22],"asyncnet":14,"asyncron":14,"asyncweb3":[5,8,9,11,13,14,16,21],"at":[0,2,4,5,8,9,12,14,16,18,19,21,22,25],"attach":[4,5,8,14,25],"attach_method":[14,25],"attach_modul":[14,25],"attack":0,"attempt":[5,8,9,14,21,22],"attent":0,"attest":20,"attester_slash":20,"attnet":20,"attr":14,"attrdict":[9,14],"attrdict_middlewar":[10,14],"attrdict_middlwar":14,"attribut":[9,10,12,14,19,22],"attributeddict":5,"attributedict":[5,14,21,22,24],"attributedictmiddlewar":[9,14,22],"attributeerror":[10,14,19,22],"audienc":14,"audit":14,"aug":14,"august":14,"author":[14,22],"authorization_list":14,"auto":[4,9,10,14,18,25],"autodoc":14,"autogener":14,"autoinit":14,"autom":[9,10],"automag":2,"automat":[2,4,9,10,12,14,21],"autoprovid":14,"avail":[0,2,4,5,8,9,10,11,12,13,14,19,21,22,23,24,25,26,27],"avax":8,"avoid":[5,8,14,22],"await":[8,9,11,12,13,14,16,21,22,25],"await_instantiation_exampl":12,"await_provider_connect_exampl":12,"awar":16,"away":8,"b1":[19,21],"b2":21,"baaedce6":23,"babbag":19,"back":[4,5,8,10,14,19,21,22,23],"backend":[2,8,10,14,23],"background":[8,14],"backoff":[8,14],"backoff_factor":[8,14],"backward":10,"badfunctioncalloutput":14,"badg":14,"badresponseformat":14,"balanc":[5,11,19,20,22,23,24],"balanceof":[5,21],"ban":0,"banner":14,"bar":[5,21],"base":[2,5,8,9,14,15,21,22,23,24],"base_contract":14,"basechainbackend":12,"basecontract":14,"basecontractcal":14,"basecontractfunct":[10,14],"baseeth":14,"basefeeperga":22,"baseprovid":8,"bash":2,"basi":[14,21],"basic":[11,14],"basicconfig":5,"batch":[5,10,14,18,19],"batch_request":[14,25],"bb":21,"be":[0,2,4,5,6,8,9,10,11,12,13,14,16,18,19,21,22,23,24,25],"beacon":[7,10,14,17],"beacon_block_root":20,"becam":22,"becaus":[2,5,8,9,10,14,21,22,23],"becom":12,"been":[2,5,8,9,10,14,16,22,23,25],"befor":[5,8,9,10,12,14,18,19,21,22,23,25],"begin":[5,8,14,16],"behalf":11,"behav":[9,21],"behavior":[0,8,10,14,16,25],"behaviour":6,"behind":[9,10,12,14],"being":[0,5,8,9,10,11,12,13,14,16,21,22,28],"believ":14,"below":[2,3,4,5,8,9,12,13,16,18,19,21,23],"benchmark":2,"best":[0,2,19],"besu":22,"beta":[2,10],"beta2":14,"better":[10,12,14,16,22],"between":[2,5,8,9,10,11,14,16,22,23],"beyond":[8,11],"bfd25e8c":23,"big_endian_int":22,"bigger":[8,14],"billboard":18,"bin":[2,19,21],"binanc":9,"binari":[2,5,10,12,14,19,21,22],"bit":[2,5,8,9,23],"black":[2,14],"blame":2,"blank":2,"blob":[5,14,20,22,23],"blob_base_fe":[14,22],"blob_sidecar":14,"blobgaspric":14,"blobgasus":[14,22],"blobversionedhash":14,"block":[6,8,10,11,12,13,14,16,21,22,24],"block_count":[14,22],"block_filt":[5,9],"block_hash":[10,20,21],"block_id":20,"block_identifi":[14,21,22],"block_info":5,"block_num":[5,12],"block_numb":[5,8,12,14,22],"block_root":20,"block_timestamp":5,"block_when":5,"blockchain":[5,8,9,11,15,21,22],"blocker":15,"blockfilt":[5,14,22],"blockhash":[10,14,21,22,24],"blockhashaddendsinexpans":21,"blockhashaskewlimitari":21,"blocklint":14,"blocknotfound":[5,10,14,22],"blocknotfounderror":22,"blocknumb":[5,14,16,21,22,24],"blocknumberoutofrang":14,"blockoverrid":22,"blockparam":22,"blocks_to_scan":5,"blockstatecal":22,"blurb":14,"bnb":[8,9],"bob":21,"bodi":[0,19,20],"body_root":20,"bold":8,"bool":[5,8,12,14,19,21,25],"boolean":[8,12,14,22,24],"bootstrap":[19,23],"borrow":9,"bot":[14,15,19],"both":[0,2,5,10,11,12,14,21,25],"bound":[14,21],"bracket":21,"branch":[2,14],"brand":15,"break":[8,9,12,16,22],"breakup":14,"brief":18,"broad":23,"broadcast":23,"broke":14,"broken":[13,14,19],"browni":15,"bsc":14,"bubbl":10,"buffer":[5,12,14,22],"bufferedgasestimatemiddlewar":9,"bug":[2,7,10,14],"bugfix":2,"build":[9,10,14,18,19,21,23,25],"build_filt":[9,11,14,21],"build_transact":[18,21,23],"builder":[9,21],"buildtransact":[10,14],"built":[5,11,21,25],"bullet":14,"bump":14,"bumpvers":14,"bunch":14,"busi":5,"but":[2,4,5,8,9,10,13,14,16,18,19,21,22,23],"buy":23,"by":[0,2,4,5,6,8,9,11,12,13,14,15,16,18,21,22,23,24,25,27,28],"bypass":14,"byte":[1,4,5,9,12,14,22,23,25],"bytecod":[2,11,14,18,21,22,28],"bytecode_runtim":[11,14,21,22],"bytes1":19,"bytes2":[4,21,25],"bytes2valu":21,"bytes32":[19,21,23,25],"bytes4":10,"bytestr":21,"bytesxx":14,"byzantium":14,"cach":[5,6,12,14,22],"cache_allowed_request":[6,8,22],"cache_async_sess":12,"cacheabl":8,"cacheable_request":8,"calcul":[10,14,22],"call":[2,4,5,6,8,9,10,11,12,13,14,15,18,19,21,22,23,24,25,28],"call_contract_funct":[10,14],"callabl":[5,14],"callback":[5,14,21,22],"caller":[4,10,11,14,21,22],"calloverrid":[10,14],"calloverrideparam":14,"calltrac":24,"came":8,"camel":[14,22],"camelcas":14,"can":[2,4,5,6,8,9,10,11,12,13,14,15,18,21,22,23,24,25],"cancel":5,"cancun":14,"cannot":[5,14,19,21,22],"canon":[14,20],"cap":24,"capabl":19,"captur":9,"care":5,"carver":23,"case":[2,4,5,8,9,11,12,13,14,16,19,21,22,25,28],"cast":[14,19],"catch":[10,14],"categori":14,"caus":[5,10,14,19],"caution":25,"ccip":[14,15,22,28],"ccip_read_en":[21,22],"cd":2,"celeri":5,"center":8,"certain":[5,8,9,10,12,14],"chain":[4,5,6,8,9,14,16,19,21,22],"chain_id":[5,14,20,22],"chain_reorg_safety_block":5,"chainid":[10,14,21,22,23],"chainlink":15,"chainstack":14,"challeng":5,"chang":[2,4,8,19,21,22],"channel":[14,23],"char":14,"charact":[10,14,25],"chat":19,"check":[2,4,5,9,14,15],"check_if_arguments_can_be_encod":14,"checkout":2,"checksum":[10,14,19,22,23,25,28],"child":2,"children":25,"choic":[5,12],"choos":[19,25],"chosen":10,"chunk":5,"chunk_siz":5,"chunk_size_decreas":5,"chunk_size_increas":5,"ci":14,"circl":[2,14],"circleci":[2,14],"circul":21,"circumst":0,"claim":4,"clang":21,"clarif":14,"clarifi":[0,11,14],"clariti":[10,14],"class":[3,4,8,9,11,14,16,19,21,22,25,28],"classic":10,"classmethod":[21,25],"clean":[13,14],"cleanup":[12,14],"clear":[9,11,14,25],"clearer":[10,14],"clef":10,"client":[2,13,14,15,16,19,20,21,22,24,25,26],"client_vers":[9,25],"clienterror":8,"clientsess":12,"clienttimeout":14,"clientvers":[10,14],"clone":2,"clone_bin":22,"close":[5,8,12,14],"cloud":14,"code":[0,10,12,13,14,16,18,21,22,23,25],"code_hash":22,"code_runtim":14,"codebas":[2,10],"codec":[4,5],"codehash":22,"coercion":14,"coin":4,"coin_typ":[4,14],"coinbas":14,"collect":14,"collis":14,"color":19,"coloredlog":19,"com":[2,4,5,12,14,19,23],"combin":11,"combine_argument_formatt":14,"combomethod":14,"come":[8,10,11,14,19,21,22,23],"comma":14,"command":[2,14,19,23],"comment":0,"commerci":23,"commit":[0,2,5,14,18,21,23],"common":[1,2,4,8,9,10,11,12,13,14,16],"communic":[8,12,19],"communiti":[0,9,14,15,19,23],"compar":[14,22,25],"comparison":10,"compat":[9,10,14],"compil":[2,5,11,14,18,21,22],"compile_contract":2,"compile_sourc":21,"compile_standard":14,"compiled_sol":21,"complaint":0,"complet":[10,14],"complex":16,"complianc":14,"complic":[14,16],"compon":[10,14],"compos":[2,14],"comput":[6,12,14,23,25],"concept":[10,18],"concern":25,"concis":11,"concisecontract":14,"concret":10,"concurr":[16,25],"condit":[9,10,14,16],"conduct":[0,14],"confidenti":0,"config":[2,14],"configur":[2,5,6,10,12,13,14,15,16,18,19,20,21,22,23,25],"confirm":[2,4,9,12],"conflict":[14,19],"conform":[14,21],"conftest":[2,14],"confus":[2,10,14],"connect":[5,6,9,10,11,13,14,16,20,21,22,24,26],"connection_timeout":14,"connectionclos":12,"connectionclosedok":14,"connectionerror":8,"consensus":[9,23],"consequ":14,"consid":[0,8,10,23,25],"consider":16,"consist":[2,14],"consol":[5,10,19,21],"constant":[5,7,14,17,21],"constantinopl":14,"constrain":9,"construct":[0,5,6,10,14,19,21],"construct_async_sign_and_send_raw_middlewar":14,"construct_contract_factori":14,"construct_event_filter_param":5,"construct_sign_and_send_raw_middlewar":[10,14],"construct_time_based_gas_price_strategi":[6,14],"constructor":[10,11,12,14,18,21,22],"consult":10,"consum":[5,8,12,14,21,22],"contact":0,"contain":[1,2,5,8,10,13,14,21,22,23,25],"content":[2,4,14,24,25],"context":[2,5,8,10,11,12,14,16,25],"context_manager_subscription_exampl":12,"contextvar":14,"continu":[3,5,8,9,12,14,18],"contract":[5,8,9,13,14,16,19,25,28],"contract1":22,"contract2":22,"contract_abi":21,"contract_address":[5,21],"contract_arg":14,"contract_data":[2,21],"contract_factory_kwarg":22,"contract_func":21,"contract_function_class":14,"contract_id":21,"contract_inst":[19,21],"contract_interfac":21,"contract_nam":22,"contract_sourc":2,"contract_source_cod":21,"contract_typ":14,"contractaddress":[11,18,21,22],"contractcal":[10,11,14],"contractconstructor":14,"contractev":[5,11,14,21],"contractfactoryclass":22,"contractfunct":[10,11,14,21],"contractlogicerror":[10,14,21,22],"contractpanicerror":14,"contribut":[0,2,7,14],"contributor":[0,2],"contriv":[5,19],"control":[5,8,10,12,14,16,22,23],"conveni":[5,11,16,18,21,23,25],"convent":[10,14,19],"convers":[14,19],"convert":[5,8,9,10,14,22,25],"convey":18,"copi":[14,22],"copyright":14,"cor":24,"core":[2,10,14],"coroutin":5,"correct":[0,2,4,5,8,10,12,14,19,21,23],"correcthorsebatterystapl":23,"correspond":[2,14,21,22,25],"cost":[4,22],"could":[0,5,10,14,16,21,22],"count":5,"coupl":[13,14],"coven":0,"cover":[18,21],"coverag":14,"cowm":25,"cpp":19,"crash":[5,14],"crashfix":14,"creat":[0,2,4,5,8,10,11,12,13,14,16,22,25,28],"create2":[14,28],"create_access_list":22,"create_filt":[5,11,14,21],"createaccesslist":14,"createfilt":[10,14],"creation":[2,5,14,21,22],"critic":0,"crucial":[9,22],"cruft":14,"cryptocurr":23,"cryptograph":[10,23],"ctrl":5,"cumulativegasus":22,"curl":19,"current":[2,5,8,9,10,12,14,21,22,24,25,26],"current_block":5,"current_block_timestamp":5,"current_chuck_s":5,"current_end":5,"current_epoch_attest":20,"current_justifi":20,"current_justified_checkpoint":20,"current_vers":20,"currentblock":22,"currentprovid":[10,14],"curv":[15,23],"custom":[2,5,10,12,14,15,16,22],"custom_geth":2,"custom_middlewar":9,"custom_sess":12,"customiz":14,"custommiddlewar":9,"cve":14,"cycl":5,"cytoolz":14,"d0364141":23,"daemon":5,"daili":14,"dao":14,"dapp":7,"dark":14,"darwin":[24,25],"dashboard":14,"data":[2,4,5,6,8,9,10,12,13,14,15,16,18,20,21,22,23,24],"data1":25,"data2":25,"data_filter_set":5,"data_for_callback_funct":21,"databas":[5,21],"datadir":[9,24],"datastructur":[5,14],"date":19,"datetim":5,"day":[8,9],"dead":14,"deal":[5,10],"debian":14,"debug":[5,12,14,19,22,24],"debug_":24,"debug_tracetransact":24,"dec":14,"decemb":14,"decid":[10,12,22],"decim":[5,10,14,19,21,25],"decis":[5,14,18],"declar":[14,16],"decod":[5,10,14,15,19,21,22],"decode_abi":14,"decode_function_input":[14,21],"decode_rpc_respons":19,"decode_tupl":[14,21,22],"decodingerror":14,"decor":[10,14],"decreas":5,"decrypt":23,"dedic":11,"deem":[0,8,14],"deep":4,"deeper":9,"def":[5,6,8,9,10,12,16,19,21,22,23,25],"default":[2,4,5,8,11,12,13,14,16,18,19,22,23,25],"default_account":[9,14,18,21,22],"default_block":[14,22],"default_except":8,"defaultaccount":[14,22],"defaultblock":14,"defer":[5,14],"defi":15,"defin":[0,6,8,9,10,14,16,21,22,24],"definit":[10,14],"defunct":14,"del":5,"delay":[5,8,14],"deleg":[22,24,25,26],"delegatedsigningmanag":14,"delet":[2,5,14],"delete_data":5,"delete_potentially_forked_block_data":5,"delic":6,"delimit":14,"demo":[5,15],"demonstr":[6,16,19],"denomin":[6,22,25],"depend":[2,5,8,10,12,13,14,16,21,22],"deploy":[2,9,10,11,13,14,18],"deploy_address":21,"deploy_txn":21,"deployed_addr":18,"deployed_contract":[11,21],"deposit":[5,20],"deposit_contract_address":20,"deposit_count":20,"deposit_root":20,"deprec":[11,12,13,22,23],"deprecationwarn":14,"dequ":14,"deriv":[4,9,22],"derogatori":0,"describ":[2,4,5,11,28],"descript":[5,14],"design":[5,8,10],"desir":[2,4,6,9,10,12,14,21,22],"detach":5,"detail":[0,2,3,5,9,10,12,13,14,19,21,22,24],"detect":[4,5,14],"determin":[0,2,4,8,11,12,22],"determinist":14,"dev":[2,9,10,14],"dev_doc":22,"develop":[4,9,11,12,13,14,15],"deviat":9,"devnum":2,"dex":15,"diagnos":19,"diagnost":5,"diagram":9,"dict":[5,12,14,21,22,25],"dict_copi":14,"dict_to_namedtupl":14,"dictionari":[4,5,6,9,10,12,14,21,22],"did":9,"didn":10,"differ":[0,2,4,8,9,10,12,14,19,21,22],"difficulti":[13,22,24],"diffmod":24,"dimension":[14,22],"direct":[8,10,12,14,20,21,22,25],"directori":[2,14,19,24],"disabl":[0,4,5,8,11,12,14,25],"disallow":[14,21],"disambigu":21,"discard":[5,21],"disconnect":[8,12,14],"discord":[2,7,14,15,19],"discourag":23,"discoveri":24,"discovery_address":20,"discuss":2,"display":19,"distinct":[10,11,21],"distinguish":[10,14],"distribut":14,"divid":5,"django":9,"dns_encode_nam":14,"do":[0,2,4,5,8,9,10,11,12,14,15,16,23],"doc":[2,5,10,12,14,21,22,23,24],"docker":14,"dockerfil":14,"docstr":14,"doctest":[14,21],"document":[4,5,8,10,11,12,13,19,20,21,22,24],"doe":[2,4,5,8,9,10,12,14,16,19,21,22,23,25],"doesn":[2,4,9,14,21],"doing":[2,5,8,9,13],"domain":[4,10,11,14],"domain_beacon_propos":20,"domain_selection_proof":20,"don":[2,4,5,8,9,10,14,16,18,19,21],"done":[2,6,8,10,11,12,13,14,18,21],"dos":14,"dot":[9,14],"doubl":[8,14,19],"doubt":[10,21],"down":[5,8,14,19,25],"downgrad":14,"download":[2,14,19],"downstream":14,"dri":14,"drop":[5,14],"ds_store":14,"dst":5,"due":[5,6,8,10,14,22,25],"dump":[5,14],"duplic":[2,10,14],"durat":[5,14],"dure":[8,10,13,14,21],"dydx":15,"dynam":[5,9,14,21,22,23],"dynamic_fee_transact":9,"dyor":15,"e176ce0793dafdd0573acc8d4b76425b6eb604ca":5,"e501":[21,22],"e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3":24,"each":[3,5,6,8,9,11,12,13,14,16,18,19,21,22,23,25],"earli":[2,9,14],"earlier":10,"earliest":[14,22],"eas":14,"easi":[5,21],"easier":[9,10,14],"easiest":9,"easili":[2,10,15,21],"ec_recover_arg":23,"econom":0,"ecosystem":[2,10,15,19],"ecr":23,"edit":0,"educ":[0,15],"effect":[9,14,22],"effective_bal":20,"effectivegaspric":14,"effici":22,"effort":[2,10],"eg":21,"eip":[9,14,15,19,21,22,23,24,28],"eip20_abi":23,"eip55":25,"either":[5,8,9,10,14,16,21,22,25],"elaps":22,"electron":0,"element":[9,10,14],"elimin":14,"ellipt":23,"els":[5,6,8,21,22,23],"elsewher":10,"eman":21,"emit":[5,10,11,16,21],"empathi":0,"emphas":14,"employ":[8,14],"empow":10,"empti":[5,9,14,21,22],"emscripten":21,"en":[2,5,9],"enabl":[2,4,5,8,9,10,12,14,21,22,24,25,27],"enable_strict_bytes_check":10,"enable_strict_bytes_type_check":14,"enable_unstable_package_manag":14,"enableunauditedfeatur":[10,14],"encod":[4,5,10,14,21,22,23],"encode_abi":[10,11,14,21],"encode_defunct":23,"encodeabi":[10,14],"encodepack":25,"encodingerror":14,"encount":[5,21],"encourag":[2,12],"encrypted_key":23,"end":[5,14,15,21],"end_block":5,"end_block_timestamp":5,"end_chunk":5,"endpoint":[8,9,10,11,12,13,14,24,27],"endpoint_uri":[8,9,12,14],"endpoint_uri_or_ipc_path":14,"enforc":[2,14],"engin":14,"enod":24,"enr":20,"ens":[7,14,17,19,21,22],"ens_encode_nam":14,"ens_name_to_address":9,"ensexcept":[10,14],"ensip":[4,14],"ensnametoaddressmiddlewar":[9,10],"ensur":[2,9,12,14,21,25],"ensvalidationerror":10,"entir":[2,21,22],"entri":[5,10,14,22],"enum":8,"env":18,"environ":[0,9,10,13,14,18,21],"eoa":23,"epoch":20,"epub":14,"equal":[8,14,21,22],"equival":[5,9,22,25],"erc":5,"erc1319":14,"erc20":[5,14],"erigon":[22,27],"error":[2,4,5,8,9,14,16,21,22,23],"escap":14,"especi":[8,14,19,23],"establish":[5,8],"estim":[14,21,22],"estimate_ga":[9,11,14,21,22],"estimate_next_chunk_s":5,"estimated_end_block":5,"estimatega":[10,14],"etc":[14,19,22],"eth":[4,5,6,7,8,9,12,13,14,15,16,17,19,21,23,24,25],"eth1_data":20,"eth1_data_vot":20,"eth1_deposit_index":20,"eth_":22,"eth_abi":[5,14],"eth_account":[9,14,22,23],"eth_address":4,"eth_blobbasefe":22,"eth_blocknumb":22,"eth_cal":[8,10,14,21,22],"eth_chainid":[8,14,22],"eth_createaccesslist":[14,22],"eth_estimatega":[14,22],"eth_exampl":25,"eth_feehistori":[14,22],"eth_gaspric":[6,9,14,22],"eth_getbal":22,"eth_getblock":5,"eth_getblockbyhash":[8,22],"eth_getblockbynumb":[8,12,22],"eth_getblocktransactioncountbyhash":[8,22],"eth_getblocktransactioncountbynumb":[8,22],"eth_getcod":[14,22],"eth_getfilterchang":22,"eth_getfilterlog":22,"eth_getlog":10,"eth_getproof":[14,22],"eth_getrawtransactionbyblockhashandindex":[8,22],"eth_getrawtransactionbyblocknumberandindex":[8,22],"eth_getrawtransactionbyhash":[14,22],"eth_getstorageat":[14,22],"eth_gettransact":[10,14],"eth_gettransactionbyblockhashandindex":[8,22],"eth_gettransactionbyblocknumberandindex":[8,22],"eth_gettransactionbyhash":[8,22],"eth_gettransactioncount":[14,22],"eth_gettransactionreceipt":[14,22],"eth_getunclebyblockhashandindex":[8,22],"eth_getunclebyblocknumberandindex":[8,22],"eth_getunclecount":14,"eth_getunclecountbyblockhash":[8,22],"eth_getunclecountbyblocknumb":[8,22],"eth_key":9,"eth_maxpriorityfeeperga":[14,22],"eth_newblockfilt":[5,22],"eth_newfilt":[5,21,22],"eth_newpendingtransactionfilt":22,"eth_protocolvers":14,"eth_sendrawtransact":[8,21,22],"eth_sendtransact":[8,9,21,22,23],"eth_sign":[14,22],"eth_signtransact":[14,22],"eth_signtypeddata":[14,22],"eth_simulatev1":[14,22],"eth_submithashr":14,"eth_submitwork":14,"eth_subscrib":[8,14,15,16,22],"eth_subscript":[8,10,12,14],"eth_sync":22,"eth_test":[10,12,14,21],"eth_typ":10,"eth_uninstallfilt":22,"eth_unsubscrib":[14,22],"eth_util":[10,14,21,22],"ether":[1,5,6,12,13,14,18,25],"ethereum":[0,2,4,5,6,8,9,10,11,12,13,14,15,16,21,22,23,24],"ethereum_test":[12,14,21],"ethereumfound":25,"ethereumpython":7,"ethereumtest":[10,12],"ethereumtesterprovid":[2,4,9,13,14,18,21,23],"etherscan":[5,21],"ethgasst":14,"ethnic":0,"ethpm":14,"ethpmexcept":[10,14],"ethpmvalidationerror":10,"ethsubscript":8,"ethtest":14,"ethtestrpc":14,"ethtoken":[14,23],"evalu":14,"even":9,"event":[0,8,9,10,14,22],"event_data":[8,16],"event_filt":5,"event_filter_param":5,"event_found_count":5,"event_nam":[5,21],"event_signature_hash":5,"event_typ":5,"eventarg1":21,"eventfilt":[10,14],"eventfilterbuild":21,"eventnam":5,"events_count":5,"eventscann":[5,14],"eventscannerst":5,"eventu":10,"ever":[9,12,22],"everi":[2,4,5,9,14,21],"everyon":0,"everyth":[5,8,11],"evict":14,"evm":[2,8,9,12,14,15,22],"evolv":20,"evt":5,"exact":[19,21,22,24,25],"exampl":[0,2,4,6,8,9,10,12,13,14,15,18,22,23,25,28],"example_method":25,"examplecontract":11,"examplemodul":25,"exceed":[5,8],"except":[2,5,8,9,12,14,21,22],"exception_retry_configur":[5,8,12,14],"exception_retry_middlewar":14,"exceptionretryconfigur":[8,12,14],"excessblobga":[14,22],"exchang":[4,23],"exclud":[2,8,22],"exclus":21,"exec":2,"execut":[4,5,10,11,14,16,18,21,22,23,24,25],"exhaust":14,"exist":[2,4,5,9,10,11,14,21,23,25],"existing_filt":5,"exit":[5,12,14],"exit_epoch":20,"expand":10,"expect":[0,5,8,10,12,14,21,22,23],"expens":21,"experi":[0,9,14],"experiment":[12,14,20],"explain":[2,13,14],"explan":19,"explicit":[0,2,10,12,14,21,22,23],"explor":[2,21],"exponenti":[5,8,14],"export":[9,14,19,23],"expos":[5,8,13,14,21,22,24,25,26,27],"express":[0,21,23],"extend":[4,5,9,10,14],"extendedresolv":4,"extens":14,"extern":[14,16,19,23],"external_modul":[14,25],"external_module_librari":25,"extra":[8,10,12,14,21],"extract":[14,19,21],"extradata":[9,22],"extradatalengtherror":[9,14],"extradatatopoamiddlewar":10,"eye":23,"f401":14,"face":0,"facilit":14,"factor":[5,19],"factori":[10,14,18,22],"fail":[5,14,21,22,24],"failur":[8,9,14],"fair":[0,10],"faith":0,"fall":[10,14],"fallback":[5,11,14,15],"fallbackfn":21,"fallbacknotfound":14,"fals":[4,5,6,8,10,12,14,16,19,20,21,22,24,25],"familiar":[8,19],"far":5,"fast":[5,19,21],"fast_gas_price_strategi":6,"faster":[12,14,19,25],"fastest":12,"faucet":[14,19,23],"favor":[10,14],"fbaf1ad11b0c7fac09ba34baff2c256cffe0a148":5,"featur":[2,8,9,11,13,16,21,22],"feb":14,"februari":14,"fed692f6":[24,25],"fee":[9,14,22,23],"fee_histori":[14,22],"feedback":[5,14],"feehistori":14,"femtoeth":19,"fetch":[6,14,19,21,22],"few":[5,8,12,13,14,18,21],"fffffffe":23,"ffffffff":23,"fiddl":5,"field":[4,5,9,10,14,21,22],"fifo":8,"figur":5,"file":[2,5,10,12,14,19,21,23],"filenam":[2,10,11,12,13],"filenotfounderror":19,"filesystem":12,"fill":[8,12,14],"fill_transaction_default":14,"filter":[14,21],"filter_build":21,"filter_id":[5,22],"filter_inst":21,"filter_param":[5,22],"filterparam":14,"final":[5,8,14,16,20,22],"finalized_checkpoint":20,"financ":15,"find":[5,10,11,14,15,19,21,22,23],"find_events_by_nam":21,"find_events_by_selector":21,"find_events_by_top":21,"find_functions_by_arg":21,"find_functions_by_nam":21,"fine":14,"finish":[2,5,12],"finney":19,"first":[2,4,5,8,9,10,12,14,16,19,21,22,25],"fix":[2,10,14,19],"fixed_length":22,"fixedmxn":14,"fixtur":[10,14,21],"fixture_middlewar":[10,14],"fixup":14,"fjafjkldskf7jkfdj":9,"flag":[2,4,8,10,14,16,19,21,22],"flake8":14,"flaki":14,"flask":15,"flat":14,"flatten":21,"flexibl":[10,14,25],"flight":14,"float":[5,10,12,14,19,22],"flogger":15,"fmt":19,"fn":14,"fn_abi":10,"fn_name":[10,14,21],"fname":5,"focus":[0,10],"folder":2,"follow":[0,2,5,6,8,9,10,11,12,13,14,19,21,22,24,25,26,27],"foo":21,"foo_contract":21,"foocontract":21,"for":[0,2,3,6,9,10,11,12,13,15,16,18,22,24,25,26,28],"forc":[5,14],"forget":2,"fork":[2,5,6,9,14,20,22],"form":[14,19,22],"format":[2,5,8,9,10,12,14,19,21,23,25],"format_entri":[5,11],"format_proof_nod":22,"formatt":[8,10,12,14],"formatted_tim":5,"formattingmiddlewar":14,"forum":19,"forward":[4,14,21],"foster":0,"found":[4,5,8,10,11,12,13,14,18,21,22,23,24],"four":21,"frame":[12,14],"framework":[5,11,21],"free":[0,9],"freebsd":[12,14],"freecodecamp":15,"frequenc":8,"frequent":[13,22],"fresh":14,"friend":[3,4,8],"friendlier":14,"from":[0,2,4,5,6,8,9,11,12,13,14,16,18,20,21,22,24,25],"from_addr":5,"from_address":21,"from_block":[5,10,21],"from_key":[9,18,23],"from_web3":[4,19],"from_wei":[5,11,19,25],"fromascii":10,"fromblock":[10,14,22],"fromdecim":10,"fromhex":22,"fromutf8":10,"fromweb3":14,"fromwei":14,"front":15,"ftm":8,"fulfil":8,"full":[2,5,9,11,12,13,14,18,21,22,23,24],"full_transact":[8,16,22],"fulli":14,"func":5,"func_to_cal":21,"function":[2,4,5,8,9,10,11,12,14,16,18,22,23,25,28],"function_identifi":10,"function_nam":10,"function_name_her":14,"fund":[14,18,21],"fungibl":21,"further":[0,11,19,21,23,25],"futur":[10,12,14,15,19,22,24],"fx":14,"g9392008":20,"ganach":14,"gap":[12,14],"garreau":15,"gas":[4,7,14,17,18,21,22,23,24],"gas_buff":9,"gas_estim":9,"gas_limit":9,"gas_pric":[14,22],"gas_price_strategi":[6,9,14,22],"gas_price_strategy_middlewar":14,"gas_strategi":[6,14],"gaslimit":[13,14,22],"gaspric":[6,9,14,19,21,22,24],"gaspricestrategymiddlewar":9,"gasus":[13,22,24],"gasusedratio":22,"gatekeep":8,"gather":[5,8,16,25],"gave":[4,14],"gender":0,"general":[2,8,10,14,19,25],"generat":[8,12,14,15,18,19,21,22,23,28],"generate_fixtur":2,"generate_gas_pric":[6,11,14,22],"generategaspric":14,"generic":[10,14],"genesi":[2,14,24],"genesis_fork_vers":20,"genesis_tim":20,"genesis_validators_root":20,"get":[2,5,8,9,10,12,14,15,16,18,21,22,23,25],"get_abi_el":14,"get_abi_element_info":14,"get_abi_input_nam":14,"get_abi_output_nam":14,"get_account":21,"get_all_entri":[5,11,14,21],"get_attest":20,"get_attestation_reward":14,"get_attester_duti":14,"get_attester_slash":20,"get_bal":[11,14,22,25],"get_beacon_head":20,"get_beacon_st":20,"get_blob_sidecar":20,"get_block":[5,9,11,12,13,14,20,22,25],"get_block_attest":20,"get_block_head":20,"get_block_numb":[14,22],"get_block_proposer_duti":14,"get_block_root":20,"get_block_timestamp":5,"get_block_transaction_count":[11,14,22],"get_block_when":5,"get_cod":[11,14,22],"get_create2_address":28,"get_create_address":28,"get_default_ipc_path":[10,14],"get_default_middlewar":9,"get_deposit_contract":20,"get_dev_ipc_path":[10,14],"get_epoch_committe":20,"get_event_abi":14,"get_event_by_nam":21,"get_event_by_selector":21,"get_event_by_signatur":21,"get_event_by_top":21,"get_event_data":[5,14],"get_event_log_top":14,"get_event_loop":5,"get_filter_chang":[5,11,14,22],"get_filter_log":[5,11,14,22],"get_finality_checkpoint":20,"get_fork_data":20,"get_fork_schedul":20,"get_from_proof":22,"get_function_by_arg":21,"get_function_by_nam":21,"get_function_by_selector":21,"get_function_by_signatur":21,"get_genesi":20,"get_hash_root":20,"get_health":20,"get_ipc_path":14,"get_last_scanned_block":5,"get_local_packag":14,"get_log":[5,11,14,21,22],"get_new_entri":[5,10,11,14,21],"get_node_ident":20,"get_normalized_abi_input":21,"get_peer":20,"get_peer_count":14,"get_proof":[11,14,22],"get_proposer_slash":20,"get_raw_transact":22,"get_raw_transaction_by_block":[14,22],"get_request_head":14,"get_spec":20,"get_storage_at":[11,14,22],"get_suggested_scan_end_block":5,"get_suggested_scan_start_block":5,"get_sync":20,"get_sync_committee_duti":14,"get_text":[4,14],"get_transact":[5,11,14,18,21,22],"get_transaction_by_block":[11,14,22],"get_transaction_count":[11,14,18,21,22,23],"get_transaction_receipt":[11,14,18,21,22],"get_uncl":14,"get_uncle_by_block":[11,14,22],"get_uncle_count":[11,14,22],"get_valid":20,"get_validator_bal":20,"get_vers":20,"get_voluntary_exit":20,"get_work":14,"getbal":14,"getblock":[10,14],"getblocktransactioncount":14,"getbytes2valu":21,"getcod":14,"getcompil":[10,14],"getfilterchang":14,"getfilterlog":14,"geth":[5,7,9,11,13,14,17,19,21,22,25],"geth_binari":2,"geth_poa_middlewar":[10,14],"geth_step":14,"geth_vers":2,"gethdev":[9,12,14,25],"gether":19,"gethperson":14,"getlog":14,"getlogg":[5,12,19],"getmyvalu":11,"getproof":14,"getstorageat":14,"gettransact":[10,14],"gettransactionbyblock":[10,14],"gettransactioncount":[10,14,21],"gettransactionfromblock":[10,14],"gettransactionreceipt":[10,14],"getunclebyblock":[10,14],"getunclecount":[10,14],"getvar":22,"getwork":14,"gevent":[5,14],"git":[2,14,23],"github":[5,7,14,19,23],"gitignor":14,"gitter":14,"give":[2,5,10,11,14,19,23,25],"given":[5,14,21,22,24,25,28],"glacial_gas_price_strategi":6,"glacier":14,"global":[14,16,21,22],"global_ccip_read_en":[14,21,22],"gm":18,"gn":18,"gno":8,"gnosi":14,"go":[2,5,9,14,19],"go1":[9,24,25],"go_ethereum":2,"goe":[9,22],"goer":[9,14],"goethereum":2,"going":[14,16,21],"good":[0,2,22],"googl":14,"got":[5,14,21],"gov":14,"gpl":14,"grace":[0,5,14],"graduat":18,"graffiti":20,"grammat":10,"grand":19,"great":[2,19],"greater":[14,19,22,23],"greet":21,"greeter":21,"groundwork":14,"group":2,"guarante":[8,9,10,16,19],"guess":5,"guesser":14,"guid":[2,10,11,13,14,15,16,18,21,23],"guidanc":2,"guidelin":14,"guy":5,"gwei":[6,19,21,22,23],"hackathon":14,"had":[10,14],"hand":18,"handl":[5,8,9,12,14,16,21,22],"handle_ev":5,"handle_offchain_lookup":[21,28],"handle_subscript":[8,14],"handler":[5,8,14],"handler_context":[8,16],"hang":14,"happen":[5,14,22],"happier":2,"happili":12,"harass":0,"hard":[2,14],"hardwar":13,"harm":0,"has":[2,3,4,5,8,9,10,11,12,14,16,19,21,22,23,25],"hasattr":14,"hash":[1,4,5,10,13,14,21,22,23,24],"hash32":22,"hash_zero":1,"hashabl":9,"hashrat":[10,14],"have":[0,2,4,5,8,9,10,11,12,13,14,15,16,19,20,21,22,23],"hd":14,"head":[8,16,20,24],"head_slot":20,"header":[8,10,12,14,16,20],"hell":14,"hello":21,"help":[8,11,13,14,16,19],"helper":[10,14],"henc":21,"her":21,"here":[2,5,6,8,9,10,11,12,13,14,15,18,19,21],"heurist":5,"hex":[5,9,10,14,19,22,23,25],"hex_":23,"hex_messag":23,"hex_message_hash":23,"hex_r":23,"hex_signatur":23,"hexadecim":[1,4,8,14,21,23,25],"hexarytri":22,"hexbyt":[9,10,13,14,19,21,22,23,24,25],"hexstr":[10,14,21,22,23,25],"hiccup":14,"high":8,"higher":[6,9,14],"highest":22,"highestblock":22,"highlight":[10,13],"hint":[2,9,14,22],"histor":[15,21],"histori":[2,5,14],"historical_root":20,"hit":5,"hold":21,"home":14,"homestead":14,"homogen":2,"hood":[4,8,10,12,18,19],"hook":[5,8,14],"host":[5,9,11,14,24],"hot":[14,23],"hour":[5,6,8],"hous":[2,8,12,14,28],"how":[5,8,9,11,12,14,18,21,22,23],"howev":[2,4,8,9,10,12,16,21,22],"html":[0,5,9],"htmlzip":14,"http":[2,5,9,11,12,13,14,19,20,24],"http_endpoint":9,"http_retry_request_middlewar":10,"httpadapt":[12,14],"httpconnectionpool":5,"httperror":8,"httpprovid":[5,8,9,10,11,13,14,19,25],"https":[0,2,4,5,10,11,12,13,14,19,23],"httpsessionmanag":14,"human":[4,5,11,14],"hunt":19,"hw":21,"hypothesi":14,"i8":19,"iban":[10,14],"id":[4,8,10,12,14,16,22,24,26],"idea":[2,10,11,18],"ideal":10,"ident":[0,21],"identifi":[5,14,18,21,22],"identity_func":21,"idna":14,"ids":14,"idx":5,"ie":14,"if":[2,4,5,6,8,9,10,11,12,13,14,16,18,19,21,22,23,25,26],"ignor":[2,14,21],"ignorerevsfil":2,"illustr":14,"imageri":0,"immut":22,"impact":14,"implement":[4,5,6,8,9,10,14,15],"impli":[4,9],"implicit":22,"implicitcontract":14,"import":[2,4,5,6,8,9,10,11,12,13,14,16,18,19,20,21,22,23,25],"importlib":14,"importrawkey":10,"imposs":14,"impract":2,"improv":[2,10,19],"in":[0,1,2,3,4,6,8,9,10,11,13,14,15,16,18,19,22,24,25,28],"inaccess":22,"inappropri":0,"incid":0,"includ":[0,2,4,5,6,8,9,10,11,13,14,16,19,21,22,25],"inclus":[0,14,21,22,24],"incom":[5,10,11,14],"incompat":[10,14],"incomplet":20,"inconsist":14,"incorrect":14,"increas":[5,12,14,22],"increment":[5,21],"inde":19,"indefinit":[8,12,14,16],"independ":[14,16],"index":[4,5,14,20,21,22,25],"indic":[5,20],"individu":[0,16],"infer":[4,10,14,21],"info":[5,14],"inform":[0,2,5,8,9,10,11,12,13,14,21,22,24,25],"infrastructur":[11,14],"infura":[5,9,11,14],"infura_api_key":14,"infurakeynotfound":[10,14],"infuraprojectidnotfound":[10,14],"inherit":[4,5,12,14,19,25],"init":14,"init_bytecod":18,"init_cod":28,"initi":[5,8,9,14,16,18,21,22,23],"inject":[9,10,11,14,18,23],"innermost":9,"input":[5,8,14,18,19,21,22,24,25],"input_mung":14,"insid":[2,9],"insight":14,"insol":2,"inspect":24,"instal":[2,10,11,12,13,14,21],"install_solc":21,"instanc":[0,4,5,8,9,10,11,12,13,14,16,20,21,22,25,28],"instant":13,"instanti":[4,5,8,10,11,12,13,14,18,19,21,25],"instead":[2,9,10,12,14,18,19,21,22,23,25],"instruct":[2,14],"insuffici":19,"insufficientdatabyt":14,"insult":0,"int":[5,8,10,12,14,19,21,22],"int256":21,"int8":[14,19],"integ":[5,6,8,14,21,22,23,25],"integr":[12,14],"intend":[14,19,21],"interact":[2,5,8,9,10,11,13,14,18,22,23,24,25,26,27],"intercept":8,"interest":[0,2],"interfac":[2,4,10,12,14,21,22],"intern":[5,8,10,12,19,25,28],"internaltyp":[18,21],"interoper":12,"interpol":14,"interpret":[13,15,21,23],"interrupt":[5,8,9],"interv":[8,14],"into":[2,5,9,11,13,14,21,23],"intro":[14,15],"introduc":[2,4,6,9,10,14,16,21,22,25],"introduct":[14,21],"invalid":[10,14],"invalidaddress":10,"invalideventabi":10,"invalidtld":10,"invers":19,"investig":0,"invoc":[10,21],"invok":[9,14,22,23],"involv":[9,23],"io":[5,9,10,19],"ioerror":[5,14],"ip":[12,24],"ip4":20,"ipc":[2,8,9,10,11,12,13,14,19,25],"ipc_path":[12,14],"ipcprovid":[4,5,9,10,11,13,14,25],"ipf":[10,14],"ipfshttpclient":[10,14],"ipython":13,"is":[0,1,2,4,5,6,8,10,11,12,13,14,18,19,20,21,22,23,24,25,26],"is_address":[10,11,25],"is_checksum_address":[11,25],"is_connect":[8,11,12,13,14,19],"is_dynamic_fee_transact":14,"is_encod":[4,11,25],"is_properti":25,"is_unsubscrib":8,"is_valid_entri":[5,11],"ischecksumaddress":14,"isconnect":14,"ish":14,"isn":[9,14],"isoformat":5,"isol":[2,8,14],"isort":14,"issu":[0,2,5,9,10,14,19,21],"it":[2,4,5,6,8,9,10,11,12,13,14,16,19,21,22,23,25,28],"item":[5,9,14,25],"iter":[5,8,10,12,14,19],"its":[0,2,4,5,8,9,10,11,12,14,18,19,21,22,23,25],"itself":[9,11,14,20,22,25],"jan":14,"januari":14,"jasoncarv":14,"java":20,"job":[14,19],"js":[14,15,23],"json":[5,6,8,9,11,12,14,15,21,22,24,25,27],"jsonbaseprovid":19,"jsondecodeerror":[5,14],"jsonifiedst":5,"jsonmessag":22,"jsonrpc":[14,24],"jsonschema":14,"juli":14,"june":14,"jupyt":18,"just":[2,5,13,14,21,23,25],"justification_bit":20,"kattimani":15,"keccack":5,"keccak":[5,10,11,14,21,22,23,25],"keccak256":25,"keep":[8,9,14,16,23],"keepaliverpcprovid":14,"kether":19,"key":[5,8,9,14,18,19,21,22,25],"keychain":23,"keyerror":14,"keyfil":14,"keysmash":9,"keystor":[19,23],"keyword":[4,5,8,10,12,14,21,22,25],"kg4qcip6ecz6hg_fd93qsw12qmbfsl2rutfqvwvp4fotlwenxyo0gg9y3wvyidf6fqc6r0e8cbk0ywq_6tkmx1bpglahgv0adkqowihlqaaian__________4jpzij2nijpcir_aaabixnly3ayntzrmaeddvt4g1gw86bfbrtlcq2frblg0anmxsxtaqga327s5feddgnwgimog3vkciijka":20,"kind":[5,10],"kit":[14,15],"know":[2,4,5,8,10],"knowledg":11,"known":[14,21,22,23],"knownstat":22,"kovan":[10,14],"kwarg":[9,10,14,21],"kwei":19,"kzg_commit":20,"kzg_commitment_inclusion_proof":20,"kzg_proof":20,"l200":5,"l2_w3":16,"l2s":19,"l71":5,"label":[8,14,16],"lag":8,"land":[2,14],"languag":[0,14],"larg":[5,14,19],"last":[4,5,9,14,16,21,22],"last_logs_found":5,"last_sav":5,"last_scan_dur":5,"last_scanned_block":5,"last_tim":5,"latenc":19,"later":[5,9,14,22],"latest":[2,5,8,9,10,12,13,14,19,21,22],"latest_block":12,"latest_block_based_cache_middlewar":10,"latest_block_head":20,"latest_block_num":8,"latter":14,"lay":14,"layer":[8,9,10,11,18,23],"lead":[2,9],"leadership":0,"learn":[2,11,13,14,15],"least":[5,18],"leav":5,"left":[2,5,14,23],"legaci":[6,9,10,14,19,22,23],"legacy_transact":9,"legacy_websocket":12,"legacywebsocketprovid":[10,11,14],"legitim":14,"len":[5,9,21,25],"length":[9,10,21],"less":[8,19,21,22],"let":[2,5,15,16,19,21,23],"level":[0,4,5,8,14],"levelnam":19,"leverag":[11,16],"lib":14,"librari":[2,5,8,10,11,12,13,14,19,21,24,25],"licens":[14,18],"lido":15,"life":14,"light":14,"lighter":15,"like":[2,4,5,8,9,10,11,12,13,14,19,21,22,23,25],"limit":[12,14,16,19,25],"line":[2,8,14,18,23],"link":[11,12,14,15,23],"lint":[2,14],"linux":[2,9,12,14,24],"list":[4,5,8,9,10,14,16,18,21,22,23,24,25],"list_storage_key":14,"list_wallet":14,"listaccount":10,"listen":[10,11,12,14,16,24,26],"listen_to_websocket":14,"listenaddr":24,"liststoragekey":14,"littl":[10,14],"live":2,"ll":[2,4,10,11,12,15,16,18,20,21,25],"load":[2,4,5,9,11,12,14,18,19,22,23,25],"local":[2,5,8,11,12,14,19,20,21,22],"local_filter_middlewar":14,"local_ipc":8,"local_w3":8,"localaccount":[9,23],"localaddress":24,"localfiltermiddlewar":9,"localhost":[5,12,19,20,24],"locat":[2,9,14],"lock":14,"lockaccount":10,"log":[8,10,12,14,16,22],"log_entry_formatt":5,"log_filt":9,"log_handl":[8,16],"log_index":5,"log_level":19,"log_loop":5,"log_receipt":[8,16],"log_to_process":21,"log_topics_to_byt":14,"logentri":14,"logfilt":[5,21,22],"logger":[5,12,14,19],"logic":[5,8,9,10,12,14,16],"logindex":[5,14,21,22],"logreceipt":14,"logsbloom":[13,14,22],"logssubscript":[8,16],"logssubscriptioncontext":[8,16],"logtopicerror":[10,21],"london":[6,9,19,22],"lone":21,"long":[2,5,8,16,19,23],"longer":[14,15,19,23],"look":[2,4,5,8,10,12,14,15,19,21,22],"lookup":[14,22,28],"loop":[8,14],"lose":19,"lost":12,"lot":14,"lovelac":19,"lower":[14,22,25],"lowercas":14,"lowest":22,"lru":[10,14],"ls":2,"mac":12,"machin":[2,12,14],"macosx":14,"made":[2,5,8,9,10,11,12,14,25],"magic":10,"mail":0,"main":[2,5,10,12,14,21,28],"mainnet":[5,8,14,16,23],"maintain":[0,9,14,15,16,19,23],"major":[2,10,12,14,19,22],"make":[0,2,5,6,8,9,10,12,13,14,15,19,21,22,23,25],"make_batch_request":14,"make_request":[8,9,10,12,14,25],"makefil":14,"malform":14,"malici":22,"manag":[2,11,12,14,16,23,25],"mandat":4,"mandatori":[5,21],"mani":[5,10,11,12,14,18,19,21],"manifest":14,"manipul":14,"manner":[8,11,22],"manual":[5,12,14,16,18,28],"manytyp":19,"map":[12,14,19,22,25],"map_abi_data":14,"mar":14,"marc":15,"march":[10,14],"mark":[14,21],"marker":14,"mass":4,"massiv":[5,14],"master":14,"match":[2,4,5,8,14,21,22,23,25],"match_ani":21,"match_singl":21,"materi":15,"math_contract":[21,25],"matic":8,"matomo":14,"matter":[9,14],"max":[1,5,8,14,22,23],"max_attester_slash":20,"max_chunk_scan_s":5,"max_connection_retri":12,"max_effective_bal":20,"max_int":1,"max_priority_fe":22,"max_priority_fee_per_ga":14,"max_request_retri":5,"max_scan_chunk_s":5,"max_siz":14,"max_wait_second":6,"maxfeeperblobga":14,"maxfeeperga":[6,9,14,18,19,21,22,23,24],"maximum":[5,6,9,12,22],"maxpriorityfeeperga":[6,9,14,18,19,21,22,23,24],"may":[0,2,4,5,8,9,10,11,12,14,16,18,19,21,22,23,25,28],"mb":5,"md":14,"md5":14,"mean":[5,6,8,9,10,12,16,19,22,25],"meaning":14,"meant":[12,13,21],"mechan":[5,8,10,14,19,23],"media":0,"medium_gas_price_strategi":6,"member":0,"memori":[5,8,14,18,19,21],"merg":[2,14],"merge_args_and_kwarg":14,"merkl":22,"messag":[2,8,10,12,14,15,18,19,20,21,22],"message_hash":23,"messagehash":14,"metadata":[12,14,20,22],"metamask":[15,23],"metaphor":11,"mether":19,"method":[3,4,5,6,8,9,11,12,13,14,16,18,19,23,24,26,27,28],"method_allowlist":8,"method_formatt":14,"method_selector_funct":14,"methodnotsupport":[10,14],"methodunavail":[10,14],"mev":[14,15],"micro":19,"microeth":19,"microsoft":[14,19],"middlewar":[4,5,8,12,14,22,23],"middleware_onion":[9,10,14,18,23],"middleware_response_processor":8,"middleware_stack":[10,14],"middlewarebuild":14,"might":[5,8,10,13,19,21,23,25],"migraion":14,"migrat":14,"milli":19,"millieth":19,"million":21,"mimic":14,"min":[5,9,15],"min_attestation_inclusion_delay":20,"min_scan_chunk_s":5,"mine":[4,5,6,11,14,21,22],"miner":[13,14,22],"minim":[2,5],"minimum":[14,22],"minor":[2,5,14],"minter_":21,"minus":5,"minut":[5,6,8],"mirror":14,"misaccount":5,"mismatchedabi":[10,14,21],"mispel":14,"miss":[2,5,10,14,21],"misus":14,"mit":[14,18],"mitig":14,"mix":[21,25],"mixhash":[13,22],"mock":10,"mode":[9,14,19,21],"model":[5,14],"modern":[14,23],"modifi":[5,8,9,12,14,22],"modify_transact":[11,14,22],"modifytransact":14,"modul":[1,2,4,5,8,12,14,16,18,19,24,27,28],"module1":25,"module2":25,"module_test":2,"moduleclass1":25,"moduleclass2":25,"moduleclass3":25,"moduleclass4":25,"moduleclass5":25,"modulev2":14,"monitor":[5,8],"monkey":19,"monkeypatch":14,"monoton":22,"more":[2,4,5,6,8,9,10,11,12,14,16,19,21,22,23,25],"most":[2,6,8,10,11,12,13,14,16,19,21,22],"mount":12,"move":[14,23],"msg":23,"msgh":23,"msghash":23,"much":[2,5,10],"muddi":[2,14],"muir":14,"multi":14,"multichain":14,"multidimension":14,"multipl":[2,5,8,10,12,14,16,19,21,25],"multipli":[8,22],"multiply7":[21,25],"multithread":14,"munger":25,"must":[2,4,5,6,8,9,10,12,14,16,19,21,22,23],"mutat":14,"mwei":19,"my":[2,14],"my_account":21,"my_contract":[5,14,21],"my_ev":14,"my_func":14,"my_middleware1":9,"my_middleware2":9,"my_modul":9,"my_token_contract":21,"myarg":21,"mybal":21,"mycontract":[9,21,22],"mycontract_address":5,"mydata":21,"myevent":[5,9,14,21],"myfunc":14,"myfunct":[11,14,21],"mymethod":21,"mynam":19,"mynod":9,"mypi":[2,14],"mypy_cach":14,"name":[2,5,8,10,11,14,18,19,21,22,24,25],"name_to_address_middlewar":10,"namedelementonion":14,"namedtupl":[14,21],"namedtupledonion":14,"namenotfound":[9,10],"namespac":[11,14,22,24,25,26,27],"nano":19,"nanoeth":19,"nation":0,"nativ":14,"natur":[8,14],"near":[5,14,15],"necessari":[0,8,10,14,19,21,25],"necessarili":[2,22],"need":[2,4,5,6,8,9,10,11,12,14,16,18,19,20,21,23,25],"negat":[5,14],"nest":[14,21,25],"net":[7,14,17,24,25],"net_":26,"net_listen":26,"net_peer":14,"net_peercount":26,"net_vers":[8,26],"nethermind":[14,22,27],"netpeer":14,"network":[2,9,10,11,12,14,21,24,26],"network_timeout":14,"never":[5,12,14,18,23],"new":[5,8,9,10,11,12,14,15,16,18,19,21,22,24],"new_acct":19,"new_block_callback":10,"new_block_filt":[5,10],"new_entri":5,"new_heads_handl":[8,16],"new_middlewar":9,"new_transact":22,"new_transaction_filt":5,"newaccount":[10,14],"newcom":14,"newer":[2,14,16],"newest":22,"newest_block":22,"newfrag":14,"newhead":[8,12,16,22],"newheadssubscript":[8,16],"newheadssubscriptioncontext":[8,16],"newli":[10,14,22,23],"newpendingtransact":[8,14],"newpropos":21,"newsfrag":2,"next":[5,9,10,11,12,14,15,21,22,24],"nibbl":1,"nice":5,"nihao":21,"nist":14,"no":[2,4,5,8,9,11,12,14,15,16,19,21,22,23,25],"noabieventsfound":10,"noabifound":[10,14],"noabifunctionsfound":10,"node":[2,5,6,8,9,10,11,12,13,14,16,19,20,21,22,24,25],"node_info":24,"node_url":24,"non":[5,8,14,25],"nonc":[13,14,18,21,22,23,24,28],"none":[5,6,8,9,10,12,14,16,19,21,22,23,24,25],"none_in_dict":14,"nonpay":[5,21],"nonsens":14,"noqa":[21,22],"nor":10,"normal":[9,14,21],"normalize_nam":14,"normalize_request_paramet":[10,14],"not":[0,2,4,5,8,9,10,12,13,14,15,16,18,21,22,23,24,25],"notabl":14,"notat":21,"note":[4,5,8,9,10,12,14,16,18,19,22,23],"notebook":18,"noth":[5,8],"notic":14,"notimpl":14,"notimplementederror":14,"notori":5,"nov":14,"novemb":14,"now":[2,4,5,8,9,10,14,15,16,19,21,22,23],"ns":[4,19],"nuanc":13,"null":[5,14,21,22],"num_blocks_rescan_for_fork":5,"number":[2,4,5,6,8,9,10,11,12,13,14,16,19,21,22,23,25,26],"nvd":14,"obj":25,"object":[2,4,5,6,8,9,10,11,12,14,16,18,19,22,23,24,25,26,27],"oblig":0,"obsolet":14,"obtain":14,"occasion":[2,5],"occur":[5,10,12,14,16,22,25],"ocl":21,"octob":[10,14],"oeth":8,"of":[0,1,2,5,6,8,11,13,14,15,16,18,19,20,21,22,23,24,25,26,28],"off":[5,8,10,14,16,21],"offchain":[14,15,22,28],"offchain_lookup_payload":28,"offchainlookup":[2,21,22,28],"offens":0,"offer":[5,10,16,21],"offici":[0,5],"offlin":[0,14,18,21],"often":[8,9,19],"okay":2,"old":[2,5,9,10,14],"old_middlewar":9,"older":[8,9,14],"oldest":22,"oldestblock":22,"omit":[12,18,20,23,25],"on":[0,2,3,4,5,8,9,10,11,12,13,14,15,16,18,21,22,23,24,25,26,27,28],"onboard":14,"onc":[2,5,8,11,12,13,20,21],"one":[1,2,4,5,9,10,11,12,14,16,18,19,21,22,23,24,25],"onion":[4,8,9,11,14],"onli":[2,4,5,6,8,9,10,12,14,21,22,24,25],"onlin":0,"ontheweb":12,"onto":12,"opcod":[14,22,28],"open":[0,2,5,8,12,14,19,23,25],"openethereum":14,"openssl":23,"oper":[8,10,12,14,25],"opinion":4,"oppos":5,"opt":[10,14,18],"optim":[5,14],"optimis":19,"option":[5,8,10,12,13,14,16,18,19,21,22,23,24,25],"or":[0,2,4,5,8,9,10,11,12,13,14,16,18,20,21,22,23,24,25],"oracl":15,"orb":14,"order":[2,4,5,8,10,14,16,21,22,23,25],"org":[0,2,5,14,19,21,23],"organiz":14,"orient":[0,15],"origin":[5,8,9,12,14,21,22,23],"os":[9,12,14,18,23],"oserror":14,"osx":[14,20],"other":[0,4,5,8,9,12,13,14,15,16,21,23],"otherwis":[0,5,18,22,25],"our":[2,5,10,14,21,23],"out":[2,5,8,10,12,14,19],"outbound":20,"outdat":14,"outermost":9,"outgo":11,"outlin":[8,10,21],"output":[2,5,14,19,21,23,24],"output_valu":[14,21],"outsid":[8,25],"outstand":14,"over":[5,6,8,9,10,12,14,22],"overflow":2,"overhaul":14,"overhead":[5,6,8,25],"overload":[5,14,21],"overrid":[2,8,9,10,14,15,16,21,22],"overridden":16,"overview":[3,14],"overwrit":[22,25],"own":[2,4,5,9,12,13,14,15,19,21,22,23,28],"owner":21,"p2p":20,"p2p_address":20,"pack":25,"packag":[2,10,12,14,19],"pad":[4,10,14,19,21,23,25],"pad_byt":22,"page":[5,11,13,14,15,19],"pagin":5,"paid":22,"pair":[10,23],"pancakeswap":15,"panic":14,"paper":9,"parallel":[2,14],"param":[5,8,9,10,12,14,22],"paramet":[2,5,6,8,9,14,21,22,23],"parameter":14,"parent":[2,4,19,25],"parent_root":20,"parentbeaconblockroot":[14,22],"parenthash":[13,22],"parenthes":[14,21],"pariti":[10,14],"pars":[8,14,16,21,22],"parse_block_identifi":14,"part":[5,9,10,14,21,22],"parti":[14,25],"partial":14,"particip":0,"particular":[2,10,16,18,22],"pass":[2,4,5,8,9,10,12,14,16,19,21,22,23,25,28],"passphras":14,"password":[14,23],"past":[2,21,23],"pastev":14,"patch":[2,19],"patch_provid":19,"path":[2,10,11,12,13,14,19,23,24],"pathlib":14,"pattern":[2,8,9,10,14,16,18,25],"pave":10,"pay":22,"payabl":[5,14,21],"payload":[5,14,21,22],"payment":23,"pdf":14,"peer":[24,26],"peer_count":[11,26],"peer_id":20,"pend":[5,8,14,16,21,22,24],"pending_queu":20,"pending_tx_handl":[8,16],"pending_txs_handl":8,"pendingtxsubscript":[8,16],"pendingtxsubscriptioncontext":8,"peopl":[10,19],"pep561":14,"pep8":14,"per":[5,12,14,16,21,22],"percentil":22,"perform":[2,5,8,9,12,16,25],"period":5,"perman":0,"permiss":0,"permit":[14,21],"persist":[5,11,13,14,16,22],"persistent_connect":12,"persistent_websocket":10,"persistentconnect":[8,12],"persistentconnectionclosedok":14,"persistentconnectionerror":14,"persistentconnectionprovid":[8,12,14],"person":[0,14],"personal_ec_recov":14,"personal_sign":14,"pertin":21,"physic":0,"picoeth":19,"piec":16,"pin":[14,21],"ping":19,"pip":[2,10,11,12,13,14,19,21],"pipe":[8,12],"pipelin":2,"pk":18,"place":[4,10,11,14,21,23],"plan":[2,10],"platform":14,"pleas":[2,5,12,19,22,23],"pledg":0,"plug":14,"pluggi":14,"plus":[14,22],"pm":14,"poa":[9,12,14],"point":[2,4,5,9,11,14,16,18,19],"pointer":5,"poke":5,"polici":0,"polish":14,"polit":0,"poll":[10,14],"poll_interv":[5,14],"poll_lat":[14,22],"polygon":9,"pool":[12,14],"pool_connect":12,"pool_maxs":12,"pop":[8,14],"popitem":[14,21],"popul":[6,18,22],"popular":13,"port":[5,12,13,14,24],"portion":21,"posit":[0,5,6,10,14,21,22],"possibl":[2,6,9,10,12,14,22],"post":[0,10,12,14,16,22,24],"potenti":[5,14],"power":4,"pr":[2,14],"pr2448":14,"practic":[19,23],"pragma":[18,21,23],"pragu":14,"pre":[2,9,10,14,18,21,22,24],"precis":[19,25],"precompil":22,"predefin":[14,22,23],"prefer":[2,13,14,18,21],"prefix":[2,10,14,19,21,23,25],"preflight":[21,22],"prematur":14,"prepar":[5,14],"prepopul":13,"present":[5,8,9,12,14,16,21,23],"preserv":14,"prestatetrac":24,"prevent":[2,9,14],"preview":2,"previous":[2,5,10,13,14,16],"previous_epoch_attest":20,"previous_justifi":20,"previous_justified_checkpoint":20,"previous_vers":20,"price":[7,14,15,17,22],"primarili":[10,18],"primit":[8,14,25],"print":[5,8,10,12,16,23,25],"print_balance_of_shaq":25,"prior":[5,22],"prioriti":[10,22],"privaci":23,"privat":[0,2,9,14,18,19,22],"private_key":[9,10,18,23],"private_key_for_senders_account":22,"private_key_or_account":9,"privatekey":9,"privatekeysigningmanag":14,"probabl":[6,8,10,19],"problem":[10,13,19],"process":[2,5,9,10,12,14,16,21],"process_ev":5,"process_log":[5,8,14,16,21],"process_receipt":21,"process_subscript":[5,8,10,12,14,16],"process_typ":14,"processed_log":21,"processlog":14,"processor":[8,14],"processreceipt":14,"produc":[8,14,21,22,23],"profession":[0,15],"program":21,"programmat":5,"progress":5,"progress_bar":5,"progress_callback":5,"project":[0,5,10,14,15,19],"promis":10,"promot":14,"prompt":14,"prone":4,"proof":[10,14,18,22],"proofofauthoritydata":13,"propag":[14,19],"proper":[9,12,13,14,19,21,22],"properti":[5,6,8,9,10,11,14,25],"proposer_index":20,"proposer_slash":20,"protobuf":14,"protocol":[5,15,24],"protocol_vers":14,"protocolvers":[10,14],"prototyp":[9,13],"prove":[21,28],"provid":[2,4,5,6,9,14,15,16,19,21,22,23,24],"provider_uri":25,"providerconnectionerror":[8,19],"proxi":[5,14],"prune":14,"pt":15,"pubkey":20,"public":[0,5,8,9,12,14,18,19,21,23,28],"public_address_of_senders_account":22,"public_newhead":8,"public_provider_w":8,"public_w3":8,"publickey":14,"publish":[0,2],"puke":5,"pull":14,"pulledst":22,"pure":[21,23],"purg":[5,21],"purpos":[2,8,10,11,14],"push":14,"put":[8,9,16,23],"pwd":2,"py":[2,4,5,7,8,9,10,11,12,13,15,18,21,22,23,25,26,28],"py2":14,"py3":[10,14,19],"py37":14,"pycryptodom":14,"pydant":14,"pyethereum":14,"pyevm":21,"pygeth_vers":2,"pylru":14,"pypa":19,"pypi":[5,14,19],"pypiwin32":14,"pyproject":[2,14],"pyrlp":14,"pytest":[2,10,14,21],"pytest_asyncio":21,"python":[2,5,6,7,12,13,14,15,19,23],"python3":[14,19],"pythonic_middlewar":10,"pythonicmiddlewar":10,"pythonwarn":13,"pywalletconnect":15,"qualifi":14,"queri":5,"question":[2,5,14,19],"queu":24,"queue":[8,12],"quick":[11,13,14,21],"quicker":2,"quickest":13,"quickstart":[13,14],"quiet":19,"quieter":19,"quit":[9,10,14],"quot":14,"race":[0,14,16],"rainbowkit":15,"rais":[5,8,9,10,12,14,19,21,22],"ram":23,"ran":14,"rand":23,"randao_mix":20,"randao_rev":20,"random":23,"rang":[5,14,21,22],"rare":12,"rather":[5,8,10,14,21],"raw":[5,8,9,12,14,18,21,22,23],"raw_bal":21,"raw_respons":19,"raw_transact":[14,18,22,23],"rawtransact":14,"rcc":5,"rcc_address":5,"re":[2,5,6,9,10,12,13,14,16,19,21,22,23,25],"reach":[2,8,9,12,14,16,19],"react":11,"reactiv":19,"read":[2,5,8,11,12,13,14,15,18,22,25,28],"read_buffer_limit":[12,14],"readabl":[5,10,11,14],"readbufferlimitreach":[12,14],"readi":[6,12],"readm":14,"readthedoc":[2,5,9,14],"real":[5,19],"rearrang":14,"reason":[0,6,8,9,10,12,14,15,16,21,22,23],"reattach":14,"reattempt":5,"rebrand":14,"rebuild":25,"recal":14,"receipt":[10,14,16,18,21,22],"receiptsroot":[13,14,22],"receiv":[8,9,12,14,16,21,22,23],"receivefn":21,"receiving_account_address":9,"recent":[6,14,21,22],"recogn":[5,10,14,25],"recommend":[2,4,5,6,8,9,10,12,13,14,16,21,22,23],"recompil":14,"reconnect":12,"record":[2,5,14],"recov":[5,23],"recover_messag":23,"recoverhash":14,"recurs":[2,9,14],"recv":[8,12,14],"recycl":[12,14],"redirect":8,"redistribut":19,"reduc":[5,6,14],"redund":21,"refactor":14,"refer":[2,4,5,9,10,11,12,14,16,18,19,20,21,22,23],"referenc":[9,14],"reflect":[2,10,14],"reformat":[2,14],"refresh":14,"refund":22,"regard":[0,5,21],"regardless":[0,14],"regex":14,"regist":[10,11,22],"registri":[11,14],"regular":[10,21],"reject":[0,14,21],"reject_recursive_repeat":14,"relat":[5,8,10,14,16,18,19],"relationship":8,"relax":14,"releas":[5,10,12,14],"release_packag":14,"releasemanag":14,"relev":[10,12,14,23],"reli":[8,9,10,14,16,23],"religion":0,"reloc":[10,14],"remain":[4,14],"remap":14,"rememb":[5,19],"remix":[11,23],"remot":[5,8,12,14,20,23,24],"remoteaddress":24,"remov":[0,5,9,11,12,22],"renam":[2,14,21],"render":[5,19],"reorg":5,"reorgan":[8,14],"reorganis":5,"repeat":[9,22,25],"repercuss":0,"repl":21,"replac":[9,10,11,14,22],"replace_transact":[11,14,22],"replacetransact":14,"repli":19,"repo":[2,14,18],"report":[0,2,14],"repositori":[2,23],"repres":[0,2,6,8,10,21],"represent":[0,5,6,8,10,25],"reproduc":2,"reput":5,"request":[5,6,9,11,12,13,14,18,19,22,24],"request_async":14,"request_cache_validation_threshold":[8,14],"request_formatt":25,"request_information_cache_s":[12,14],"request_kwarg":[12,14],"request_mock":10,"request_processor":[8,9,10],"request_retry_allowlist":8,"request_retry_second":5,"request_timeout":[12,14],"requestcachevalidationthreshold":8,"requestinform":8,"requestmanag":19,"requestmock":10,"requestprocessor":[8,12,14],"requests_hash":14,"requesttimedout":14,"requir":[2,5,8,9,11,12,13,14,16,18,19,21,22,23],"rescan":5,"research":15,"reserv":14,"reset":[5,21],"resid":10,"resolut":14,"resolv":[11,14,19,21],"resourc":[14,15,23],"respect":[0,2,10,12,14,21,22],"respond":9,"respons":[5,9,10,11,12,14,16,19,21,22,23,25],"response_formatt":8,"response_processor":[9,10],"response_timeout":8,"rest":[12,18],"restart":[5,14],"restor":5,"restrict":21,"restructur":14,"result":[0,2,5,8,9,11,14,16,21,22,23,25],"result_formatt":25,"result_generator_middlewar":10,"resum":5,"retri":[5,12,14],"retriev":[5,9,12,14,15,21,22],"retry_configur":8,"retryabl":8,"return":[4,5,6,8,9,10,12,14,19,21,22,23,24,25,26,28],"return13":21,"return_on":25,"return_two":25,"return_zero":25,"returndata":22,"returnvalu":24,"reus":14,"reusabl":5,"rev":2,"revers":[4,9,14],"revert":[14,15,21,22,28],"revertswithoffchainlookup":21,"review":[0,2,10,12,14],"reward":[14,22],"reward_percentil":[14,22],"rich_log":21,"right":[0,21],"rinkebi":14,"rishab":15,"rjust":23,"rlp":22,"rlp_account":22,"rlp_node":22,"rlp_valu":22,"robin":10,"robust":[5,14],"roll":14,"root":[2,19,20,22],"rope":13,"ropsten":14,"round":10,"rout":21,"rpc":[5,6,8,9,11,12,14,15,16,21,22,24,26,27],"rpc_abi":14,"rpc_gas_price_strategi":[6,14],"rpccorsdomain":24,"rpcendpoint":[8,12],"rpcprovid":14,"rpcrespons":19,"rst":14,"rt":5,"rtd":14,"rudimentari":6,"rule":[14,21,22,25],"run":[8,9,10,12,13,14,19,20,21,22,23,24],"run_forev":[8,14],"run_until_complet":5,"runtim":[9,14,21],"s1":21,"s2":21,"sa":19,"safe":[5,8,14,22,23],"safest":13,"safeti":[5,8,14],"said":2,"sake":[5,18],"salt":28,"same":[2,4,5,8,9,10,12,14,16,18,19,21,22,23,25],"sampl":[6,14,15,22],"sample_s":6,"sandbox":[2,21],"saniti":[4,9,14],"satisfi":11,"save":[2,5,8,18,23],"say":[10,14,23],"sb":19,"scale":4,"scan":5,"scan_chunk":5,"scanner":5,"schedul":24,"schema":14,"scientist":15,"scope":2,"scr":8,"scratch":5,"script":[2,5,12,14,23],"sdk":15,"sealfield":22,"search":[5,14,19,21],"second":[5,6,8,9,12,14,22],"secret":[14,23],"section":[2,8,10,11,12,14,16,19,21,22,28],"secur":[11,12,13,15,19,23],"sede":22,"see":[2,4,5,8,9,10,11,12,13,14,16,18,19,21,22,23,25,28],"seen":[12,13],"select":[10,12,14,21,22],"selector":[14,21],"self":[5,9,22,25],"semant":10,"send":[8,9,12,13,14,16,18,19,22,23,25],"send_raw_transact":[9,11,14,22,23,25],"send_transact":[9,11,14,19,21,22,23,25],"sender":[14,21,22,23,28],"sendrawtransact":14,"sendtransact":[10,14],"sens":[2,5,9,11],"sensibl":4,"sensit":14,"sent":[5,8,12,14,18,21,22],"separ":[0,4,10,11,12,14,16],"sepolia":14,"septemb":14,"seq_numb":20,"sequenc":12,"sequenti":16,"serial":[14,22],"serializ":22,"serv":[5,11,13],"server":[2,5,8,9,11,12,14,19,24],"servic":[4,5,9,11,13,14,19],"session":[2,5,12,14,19],"set":[0,2,5,6,8,9,10,12,13,14,16,18,20,21,22,23,24,25,28],"set_contract_factori":[14,22],"set_data_filt":5,"set_descript":5,"set_gas_price_strategi":[6,11,14,22],"set_mod":14,"set_text":4,"setbar":21,"setbyt":21,"setbytes2valu":21,"setcontractfactori":14,"setgaspricestrategi":14,"setgreet":21,"setlevel":[12,19],"setmod":14,"setprovid":14,"setter":10,"setup":[2,5,14,19,21],"setup_address":[4,14],"setup_log":19,"setup_nam":4,"setuptool":19,"setvar":22,"sever":[5,9,11,13,14,19,23],"sexual":0,"sf":[10,23],"sha256":14,"sha3":[10,14],"sha3uncl":[13,22],"shanghai":14,"shannon":19,"shape":10,"shaq":25,"share":[2,5,14,16,23],"shell":23,"shh":14,"ship":12,"shortcut":21,"should":[2,4,5,6,8,9,10,12,14,16,19,21,22,23,25],"show":[0,2,4,5,8,10,13,14,16,22],"show_traceback":[8,14,19],"shown":[12,19],"shrink":5,"shuffle_round_count":20,"side":[5,22],"sig":23,"sign":[8,11,13,14,15,18,21,22,25],"sign_and_send_raw_middlewar":14,"sign_messag":23,"sign_transact":[11,14,18,21,22,23,25],"sign_typed_data":[11,14,22,25],"signandsendrawmiddlewarebuild":[9,10,14,18,23],"signandsendtransact":10,"signatur":[5,6,10,14,15,20,21,22,23],"signed_block_head":20,"signed_messag":23,"signed_tx":18,"signed_txn":[22,23],"signedmessag":23,"signedsetcodetransact":14,"signer":[15,23],"signhash":14,"signific":12,"signtransact":14,"signtypeddata":14,"silenc":[12,14],"silence_listener_task_except":12,"silent":[10,14,21],"similar":[9,10,12,14,21,25],"simpl":[5,14,22,23],"simple_cache_middlewar":[10,14],"simple_middleware_cach":14,"simplecach":[8,14,28],"simpler":10,"simpli":[2,6,19,22,25],"simplic":21,"simplifi":[9,10,14],"simul":[15,22],"simulatev1":22,"sinc":[4,5,8,9,10,14,16,19,21,22,24],"since_block":5,"singl":[8,9,10,14,21,23,25],"sit":9,"site":14,"six":14,"size":[0,5,8,12,13,14,19,21,22,25,28],"skip":[2,4,9,10,12,14],"slash":20,"slate":10,"sleep":[5,14,22],"slip44":4,"slot":[20,22],"slots_per_epoch":20,"slow":[5,14,19],"slow_gas_price_strategi":6,"small":14,"smaller":[5,14],"smart":[5,9,10,11,16,18,21,23],"smarter":5,"smol":18,"smoother":14,"snake":14,"snake_cas":14,"snakecas":14,"snakecharm":[0,24],"sneak":5,"so":[2,4,5,8,9,10,12,14,16,19,21,22,23,25],"social":0,"socio":0,"socket":[5,8,10,11,12,14,16,19],"softwar":2,"sol":2,"solc":[2,14,21],"solcx":[2,21],"solid":[2,5,14,15,18,19,21,25],"solidity_keccak":[11,14,25],"solidityerror":[10,14],"soliditykeccak":[10,14],"soliditysha3":[10,14],"solut":[5,6],"some":[2,5,8,9,10,11,12,13,14,16,19,21,22,25,28],"some_address":18,"some_condit":[8,12,16],"somehow":5,"someon":[14,21,23],"someth":[2,19,21],"sometim":[4,8],"somewher":8,"soon":[8,14],"sophist":14,"sort":[14,21],"sourc":[14,19,20,21,23,25],"sourcifi":15,"space":0,"span":2,"spdx":18,"spec":[3,14,19,25],"special":21,"specif":[0,2,5,8,9,10,11,14,16,19,20,21,22],"specifi":[2,4,5,8,9,10,12,13,14,16,19,21,22,24,25],"speed":[2,14,18,19],"spell":14,"spend":21,"spender":21,"sphinx":14,"sphinx_rtd_them":14,"split":[14,23],"sqlite":15,"squash":14,"src":5,"src_map":22,"src_map_runtim":22,"ssl":14,"stabl":[2,9,14,24,25],"stabliz":14,"stack":[2,14,19],"stackexchang":7,"stage":2,"stake":[10,12],"stakewis":15,"stale":[9,14],"staleblockchain":9,"stalecheck":4,"stalecheck_middlewar":14,"stalecheckmiddlewarebuild":9,"stamp":4,"standalon":[4,14,19],"standard":[5,9,10,12,14,21,24],"start":[2,5,8,9,11,12,13,14,16,19,21,23,24],"start_block":5,"start_chunk":5,"start_chunk_s":5,"start_http":24,"start_rpc":14,"start_w":24,"starthttp":14,"startingblock":22,"startrpc":14,"startswith":23,"state":[2,4,5,9,10,14,15,16,20,21,22,23],"state_id":20,"state_overrid":[14,22],"state_root":20,"stateless":[5,23],"statement":[14,23],"statemut":[5,21],"stateoverrid":[10,14,22],"stateroot":[13,22],"static":[14,21,24],"staticcal":24,"status":[0,2,14,16,20,22,24],"stay":8,"stderr":14,"stdout":[5,14],"steep":13,"step":[10,11,14,16,21],"still":[9,10,12,14,16,19,20,21],"stop":[10,14,21,24],"stop_http":24,"stop_rpc":14,"stop_w":24,"stophttp":14,"stoprpc":14,"storag":[14,22],"storage_proof":22,"storagehash":22,"storagekey":[14,22,23],"storageproof":22,"store":[2,5,8,12,14,19,22,23],"storedvalu":21,"str":[5,10,12,14],"straightforward":2,"strategi":[8,14,22],"strategy_based_gas_pric":14,"stream":[8,12,14],"streamhandl":12,"strftime":5,"strict":[4,12,14,25],"strict_bytes_type_check":[4,10,19,21,25],"stricter":[4,14,19,25],"string":[5,8,9,14,18,19,22,23,25],"strong":[2,9],"struct":[14,22],"structlog":24,"structur":[2,5,12,14,22],"stub":5,"stuck":2,"studio":19,"stuff":5,"style":14,"sub":14,"sub1":16,"sub2":16,"sub3":16,"sub_manag":[8,16],"subclass":[5,12,21],"subdirectori":2,"subdomain":4,"submiss":[2,15],"submit":[12,21,22],"submit_hashr":14,"submit_work":14,"submithashr":14,"submitwork":14,"submodul":[2,14,25],"submodule1":25,"submodule2":25,"submodule2a":25,"subscrib":[5,8,11,12,14,22,25],"subscribe_to_transfer_ev":5,"subscript":[5,8,10,11,12,14,22],"subscription_id":[5,8,12,16,22],"subscription_identifi":22,"subscription_iterator_exampl":12,"subscription_manag":[8,14],"subscription_param":22,"subscription_response_queue_s":12,"subsequ":5,"subset":2,"subsystem":19,"succeed":[9,12],"success":[8,9,14,22,24],"such":[0,5,6,8,9,10,11,12,14,19,21],"sudo":19,"suggest":[12,13,14,22],"suit":[2,14],"summar":8,"summari":[10,11,13,14,24],"suppli":[4,5,14,19,21,22],"support":[2,5,6,9,11,12,14,16,19,20,22,24,25,27,28],"supportsinterfac":4,"suprem":4,"sure":[2,4,5,12,14,19],"surfac":14,"survey":14,"sushi":15,"suspend":25,"swallow":10,"switch":[2,10,14],"symbol":[5,21],"symptom":19,"sync":[2,8,10,12,14,16,21,22],"sync_dist":20,"synchron":14,"syncingsubscript":16,"syntax":[9,10,11,12,14,21,22],"sys":5,"system":[5,12,14,24],"szabo":19,"t9":23,"tabl":14,"tag":[2,14,22],"tailwind":15,"take":[0,2,4,5,6,8,9,10,14,16,21,23,25],"taken":[5,10],"target":[5,15,20],"task":[5,8,12,14],"tcp":[12,20],"team":[0,10,15],"technic":14,"teku":20,"tell":5,"temo":15,"templat":[2,14,15],"temporari":[0,2],"temporarili":0,"ten":5,"tend":19,"term":19,"termin":[13,15,19],"test":[5,8,9,10,12,14,15,18,23],"test_":2,"test_account":2,"test_async_can_update_greet":21,"test_async_eth_sign":14,"test_async_initial_greet":21,"test_async_updating_greeting_emits_ev":21,"test_can_update_greet":21,"test_goethereum_http":2,"test_initial_greet":21,"test_middlewar":9,"test_updating_greeting_emits_ev":21,"tester":[10,12,13,14,21],"tester_provid":21,"testnet":[5,8,14,19,23],"testrpc":[10,14],"testrpcprovid":14,"testtoken":21,"tether":19,"text":[5,10,12,14,22,23,25],"textual":[15,24],"than":[5,6,8,9,10,12,14,19,21,22,23],"thank":[2,14],"that":[0,2,4,5,6,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,27],"the":[0,1,3,8,9,10,11,13,14,15,18,20,22,23,24,25,26,27,28],"their":[2,4,5,8,14,15,21,22],"them":[5,8,9,10,12,13,14,16,21,23,25],"theme":14,"themselv":[21,25],"then":[2,4,5,8,9,10,12,13,14,16,18,19,21,22,23],"there":[2,5,8,9,10,12,13,14,16,18,19,21,22,23,25],"therefor":[9,14,21,22],"these":[2,4,5,8,9,10,11,12,13,14,16,21,22,23,24,25],"they":[0,2,5,8,9,10,14,16,21,22,23,24,25],"thing":[2,8,10,16,19,23],"think":[2,9],"third":[14,25],"this":[0,2,4,5,6,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,25,28],"those":[2,5,8,10,11,14,15,16,21],"though":[2,5,9,22],"thread":[8,14,15,22],"threadsaf":14,"threaten":0,"three":[4,5,14,19,22],"threshold":[5,8,14],"throttl":5,"through":[5,8,12,14,16,21,22,23],"throughout":10,"throw":[10,14,16,22],"thrown":[10,14],"tidi":14,"tight":10,"tighten":10,"tilda":14,"time":[2,4,5,6,8,9,10,12,13,14,16,19,21,22],"time_bas":[6,14],"time_based_cache_middlewar":10,"timeexhaust":[8,14,22],"timeout":[5,8,12,14,22],"timeouterror":8,"timestamp":[5,8,13,22],"tip":[14,19,23],"titanoboa":15,"titl":14,"tld":[4,10,14],"to":[0,5,6,11,12,13,15,18,20,21,22,23,24,25,26,27,28],"to_0x_hex":14,"to_32byte_hex":23,"to_addr":5,"to_ascii_if_byt":10,"to_block":[5,10,21],"to_byt":[11,23,25],"to_checksum_address":[8,11,16,22,25],"to_hex":[11,14,23,25],"to_hexbyt":14,"to_int":[11,23,25],"to_integer_if_hex":10,"to_json":[11,25],"to_text":[11,25],"to_wei":[6,11,18,19,21,22,23,25],"toaddress":14,"toascii":10,"toblock":[10,14,22],"tobyt":[10,14],"tochecksumaddress":14,"todecim":14,"todo":14,"togeth":[2,16],"toggl":[4,10,12],"toggleabl":10,"tohex":[10,14],"toint":[10,14],"tojson":14,"token":14,"token_address":5,"token_contract":21,"toml":[2,14],"too":[5,9,10,21],"took":5,"tool":[2,10,14,19],"toolz":14,"top":[4,14,23],"topic":[5,8,14,16,21,22],"total":[5,21],"total_chunks_scan":5,"totaldifficulti":[13,22],"totalsuppli":[5,21],"totext":[10,14],"tour":[14,15,23],"toutf8":10,"toward":[0,6,10],"towei":14,"towncrier":14,"tox":14,"tqdm":5,"trace":[7,14,17,19,24],"trace_":27,"trace_block":[14,27],"trace_cal":[14,27],"trace_config":24,"trace_filt":[14,27],"trace_raw_transact":[14,27],"trace_replay_block_transact":[14,27],"trace_replay_transact":[14,27],"trace_transact":[14,24,27],"traceback":[21,22],"traceblock":14,"tracecal":14,"traceconfig":24,"tracefilt":14,"tracefilterparam":14,"tracer":24,"tracerawtransact":14,"tracerconfig":24,"tracereplayblocktransact":14,"tracereplaytransact":14,"tracetransact":14,"tracetransf":22,"track":[14,16,22,24],"trade":15,"traffic":19,"transact":[4,6,8,9,10,13,14,15,16,21,22,24,28],"transaction_default":14,"transaction_dict":4,"transaction_hash":[14,22,24],"transaction_index":[5,22],"transaction_param":[6,22],"transaction_receipt":[14,21],"transactionfilt":[5,14,22],"transactionhash":[5,21,22],"transactionindex":[5,21,22,24],"transactionindexinginprogress":10,"transactionnotfound":[10,14,22],"transactionsroot":[13,22],"transfer":[8,16,23],"transfer_ev":[8,16],"transfer_event_top":5,"transfer_filt":21,"transferfrom":[5,21],"transform":[5,10],"transient":12,"transit":10,"translat":[5,21],"transpar":8,"travi":14,"treat":10,"tree":[14,18,22],"tri":[5,8,12,13,14,19,21],"trie":[14,21,22],"trie_key":22,"trie_proof":22,"trie_root":22,"trigger":[2,5,8,14],"triniti":14,"troll":0,"troubl":19,"troubleshoot":[13,14],"true":[4,5,6,8,10,11,12,13,14,16,19,20,21,22,24,25,26],"trust":[21,25],"tune":[12,14],"tupl":[5,8,9,14,21,22,25],"tupleiz":14,"turbogeth":19,"turn":[8,14,22],"tutori":[2,14,18],"tweak":[9,14],"twentyon":21,"twice":14,"twine":14,"twist":5,"two":[5,8,14,16,18,21,22,25],"two_day_stalecheck":9,"tx":[5,8,14,16,18,21,22],"tx_dict":9,"tx_filter":5,"tx_hash":[5,11,18,21,24],"tx_receipt":[11,21],"txdata":14,"txhash":5,"txn_dict":14,"txn_receipt":21,"txpool":[10,14,24],"txpool_":24,"txpool_cont":24,"txpool_inspect":24,"txpool_status":24,"txreceipt":14,"txs":14,"txt":25,"type":[2,4,5,9,14,15,22,23,24,25],"typeddict":14,"typeerror":[10,14,22],"typic":[2,9,13,18,19,22],"typo":[2,14],"tz":22,"u256":19,"u8":19,"ubuntu":2,"udp":20,"ugh":14,"ui":[2,5],"uint256":[1,5,14,19,21],"uint32":5,"uint8":[5,14,19,21,23,25],"ujson":19,"ultim":22,"un":[5,9,14],"unabl":[12,14],"unaccept":0,"unaffect":14,"unavail":10,"uncl":[13,14,22],"uncle_index":22,"uncommon":10,"under":[2,4,5,8,9,10,11,12,14,18,19,22,24,26],"understand":[2,8,14],"undesir":21,"unexpect":[16,25],"unfamiliar":23,"unfortun":9,"unguess":23,"unhappi":14,"unhash":14,"unicod":[10,19],"unicodedecodeerror":14,"unicorn":[14,23],"unicorn_txn":23,"unimpl":14,"unindex":21,"uninstal":22,"uninstall_filt":[11,14,22],"uninstallfilt":14,"union":[8,10],"uniqu":[4,9,14],"uniswap":15,"unit":[14,23],"unix":23,"unknown":14,"unless":[2,16,21,22],"unlik":[5,8,12],"unlock":[2,14,21,22],"unlockaccount":10,"unmin":[21,22],"unmodifi":5,"unnecessari":[8,14],"unneed":14,"unord":14,"unreach":14,"unreleas":[2,14],"unreli":5,"unsent_billboard_tx":18,"unsign":14,"unstabl":[2,14],"unsubscrib":[8,12,14,22,25],"unsubscribe_al":16,"unsuccess":22,"unsupport":[14,19,25],"until":[2,5,8,14,16,19,25],"unus":[10,14,22],"unwelcom":0,"up":[2,5,8,10,12,13,14,15,16,20,21,22,23],"upcom":[2,14],"updat":[2,5,21],"updateaddr":19,"updatebool":19,"updatebytes1":19,"updateint8":19,"updatemap":19,"updateuint256":19,"updateuint8":19,"updateuintarray":19,"updatevalu":21,"upgrad":[10,14,19],"upon":[14,21],"upper":[14,21,25],"upstream":14,"uri":[12,14],"url":[4,5,10,12,13,14,16],"urllib3":19,"us":[2,5,14,23],"usag":[2,5,8,13,14,22,25],"use":[0,1,4,5,6,8,9,10,11,13,14,16,18,20,22,25,28],"use_text_fram":[12,14],"uselessflag":21,"user":[2,4,5,8,10,14,19,21,22,23,24],"user_doc":22,"user_messag":14,"usernam":2,"usual":[10,14,19,22,23],"utc":[5,23],"utcfromtimestamp":5,"utf":[10,25],"util":[5,7,8,10,11,12,14,15,16,17,18,22,25],"utility_method":14,"uts46":14,"v0":[14,23],"v1":[2,5,9,14,15,24,25],"v10":[10,14],"v2":[5,10,14],"v20":20,"v3":[14,15],"v6":[21,22],"v7":16,"v8":[14,22],"val":23,"valid":[2,5,8,10,12,14,15,19,20,22,23,25],"validate_pay":14,"validationerror":14,"validationmiddlewar":9,"validator_id":20,"valu":[1,4,5,6,8,9,10,14,16,18,19,21,22,23,24,25],"value_based_gas_price_strategi":6,"valueerror":[10,14,21,22,23],"vaniti":15,"vari":8,"variabl":[2,10,13,14,18,21],"varieti":[12,14,19,25],"various":14,"ve":[2,10,19,21,25],"venv":[2,19],"verbiag":14,"verbos":[5,10,19],"veri":[2,5,23],"verif":22,"verifi":[2,4,21,22],"verify_eth_get_proof":22,"version":[0,1,4,5,6,9,10,11,12,14,15,19,20,21,23,24,25,26,28],"version_part_to_bump":2,"vet":[15,25],"via":[0,2,4,8,9,10,11,13,14,15,16,18,19,21,22,25],"view":[5,11,18,21,22,23],"viewpoint":0,"virtual":[2,19],"virtualenv":[13,14,19],"visit":[10,19],"visual":[8,10,11,14],"visualstudio":19,"voluntary_exit":20,"vs":14,"vuln":14,"vulner":14,"vyper":[14,15],"w3":[4,5,6,8,9,10,11,12,13,14,16,19,21,22,23,24,25],"w3_1":9,"w3_2":9,"wad":5,"wagmi":15,"wait":[4,8,12,14,21,22],"wait_for_transaction_receipt":[10,11,14,18,21,22],"waitfortransactionreceipt":14,"wake":15,"wallet":[15,23],"walletconnect":15,"want":[2,4,5,8,10,11,12,14,16,18,19,21,23,25],"warn":[5,13,14,19,21],"was":[5,8,9,10,14,21,22,23,24],"wasn":[10,14],"wast":2,"watch":[5,10],"way":[2,4,5,8,9,10,12,13,14,16,18,19,21,22,23],"we":[0,2,5,8,9,10,13,14,16,19,21,23],"web":[14,15,19],"web3":[1,2,4,5,6,7,9,12,15,17,18,20,21,23,24,26,27,28],"web3_clientvers":[8,14,25],"web3_infura_api_key":[10,14],"web3_infura_project_id":[10,14],"web3_provider_uri":[12,14],"web3assertionerror":10,"web3attributeerror":10,"web3except":[10,14],"web3jsonencod":14,"web3middlewar":[9,14],"web3pi":[2,9,15],"web3rpcerror":[10,14],"web3typeerror":[5,10],"web3validationerror":[10,14],"web3valueerror":[10,14,21],"webserv":24,"websocket":[10,11,12,13,14,15,16,19,24],"websocket_kwarg":12,"websocket_timeout":12,"websocketconnect":14,"websocketprovid":[5,8,11,13,14,16,21,22],"websocketproviderv2":[10,14],"websocketsproviderv2":10,"wei":[1,6,14,19,22,24,25],"wei_per_eth":1,"weight":[6,14,22],"welcom":[0,14],"well":[2,4,8,9,14,18,22,24],"were":[5,10,12,14,21,25],"weth":[5,8,16],"weth_abi":[5,8],"weth_address":5,"weth_contract":[5,8,16],"what":[0,2,4,5,8,21],"whatev":[2,5,9,10,16,19],"wheel":14,"when":[0,2,4,5,6,8,9,10,12,14,16,18,19,21,22,23,25],"whenev":[6,9,10],"where":[2,4,5,9,10,11,14,21,22,28],"wherea":2,"wherev":[5,10,16],"whether":[4,5,8,12,14,21,22,24],"whi":[8,14],"which":[0,1,4,5,6,8,9,10,11,12,14,15,16,18,19,21,22,23,25],"while":[5,8,9,10,12,14,16,19,22],"whisper":14,"whitelist":14,"whitespac":14,"who":[0,19],"whole":[5,14,16,21],"whose":[8,14,21,25],"wide":10,"wiki":0,"wildcard":14,"will":[0,2,4,5,6,8,9,10,11,12,13,14,16,18,19,21,22,23,25],"win":14,"window":[5,12,14,19,24],"wish":9,"with":[0,6,8,10,11,13,14,15,16,19,22,24,25,26,27,28],"withdraw":[5,14,22],"withdrawable_epoch":20,"withdrawal_credenti":20,"withdrawals_root":14,"withdrawalsroot":22,"within":[0,2,5,6,9,10,11,14,16,21,22,25,28],"withlog":24,"without":[0,2,9,10,11,12,13,14,16,19,21,22,23,25],"won":[2,8,10],"word":5,"work":[5,8,9,10,12,14,15,16,18,23],"worker":[2,5],"workflow":[2,19],"world":[5,21],"would":[2,5,9,10,12,14,18,21,25],"wrap":[10,14,16],"wrap_make_request":[9,10],"wrapper":[10,14],"write":[5,9,14,21],"writebillboard":18,"written":[2,16,22],"wrong":[14,21],"ws":[2,8,10,11,12,13,14],"ws_one_to_one_exampl":8,"ws_subscription_exampl":8,"wss":[12,13,14,16],"wt":5,"www":0,"x00":[4,21,22,25],"x01":[22,25],"x03":[21,23],"x040":22,"x08":22,"x0bm":21,"x0en":22,"x0f":25,"x11":22,"x12":[22,23],"x124":21,"x12qc":21,"x14":21,"x15":22,"x16s":4,"x18":22,"x1a":22,"x1b":22,"x1d":22,"x1e":21,"x1f":23,"x64":19,"x74":25,"x78":25,"x80":22,"x82":22,"x82r":22,"x83h":4,"x84":21,"x85":22,"x86":[19,21],"x86_64":20,"x87":22,"x89":4,"x8a":21,"x8b":21,"x8c":21,"x8f":22,"x92":21,"x94":22,"x96vk":23,"x97":22,"x97lf":22,"x98":22,"x99":[10,22],"x9a":23,"x9e":22,"x9fw9":21,"xa0":22,"xa04p":22,"xa3":[21,22],"xa4":21,"xa5sf":10,"xa8":22,"xa9":21,"xab":21,"xad":22,"xae":22,"xb0":4,"xb1":22,"xb2":[21,23],"xb3":[22,23],"xb3d":23,"xb4":21,"xb5":22,"xb6":[22,25],"xb7":[4,22],"xb9":21,"xbb":[4,22],"xbc":22,"xbf":[22,23],"xc0":21,"xc0v":22,"xc3":[21,22,25],"xc4":4,"xc4rm":23,"xc7":21,"xc7t":22,"xc8":21,"xc9":4,"xccz":4,"xcd":4,"xd1oqb":21,"xd2":22,"xd3":[21,22],"xd9":23,"xdax":21,"xdctm":22,"xdcv":23,"xdd":21,"xddb":21,"xdf":22,"xdist":[2,14],"xe1":21,"xe2":10,"xe24":22,"xe3":22,"xe4":23,"xe5":[21,22,23],"xe6":22,"xe7":22,"xe8":21,"xe9":22,"xeb":21,"xec":[21,23],"xed":[21,22],"xedn":21,"xee":[22,23],"xef":22,"xf0":22,"xf1":[21,22,23],"xf2":[21,22],"xf3":21,"xf4":21,"xf6":22,"xf7":21,"xf8":22,"xf8d":22,"xfail":14,"xfd":[21,22],"xfe":4,"xxx":23,"xyz":15,"yank":14,"year":14,"yearn":15,"yellow":9,"yet":[2,5,9,14,22],"yield":[5,8,12,14,22],"yml":[2,14],"you":[2,4,5,6,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,27],"your":[5,9,10,11,12,13,14,15,16,18,19,20,21,22,23,25,28],"your_event_nam":[5,11,21],"yourself":[2,8],"zero":[1,4,14,21,22,23,25],"zip":[2,14],"zkevm":8,"zksync":8},"titles":["\u884c\u4e3a\u51c6\u5219","Constants","\u8d21\u732e","ENS API","\u4ee5\u592a\u574a\u540d\u79f0\u670d\u52a1 (ENS)","\u4e8b\u4ef6\u548c\u65e5\u5fd7","Gas Price API","gm\uff08\u65e9\u5b89\uff09","Web3 \u5185\u90e8\u5b9e\u73b0","\u4e2d\u95f4\u4ef6","\u8fc1\u79fb\u6307\u5357","\u6982\u89c8","\u63d0\u4f9b\u8005","\u5feb\u901f\u5f00\u59cb","\u53d1\u5e03\u8bf4\u660e","\u8d44\u6e90\u548c\u5b66\u4e60\u6750\u6599","\u4e8b\u4ef6\u8ba2\u9605","\u76ee\u5f55","\u4ea4\u6613","\u6545\u969c\u6392\u9664","Beacon API","\u5408\u7ea6","web3.eth API","\u8d26\u6237","Geth API","Web3 API","Net API","Tracing API","Utils"],"titleterms":{"01":14,"02":14,"03":14,"04":14,"05":14,"06":14,"07":14,"08":14,"09":14,"10":[10,14],"11":[10,14],"12":14,"13":14,"14":14,"15":14,"16":14,"17":14,"18":14,"19":14,"20":[14,21],"2019":14,"2020":14,"2021":14,"2022":14,"2023":14,"2024":14,"2025":14,"21":14,"22":14,"23":14,"24":14,"25":14,"26":14,"27":14,"28":14,"29":14,"30":14,"31":14,"abi":[10,19,28],"access":[10,19],"account":[11,19,21,23],"addit":16,"address":[4,9,11,19,25,28],"adjust":19,"advanc":5,"all":5,"alpha":14,"am":19,"ambigu":21,"an":[4,16,19,21,23],"and":[2,4,5,9,10,11,14,15,21,25],"anoth":19,"api":[3,6,7,9,10,11,14,17,19,20,22,24,25,26,27],"applic":[15,16],"approv":21,"argument":21,"as":21,"async":[5,25],"async_en":3,"asynchron":5,"asynchttpprovid":12,"asyncipcprovid":[10,12],"asyncweb3":[10,12],"attribut":[0,21,25],"attributedict":[9,10],"author":[9,12],"auto":12,"autoprovid":12,"avail":6,"await":5,"balanc":21,"base":[10,11,12],"batch":25,"beacon":20,"befor":2,"beta":14,"block":[5,9],"blockchain":13,"boolean":19,"break":[10,14],"buffer":9,"bugfix":14,"build":2,"builder":10,"built":12,"bump":2,"by":[10,19],"byte":[10,19,21],"bytes4":21,"cach":[8,10,28],"camelcas":10,"can":[16,19],"case":10,"ccip":21,"chang":[10,14],"chapter":18,"check":[10,19,21,25],"choos":12,"ci":2,"class":[5,10,12],"clean":19,"code":[2,5],"common":23,"communiti":[],"concisecontract":10,"concurr":5,"conduct":[],"confer":15,"configur":[8,9,11],"conform":19,"connect":[8,12,19],"constant":1,"content":[],"contract":[2,10,11,15,18,21,22,23],"contractcal":21,"contribut":[],"contributor":14,"conveni":10,"convers":[10,11,25],"convert":19,"cours":15,"creat":[6,9,19,21,23],"cryptograph":[11,25],"currenc":[11,19,25],"custom":[9,25],"cython":19,"data":11,"decod":[11,25],"default":[9,10,21],"denomin":19,"deploy":21,"deprec":[10,14],"dev":12,"develop":2,"dict":10,"disabl":[19,21],"disambigu":10,"do":19,"docker":2,"document":[2,14],"doesn":19,"drop":10,"each":2,"ecrecov":23,"encod":[11,25],"end":10,"enforc":0,"ens":[3,4,9,10,11],"environ":[2,12,19,23],"erc":21,"error":[10,19],"estim":9,"eth":[2,10,11,18,22],"eth_getlog":5,"ether":19,"ethereum":19,"ethereumtesterprovid":[10,12],"ethpm":10,"event":[5,11,16,21],"exampl":[5,11,16,19,21],"except":[3,10,28],"extern":[21,25],"extract":23,"extradatatopoamiddlewar":9,"factori":21,"fallback":21,"faq":16,"featur":[10,14],"fetch":[5,11],"filter":[5,9,10,11,22],"final":2,"first":15,"fixtur":2,"for":[4,5,8,14,19,21,23],"framework":15,"from":[10,19,23],"function":[19,21],"fund":23,"gas":[6,9],"generat":[2,10],"get":[4,13,19],"geth":[2,10,12,23,24],"gethadmin":24,"gethdebug":24,"gethtxpool":24,"github":2,"gm":7,"guid":[],"hackathon":15,"handl":[10,28],"handle_subscript":16,"handler":16,"hash":[11,25],"help":2,"helper":[11,15,25],"hex":21,"hexadecim":19,"host":23,"how":[2,16,19],"http":[8,10],"httpprovid":12,"implicitcontract":10,"improv":14,"in":[5,12,21,23],"indic":[],"info":[4,13],"infura":10,"inherit":10,"initi":12,"input":10,"instal":19,"instanc":19,"instanti":9,"int":1,"integ":19,"integr":2,"interact":[12,21],"intern":14,"into":10,"intro":[],"introduct":16,"invalid":21,"invok":21,"ipcprovid":12,"is":[9,16],"isn":19,"json":[10,19],"key":[10,11,23],"keyfil":23,"languag":15,"learn":[],"legacywebsocketprovid":12,"level":19,"librari":15,"lifecycl":8,"limit":5,"link":4,"listen":[5,8],"local":[9,13,23],"log":[5,9,11,19,21],"longer":10,"lookup":21,"loop":5,"manag":[8,9,10],"mani":8,"manual":2,"materi":[],"messag":23,"metadata":[4,21],"metamask":19,"method":[10,20,21,22,25],"middlewar":[9,10,11,18],"migrat":10,"miner":10,"misc":[10,14],"miscellan":[10,14],"model":10,"modul":[3,10,25],"move":10,"multichain":4,"my":[16,19],"name":[4,9],"namespac":10,"necessari":9,"net":[11,26],"network":19,"new":[2,23],"night":2,"no":10,"node":23,"non":[10,21],"normal":10,"not":19,"notabl":10,"note":2,"object":21,"of":[4,9,10,12],"offchain":21,"on":19,"onc":16,"one":8,"optim":19,"option":9,"or":19,"order":9,"other":10,"our":0,"overview":[],"own":8,"owner":4,"parallel":16,"paramet":10,"part":2,"particular":19,"perform":[14,21],"persist":[8,12],"person":10,"pledg":[],"poll":5,"prepar":23,"present":15,"price":[6,9],"privat":[11,23],"process":8,"program":15,"proof":[9,12],"properti":[21,22,26],"provid":[8,10,11,12,13,25],"pull":2,"push":2,"py":[14,16,19],"pypi":2,"python":[10,21],"queri":21,"quickstart":[],"read":[4,21,23],"record":4,"releas":2,"remain":10,"remot":13,"remov":[10,14],"renam":10,"represent":19,"request":[2,8,10,25],"requir":10,"resolut":[4,9],"resolv":4,"resourc":[],"respons":[0,8],"result":10,"retri":[8,10],"retriev":6,"rpc":[10,19,25],"run":[2,5,16],"scope":0,"select":6,"send":[11,21],"send_raw_transact":18,"send_transact":18,"separ":5,"servic":[],"set":[4,19],"setup":4,"shortcut":12,"sign":[9,19,23],"signer":18,"singl":5,"smart":15,"snake":10,"snake_cas":10,"solid":23,"some":23,"split":10,"stack":9,"stalecheck":9,"standard":0,"step":15,"strategi":[6,9],"strict":[10,19,21],"string":[1,10,21],"struct":[19,21],"style":2,"subscrib":16,"subscript":16,"subscription_manag":16,"support":[4,10,21],"synchron":5,"tabl":[],"test":[2,13,19,21],"tester":[2,18],"testnet":10,"testrpcprovid":10,"text":[4,19],"the":[2,4,5,6,12,16,19,21],"thread":5,"to":[2,4,8,9,10,14,16,19],"todecim":10,"token":[5,21],"tool":15,"trace":27,"transact":[5,11,18,19,23],"transfer":[5,21],"troubleshoot":[],"tutori":15,"type":[10,16,19,21],"unit":[2,21],"unsign":19,"unsubscrib":16,"up":[4,19],"updat":[10,14],"usag":4,"use":[2,12,19,21,23],"util":[21,28],"v1":10,"v3":10,"v4":[10,14],"v5":[10,14],"v6":[10,14],"v7":[10,14],"valid":[9,21],"validationerror":10,"variabl":[12,23],"verifi":23,"version":2,"via":12,"video":15,"visual":19,"vs":[19,23],"w3":18,"web3":[8,10,11,13,14,16,19,22,25],"websocketprovid":[10,12],"whi":[9,19],"which":2,"wildcard":4,"with":[2,4,5,9,12,18,21,23],"work":[2,4,19,21],"write":[2,8],"your":[2,4,8]}}) diff --git a/_build/html_zh_CN/subscriptions.html b/_build/html_zh_CN/subscriptions.html new file mode 100644 index 0000000000..781b4d332f --- /dev/null +++ b/_build/html_zh_CN/subscriptions.html @@ -0,0 +1,504 @@ + + + + + + + + + 事件订阅 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

事件订阅

+

Most Ethereum clients include eth_subscribe support, allowing you to listen for specific events as they occur. This applies to a limited set of events: new block headers, the syncing status of a node, new pending transactions, and emitted logs from smart contracts.

+
+

警告

+

Subscriptions require a persistent socket connection between you and the Ethereum client. For that reason, you must use web3.py's WebSocketProvider or AsyncIPCProvider to utilize subscriptions. As it is the more common of the two, examples in this guide will leverage the WebSocketProvider.

+
+
+

An introduction to subscriptions

+

When you subscribe to an event – new block headers, for example – you'll receive a subscription ID. The Ethereum client will then maintain a connection to your application and send along any related event until you unsubscribe with that ID. That example in code:

+
import asyncio
+from web3 import AsyncWeb3, WebSocketProvider
+
+async def example():
+    # connect to a node:
+    async with AsyncWeb3(WebSocketProvider("wss://...")) as w3:
+
+    # subscribe to new block headers:
+    subscription_id = await w3.eth.subscribe("newHeads")
+    print(subscription_id)
+
+    # listen for events as they occur:
+    async for response in w3.socket.process_subscriptions():
+        # handle each event:
+        print(response)
+
+        # unsubscribe:
+        if response["number"] > 42012345:
+            await w3.eth.unsubscribe(subscription_id)
+            break
+
+asyncio.run(example())
+
+
+
+
+

web3.py's subscription_manager

+

The example above is the "manual" approach to managing subscriptions. It's not so complicated in the case of listening for new block headers, but things get considerably more complex once you start listening for smart contract event logs or managing multiple subscriptions. +As of v7.7.0, web3.py includes some additional convenient subscription management features. We'll step through them now.

+
+

1.) The subscription_manager

+

The w3 (AsyncWeb3) instance has a subscription_manager module. While you may +still use the w3.eth.subscribe method from the previous example, the +subscription_manager offers an additional way to start one or more subscriptions and +provides better management of those subscriptions. We're going to pass in a list of +events we want to subscribe to within the w3.subscription_manager.subscribe method.

+
await w3.subscription_manager.subscribe([sub1, sub2, ...])
+
+
+
+
+

2.) Subscription types

+

To aid in defining those subscriptions, subscription type classes have been introduced: NewHeadsSubscription, PendingTxSubscription, LogsSubscription, and SyncingSubscription. Each class is context aware, meaning it will throw an error if you provide an unexpected data type.

+
from web3.utils.subscriptions import (
+    NewHeadsSubscription,
+    PendingTxSubscription,
+    LogsSubscription,
+)
+
+sub1 = NewHeadsSubscription(
+    label="new-heads-mainnet",  # optional label
+    handler=new_heads_handler,
+)
+
+sub2 = PendingTxSubscription(
+    label="pending-tx-mainnet",  # optional label
+    full_transactions=True,
+    handler=pending_tx_handler,
+    # optional parallelization flag (see Parallelizing subscriptions section below)
+    parallelize=True,
+)
+
+sub3 = LogsSubscription(
+    label="WETH transfers",  # optional label
+    address=weth_contract.address,
+    topics=[weth_contract.events.Transfer().topic],
+    handler=log_handler,
+    # optional `handler_context` args to help parse a response
+    handler_context={"transfer_event": weth_contract.events.Transfer()},
+)
+
+
+
+
+

3.) Handlers

+

In the example above, there is a handler specified for each subscription. These are context-aware functions that you can declare separate from the subscription logic. Within each handler, parse and perform whatever logic you require. +Note that in addition to the result being processed, the handler_context in each handler provides access to your AsyncWeb3 instance, the subscription instance, and any custom values declared within the handler_context of the subscription: from web3.utils.subscriptions import LogsSubscriptionContext

+
async def new_heads_handler(
+    handler_context: LogsSubscriptionContext,
+) -> None:
+    log_receipt = handler_context.result
+    print(f"New log: {log_receipt}\n")
+
+    event_data = handler_context.transfer_event.process_log(log_receipt)
+    print(f"Log event data: {event_data}\n")
+
+    if log_receipt["blockNumber"] > 42012345:
+        await handler_context.subscription.unsubscribe()
+
+
+
+
+

4.) handle_subscriptions

+

Finally, when all your subscriptions are configured, utilize the handle_subscriptions method to begin processing them. If you need to listen for events on multiple chains, create one w3 instance per chain.

+
async def sub_manager():
+    ...
+
+    # handle subscriptions via configured handlers:
+    await w3.subscription_manager.handle_subscriptions()
+
+    # or, gather one w3 instance per chain:
+    await asyncio.gather(
+        w3.subscription_manager.handle_subscriptions(),
+        l2_w3.subscription_manager.handle_subscriptions(),
+    )
+
+asyncio.run(sub_manager())
+
+
+
+
+

5.) Unsubscribing

+

If you don't want to subscribe indefinitely to an event, you can unsubscribe at any point. The first example in this post demonstrated the manual approach: await w3.eth.unsubscribe(subscription_id)

+

The new handler pattern will keep track of the subscription ID for you however, so the same can be accomplished via the handler_context without an ID:

+
async def new_heads_handler(handler_context):
+    ...
+    if some_condition:
+        await handler_context.subscription.unsubscribe()
+
+
+

Lastly, if you're wrapping up the whole show, you can reach for unsubscribe_all on the subscription_manager:

+
await w3.subscription_manager.unsubscribe_all()
+assert subscription_manager.subscriptions == []
+
+
+
+
+
+

An example

+

Let's put all the pieces together. This example will subscribe to new block headers and transfer events from the WETH contract. It should work as written if you provide a WebSocket RPC URL.

+
import asyncio
+from web3 import AsyncWeb3, WebSocketProvider
+from web3.utils.subscriptions import (
+    NewHeadsSubscription,
+    NewHeadsSubscriptionContext,
+    LogsSubscription,
+    LogsSubscriptionContext,
+)
+
+# -- declare handlers --
+async def new_heads_handler(
+    handler_context: NewHeadsSubscriptionContext,
+) -> None:
+    header = handler_context.result
+    print(f"New block header: {header}\n")
+
+async def log_handler(
+    handler_context: LogsSubscriptionContext,
+) -> None:
+    log_receipt = handler_context.result
+    print(f"Log receipt: {log_receipt}\n")
+
+async def sub_manager():
+
+    # -- initialize provider --
+    w3 = await AsyncWeb3(WebSocketProvider("wss://..."))
+
+    # -- subscribe to event(s) --
+    await w3.subscription_manager.subscribe(
+        [
+            NewHeadsSubscription(
+                label="new-heads-mainnet",
+                handler=new_heads_handler
+            ),
+            LogsSubscription(
+                label="WETH transfers",
+                address=w3.to_checksum_address(
+                    "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
+                ),
+                topics=["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
+                handler=log_handler,
+            ),
+        ]
+    )
+
+    # -- listen for events --
+    await w3.subscription_manager.handle_subscriptions()
+
+asyncio.run(sub_manager())
+
+
+
+
+

Parallelizing subscriptions

+
+

重要

+

Parallelizing subscriptions does not guarantee that events will be processed in the +order they are received. Most events should still be processed in the order they are +received, but if a particular handler takes a long time to execute, newer events may +be processed first. It is recommended to set the parallelize flag to False +(default behavior) for subscriptions that depend on the order of events.

+
+

If you have multiple subscriptions that can be processed in parallel, you can set the +parallelize flag to True - either globally on the subscription manager, or +individually on each subscription. This control allows the subscription manager to +handle subscription processing concurrently. This flag can be set on the manager, as a +global setting, or on individual subscriptions. This can help with performance if +subscriptions are independent of each other, or do not rely on some external shared +state (no race conditions are present).

+

Global parallelization is off by default, meaning all subscriptions will be processed +sequentially unless you set the parallelize flag to True on the subscription +manager or individual subscriptions.

+
sub1 = NewHeadsSubscription(
+    label="new-heads-mainnet",
+    handler=new_heads_handler,
+    parallelize=True,  # process this subscription in parallel
+)
+
+sub2 = LogsSubscription(
+    label="WETH transfers",
+    address=weth_contract.address,
+    topics=[weth_contract.events.Transfer().topic],
+    handler=log_handler,
+    parallelize=False,  # process sequentially (this is the default behavior)
+)
+
+sub3 = LogsSubscription(
+    label="WETH approvals",
+    address=weth_contract.address,
+    topics=[weth_contract.events.Approval().topic],
+    handler=approval_handler,
+    parallelize=True,  # process this subscription in parallel
+)
+
+await w3.subscription_manager.subscribe([sub1, sub2])
+
+
+

Global parallelization can also be set on the subscription manager, which will apply to +all subscriptions unless overridden by an individual subscription's parallelize +flag:

+
# or set the parallelize flag globally on the subscription manager:
+w3.subscription_manager.parallelize = True
+
+# parallelize is set globally, so this will be processed in parallel
+sub1 = NewHeadsSubscription(
+    label="new-heads-mainnet",
+    handler=new_heads_handler,
+)
+
+# this will be processed sequentially since ``parallelize`` is set to ``False``,
+# overriding the global setting
+sub2 = LogsSubscription(
+    label="WETH transfers",
+    address=weth_contract.address,
+    topics=[weth_contract.events.Transfer().topic],
+    handler=log_handler,
+    parallelize=False,  # process sequentially
+)
+
+# this will also be processed in parallel
+sub3 = LogsSubscription(
+    label="WETH approvals",
+    address=weth_contract.address,
+    topics=[weth_contract.events.Approval().topic],
+    handler=approval_handler,
+)
+
+await w3.subscription_manager.subscribe([sub1, sub2, sub3])
+
+
+
+
+

FAQ

+
+

How can I subscribe to additional events once my application is running?

+

Wherever you have a w3 instance of the AsyncWeb3 object, you can use the subscription_manager to subscribe to new events.

+

For example, the handler of one subscription could initialize a new subscription:

+
async def log_handler(
+    handler_context: LogsSubscriptionContext,
+) -> None:
+    log_receipt = handler_context.result
+    print(f"Log receipt: {log_receipt}\n")
+
+    # reference the w3 instance
+    w3 = handler_context.async_w3
+
+    # initialize a new subscription
+    await w3.subscription_manager.subscribe(
+        NewHeadsSubscription(handler=new_heads_handler)
+    )
+
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/toc.html b/_build/html_zh_CN/toc.html new file mode 100644 index 0000000000..36d22b740b --- /dev/null +++ b/_build/html_zh_CN/toc.html @@ -0,0 +1,245 @@ + + + + + + + + + 目录 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+ +
+ +
+ +
+

© 版权所有 2016-2025, The Ethereum Foundation。

+
+ + 利用 Sphinx 构建,使用的 + 主题 + 由 Read the Docs 开发. + + +
+
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/toggle.css b/_build/html_zh_CN/toggle.css new file mode 100644 index 0000000000..d2f278d1a2 --- /dev/null +++ b/_build/html_zh_CN/toggle.css @@ -0,0 +1,77 @@ +input[type=checkbox] { + visibility: hidden; + height: 0; + width: 0; + margin: 0; +} + +.rst-versions .rst-current-version { + padding: 10px; + display: flex; + justify-content: space-between; +} + +.rst-versions .rst-current-version .fa-book, +.rst-versions .rst-current-version .fa-v, +.rst-versions .rst-current-version .fa-caret-down { + height: 24px; + line-height: 24px; + vertical-align: middle; +} + +.rst-versions .rst-current-version .fa-element { + width: 80px; + text-align: center; +} + +.rst-versions .rst-current-version .fa-book { + text-align: left; +} + +.rst-versions .rst-current-version .fa-v { + color: #27AE60; + text-align: right; +} + +label { + margin: 0 auto; + display: inline-block; + justify-content: center; + align-items: right; + border-radius: 100px; + position: relative; + cursor: pointer; + text-indent: -9999px; + width: 50px; + height: 21px; + background: #000; +} + +label:after { + border-radius: 50%; + position: absolute; + content: ''; + background: #fff; + width: 15px; + height: 15px; + top: 3px; + left: 3px; + transition: ease-in-out 200ms; +} + +input:checked+label { + background: #3a7ca8; +} + +input:checked+label:after { + left: calc(100% - 5px); + transform: translateX(-100%); +} + +html.transition, +html.transition *, +html.transition *:before, +html.transition *:after { + transition: ease-in-out 200ms !important; + transition-delay: 0 !important; +} diff --git a/_build/html_zh_CN/transactions.html b/_build/html_zh_CN/transactions.html new file mode 100644 index 0000000000..6d91711c2a --- /dev/null +++ b/_build/html_zh_CN/transactions.html @@ -0,0 +1,385 @@ + + + + + + + + + 交易 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

交易

+

There are a handful of ways to interact with transactions in web3.py. See the +Web3.eth module for a full list of transaction-related methods. Note that you may also batch requests that read transaction data, but not send new transactions in a batch request.

+

The rest of this guide covers the decision tree for how to send a transaction.

+
+

备注

+

Prefer to view this code in a Jupyter Notebook? View the repo here.

+
+

There are two methods for sending transactions using web3.py: send_transaction() and send_raw_transaction(). A brief guide:

+
    +
  1. Want to sign a transaction offline or send pre-signed transactions?

    + +
  2. +
  3. Are you primarily using the same account for all transactions and would you prefer to save a few lines of code?

    + +
  4. +
  5. Otherwise:

    + +
  6. +
+

Interacting with or deploying a contract?

+ +

An example for each can be found below.

+
+

Chapter 0: w3.eth.send_transaction with eth-tester

+

Many tutorials use eth-tester (via EthereumTesterProvider) for convenience and speed +of conveying ideas/building a proof of concept. Transactions sent by test accounts are +auto-signed.

+
from web3 import Web3, EthereumTesterProvider
+
+w3 = Web3(EthereumTesterProvider())
+
+# eth-tester populates accounts with test ether:
+acct1 = w3.eth.accounts[0]
+
+some_address = "0x0000000000000000000000000000000000000000"
+
+# when using one of its generated test accounts,
+# eth-tester signs the tx (under the hood) before sending:
+tx_hash = w3.eth.send_transaction({
+    "from": acct1,
+    "to": some_address,
+    "value": 123123123123123
+})
+
+tx = w3.eth.get_transaction(tx_hash)
+assert tx["from"] == acct1
+
+
+
+
+

Chapter 1: w3.eth.send_transaction + signer middleware

+

The send_transaction() method is convenient and to-the-point. +If you want to continue using the pattern after graduating from eth-tester, you can +utilize web3.py middleware to sign transactions from a particular account:

+
from web3.middleware import SignAndSendRawMiddlewareBuilder
+import os
+
+# Note: Never commit your key in your code! Use env variables instead:
+pk = os.environ.get('PRIVATE_KEY')
+
+# Instantiate an Account object from your key:
+acct2 = w3.eth.account.from_key(pk)
+
+# For the sake of this example, fund the new account:
+w3.eth.send_transaction({
+    "from": acct1,
+    "value": w3.to_wei(3, 'ether'),
+    "to": acct2.address
+})
+
+# Add acct2 as auto-signer:
+w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(acct2), layer=0)
+# pk also works: w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(pk), layer=0)
+
+# Transactions from `acct2` will then be signed, under the hood, in the middleware:
+tx_hash = w3.eth.send_transaction({
+    "from": acct2.address,
+    "value": 3333333333,
+    "to": some_address
+})
+
+tx = w3.eth.get_transaction(tx_hash)
+assert tx["from"] == acct2.address
+
+# Optionally, you can set a default signer as well:
+# w3.eth.default_account = acct2.address
+# Then, if you omit a "from" key, acct2 will be used.
+
+
+
+
+

Chapter 2: w3.eth.send_raw_transaction

+

if you don't opt for the middleware, you'll need to:

+ +
# 1. Build a new tx
+transaction = {
+    'from': acct2.address,
+    'to': some_address,
+    'value': 1000000000,
+    'nonce': w3.eth.get_transaction_count(acct2.address),
+    'gas': 200000,
+    'maxFeePerGas': 2000000000,
+    'maxPriorityFeePerGas': 1000000000,
+}
+
+# 2. Sign tx with a private key
+signed = w3.eth.account.sign_transaction(transaction, pk)
+
+# 3. Send the signed transaction
+tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
+tx = w3.eth.get_transaction(tx_hash)
+assert tx["from"] == acct2.address
+
+
+
+
+

Chapter 3: Contract transactions

+

The same concepts apply for contract interactions, at least under the hood.

+

Executing a function on a smart contract requires sending a transaction, which is typically done in one of two ways:

+ +
#########################################
+#### SMOL CONTRACT FOR THIS EXAMPLE: ####
+#########################################
+# // SPDX-License-Identifier: MIT
+# pragma solidity 0.8.17;
+#
+# contract Billboard {
+#     string public message;
+#
+#     constructor(string memory _message) {
+#         message = _message;
+#     }
+#
+#     function writeBillboard(string memory _message) public {
+#         message = _message;
+#     }
+# }
+
+# After compiling the contract, initialize the contract factory:
+init_bytecode = "60806040523480156200001157600080fd5b5060..."
+abi = '[{"inputs": [{"internalType": "string","name": "_message",...'
+Billboard = w3.eth.contract(bytecode=init_bytecode, abi=abi)
+
+# Deploy a contract using `transact` + the signer middleware:
+tx_hash = Billboard.constructor("gm").transact({"from": acct2.address})
+receipt = w3.eth.get_transaction_receipt(tx_hash)
+deployed_addr = receipt["contractAddress"]
+
+# Reference the deployed contract:
+billboard = w3.eth.contract(address=deployed_addr, abi=abi)
+
+# Manually build and sign a transaction:
+unsent_billboard_tx = billboard.functions.writeBillboard("gn").build_transaction({
+    "from": acct2.address,
+    "nonce": w3.eth.get_transaction_count(acct2.address),
+})
+signed_tx = w3.eth.account.sign_transaction(unsent_billboard_tx, private_key=acct2.key)
+
+# Send the raw transaction:
+assert billboard.functions.message().call() == "gm"
+tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
+w3.eth.wait_for_transaction_receipt(tx_hash)
+assert billboard.functions.message().call() == "gn"
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/troubleshooting.html b/_build/html_zh_CN/troubleshooting.html new file mode 100644 index 0000000000..2dff89486b --- /dev/null +++ b/_build/html_zh_CN/troubleshooting.html @@ -0,0 +1,662 @@ + + + + + + + + + 故障排除 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

故障排除

+
+

Set up a clean environment

+

Many things can cause a broken environment. You might be on an unsupported version of Python. +Another package might be installed that has a name or version conflict. +Often, the best way to guarantee a correct environment is with virtualenv, like:

+
# Install pip if it is not available:
+$ which pip || curl https://bootstrap.pypa.io/get-pip.py | python
+
+# Install virtualenv if it is not available:
+$ which virtualenv || pip install --upgrade virtualenv
+
+# *If* the above command displays an error, you can try installing as root:
+$ sudo pip install virtualenv
+
+# Create a virtual environment:
+$ virtualenv -p python3 ~/.venv-py3
+
+# Activate your new virtual environment:
+$ source ~/.venv-py3/bin/activate
+
+# With virtualenv active, make sure you have the latest packaging tools
+$ pip install --upgrade pip setuptools
+
+# Now we can install web3.py...
+$ pip install --upgrade web3
+
+
+
+

备注

+

Remember that each new terminal session requires you to reactivate your virtualenv, like: +$ source ~/.venv-py3/bin/activate

+
+
+
+

Why can't I use a particular function?

+

Note that a web3.py instance must be configured before you can use most of its capabilities. +One symptom of not configuring the instance first is an error that looks something like this: +AttributeError: type object 'Web3' has no attribute 'eth'.

+

To properly configure your web3.py instance, specify which provider you're using to connect to the +Ethereum network. An example configuration, if you're connecting to a locally run node, might be:

+
>>> from web3 import Web3
+>>> w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
+
+# now `w3` is available to use:
+>>> w3.is_connected()
+True
+>>> w3.eth.send_transaction(...)
+
+
+

Refer to the 提供者 documentation for further help with configuration.

+
+
+

Why isn't my web3 instance connecting to the network?

+

You can check that your instance is connected via the is_connected method:

+
>>> w3.is_connected()
+False
+
+
+

There are a variety of explanations for why you may see False here. To help you +diagnose the problem, is_connected has an optional show_traceback argument:

+
>>> w3.is_connected(show_traceback=True)
+# this is an example, your error may differ
+
+# <long stack trace output>
+ProviderConnectionError: Problem connecting to provider with error: <class 'FileNotFoundError'>: cannot connect to IPC socket at path: None
+
+
+

If you're running a local node, such as Geth, double-check that you've indeed started +the binary and that you've started it from the intended directory - particularly if +you've specified a relative path to its ipc file.

+

If that does not address your issue, it's probable that you still have a +Provider configuration issue. There are several options for configuring +a Provider, detailed here.

+
+
+

How do I get ether for my test network?

+

Test networks usually have something called a "faucet" to +help get test ether to people who want to use it. The faucet +simply sends you test ether when you visit a web page, or ping a chat bot, etc.

+

Each test network has its own version of test ether, so each one must maintain +its own faucet. Faucet mechanisms tend to come and go, so a web search for +"ethereum testnet faucet" should give you the most up-to-date options.

+
+
+

How do I use my MetaMask accounts from web3.py?

+

Export your private key from MetaMask, and use +the local private key tools in web3.py to sign and send transactions.

+

See how to export your private key +and Accounts.

+
+
+

How do I create an account?

+

In general, your options for accounts are:

+
    +
  • Import a keystore file for an account and extract the private key.

  • +
  • Create an account via the eth-account API, e.g., new_acct = w3.eth.account.create().

  • +
  • Use an external service (e.g. Metamask) to generate a new account, then securely import its private key.

  • +
+
+

警告

+

Don't store real value in an account until you are familiar with security best practices. +If you lose your private key, you lose your account!

+
+
+
+

Why doesn't my transaction work on another network?

+

web3.py is an Ethereum-specific library, which defaults to +"type 2" EIP-1559 transactions +as of the London network upgrade. Some chains (including Ethereum L2s) do not support +the same transaction types.

+

If your chain doesn't support this transaction type, you likely need to create a +"legacy" transaction, i.e., include gasPrice, but not type, maxFeePerGas, +or maxPriorityFeePerGas in your transaction body.

+

If that doesn't resolve your issue, open a GitHub issue or reach out for help in the community +Discord server if you're having trouble with an Ethereum-ecosystem chain. If you're +debugging in an alternative ecosystem, please find another appropriate forum to raise +your question.

+
+
+

How do I conform to ABI types?

+

The web3 library follows the following conventions:

+
+

Bytes vs Text

+
    +
  • The term bytes is used to refer to the binary representation of a string.

  • +
  • The term text is used to refer to unicode representations of strings.

  • +
+
+
+

Hexadecimal Representations

+
    +
  • All hexadecimal values will be returned as text.

  • +
  • All hexadecimal values will be 0x prefixed.

  • +
+
+
+

Ethereum Addresses

+

All addresses must be supplied in one of three ways:

+
    +
  • A 20-byte hexadecimal that is checksummed using the EIP-55 spec.

  • +
  • A 20-byte binary address (python bytes type).

  • +
  • While connected to an Ethereum Name Service (ENS) supported chain, an ENS name +(often in the form myname.eth).

  • +
+
+
+

Disabling Strict Bytes Type Checking

+

There is a boolean flag on the Web3 class and the ENS class that will disable +strict bytes type checking. This allows bytes values of Python strings and allows byte +strings less than the specified byte size, appropriately padding values that need +padding. To disable stricter checks, set the w3.strict_bytes_type_checking +(or ns.strict_bytes_type_checking) flag to False. This will no longer cause +the Web3 / ENS instance to raise an error if a Python string is passed in +without a "0x" prefix. It will also render valid byte strings or hex strings +that are below the exact number of bytes specified by the ABI type by padding the value +appropriately, according to the ABI type. See the Disabling Strict Checks for Bytes Types +section for an example on using the flag and more details.

+
+

备注

+

If a standalone ENS instance is instantiated from a Web3 instance, i.e. +ns = ENS.from_web3(w3), it will inherit the value of the +w3.strict_bytes_type_checking flag from the Web3 instance at the time of +instantiation.

+

Also of note, all modules on the Web3 class will inherit the value of this flag, +since all modules use the parent w3 object reference under the hood. This means +that w3.eth.w3.strict_bytes_type_checking will always have the same value as +w3.strict_bytes_type_checking.

+
+

For more details on the ABI +specification, refer to the +Solidity ABI Spec.

+
+
+

Types by Example

+

Let's use a contrived contract to demonstrate input types in web3.py:

+
contract ManyTypes {
+    // booleans
+    bool public b;
+
+    // unsigned ints
+    uint8 public u8;
+    uint256 public u256;
+    uint256[] public u256s;
+
+    // signed ints
+    int8 public i8;
+
+    // addresses
+    address public addr;
+    address[] public addrs;
+
+    // bytes
+    bytes1 public b1;
+
+    // structs
+    struct S {
+      address sa;
+      bytes32 sb;
+    }
+    mapping(address => S) addrStructs;
+
+    function updateBool(bool x) public { b = x; }
+    function updateUint8(uint8 x) public { u8 = x; }
+    function updateUint256(uint256 x) public { u256 = x; }
+    function updateUintArray(uint256[] memory x) public { u256s = x; }
+    function updateInt8(int8 x) public { i8 = x; }
+    function updateAddr(address x) public { addr = x; }
+    function updateBytes1(bytes1 x) public { b1 = x; }
+    function updateMapping(S memory x) public { addrStructs[x.sa] = x; }
+}
+
+
+
+

Booleans

+
contract_instance.functions.updateBool(True).transact()
+
+
+
+
+

Unsigned Integers

+
contract_instance.functions.updateUint8(255).transact()
+contract_instance.functions.updateUint256(2**256 - 1).transact()
+contract_instance.functions.updateUintArray([1, 2, 3]).transact()
+
+
+
+
+

Signed Integers

+
contract_instance.functions.updateInt8(-128).transact()
+
+
+
+
+

Addresses

+
contract_instance.functions.updateAddr("0x0000000000000000000000000000000000000000").transact()
+
+
+
+
+

Bytes

+
contract_instance.functions.updateBytes1(HexBytes(255)).transact()
+
+
+
+
+

Structs

+
contract_instance.functions.updateMapping({"sa": "0x0000000000000000000000000000000000000000", "sb": HexBytes(123)}).transact()
+
+
+
+
+
+
+

How can I optimize Ethereum JSON-RPC API access?

+

Your Ethereum node JSON-RPC API might be slow when fetching multiple and large requests, especially when running batch jobs. Here are some tips for how to speed up your web3.py application.

+
    +
  • Run your client locally, e.g., Go Ethereum or TurboGeth. The network latency and speed are the major limiting factors for fast API access.

  • +
  • Use IPC communication instead of HTTP/WebSockets. See Choosing a Provider.

  • +
  • Use an optimised JSON decoder. A future iteration of web3.py may change the default decoder or provide an API to configure one, but for now, you may patch the provider class to use ujson.

  • +
+
"""JSON-RPC decoding optimised for web3.py"""
+
+from typing import cast
+
+import ujson
+
+from web3.providers import JSONBaseProvider
+from web3.types import RPCResponse
+
+
+def _fast_decode_rpc_response(raw_response: bytes) -> RPCResponse:
+    decoded = ujson.loads(raw_response)
+    return cast(RPCResponse, decoded)
+
+
+def patch_provider(provider: JSONBaseProvider):
+    """Monkey-patch web3.py provider for faster JSON decoding.
+
+    Call this on your provider after construction.
+
+    This greatly improves JSON-RPC API access speeds, when fetching
+    multiple and large responses.
+    """
+    provider.decode_rpc_response = _fast_decode_rpc_response
+
+
+
+
+

Why am I getting Visual C++ or Cython not installed error?

+

Some Windows users that do not have Microsoft Visual C++ version 14.0 or greater installed may see an error message +when installing web3.py as shown below:

+
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
+
+
+

To fix this error, download and install Microsoft Visual C++ from here :

+

Microsoft Visual C++ Redistributable for Visual Studio

+ +
+
+

How do I convert currency denominations?

+

The following denominations are supported:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

denomination

amount in wei

wei

1

kwei

1000

babbage

1000

femtoether

1000

mwei

1000000

lovelace

1000000

picoether

1000000

gwei

1000000000

shannon

1000000000

nanoether

1000000000

nano

1000000000

szabo

1000000000000

microether

1000000000000

micro

1000000000000

finney

1000000000000000

milliether

1000000000000000

milli

1000000000000000

ether

1000000000000000000

kether

1000000000000000000000

grand

1000000000000000000000

mether

1000000000000000000000000

gether

1000000000000000000000000000

tether

1000000000000000000000000000000

+

You can use the from_wei() method +to convert a balance to ether (or another denomination).

+
>>> web3.from_wei(3841357360894980500000001, 'ether')
+Decimal('3841357.360894980500000001')
+
+
+

To convert back to wei, you can use the inverse function, to_wei(). +Note that Python's default floating point precision is insufficient for this +use case, so it's necessary to cast the value to a +Decimal if it isn't already.

+
>>> from decimal import Decimal
+>>> web3.to_wei(Decimal('3841357.360894980500000001'), 'ether')
+3841357360894980500000001
+
+
+

Best practice: If you need to work with multiple currency denominations, default +to wei. A typical workflow may require a conversion from some denomination to +wei, then from wei to whatever you need.

+
>>> web3.to_wei(Decimal('0.000000005'), 'ether')
+5000000000
+>>> web3.from_wei(5000000000, 'gwei')
+Decimal('5')
+
+
+
+
+

How do I adjust the log levels?

+

web3.py internally uses Python logging subsystem.

+

If you want to run your application logging in debug mode, below is an example of how to make some JSON-RPC traffic quieter.

+
import logging
+import coloredlogs
+
+def setup_logging(log_level=logging.DEBUG):
+    """Setup root logger and quiet some levels."""
+    logger = logging.getLogger()
+
+    # Set log format to display the logger name to hunt down verbose logging modules
+    fmt = "%(name)-25s %(levelname)-8s %(message)s"
+
+    # Use colored logging output for console with the coloredlogs package
+    # https://pypi.org/project/coloredlogs/
+    coloredlogs.install(level=log_level, fmt=fmt, logger=logger)
+
+    # Disable logging of JSON-RPC requests and replies
+    logging.getLogger("web3.RequestManager").setLevel(logging.WARNING)
+    logging.getLogger("web3.providers.HTTPProvider").setLevel(logging.WARNING)
+    # logging.getLogger("web3.RequestManager").propagate = False
+
+    # Disable all internal debug logging of requests and urllib3
+    # E.g. HTTP traffic
+    logging.getLogger("requests").setLevel(logging.WARNING)
+    logging.getLogger("urllib3").setLevel(logging.WARNING)
+
+    return logger
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.beacon.html b/_build/html_zh_CN/web3.beacon.html new file mode 100644 index 0000000000..72bf37f585 --- /dev/null +++ b/_build/html_zh_CN/web3.beacon.html @@ -0,0 +1,841 @@ + + + + + + + + + Beacon API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Beacon API

+
+

警告

+

This API Is experimental. Client support is incomplete and the API itself is still evolving.

+
+

To use this API, you'll need a beacon node running locally or remotely. To set that up, refer to the documentation of your specific client.

+

Once you have a running beacon node, import and configure your beacon instance:

+
>>> from web3.beacon import Beacon
+>>> beacon = Beacon("http://localhost:5051")
+
+
+
+

Methods

+
+
+Beacon.get_genesis()
+
>>> beacon.get_genesis()
+{
+  'data': {
+    'genesis_time': '1605700807',
+    'genesis_validators_root': '0x9436e8a630e3162b7ed4f449b12b8a5a368a4b95bc46b941ae65c11613bfa4c1',
+    'genesis_fork_version': '0x00002009'
+  }
+}
+
+
+
+ +
+
+Beacon.get_hash_root(state_id='head')
+
>>> beacon.get_hash_root()
+{
+  "data": {
+    "root":"0xbb399fda70617a6f198b3d9f1c1cdbd70077677231b84f34e58568c9dc903558"
+  }
+}
+
+
+
+ +
+
+Beacon.get_fork_data(state_id='head')
+
>>> beacon.get_fork_data()
+{
+  'data': {
+    'previous_version': '0x00002009',
+    'current_version': '0x00002009',
+    'epoch': '0'
+  }
+}
+
+
+
+ +
+
+Beacon.get_finality_checkpoint(state_id='head')
+
>>> beacon.get_finality_checkpoint()
+{
+  'data': {
+    'previous_justified': {
+      'epoch': '5024',
+      'root': '0x499ba555e8e8be639dd84be1be6d54409738facefc662f37d97065aa91a1a8d4'
+    },
+    'current_justified': {
+      'epoch': '5025',
+      'root': '0x34e8a230f11536ab2ec56a0956e1f3b3fd703861f96d4695877eaa48fbacc241'
+    },
+    'finalized': {
+      'epoch': '5024',
+      'root': '0x499ba555e8e8be639dd84be1be6d54409738facefc662f37d97065aa91a1a8d4'
+    }
+  }
+}
+
+
+
+ +
+
+Beacon.get_validators(state_id='head')
+
>>> beacon.get_validators()
+ {
+   'data': [
+     {
+       'index': '110280',
+       'balance': '32000000000',
+       'status': 'pending_queued',
+       'validator': {
+         'pubkey': '0x99d37d1f7dd15859995330f75c158346f86d298e2ffeedfbf1b38dcf3df89a7dbd1b34815f3bcd1b2a5588592a35b783',
+         'withdrawal_credentials': '0x00f338cfdb0c22bb85beed9042bd19fff58ad6421c8a833f8bc902b7cca06f5f',
+         'effective_balance': '32000000000',
+         'slashed': False,
+         'activation_eligibility_epoch': '5029',
+         'activation_epoch': '18446744073709551615',
+         'exit_epoch': '18446744073709551615',
+         'withdrawable_epoch': '18446744073709551615'
+       }
+     },
+     ...
+   ]
+ }
+
+
+
+ +
+
+Beacon.get_validator(validator_id, state_id='head')
+
>>> beacon.get_validator(110280)
+{
+  'data': {
+    'index': '110280',
+    'balance': '32000000000',
+    'status': 'pending_queued',
+    'validator': {
+      'pubkey': '0x99d37d1f7dd15859995330f75c158346f86d298e2ffeedfbf1b38dcf3df89a7dbd1b34815f3bcd1b2a5588592a35b783',
+      'withdrawal_credentials': '0x00f338cfdb0c22bb85beed9042bd19fff58ad6421c8a833f8bc902b7cca06f5f',
+      'effective_balance': '32000000000',
+      'slashed': False,
+      'activation_eligibility_epoch': '5029',
+      'activation_epoch': '18446744073709551615',
+      'exit_epoch': '18446744073709551615',
+      'withdrawable_epoch': '18446744073709551615'
+    }
+  }
+}
+
+
+
+ +
+
+Beacon.get_validator_balances(state_id='head')
+
>>> beacon.get_validator_balances()
+{
+  'data': [
+    {
+      'index': '110278',
+      'balance': '32000000000'
+    },
+    ...
+  ]
+}
+
+
+
+ +
+
+Beacon.get_epoch_committees(state_id='head')
+
>>> beacon.get_epoch_committees()
+{
+  'data': [
+    {
+      'slot': '162367',
+      'index': '25',
+      'validators': ['50233', '36829', '84635', ...],
+    },
+    ...
+  ]
+}
+
+
+
+ +
+
+Beacon.get_block_headers()
+
>>> beacon.get_block_headers()
+{
+  'data': [
+    {
+      'root': '0xa3873e7b1e0bcc7c59013340cfea59dff16e42e79825e7b8ab6c243dbafd4fe0',
+      'canonical': True,
+      'header': {
+        'message': {
+          'slot': '163587',
+          'proposer_index': '69198',
+          'parent_root': '0xc32558881dbb791ef045c48e3709a0978dc445abee4ae34d30df600eb5fbbb3d',
+          'state_root': '0x4dc0a72959803a84ee0231160b05dda76a91b8f8b77220b4cfc7db160840b8a8',
+          'body_root': '0xa3873e7b1e0bcc7c59013340cfea59dff16e42e79825e7b8ab6c243dbafd4fe0'
+        },
+        'signature': '0x87b549448d36e5e8b1783944b5511a05f34bb78ad3fcbf71a1adb346eed363d46e50d51ac53cd23bd03d0107d064e05913a6ef10f465f9171aba3b2b8a7a4d621c9e18d5f148813295a2d5aa5053029ccbd88cec72130833de2b4b7addf7faca'
+      }
+    }
+  ]
+}
+
+
+
+ +
+
+Beacon.get_block_header(block_id)
+
>>> beacon.get_block_header(1)
+{
+  'data': {
+    root': '0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d',
+    'canonical': True,
+    'header': {
+      'message': {
+        'slot': '1',
+        'proposer_index': '61090',
+        'parent_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87',
+        'state_root': '0x7773ed5a7e944c6238cd0a5c32170663ef2be9efc594fb43ad0f07ecf4c09d2b',
+        'body_root': '0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d'
+      },
+      'signature': '0xa30d70b3e62ff776fe97f7f8b3472194af66849238a958880510e698ec3b8a470916680b1a82f9d4753c023153fbe6db10c464ac532c1c9c8919adb242b05ef7152ba3e6cd08b730eac2154b9802203ead6079c8dfb87f1e900595e6c00b4a9a'
+    }
+  }
+}
+
+
+
+ +
+
+Beacon.get_block(block_id)
+
>>> beacon.get_block(1)
+{
+  'data': {
+    'message': {
+      'slot': '1',
+      'proposer_index': '61090',
+      'parent_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87',
+      'state_root': '0x7773ed5a7e944c6238cd0a5c32170663ef2be9efc594fb43ad0f07ecf4c09d2b',
+      'body': {
+        'randao_reveal': '0x8e245a52a0a680fcfe789013e123880c321f237de10cad108dc55dd47290d7cfe50cdaa003c6f783405efdac48cef44e152493abba40d9f9815a060dd6151cb0635906c9e3c1ad4859cada73ccd2d6b8747e4aeeada7d75d454bcc8672afa813',
+        'eth1_data': {
+          'deposit_root': '0x4e910ac762815c13e316e72506141f5b6b441d58af8e0a049cd3341c25728752',
+          'deposit_count': '100596',
+          'block_hash': '0x89cb78044843805fb4dab8abd743fc96c2b8e955c58f9b7224d468d85ef57130'
+        },
+        'graffiti': '0x74656b752f76302e31322e31342b34342d673863656562663600000000000000',
+        'proposer_slashings': [],
+        'attester_slashings': [],
+        'attestations': [
+          {
+            'aggregation_bits': '0x0080020004000000008208000102000905',
+            'data': {
+              'slot': '0',
+              'index': '7',
+              'beacon_block_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87',
+              'source': {
+                'epoch': '0',
+                'root': '0x0000000000000000000000000000000000000000000000000000000000000000'
+              },
+              'target': {
+                'epoch': '0',
+                'root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87'
+              }
+            },
+            'signature': '0x967dd2946358db7e426ed19d4576bc75123520ef6a489ca50002222070ee4611f9cef394e5e3071236a93b825f18a4ad07f1d5a1405e6c984f1d71e03f535d13a2156d6ba22cb0c2b148df23a7b8a7293315d6e74b9a26b64283e8393f2ad4c5'
+          }
+        ],
+        'deposits': [],
+        'voluntary_exits': []
+      }
+    },
+    'signature': '0xa30d70b3e62ff776fe97f7f8b3472194af66849238a958880510e698ec3b8a470916680b1a82f9d4753c023153fbe6db10c464ac532c1c9c8919adb242b05ef7152ba3e6cd08b730eac2154b9802203ead6079c8dfb87f1e900595e6c00b4a9a'
+  }
+}
+
+
+
+ +
+
+Beacon.get_block_root(block_id)
+
>>> beacon.get_block_root(1)
+{
+  'data': {
+    'root': '0x30c04689dd4f6cd4d56eb78f72727d2d16d8b6346724e4a88f546875f11b750d'
+  }
+}
+
+
+
+ +
+
+Beacon.get_block_attestations(block_id)
+
>>> beacon.get_block_attestations(1)
+{
+  'data': [
+    {
+      'aggregation_bits': '0x0080020004000000008208000102000905',
+      'data': {
+        'slot': '0',
+        'index': '7',
+        'beacon_block_root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87',
+        'source': {
+          'epoch': '0',
+          'root': '0x0000000000000000000000000000000000000000000000000000000000000000'
+        },
+        'target': {
+          'epoch': '0',
+          'root': '0x6a89af5df908893eedbed10ba4c13fc13d5653ce57db637e3bfded73a987bb87'
+        }
+      },
+      'signature': '0x967dd2946358db7e426ed19d4576bc75123520ef6a489ca50002222070ee4611f9cef394e5e3071236a93b825f18a4ad07f1d5a1405e6c984f1d71e03f535d13a2156d6ba22cb0c2b148df23a7b8a7293315d6e74b9a26b64283e8393f2ad4c5'
+    },
+    ...
+  ]
+}
+
+
+
+ +
+
+Beacon.get_attestations()
+
>>> beacon.get_attestations()
+{'data': []}
+
+
+
+ +
+
+Beacon.get_attester_slashings()
+
>>> beacon.get_attester_slashings()
+{'data': []}
+
+
+
+ +
+
+Beacon.get_proposer_slashings()
+
>>> beacon.get_proposer_slashings()
+{'data': []}
+
+
+
+ +
+
+Beacon.get_voluntary_exits()
+
>>> beacon.get_voluntary_exits()
+{'data': []}
+
+
+
+ +
+
+Beacon.get_fork_schedule()
+
>>> beacon.get_fork_schedule()
+{
+  'data': [
+    {
+      'previous_version': '0x00002009',
+      'current_version': '0x00002009',
+      'epoch': '0'
+    }
+  ]
+}
+
+
+
+ +
+
+Beacon.get_spec()
+
>>> beacon.get_spec()
+{
+  'data': {
+    'DEPOSIT_CONTRACT_ADDRESS': '0x8c5fecdC472E27Bc447696F431E425D02dd46a8c',
+    'MIN_ATTESTATION_INCLUSION_DELAY': '1',
+    'SLOTS_PER_EPOCH': '32',
+    'SHUFFLE_ROUND_COUNT': '90',
+    'MAX_EFFECTIVE_BALANCE': '32000000000',
+    'DOMAIN_BEACON_PROPOSER': '0x00000000',
+    'MAX_ATTESTER_SLASHINGS': '2',
+    'DOMAIN_SELECTION_PROOF': '0x05000000',
+    ...
+  }
+}
+
+
+
+ +
+
+Beacon.get_deposit_contract()
+
>>> beacon.get_deposit_contract()
+{
+  'data': {
+    'chain_id': '5',
+    'address': '0x8c5fecdC472E27Bc447696F431E425D02dd46a8c'
+  }
+}
+
+
+
+ +
+
+Beacon.get_beacon_state(state_id='head')
+
>>> beacon.get_beacon_state()
+{
+  'data': {
+    'genesis_time': '1',
+    'genesis_validators_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2',
+    'slot': '1',
+    'fork': {
+      'previous_version': '0x00000000',
+      'current_version': '0x00000000',
+      'epoch': '1'
+    },
+    'latest_block_header': {
+      'slot': '1',
+      'proposer_index': '1',
+      'parent_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2',
+      'state_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2',
+      'body_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
+    },
+    'block_roots': ['0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'],
+    'state_roots': ['0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'],
+    'historical_roots': ['0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'],
+    'eth1_data': {
+      'deposit_root': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2',
+      'deposit_count': '1',
+      'block_hash': '0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2'
+    },
+    'eth1_data_votes': [...],
+    'eth1_deposit_index': '1',
+    'validators': [...],
+    'balances': [...],
+    'randao_mixes': [...],
+    'slashings': [...],
+    'previous_epoch_attestations': [...],
+    'current_epoch_attestations': [...],
+    'justification_bits': '0x0f',
+    'previous_justified_checkpoint': {
+      'epoch': '5736',
+      'root': '0xec7ef54f1fd81bada8170dd0cb6be8216f8ee2f445e6936f95f5c6894a4a3b38'
+    },
+    'current_justified_checkpoint': {
+      'epoch': '5737',
+      'root': '0x781f0166e34c361ce2c88070c1389145abba2836edcb446338a2ca2b0054826e'
+    },
+    'finalized_checkpoint': {
+      'epoch': '5736',
+      'root': '0xec7ef54f1fd81bada8170dd0cb6be8216f8ee2f445e6936f95f5c6894a4a3b38'
+    }
+  }
+}
+
+
+
+ +
+
+Beacon.get_beacon_heads()
+
>>> beacon.get_beacon_heads()
+{
+  'data': [
+    {
+      'slot': '221600',
+      'root': '0x9987754077fe6100a60c75d81a51b1ef457d019404d1546a66f4f5d6c23fae45'
+    }
+  ]
+}
+
+
+
+ +
+
+Beacon.get_blob_sidecars(block_id, indices=[])
+
>>> beacon.get_blob_sidecars(1, indices=[1])
+{
+  "data": [
+    {
+      "index": "1",
+      "blob": ..., # omitted
+      "kzg_commitment": "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a",
+      "kzg_proof": "0x7FB0A12D11Ffe8A48c2fF80dCA17adbCC1da5F6aADaAEF2b338717dcDEECf6DaB9FD7C4e4265CfBc097cD31dCB19E836",
+      "signed_block_header": {
+        "message": {
+          "slot": "1",
+          "proposer_index": "1",
+          "parent_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+          "state_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+          "body_root": "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
+        },
+        "signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
+      },
+      "kzg_commitment_inclusion_proof": [
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
+        "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2"
+      ]
+    }
+  ]
+}
+
+
+
+ +
+
+Beacon.get_node_identity()
+
>>> beacon.get_node_identity()
+{
+  'data': {
+    'peer_id': '16Uiu2HAmLZ1CYVFKpa3wwn4cnknZqosum8HX3GHDhUpEULQc9ixE',
+    'enr': 'enr:-KG4QCIp6eCZ6hG_fd93qsw12qmbfsl2rUTfQvwVP4FOTlWeNXYo0Gg9y3WVYIdF6FQC6R0E8CbK0Ywq_6TKMx1BpGlAhGV0aDKQOwiHlQAAIAn__________4JpZIJ2NIJpcIR_AAABiXNlY3AyNTZrMaEDdVT4g1gw86BfbrtLCq2fRBlG0AnMxsXtAQgA327S5FeDdGNwgiMog3VkcIIjKA',
+    'p2p_addresses': ['/ip4/127.0.0.1/tcp/9000/p2p/16Uiu2HAmLZ1CYVFKpa3wwn4cnknZqosum8HX3GHDhUpEULQc9ixE'],
+    'discovery_addresses': ['/ip4/127.0.0.1/udp/9000/p2p/16Uiu2HAmLZ1CYVFKpa3wwn4cnknZqosum8HX3GHDhUpEULQc9ixE'],
+    'metadata': {'seq_number': '0', 'attnets': '0x0000000000000000'}
+  }
+}
+
+
+
+ +
+
+Beacon.get_peers()
+
>>> beacon.get_peers()
+{
+  'data': [
+    {
+      'peer_id': '16Uiu2HAkw1yVqF3RtMCBHMbkLZbNhfGcTUdD6Uo4X3wfzPhGVnqv',
+      'address': '/ip4/3.127.23.51/tcp/9000',
+      'state': 'connected',
+      'direction': 'outbound'
+    },
+    {
+      'peer_id': '16Uiu2HAmEJHiCzgS8GwiEYLyM3d148mzvZ9iZzsz8yqayWVPANMG',
+      'address': '/ip4/3.88.7.240/tcp/9000',
+      'state': 'connected',
+      'direction': 'outbound'
+    }
+  ]
+}
+
+
+
+ +
+
+Beacon.get_peer(peer_id)
+
>>> beacon.get_peer('16Uiu2HAkw1yVqF3RtMCBHMbkLZbNhfGcTUdD6Uo4X3wfzPhGVnqv')
+{
+  'data': {
+    'peer_id': '16Uiu2HAkw1yVqF3RtMCBHMbkLZbNhfGcTUdD6Uo4X3wfzPhGVnqv',
+    'address': '/ip4/3.127.23.51/tcp/9000',
+    'state': 'connected',
+    'direction': 'outbound'
+  }
+}
+
+
+
+ +
+
+Beacon.get_health()
+
>>> beacon.get_health()
+200
+
+
+
+ +
+
+Beacon.get_version()
+
>>> beacon.get_version()
+{
+  'data': {
+    'version': 'teku/v20.12.0+9-g9392008/osx-x86_64/adoptopenjdk-java-15'
+  }
+}
+
+
+
+ +
+
+Beacon.get_syncing()
+
>>> beacon.get_syncing()
+{
+  'data': {
+    'head_slot': '222270',
+    'sync_distance': '190861'
+  }
+}
+
+
+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.contract.html b/_build/html_zh_CN/web3.contract.html new file mode 100644 index 0000000000..b08e3c0ef7 --- /dev/null +++ b/_build/html_zh_CN/web3.contract.html @@ -0,0 +1,2077 @@ + + + + + + + + + 合约 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

合约

+

Smart contracts are programs deployed to the Ethereum network. See the +ethereum.org docs +for a proper introduction.

+
+

Interacting with deployed contracts

+

In order to use an existing contract, you'll need its deployed address and its ABI. +Both can be found using block explorers, like Etherscan. Once you instantiate a contract +instance, you can read data and execute transactions.

+
# Configure w3, e.g., w3 = Web3(...)
+address = '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F988'
+abi = '[{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"minter_","type":"address"},...'
+contract_instance = w3.eth.contract(address=address, abi=abi)
+
+# read state:
+contract_instance.functions.storedValue().call()
+# 42
+
+# update state:
+tx_hash = contract_instance.functions.updateValue(43).transact()
+
+
+
+
+

Contract Deployment Example

+

To run this example, you will need to install a few extra features:

+
    +
  • The sandbox node provided by eth-tester. You can install it with:

  • +
+
$ pip install -U "web3[tester]"
+
+
+
    +
  • py-solc-x. This is the supported route to installing the solidity compiler solc. You can install it with:

  • +
+
$ pip install py-solc-x
+
+
+

After py-solc-x is installed, you will need to install a version of solc. You can install the latest version via a new REPL with:

+
>>> from solcx import install_solc
+>>> install_solc(version='latest')
+
+
+

You should now be set up to compile and deploy a contract.

+

The following example runs through these steps:

+
    +
  1. Compile Solidity contract into bytecode and an ABI

  2. +
  3. Initialize a Contract instance

  4. +
  5. Deploy the contract using the Contract instance to initiate a transaction

  6. +
  7. Interact with the contract functions using the Contract instance

  8. +
+
>>> from web3 import Web3
+>>> from solcx import compile_source
+
+# Solidity source code
+>>> compiled_sol = compile_source(
+...     '''
+...     pragma solidity >0.5.0;
+...
+...     contract Greeter {
+...         string public greeting;
+...
+...         constructor() public {
+...             greeting = 'Hello';
+...         }
+...
+...         function setGreeting(string memory _greeting) public {
+...             greeting = _greeting;
+...         }
+...
+...         function greet() view public returns (string memory) {
+...             return greeting;
+...         }
+...     }
+...     ''',
+...     output_values=['abi', 'bin']
+... )
+
+# retrieve the contract interface
+>>> contract_id, contract_interface = compiled_sol.popitem()
+
+# get bytecode / bin
+>>> bytecode = contract_interface['bin']
+
+# get abi
+>>> abi = contract_interface['abi']
+
+# web3.py instance
+>>> w3 = Web3(Web3.EthereumTesterProvider())
+
+# set pre-funded account as sender
+>>> w3.eth.default_account = w3.eth.accounts[0]
+
+>>> Greeter = w3.eth.contract(abi=abi, bytecode=bytecode)
+
+# Submit the transaction that deploys the contract
+>>> tx_hash = Greeter.constructor().transact()
+
+# Wait for the transaction to be mined, and get the transaction receipt
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+
+>>> greeter = w3.eth.contract(
+...     address=tx_receipt.contractAddress,
+...     abi=abi
+... )
+
+>>> greeter.functions.greet().call()
+'Hello'
+
+>>> tx_hash = greeter.functions.setGreeting('Nihao').transact()
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> greeter.functions.greet().call()
+'Nihao'
+
+
+
+
+

Contract Factories

+

These factories are not intended to be initialized directly. +Instead, create contract objects using the w3.eth.contract() +method. By default, the contract factory is Contract.

+
+
+class web3.contract.Contract(address)
+

Contract provides a default interface for deploying and interacting with +Ethereum smart contracts.

+

The address parameter can be a hex address or an ENS name, like mycontract.eth.

+
+ +
+
+

Properties

+

Each Contract Factory exposes the following properties.

+
+
+Contract.address
+

The hexadecimal encoded 20-byte address of the contract, or an ENS name. +May be None if not provided during factory creation.

+
+ +
+
+Contract.abi
+

The contract abi, or Application Binary Interface, specifies how a contract can +be interacted with. Without an abi, the contract cannot be decoded. The abi +enables the Contract instance to expose functions and events as object properties.

+

For further details, see the Solidity ABI specification.

+
+ +
+
+Contract.bytecode
+

The contract bytecode string. May be None if not provided during +factory creation.

+
+ +
+
+Contract.bytecode_runtime
+

The runtime part of the contract bytecode string. May be None if not +provided during factory creation.

+
+ +
+
+Contract.decode_tuples
+

If a Tuple/Struct is returned by a contract function, this flag defines whether +to apply the field names from the ABI to the returned data. +If False, the returned value will be a normal Python Tuple. If True, the returned +value will be a Python NamedTuple of the class ABIDecodedNamedTuple.

+

NamedTuples have some restrictions regarding field names. +web3.py sets NamedTuple's rename=True, so disallowed field names may be +different than expected. See the Python docs +for more information.

+

Defaults to False if not provided during factory creation.

+
+ +
+
+Contract.functions
+

This provides access to contract functions as attributes. For example: +myContract.functions.MyMethod(). The exposed contract functions are classes of the +type ContractFunction.

+
+ +
+
+Contract.events
+

This provides access to contract events as attributes. For example: +myContract.events.MyEvent(). The exposed contract events are classes of the +type ContractEvent.

+
+ +
+
+

Methods

+

Method doctests use the following ABI and bytecode.

+
>>> bytecode = '6060604052341561000c57fe5b604051602080610acb833981016040528080519060200190919050505b620f42408114151561003b5760006000fd5b670de0b6b3a76400008102600281905550600254600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505b610a27806100a46000396000f30060606040523615610097576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610099578063095ea7b31461013257806318160ddd1461018957806323b872dd146101af578063313ce5671461022557806370a082311461025157806395d89b411461029b578063a9059cbb14610334578063dd62ed3e1461038b575bfe5b34156100a157fe5b6100a96103f4565b60405180806020018281038252838181518152602001915080519060200190808383600083146100f8575b8051825260208311156100f8576020820191506020810190506020830392506100d4565b505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013a57fe5b61016f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061042e565b604051808215151515815260200191505060405180910390f35b341561019157fe5b610199610521565b6040518082815260200191505060405180910390f35b34156101b757fe5b61020b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610527565b604051808215151515815260200191505060405180910390f35b341561022d57fe5b610235610791565b604051808260ff1660ff16815260200191505060405180910390f35b341561025957fe5b610285600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610796565b6040518082815260200191505060405180910390f35b34156102a357fe5b6102ab6107e0565b60405180806020018281038252838181518152602001915080519060200190808383600083146102fa575b8051825260208311156102fa576020820191506020810190506020830392506102d6565b505050905090810190601f1680156103265780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033c57fe5b610371600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061081a565b604051808215151515815260200191505060405180910390f35b341561039357fe5b6103de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610973565b6040518082815260200191505060405180910390f35b604060405190810160405280600981526020017f54657374546f6b656e000000000000000000000000000000000000000000000081525081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60025481565b600081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410806105f1575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054105b156105fc5760006000fd5b81600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b604060405190810160405280600481526020017f544553540000000000000000000000000000000000000000000000000000000081525081565b600081600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156108695760006000fd5b81600060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058205071371ee2a4a1be3c96e77d939cdc26161a256fdd638efc08bd33dfc65d3b850029'
+>>> abi = '[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","stateMutability":"view"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function","stateMutability":"nonpayable"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","stateMutability":"view"},{"inputs":[{"name":"_totalSupply","type":"uint256"}],"payable":false,"type":"constructor","stateMutability":"nonpayable"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"}]'
+>>> contract = w3.eth.contract(abi=abi, bytecode=bytecode)
+
+
+

Each Contract Factory exposes the following methods.

+
+
+classmethod Contract.constructor(*args, **kwargs).transact(transaction=None)
+

Construct and deploy a contract by sending a new public transaction.

+

If provided transaction should be a dictionary conforming to the +web3.eth.send_transaction(transaction) method. This value may not +contain the keys data or to.

+

If the contract takes constructor parameters they should be provided as +positional arguments or keyword arguments.

+

If any of the arguments specified in the ABI are an address type, they +will accept ENS names.

+

If a gas value is not provided, then the gas value for the +deployment transaction will be created using the web3.eth.estimate_gas() +method.

+

Returns the transaction hash for the deploy transaction.

+
>>> deploy_txn = contract.constructor(1000000).transact({'from': w3.eth.accounts[0], 'gas': 899000, 'gasPrice': Web3.to_wei(1, 'gwei')})
+>>> txn_receipt = w3.eth.get_transaction_receipt(deploy_txn)
+>>> txn_receipt['contractAddress']
+'0xF2E246BB76DF876Cef8b38ae84130F4F55De395b'
+
+
+
+ +
+
+classmethod Contract.constructor(*args, **kwargs).estimate_gas(transaction=None, block_identifier=None)
+

Estimate gas for constructing and deploying the contract.

+

This method behaves the same as the +Contract.constructor(*args, **kwargs).transact() method, +with transaction details being passed into the end portion of the +function call, and function arguments being passed into the first portion.

+

The block_identifier parameter is passed directly to the call at the end portion +of the function call.

+

Returns the amount of gas consumed which can be used as a gas estimate for +executing this transaction publicly.

+

Returns the gas needed to deploy the contract.

+
>>> contract.constructor(1000000).estimate_gas()
+664971
+
+
+
+ +
+
+classmethod Contract.constructor(*args, **kwargs).build_transaction(transaction=None)
+

Construct the contract deploy transaction bytecode data.

+

If the contract takes constructor parameters they should be provided as +positional arguments or keyword arguments.

+

If any of the args specified in the ABI are an address type, they +will accept ENS names.

+

Returns the transaction dictionary that you can pass to send_transaction method.

+
>>> transaction = {
+...   'gas': 664971,
+...   'chainId': 131277322940537
+... }
+>>> contract_data = contract.constructor(1000000).build_transaction(transaction)
+>>> w3.eth.send_transaction(contract_data)
+HexBytes('0x40c51804800dee88e14e69826cfe51bc5f25f61935331e8aa6d8d7771fb36350')
+
+
+
+ +
+
+classmethod Contract.events.your_event_name.create_filter(from_block=None, to_block='latest', argument_filters={}, topics=[])
+

Creates a new event filter, an instance of web3.utils.filters.LogFilter.

+
    +
  • from_block is a mandatory field. Defines the starting block (exclusive) filter block range. It can be either the starting block number, or 'latest' for the last mined block, or 'pending' for unmined transactions. In the case of from_block, 'latest' and 'pending' set the 'latest' or 'pending' block as a static value for the starting filter block.

  • +
  • to_block optional. Defaults to 'latest'. Defines the ending block (inclusive) in the filter block range. Special values 'latest' and 'pending' set a dynamic range that always includes the 'latest' or 'pending' blocks for the filter's upper block range.

  • +
  • address optional. Defaults to the contract address. The filter matches the event logs emanating from address.

  • +
  • argument_filters, optional. Expects a dictionary of argument names and values. When provided event logs are filtered for the event argument values. Event arguments can be both indexed or unindexed. Indexed values will be translated to their corresponding topic arguments. Unindexed arguments will be filtered using a regular expression.

  • +
  • topics optional, accepts the standard JSON-RPC topics argument. See the JSON-RPC documentation for eth_newFilter more information on the topics parameters.

  • +
+
>>> filter = contract.events.Transfer.create_filter(from_block='latest')
+
+
+
+ +
+
+classmethod Contract.events.your_event_name.build_filter()
+

Creates a EventFilterBuilder instance with the event abi, and the contract address if called from a deployed contract instance. The EventFilterBuilder provides a convenient way to construct the filter parameters with value checking against the event abi. It allows for defining multiple match values or of single values through the match_any and match_single methods.

+
>>> filter_builder = contract.events.Transfer.build_filter()
+>>> filter_builder.from_block = "latest"
+>>> filter_builder.args['from'].match_any(w3.eth.accounts[0])
+>>> filter_builder.args['to'].match_single(w3.eth.accounts[1])
+>>> filter_builder.args['value'].match_single(10000)
+>>> filter_instance = filter_builder.deploy(w3)
+
+
+

The deploy method returns a web3.utils.filters.LogFilter instance from the filter parameters generated by the filter builder. Defining multiple match values for array arguments can be accomplished easily with the filter builder:

+
>>> filter_builder = contract.events.Transfer.build_filter()
+>>> filter_builder.args['to'].match_any(w3.eth.accounts[0], w3.eth.accounts[1])
+
+
+

The filter builder blocks already defined filter parameters from being changed.

+
>>> filter_builder = contract.events.Transfer.build_filter()
+>>> filter_builder.from_block = "latest"
+>>> filter_builder.from_block = 0
+Traceback (most recent call last):
+web3.exceptions.Web3ValueError: from_block is already set to 'latest'. Resetting filter parameters is not permitted
+
+
+
+ +
+
+classmethod Contract.encode_abi(abi_element_identifier, args=None, kwargs=None, data=None)
+

Encodes the arguments using the Ethereum ABI for the contract function that +matches the given abi_element_identifier and arguments args. The data parameter +defaults to the function selector.

+
>>> contract.encode_abi("approve", args=[w3.eth.accounts[0], 10])
+'0x095ea7b30000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf000000000000000000000000000000000000000000000000000000000000000a'
+
+
+
+ +
+
+classmethod Contract.all_events()
+

Returns a list of all the events present in a Contract where every event is +an instance of ContractEvent.

+
>>> contract.all_events()
+[<Event Transfer(address,address,uint256)>, <Event Approval(address,address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_event_by_signature(signature)
+

Searches for a distinct event with matching signature. Returns an instance of +ContractEvent upon finding a match. Raises Web3ValueError if no +match is found.

+
>>> contract.get_event_by_signature('Transfer(address,address,uint256)')
+<Event Transfer(address,address,uint256)>
+
+
+
+ +
+
+classmethod Contract.find_events_by_name(name)
+

Searches for all events matching the provided name. Returns a list of matching +events where every event is an instance of ContractEvent. Returns an +empty list when no match is found.

+
>>> contract.find_events_by_name('Transfer')
+[<Event Transfer(address,address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_event_by_name(name)
+

Searches for a distinct event matching the name. Returns an instance of +ContractEvent upon finding a match. Raises Web3ValueError if no +match is found or if multiple matches are found.

+
>>> contract.get_event_by_name('Approval')
+<Event Approval(address,address,uint256)>
+
+
+
+ +
+
+classmethod Contract.find_events_by_selector(selector)
+

Searches for all events matching the provided selector. Returns a list of matching +events where every event is an instance of ContractEvent. Returns an +empty list when no match is found.

+
>>> contract.find_events_by_selector('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925')
+[<Event Approval(address,address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_event_by_selector(selector)
+

Searches for a distinct event with matching selector. +The selector can be a hexadecimal string, bytes or int. +Returns an instance of ContractEvent upon finding a match. +Raises Web3ValueError if no match is found.

+
>>> contract.get_event_by_selector('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925')
+<Event Approval(address,address,uint256)>
+>>> contract.get_event_by_selector(b'\x8c[\xe1\xe5\xeb\xec}[\xd1OqB}\x1e\x84\xf3\xdd\x03\x14\xc0\xf7\xb2)\x1e[ \n\xc8\xc7\xc3\xb9%')
+<Event Approval(address,address,uint256)>
+>>> contract.get_event_by_selector(0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925)
+<Event Approval(address,address,uint256)>
+
+
+
+ +
+
+classmethod Contract.find_events_by_topic(topic)
+

Searches for all events matching the provided topic. Returns a list of matching +events where every event is an instance of ContractEvent. Returns an +empty list when no match is found.

+
>>> contract.find_events_by_topic('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925')
+[<Event Approval(address,address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_event_by_topic(topic)
+

Searches for a distinct event with matching topic. +The topic is a hexadecimal string. +Returns an instance of ContractEvent upon finding a match. +Raises Web3ValueError if no match is found.

+
>>> contract.get_event_by_topic('0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925')
+<Event Approval(address,address,uint256)>
+
+
+
+ +
+
+classmethod Contract.all_functions()
+

Returns a list of all the functions present in a Contract where every function is +an instance of ContractFunction.

+
>>> contract.all_functions()
+[<Function allowance(address,address)>, <Function approve(address,uint256)>, <Function balanceOf(address)>, <Function decimals()>, <Function name()>, <Function symbol()>, <Function totalSupply()>, <Function transfer(address,uint256)>, <Function transferFrom(address,address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_function_by_signature(signature)
+

Searches for a distinct function with matching signature. Returns an instance of +ContractFunction upon finding a match. Raises Web3ValueError if no +match is found.

+
>>> contract.get_function_by_signature('approve(address,uint256)')
+<Function approve(address,uint256)>
+
+
+
+ +
+
+classmethod Contract.find_functions_by_name(name)
+

Searches for all functions matching the name. Returns a list of matching functions +where every function is an instance of ContractFunction. Returns an empty +list when no match is found.

+
>>> contract.find_functions_by_name('transferFrom')
+[<Function transferFrom(address,address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_function_by_name(name)
+

Searches for a distinct function with matching name. Returns an instance of +ContractFunction upon finding a match. Raises Web3ValueError if no +match is found or if multiple matches are found.

+
>>> contract.get_function_by_name('decimals')
+<Function decimals()>
+
+
+
+ +
+
+classmethod Contract.get_function_by_selector(selector)
+

Searches for a distinct function with matching selector. +The selector can be a hexadecimal string, bytes or int. +Returns an instance of ContractFunction upon finding a match. +Raises Web3ValueError if no match is found.

+
>>> contract.get_function_by_selector('0xdd62ed3e')
+<Function allowance(address,address)>
+>>> contract.get_function_by_selector(b'\xddb\xed>')
+<Function allowance(address,address)>
+>>> contract.get_function_by_selector(0xdd62ed3e)
+<Function allowance(address,address)>
+
+
+
+ +
+
+classmethod Contract.find_functions_by_args(*args)
+

Searches for all function with matching args. Returns a list of matching functions +where every function is an instance of ContractFunction. Returns an empty +list when no match is found.

+
>>> contract.find_functions_by_args(w3.eth.accounts[0], 10000)
+[<Function approve(address,uint256)>, <Function transfer(address,uint256)>]
+
+
+
+ +
+
+classmethod Contract.get_function_by_args(*args)
+

Searches for a distinct function with matching args. Returns an instance of +ContractFunction upon finding a match. Raises ValueError if no +match is found or if multiple matches are found.

+
>>> contract.get_function_by_args(w3.eth.accounts[0], w3.eth.accounts[1], 10000)
+<Function transferFrom(address,address,uint256)>
+
+
+
+ +
+

备注

+

Contract methods all_functions, get_function_by_signature, find_functions_by_name, +get_function_by_name, get_function_by_selector, find_functions_by_args and +get_function_by_args can only be used when abi is provided to the contract.

+
+
+

备注

+

web3.py rejects the initialization of contracts that have more than one function +with the same selector or signature. +eg. blockHashAddendsInexpansible(uint256) and blockHashAskewLimitary(uint256) have the +same selector value equal to 0x00000000. A contract containing both of these functions +will be rejected.

+
+
+
+

Disabling Strict Checks for Bytes Types

+

By default, web3 is strict when it comes to hex and bytes values, as of v6. +If an abi specifies a byte size, but the value that gets passed in is not the specified +size, web3 will invalidate the value. For example, if an abi specifies a type of +bytes4, web3 will invalidate the following values:

+ + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Invalid byte and hex strings with strict (default) bytes4 type checking

Input

Reason

''

Needs to be prefixed with a "0x" to be interpreted as an empty hex string

2

Wrong type

'ah'

String is not valid hex

'1234'

Needs to either be a bytestring (b'1234') or be a hex value of the right size, prefixed with 0x (in this case: '0x31323334')

b''

Needs to have exactly 4 bytes

b'ab'

Needs to have exactly 4 bytes

'0xab'

Needs to have exactly 4 bytes

'0x6162636464'

Needs to have exactly 4 bytes

+

However, you may want to be less strict with acceptable values for bytes types. +This may prove useful if you trust that values coming through are what they are +meant to be with respect to the ABI. In this case, the automatic padding might be +convenient for inferred types. For this, you can set the +w3.strict_bytes_type_checking() flag to False, which is available on the +Web3 instance. A Web3 instance which has this flag set to False will have a less +strict set of rules on which values are accepted. A bytes type will allow values as +a hex string, a bytestring, or a regular Python string that can be decoded as a hex. +0x-prefixed hex strings are also not required.

+
+
    +
  • A Python string that is not prefixed with 0x is valid.

  • +
  • A bytestring whose length is less than the specified byte size is valid.

  • +
+
+ + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Valid byte and hex strings for a non-strict bytes4 type

Input

Normalizes to

''

b'\x00\x00\x00\x00'

'0x'

b'\x00\x00\x00\x00'

b''

b'\x00\x00\x00\x00'

b'ab'

b'ab\x00\x00'

'0xab'

b'\xab\x00\x00\x00'

'1234'

b'\x124\x00\x00'

'0x61626364'

b'abcd'

'1234'

b'1234'

+

Taking the following contract code as an example:

+
>>> #  pragma solidity >=0.4.22 <0.6.0;
+...
+... #   contract ArraysContract {
+... #      bytes2[] public bytes2Value;
+
+... #      constructor(bytes2[] memory _bytes2Value) public {
+... #          bytes2Value = _bytes2Value;
+... #      }
+
+... #      function setBytes2Value(bytes2[] memory _bytes2Value) public {
+... #          bytes2Value = _bytes2Value;
+... #      }
+
+... #      function getBytes2Value() public view returns (bytes2[] memory) {
+... #          return bytes2Value;
+... #      }
+... #  }
+
+>>> # abi = "..."
+>>> # bytecode = "6080..."
+
+
+
>>> arrays_contract_instance = w3.eth.contract(abi=abi, bytecode=bytecode)
+
+>>> tx_hash = arrays_contract_instance.constructor([b'bb']).transact()
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> arrays_contract = w3.eth.contract(
+...     address=tx_receipt.contractAddress,
+...     abi=abi
+... )
+>>> arrays_contract.functions.getBytes2Value().call()
+[b'bb']
+
+>>> # set value with appropriate byte size
+>>> arrays_contract.functions.setBytes2Value([b'aa']).transact({'gas': 420000, "maxPriorityFeePerGas": 10 ** 9, "maxFeePerGas": 10 ** 9})
+HexBytes('0xcb95151142ea56dbf2753d70388aef202a7bb5a1e323d448bc19f1d2e1fe3dc9')
+>>> # check value
+>>> arrays_contract.functions.getBytes2Value().call()
+[b'aa']
+
+>>> # trying to set value without appropriate size (bytes2) is not valid
+>>> arrays_contract.functions.setBytes2Value([b'b']).transact()
+Traceback (most recent call last):
+   ...
+web3.exceptions.MismatchedABI:
+Could not identify the intended function with name
+>>> # check value is still b'aa'
+>>> arrays_contract.functions.getBytes2Value().call()
+[b'aa']
+
+>>> # disabling strict byte checking...
+>>> w3.strict_bytes_type_checking = False
+
+>>> tx_hash = arrays_contract_instance.constructor([b'b']).transact()
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> arrays_contract = w3.eth.contract(
+...     address=tx_receipt.contractAddress,
+...     abi=abi
+... )
+>>> # check value is zero-padded... i.e. b'b\x00'
+>>> arrays_contract.functions.getBytes2Value().call()
+[b'b\x00']
+
+>>> # set the flag back to True
+>>> w3.strict_bytes_type_checking = True
+
+>>> arrays_contract.functions.setBytes2Value([b'a']).transact()
+Traceback (most recent call last):
+   ...
+web3.exceptions.MismatchedABI:
+Could not identify the intended function with name
+
+
+
+
+

Contract Functions

+

The named functions exposed through the Contract.functions property are +of the ContractFunction type. This class is not to be used directly, +but instead through Contract.functions.

+

For example:

+
+
myContract = web3.eth.contract(address=contract_address, abi=contract_abi)
+twentyone = myContract.functions.multiply7(3).call()
+
+
+
+

If you have the function name in a variable, you might prefer this alternative:

+
+
func_to_call = 'multiply7'
+contract_func = myContract.functions[func_to_call]
+twentyone = contract_func(3).call()
+
+
+
+

You can also interact with contract functions without parentheses if the function doesn't +take any arguments. For example:

+
+
>>> myContract.functions.return13.call()
+13
+>>> myContract.functions.return13().call()
+13
+
+
+
+

In cases where functions are overloaded and use arguments of similar types, a function +may resolve to an undesired function when using the method syntax. For example, given +two functions with the same name that take a single argument of differing types of +bytes and bytes32. When a reference to contract.functions.setBytes(b'1')() +is used, the function will resolve as the one that takes bytes. If a value is passed +that was meant to be 32 bytes but the given argument was off by one, the function +reference will still use the one that takes bytes.

+

When in doubt, use explicit function references to the signature. Use bracket notation +(contract.functions["setBytes(bytes32)"](b'')()) or the contract API +contract.get_function_by_signature("setBytes(bytes32)") to retrieve the desired +function. This will ensure an exception is raised if the argument is not strictly +32 bytes in length.

+
+
+class web3.contract.ContractFunction
+
+ +
+

Attributes

+

The ContractFunction class provides attributes for each function. Access the function attributes through Contract.functions.myMethod.

+
+
+ContractFunction.myMethod(*args, **kwargs).abi_element_identifier
+

The signature of the function assigned to the class __name__ during initialization. +Fallback and Receive functions will be assigned as classes FallbackFn or +ReceiveFn respectively.

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).name
+

A string representing the function, receive or fallback name.

+

Use ContractFunction.signature when the function arguments are needed.

+

This is an alias of ContractFunction.fn_name.

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).signature
+

A string representing the function, receive or fallback signature.

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).selector
+

A HexStr encoded from the first four bytes of the function signature.

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).abi
+

The function ABI with the type, name, inputs and outputs.

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).arguments
+

A tuple of all function inputs, normalized so that kwargs themselves are +flattened into a tuple as returned by eth_utils.abi.get_normalized_abi_inputs().

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).argument_names
+

The function input names.

+
+ +
+
+ContractFunction.myMethod(*args, **kwargs).argument_types
+

The function input types.

+
+ +
+
+

Methods

+

ContractFunction provides methods to interact with contract functions. +Positional and keyword arguments supplied to the contract function subclass +will be used to find the contract function by signature, +and forwarded to the contract function when applicable.

+

EIP-3668 introduced support for the OffchainLookup revert / +CCIP Read support. CCIP Read is set to True for calls by default, as recommended in EIP-3668. This is done via a +global global_ccip_read_enabled flag on the provider. If raising the OffchainLookup revert is preferred for a +specific call, the ccip_read_enabled flag on the call may be set to False.

+
+
>>> # raises the revert instead of handling the offchain lookup
+>>> myContract.functions.revertsWithOffchainLookup(myData).call(ccip_read_enabled=False)
+*** web3.exceptions.OffchainLookup
+
+
+
+

Disabling CCIP Read support can be useful if a transaction needs to be sent to the callback function. In such cases, +"preflighting" with an eth_call, handling the OffchainLookup, and sending the data via a transaction may be +necessary. See CCIP Read support for offchain lookup in the examples section for how to preflight a transaction with a contract call.

+

Similarly, if CCIP Read is globally set to False via the global_ccip_read_enabled flag on the provider, it may be +enabled on a per-call basis - overriding the global flag. This ensures only explicitly enabled calls will handle the +OffchainLookup revert appropriately.

+
+
>>> # global flag set to `False`
+>>> w3.provider.global_ccip_read_enabled = False
+
+>>> # does not raise the revert since explicitly enabled on the call:
+>>> response = myContract.functions.revertsWithOffchainLookup(myData).call(ccip_read_enabled=True)
+
+
+
+

If the function called results in a revert error, a ContractLogicError will be raised. +If there is an error message with the error, web3.py attempts to parse the +message that comes back and return it to the user as the error string. +As of v6.3.0, the raw data is also returned and +can be accessed via the data attribute on ContractLogicError.

+
+
+ContractFunction.transact(transaction)
+

Execute the specified function by sending a new public transaction.

+

Refer to the following invocation:

+
myContract.functions.myMethod(*args, **kwargs).transact(transaction)
+
+
+

The first portion of the function call myMethod(*args, **kwargs) +selects the appropriate contract function based on the name and provided +argument. Arguments can be provided as positional arguments, keyword +arguments, or a mix of the two.

+

The end portion of this function call transact(transaction) takes a +single parameter which should be a python dictionary conforming to +the same format as the web3.eth.send_transaction(transaction) method. +This dictionary may not contain the keys data.

+

If any of the args or kwargs specified in the ABI are an address type, they +will accept ENS names.

+

If a gas value is not provided, then the gas value for the +method transaction will be created using the web3.eth.estimate_gas() +method.

+

Returns the transaction hash.

+
>>> token_contract.functions.transfer(web3.eth.accounts[1], 12345).transact()
+"0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd"
+
+
+
+ +
+
+ContractFunction.call(transaction, block_identifier='latest')
+

Call a contract function, executing the transaction locally using the +eth_call API. This will not create a new public transaction.

+

Refer to the following invocation:

+
myContract.functions.myMethod(*args, **kwargs).call(transaction)
+
+
+

This method behaves the same as the ContractFunction.transact() method, +with transaction details being passed into the end portion of the +function call, and function arguments being passed into the first portion.

+

Returns the return value of the executed function.

+
>>> my_contract.functions.multiply7(3).call()
+21
+>>> token_contract.functions.myBalance().call({'from': web3.eth.accounts[0]})
+12345  # the token balance for `web3.eth.accounts[0]`
+>>> token_contract.functions.myBalance().call({'from': web3.eth.accounts[1]})
+54321  # the token balance for the account `web3.eth.accounts[1]`
+
+
+

You can call the method at a historical block using block_identifier. Some examples:

+
# You can call your contract method at a block number:
+>>> token_contract.functions.myBalance().call(block_identifier=10)
+
+# or a number of blocks back from pending,
+# in this case, the block just before the latest block:
+>>> token_contract.functions.myBalance().call(block_identifier=-2)
+
+# or a block hash:
+>>> token_contract.functions.myBalance().call(block_identifier='0x4ff4a38b278ab49f7739d3a4ed4e12714386a9fdf72192f2e8f7da7822f10b4d')
+>>> token_contract.functions.myBalance().call(block_identifier=b'O\xf4\xa3\x8b\'\x8a\xb4\x9fw9\xd3\xa4\xedN\x12qC\x86\xa9\xfd\xf7!\x92\xf2\xe8\xf7\xdax"\xf1\x0bM')
+
+# Latest is the default, so this is redundant:
+>>> token_contract.functions.myBalance().call(block_identifier='latest')
+
+# You can check the state after your pending transactions (if supported by your node):
+>>> token_contract.functions.myBalance().call(block_identifier='pending')
+
+
+

Passing the block_identifier parameter for past block numbers requires that your Ethereum API node +is running in the more expensive archive node mode. Normally synced Ethereum nodes will fail with +a "missing trie node" error, because Ethereum node may have purged the past state from its database. +More information about archival nodes here.

+
+ +
+
+ContractFunction.estimate_gas(transaction, block_identifier=None)
+

Call a contract function, executing the transaction locally using the +eth_call API. This will not create a new public transaction.

+

Refer to the following invocation:

+
myContract.functions.myMethod(*args, **kwargs).estimate_gas(transaction)
+
+
+

This method behaves the same as the ContractFunction.transact() method, +with transaction details being passed into the end portion of the +function call, and function arguments being passed into the first portion.

+

Returns the amount of gas consumed which can be used as a gas estimate for +executing this transaction publicly.

+
>>> my_contract.functions.multiply7(3).estimate_gas()
+42650
+
+
+
+

备注

+

The parameter block_identifier is not enabled in geth nodes, +hence passing a value of block_identifier when connected to a geth +nodes would result in an error like: ValueError: {'code': -32602, 'message': 'too many arguments, want at most 1'}

+
+
+ +
+
+ContractFunction.build_transaction(transaction)
+

Builds a transaction dictionary based on the contract function call specified.

+

Refer to the following invocation:

+
myContract.functions.myMethod(*args, **kwargs).build_transaction(transaction)
+
+
+

This method behaves the same as the Contract.transact() method, +with transaction details being passed into the end portion of the +function call, and function arguments being passed into the first portion.

+
+

备注

+

nonce is not returned as part of the transaction dictionary unless it is +specified in the first portion of the function call:

+
>>> math_contract.functions.increment(5).build_transaction({'nonce': 10})
+
+
+

You may use getTransactionCount() to get the current nonce +for an account. Therefore a shortcut for producing a transaction dictionary with +nonce included looks like:

+
>>> math_contract.functions.increment(5).build_transaction({'nonce': web3.eth.get_transaction_count('0xF5...')})
+
+
+
+

Returns a transaction dictionary. This transaction dictionary can then be sent using +send_transaction().

+

Additionally, the dictionary may be used for offline transaction signing using +sign_transaction().

+
>>> math_contract.functions.increment(5).build_transaction({'maxFeePerGas': 2000000000, 'maxPriorityFeePerGas': 1000000000})
+{
+    'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+    'data': '0x7cf5dab00000000000000000000000000000000000000000000000000000000000000005',
+    'value': 0,
+    'gas': 43242,
+    'maxFeePerGas': 2000000000,
+    'maxPriorityFeePerGas': 1000000000,
+    'chainId': 1
+}
+
+
+
+ +
+
+

Fallback Function

+
+

The Contract Factory also offers an API to interact with the fallback function, which supports four methods like +normal functions:

+
+
+
+Contract.fallback.call(transaction)
+

Call fallback function, executing the transaction locally using the +eth_call API. This will not create a new public transaction.

+
+ +
+
+Contract.fallback.estimate_gas(transaction)
+

Call fallback function and return the gas estimation.

+
+ +
+
+Contract.fallback.transact(transaction)
+

Execute fallback function by sending a new public transaction.

+
+ +
+
+Contract.fallback.build_transaction(transaction)
+

Builds a transaction dictionary based on the contract fallback function call.

+
+ +
+
+
+

Contract Events

+

The named events exposed through the Contract.events property are of the ContractEvent type. This class is not to be used directly, but instead through Contract.events.

+

For example:

+
+
myContract = web3.eth.contract(address=contract_address, abi=contract_abi)
+tx_hash = myContract.functions.myFunction().transact()
+receipt = web3.eth.get_transaction_receipt(tx_hash)
+myContract.events.MyEvent().process_receipt(receipt)
+
+
+
+
+
+class web3.contract.ContractEvent
+
+ +
+

Attributes

+

The ContractEvent class provides attributes for each event. Access the event attributes through Contract.events.MyEvent.

+
+
+ContractEvent.MyEvent(*args, **kwargs).abi_element_identifier
+

The signature of the event assigned to the class __name__ during initialization.

+
+ +
+
+ContractEvent.MyEvent(*args, **kwargs).name
+

A string representing the event, receive or fallback name.

+

Use ContractEvent.MyEvent(*args, **kwargs).signature when the event arguments are needed.

+

This is an alias of ContractEvent.MyEvent(*args, **kwargs).event_name.

+
+ +
+
+ContractEvent.MyEvent(*args, **kwargs).signature
+

A string representing the event signature.

+
+ +
+
+ContractEvent.MyEvent(*args, **kwargs).abi
+

The event ABI with the type, name, inputs.

+
+ +
+
+ContractEvent.MyEvent(*args, **kwargs).argument_names
+

The event input names.

+
+ +
+
+ContractEvent.MyEvent(*args, **kwargs).argument_types
+

The event input types.

+
+ +
+
+ContractEvent.MyEvent(*args, **kwargs).topic
+

The event topic represented by a hex encoded string from the keccak signature.

+
+ +
+
+

Methods

+

ContractEvent provides methods to interact with contract events. Positional and keyword arguments supplied to the contract event subclass will be used to find the contract event by signature.

+
+
+ContractEvent.get_logs(from_block=None, to_block='latest', block_hash=None, argument_filters={})
+

Fetches all logs for a given event within the specified block range or block hash.

+

Returns a list of decoded event logs sorted by logIndex.

+
+

argument_filters is an optional dictionary argument that can be used to filter +for logs where the event's argument values match the values provided in the +dictionary. The keys must match the event argument names as they exist in the ABI. +The values can either be a single value or a list of values to match against. If a +list is provided, the logs will be filtered for any logs that match any of the +values in the list. Indexed arguments are filtered pre-call by building specific +topics to filter for. Non-indexed arguments are filtered by the library after +the logs are fetched from the node.

+
my_contract = web3.eth.contract(address=contract_address, abi=contract_abi)
+
+# get ``MyEvent`` logs from block 1337 to block 2337 where the value for the
+# event argument "eventArg1" is either 1, 2, or 3
+my_contract.events.MyEvent().get_logs(
+    argument_filters={"eventArg1": [1, 2, 3]},
+    from_block=1337,
+    to_block=2337,
+)
+
+
+
+
+ +
+
+ContractEvent.process_receipt(transaction_receipt, errors=WARN)
+

Extracts the pertinent logs from a transaction receipt.

+

If there are no errors, process_receipt returns a tuple of Event Log Objects, emitted from the event (e.g. MyEvent), +with decoded output.

+
>>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address})
+>>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
+>>> rich_logs = contract.events.MyEvent().process_receipt(tx_receipt)
+>>> rich_logs[0]['args']
+{'myArg': 12345}
+
+
+

If there are errors, the logs will be handled differently depending on the flag that is passed in:

+
+
    +
  • WARN (default) - logs a warning to the console for the log that has an error, and discards the log. Returns any logs that are able to be processed.

  • +
  • STRICT - stops all processing and raises the error encountered.

  • +
  • IGNORE - returns any raw logs that raised an error with an added "errors" field, along with any other logs were able to be processed.

  • +
  • DISCARD - silently discards any logs that have errors, and returns processed logs that don't have errors.

  • +
+
+

An event log error flag needs to be imported from web3/logs.py.

+
>>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address})
+>>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
+>>> processed_logs = contract.events.MyEvent().process_receipt(tx_receipt)
+>>> processed_logs
+(
+   AttributeDict({
+       'args': AttributeDict({}),
+       'event': 'MyEvent',
+       'logIndex': 0,
+       'transactionIndex': 0,
+       'transactionHash': HexBytes('0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa'),
+       'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+       'blockHash': HexBytes('0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68'),
+       'blockNumber': 3
+   })
+)
+
+
+# Or, if there were errors encountered during processing:
+>>> from web3.logs import STRICT, IGNORE, DISCARD, WARN
+>>> processed_logs = contract.events.MyEvent().process_receipt(tx_receipt, errors=IGNORE)
+>>> processed_logs
+(
+    AttributeDict({
+        'type': 'mined',
+        'logIndex': 0,
+        'transactionIndex': 0,
+        'transactionHash': HexBytes('0x01682095d5abb0270d11a31139b9a1f410b363c84add467004e728ec831bd529'),
+        'blockHash': HexBytes('0x92abf9325a3959a911a2581e9ea36cba3060d8b293b50e5738ff959feb95258a'),
+        'blockNumber': 5,
+        'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+        'data': '0x0000000000000000000000000000000000000000000000000000000000003039',
+        'topics': [
+            HexBytes('0xf70fe689e290d8ce2b2a388ac28db36fbb0e16a6d89c6804c461f65a1b40bb15')
+        ],
+        'errors': LogTopicError('Expected 1 log topics.  Got 0')})
+   })
+)
+>>> processed_logs = contract.events.MyEvent().process_receipt(tx_receipt, errors=DISCARD)
+>>> assert processed_logs == ()
+True
+
+
+
+ +
+
+ContractEvent.process_log(log)
+

Similar to process_receipt, but only processes one log at a time, instead of a whole transaction receipt. +Will return a single Event Log Object if there are no errors encountered during processing. If an error is encountered during processing, it will be raised.

+
>>> tx_hash = contract.functions.myFunction(12345).transact({'to':contract_address})
+>>> tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
+>>> log_to_process = tx_receipt['logs'][0]
+>>> processed_log = contract.events.MyEvent().process_log(log_to_process)
+>>> processed_log
+AttributeDict({
+    'args': AttributeDict({}),
+    'event': 'MyEvent',
+    'logIndex': 0,
+    'transactionIndex': 0,
+    'transactionHash': HexBytes('0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa'),
+    'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+    'blockHash': HexBytes('0xd74c3e8bdb19337987b987aee0fa48ed43f8f2318edfc84e3a8643e009592a68'),
+    'blockNumber': 3
+})
+
+
+
+ +
+
+

Event Log Object

+
+

The Event Log Object is a python dictionary with the following keys:

+
    +
  • args: Dictionary - The arguments coming from the event.

  • +
  • event: String - The event name.

  • +
  • logIndex: Number - integer of the log index position in the block.

  • +
  • transactionIndex: Number - integer of the transactions index position +log was created from.

  • +
  • transactionHash: String, 32 Bytes - hash of the transactions this log +was created from.

  • +
  • address: String, 32 Bytes - address from which this log originated.

  • +
  • blockHash: String, 32 Bytes - hash of the block where this log was +in. null when it's pending.

  • +
  • blockNumber: Number - the block number where this log was in. null +when it's pending.

  • +
+
+
>>> transfer_filter = my_token_contract.events.Transfer.create_filter(from_block="0x0", argument_filters={'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf'})
+>>> transfer_filter.get_new_entries()
+[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'value': 10}),
+ 'event': 'Transfer',
+ 'logIndex': 0,
+ 'transactionIndex': 0,
+ 'transactionHash': HexBytes('0x9da859237e7259832b913d51cb128c8d73d1866056f7a41b52003c953e749678'),
+ 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+ 'blockHash': HexBytes('...'),
+ 'blockNumber': 2})]
+>>> transfer_filter.get_new_entries()
+[]
+>>> tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 1000000000})
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> transfer_filter.get_new_entries()
+[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'value': 10}),
+ 'event': 'Transfer',
+ 'logIndex': 0,
+ 'transactionIndex': 0,
+ 'transactionHash': HexBytes('...'),
+ 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+ 'blockHash': HexBytes('...'),
+ 'blockNumber': 3})]
+>>> transfer_filter.get_all_entries()
+[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'value': 10}),
+ 'event': 'Transfer',
+ 'logIndex': 0,
+ 'transactionIndex': 0,
+ 'transactionHash': HexBytes('...'),
+ 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+ 'blockHash': HexBytes('...'),
+ 'blockNumber': 2}),
+ AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
+ 'value': 10}),
+ 'event': 'Transfer',
+ 'logIndex': 0,
+ 'transactionIndex': 0,
+ 'transactionHash': HexBytes('...'),
+ 'address': '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b',
+ 'blockHash': HexBytes('...'),
+ 'blockNumber': 3})]
+
+
+
+
+
+

Utils

+
+
+classmethod Contract.decode_function_input(data)
+

Decodes the transaction data used to invoke a smart contract function, and returns +ContractFunction and decoded parameters as dict.

+
>>> transaction = w3.eth.get_transaction('0x5798fbc45e3b63832abc4984b0f3574a13545f415dd672cd8540cd71f735db56')
+>>> transaction.input
+'0x612e45a3000000000000000000000000b656b2a9c3b2416437a811e07466ca712f5a5b5a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000116c6f6e656c792c20736f206c6f6e656c7900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
+>>> contract.decode_function_input(transaction.input)
+(<Function newProposal(address,uint256,string,bytes,uint256,bool)>,
+ {'_recipient': '0xB656b2a9c3b2416437A811e07466cA712F5a5b5a',
+  '_amount': 0,
+  '_description': b'lonely, so lonely',
+  '_transactionData': b'',
+  '_debatingPeriod': 604800,
+  '_newCurator': True})
+
+
+
+ +
+
+

ContractCaller

+
+
+class web3.contract.ContractCaller
+
+ +

The ContractCaller class provides an API to call functions in a contract. This class +is not to be used directly, but instead through Contract.caller.

+

There are a number of different ways to invoke the ContractCaller.

+

For example:

+
>>> myContract = w3.eth.contract(address=address, abi=ABI)
+>>> twentyone = myContract.caller.multiply7(3)
+>>> twentyone
+21
+
+
+

It can also be invoked using parentheses:

+
>>> twentyone = myContract.caller().multiply7(3)
+>>> twentyone
+21
+
+
+

And a transaction dictionary, with or without the transaction keyword. +You can also optionally include a block identifier. For example:

+
>>> from_address = w3.eth.accounts[1]
+>>> twentyone = myContract.caller({'from': from_address}).multiply7(3)
+>>> twentyone
+21
+>>> twentyone = myContract.caller(transaction={'from': from_address}).multiply7(3)
+>>> twentyone
+21
+>>> twentyone = myContract.caller(block_identifier='latest').multiply7(3)
+>>> twentyone
+21
+
+
+

Like ContractFunction, ContractCaller +provides methods to interact with contract functions. +Positional and keyword arguments supplied to the contract caller subclass +will be used to find the contract function by signature, +and forwarded to the contract function when applicable.

+
+
+

Examples

+
+

Working with an ERC-20 Token Contract

+

Most fungible tokens on the Ethereum blockchain conform to the ERC-20 +standard. This section of the guide covers interacting with an existing token +contract which conforms to this standard.

+

In this guide we will interact with an existing token contract that we have +already deployed to a local testing chain. This guide assumes:

+
    +
  1. An existing token contract at a known address.

  2. +
  3. Access to the proper ABI for the given contract.

  4. +
  5. A web3.main.Web3 instance connected to a provider with an unlocked account which can send transactions.

  6. +
+
+

Creating the contract factory

+

First we need to create a contract instance with the address of our token +contract and the ERC-20 ABI.

+
>>> contract = w3.eth.contract(contract_address, abi=ABI)
+>>> contract.address
+'0xF2E246BB76DF876Cef8b38ae84130F4F55De395b'
+
+
+
+
+

Querying token metadata

+

Each token will have a total supply which represents the total number of tokens +in circulation. In this example we've initialized the token contract to have 1 +million tokens. Since this token contract is setup to have 18 decimal places, +the raw total supply returned by the contract is going to have 18 additional +decimal places.

+
>>> contract.functions.name().call()
+'TestToken'
+>>> contract.functions.symbol().call()
+'TEST'
+>>> decimals = contract.functions.decimals().call()
+>>> decimals
+18
+>>> DECIMALS = 10 ** decimals
+>>> contract.functions.totalSupply().call() // DECIMALS
+1000000
+
+
+
+
+

Query account balances

+

Next we can query some account balances using the contract's balanceOf +function. The token contract we are using starts with a single account which +we'll refer to as alice holding all of the tokens.

+
>>> alice = '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf'
+>>> bob = '0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF'
+>>> raw_balance = contract.functions.balanceOf(alice).call()
+>>> raw_balance
+1000000000000000000000000
+>>> raw_balance // DECIMALS
+1000000
+>>> contract.functions.balanceOf(bob).call()
+0
+
+
+
+
+

Sending tokens

+

Next we can transfer some tokens from alice to bob using the contract's +transfer function.

+
>>> tx_hash = contract.functions.transfer(bob, 100).transact({'from': alice})
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> contract.functions.balanceOf(alice).call()
+999999999999999999999900
+>>> contract.functions.balanceOf(bob).call()
+100
+
+
+
+
+

Creating an approval for external transfers

+

Alice could also approve someone else to spend tokens from her account using +the approve function. We can also query how many tokens we're approved to +spend using the allowance function.

+
>>> contract.functions.allowance(alice, bob).call()
+0
+>>> tx_hash = contract.functions.approve(bob, 200).transact({'from': alice})
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> contract.functions.allowance(alice, bob).call()
+200
+
+
+
+
+

Performing an external transfer

+

When someone has an allowance they can transfer those tokens using the +transferFrom function.

+
>>> contract.functions.allowance(alice, bob).call()
+200
+>>> contract.functions.balanceOf(bob).call()
+100
+>>> tx_hash = contract.functions.transferFrom(alice, bob, 75).transact({'from': bob})
+>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
+>>> contract.functions.allowance(alice, bob).call()
+125
+>>> contract.functions.balanceOf(bob).call()
+175
+
+
+
+
+
+

Using a struct as a function argument

+

web3.py accepts struct arguments as dictionaries. This format also supports nested structs. +Let's take a look at a quick example. Given the following Solidity contract:

+
contract Example {
+  address addr;
+
+  struct S1 {
+    address a1;
+    address a2;
+  }
+
+  struct S2 {
+    bytes32 b1;
+    bytes32 b2;
+  }
+
+  struct X {
+    S1 s1;
+    S2 s2;
+    address[] users;
+  }
+
+  function update(X memory x) public {
+    addr = x.s1.a2;
+  }
+
+  function retrieve() public view returns (address) {
+    return addr;
+  }
+}
+
+
+

You can interact with the web3.py contract API as follows:

+
# deploy or lookup the deployed contract, then:
+
+>>> deployed_contract.functions.retrieve().call()
+'0x0000000000000000000000000000000000000000'
+
+>>> deployed_contract.functions.update({'s1': ['0x0000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000002'], 's2': [b'0'*32, b'1'*32], 'users': []}).transact()
+
+>>> deployed_contract.functions.retrieve().call()
+'0x0000000000000000000000000000000000000002'
+
+
+
+
+

Invoke Ambiguous Contract Functions

+

Calling overloaded functions can be done as you would expect. Passing arguments will +disambiguate which function you want to call.

+

For example, if you have a contract with two functions with the name identity that +accept different types of arguments, you can call them like this:

+
>>> ambiguous_contract = w3.eth.contract(address=..., abi=...)
+>>> ambiguous_contract.functions.identity(1, True).call()
+1
+>>> ambiguous_contract.functions.identity("one", 1, True).call()
+1
+
+
+

If there is a need to first retrieve the function, you can use the contract instance's +get_function_by_signature method to get the function you want to call.

+

Below is an example of a contract that has multiple functions of the same name, +and the arguments are ambiguous. You can use the Contract.get_function_by_signature() +method to reference the intended function and call it with the correct arguments.

+
>>> contract_source_code = """
+pragma solidity ^0.8.24;
+contract AmbiguousDuo {
+  function identity(uint256 input, bool uselessFlag) public pure returns (uint256) {
+    return input;
+  }
+  function identity(int256 input, bool uselessFlag) public pure returns (int256) {
+    return input;
+  }
+}
+"""
+# fast forward all the steps of compiling and deploying the contract.
+
+>>> identity_func = ambiguous_contract.get_function_by_signature('identity(uint256,bool)')
+>>> identity_func(1, True)
+<Function identity(uint256,bool) bound to (1, True)>
+>>> identity_func(1, True).call()
+1
+
+
+
+
+

CCIP Read support for offchain lookup

+

Contract calls support CCIP Read by default, via a ccip_read_enabled flag on the call and, more globally, a +global_ccip_read_enabled flag on the provider. The following should work by default without raising an +OffchainLookup and instead handling it appropriately as per the specification outlined in +EIP-3668.

+
myContract.functions.revertsWithOffchainLookup(myData).call()
+
+
+

If the offchain lookup requires the user to send a transaction rather than make a call, this may be handled +appropriately in the following way:

+
from web3 import Web3, WebSocketProvider
+from web3.utils import handle_offchain_lookup
+
+w3 = Web3(WebSocketProvider(...))
+
+myContract = w3.eth.contract(address=...)
+myData = b'data for offchain lookup function call'
+
+# preflight with an `eth_call` and handle the exception
+try:
+    myContract.functions.revertsWithOffchainLookup(myData).call(ccip_read_enabled=False)
+except OffchainLookup as ocl:
+    tx = {'to': myContract.address, 'from': my_account}
+    data_for_callback_function = handle_offchain_lookup(ocl.payload)
+    tx['data'] = data_for_callback_function
+
+    # send the built transaction with `eth_sendTransaction` or sign and send with `eth_sendRawTransaction`
+    tx_hash = w3.eth.send_transaction(tx)
+
+
+
+
+

Contract Unit Tests in Python

+

Here is an example of how one can use the pytest framework in python, web3.py, +eth-tester, and PyEVM to perform unit tests entirely in python without any +additional need for a full featured ethereum node/client. To install needed +dependencies you can use the pinned extra for testing:

+
$ pip install web3[test] pytest
+
+
+

Once you have an environment set up for testing, you can then write your tests +like so:

+
# of how to write unit tests with web3.py
+import pytest
+
+import pytest_asyncio
+
+from web3 import (
+    AsyncWeb3,
+    EthereumTesterProvider,
+    Web3,
+)
+from web3.providers.eth_tester.main import (
+    AsyncEthereumTesterProvider,
+)
+
+
+@pytest.fixture
+def tester_provider():
+    return EthereumTesterProvider()
+
+
+@pytest.fixture
+def eth_tester(tester_provider):
+    return tester_provider.ethereum_tester
+
+
+@pytest.fixture
+def w3(tester_provider):
+    return Web3(tester_provider)
+
+
+@pytest.fixture
+def foo_contract(eth_tester, w3):
+    # For simplicity of this example we statically define the
+    # contract code here. You might read your contracts from a
+    # file, or something else to test with in your own code
+    #
+    # pragma solidity^0.5.3;
+    #
+    # contract Foo {
+    #
+    #     string public bar;
+    #     event barred(string _bar);
+    #
+    #     constructor() public {
+    #         bar = "hello world";
+    #     }
+    #
+    #     function setBar(string memory _bar) public {
+    #         bar = _bar;
+    #         emit barred(_bar);
+    #     }
+    #
+    # }
+
+    deploy_address = eth_tester.get_accounts()[0]
+
+    abi = """[{"anonymous":false,"inputs":[{"indexed":false,"name":"_bar","type":"string"}],"name":"barred","type":"event"},{"constant":false,"inputs":[{"name":"_bar","type":"string"}],"name":"setBar","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":true,"inputs":[],"name":"bar","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]"""  # noqa: E501
+    # This bytecode is the output of compiling with
+    # solc version:0.5.3+commit.10d17f24.Emscripten.clang
+    bytecode = """608060405234801561001057600080fd5b506040805190810160405280600b81526020017f68656c6c6f20776f726c640000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b6103bb806101166000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c01000000000000000000000000000000000000000000000000000000009004806397bc14aa14610058578063febb0f7e14610113575b600080fd5b6101116004803603602081101561006e57600080fd5b810190808035906020019064010000000081111561008b57600080fd5b82018360208201111561009d57600080fd5b803590602001918460018302840111640100000000831117156100bf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610196565b005b61011b61024c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015b578082015181840152602081019050610140565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b80600090805190602001906101ac9291906102ea565b507f5f71ad82e16f082de5ff496b140e2fbc8621eeb37b36d59b185c3f1364bbd529816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561020f5780820151818401526020810190506101f4565b50505050905090810190601f16801561023c5780820380516001836020036101000a031916815260200191505b509250505060405180910390a150565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e25780601f106102b7576101008083540402835291602001916102e2565b820191906000526020600020905b8154815290600101906020018083116102c557829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061032b57805160ff1916838001178555610359565b82800160010185558215610359579182015b8281111561035857825182559160200191906001019061033d565b5b509050610366919061036a565b5090565b61038c91905b80821115610388576000816000905550600101610370565b5090565b9056fea165627a7a72305820ae6ca683d45ee8a71bba45caee29e4815147cd308f772c853a20dfe08214dbb50029"""  # noqa: E501
+
+    # Create our contract class.
+    FooContract = w3.eth.contract(abi=abi, bytecode=bytecode)
+    # issue a transaction to deploy the contract.
+    tx_hash = FooContract.constructor().transact(
+        {
+            "from": deploy_address,
+        }
+    )
+    # wait for the transaction to be mined
+    tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash, 180)
+    # instantiate and return an instance of our contract.
+    return FooContract(tx_receipt.contractAddress)
+
+
+def test_initial_greeting(foo_contract):
+    hw = foo_contract.caller.bar()
+    assert hw == "hello world"
+
+
+def test_can_update_greeting(w3, foo_contract):
+    # send transaction that updates the greeting
+    tx_hash = foo_contract.functions.setBar("testing contracts is easy").transact(
+        {
+            "from": w3.eth.accounts[1],
+        }
+    )
+    w3.eth.wait_for_transaction_receipt(tx_hash, 180)
+
+    # verify that the contract is now using the updated greeting
+    hw = foo_contract.caller.bar()
+    assert hw == "testing contracts is easy"
+
+
+def test_updating_greeting_emits_event(w3, foo_contract):
+    # send transaction that updates the greeting
+    tx_hash = foo_contract.functions.setBar("testing contracts is easy").transact(
+        {
+            "from": w3.eth.accounts[1],
+        }
+    )
+    receipt = w3.eth.wait_for_transaction_receipt(tx_hash, 180)
+
+    # get all of the `barred` logs for the contract
+    logs = foo_contract.events.barred.get_logs()
+    assert len(logs) == 1
+
+    # verify that the log's data matches the expected value
+    event = logs[0]
+    assert event.blockHash == receipt.blockHash
+    assert event.args._bar == "testing contracts is easy"
+
+
+@pytest.fixture
+def async_eth_tester():
+    return AsyncEthereumTesterProvider().ethereum_tester
+
+
+@pytest_asyncio.fixture()
+async def async_w3():
+    async_w3 = AsyncWeb3(AsyncEthereumTesterProvider())
+    accounts = await async_w3.eth.accounts
+    async_w3.eth.default_account = accounts[0]
+    return async_w3
+
+
+@pytest_asyncio.fixture()
+async def async_foo_contract(async_w3):
+    # For simplicity of this example we statically define the
+    # contract code here. You might read your contracts from a
+    # file, or something else to test with in your own code
+    #
+    # pragma solidity^0.5.3;
+    #
+    # contract Foo {
+    #
+    #     string public bar;
+    #     event barred(string _bar);
+    #
+    #     constructor() public {
+    #         bar = "hello world";
+    #     }
+    #
+    #     function setBar(string memory _bar) public {
+    #         bar = _bar;
+    #         emit barred(_bar);
+    #     }
+    #
+    # }
+
+    abi = """[{"anonymous":false,"inputs":[{"indexed":false,"name":"_bar","type":"string"}],"name":"barred","type":"event"},{"constant":false,"inputs":[{"name":"_bar","type":"string"}],"name":"setBar","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":true,"inputs":[],"name":"bar","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]"""  # noqa: E501
+    # This bytecode is the output of compiling with
+    # solc version:0.5.3+commit.10d17f24.Emscripten.clang
+    bytecode = """608060405234801561001057600080fd5b506040805190810160405280600b81526020017f68656c6c6f20776f726c640000000000000000000000000000000000000000008152506000908051906020019061005c929190610062565b50610107565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100a357805160ff19168380011785556100d1565b828001600101855582156100d1579182015b828111156100d05782518255916020019190600101906100b5565b5b5090506100de91906100e2565b5090565b61010491905b808211156101005760008160009055506001016100e8565b5090565b90565b6103bb806101166000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c01000000000000000000000000000000000000000000000000000000009004806397bc14aa14610058578063febb0f7e14610113575b600080fd5b6101116004803603602081101561006e57600080fd5b810190808035906020019064010000000081111561008b57600080fd5b82018360208201111561009d57600080fd5b803590602001918460018302840111640100000000831117156100bf57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050610196565b005b61011b61024c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015b578082015181840152602081019050610140565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b80600090805190602001906101ac9291906102ea565b507f5f71ad82e16f082de5ff496b140e2fbc8621eeb37b36d59b185c3f1364bbd529816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561020f5780820151818401526020810190506101f4565b50505050905090810190601f16801561023c5780820380516001836020036101000a031916815260200191505b509250505060405180910390a150565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e25780601f106102b7576101008083540402835291602001916102e2565b820191906000526020600020905b8154815290600101906020018083116102c557829003601f168201915b505050505081565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061032b57805160ff1916838001178555610359565b82800160010185558215610359579182015b8281111561035857825182559160200191906001019061033d565b5b509050610366919061036a565b5090565b61038c91905b80821115610388576000816000905550600101610370565b5090565b9056fea165627a7a72305820ae6ca683d45ee8a71bba45caee29e4815147cd308f772c853a20dfe08214dbb50029"""  # noqa: E501
+
+    # Create our contract class.
+    FooContract = async_w3.eth.contract(abi=abi, bytecode=bytecode)
+    # issue a transaction to deploy the contract.
+    tx_hash = await FooContract.constructor().transact(
+        {
+            "from": async_w3.eth.default_account,
+        }
+    )
+    # wait for the transaction to be mined
+    tx_receipt = await async_w3.eth.wait_for_transaction_receipt(tx_hash, 180)
+    # instantiate and return an instance of our contract.
+    return FooContract(tx_receipt["contractAddress"])
+
+
+@pytest.mark.asyncio
+async def test_async_initial_greeting(async_foo_contract):
+    hw = await async_foo_contract.caller.bar()
+    assert hw == "hello world"
+
+
+@pytest.mark.asyncio
+async def test_async_can_update_greeting(async_w3, async_foo_contract):
+    tx_hash = await async_foo_contract.functions.setBar(
+        "testing contracts is easy",
+    ).transact(
+        {
+            "from": async_w3.eth.default_account,
+        }
+    )
+    await async_w3.eth.wait_for_transaction_receipt(tx_hash, 180)
+
+    # verify that the contract is now using the updated greeting
+    hw = await async_foo_contract.caller.bar()
+    assert hw == "testing contracts is easy"
+
+
+@pytest.mark.asyncio
+async def test_async_updating_greeting_emits_event(async_w3, async_foo_contract):
+    # send transaction that updates the greeting
+    tx_hash = await async_foo_contract.functions.setBar(
+        "testing contracts is easy",
+    ).transact(
+        {
+            "from": async_w3.eth.default_account,
+        }
+    )
+    receipt = await async_w3.eth.wait_for_transaction_receipt(tx_hash, 180)
+
+    # get all of the `barred` logs for the contract
+    logs = await async_foo_contract.events.barred.get_logs()
+    assert len(logs) == 1
+
+    # verify that the log's data matches the expected value
+    event = logs[0]
+    assert event.blockHash == receipt.blockHash
+    assert event.args._bar == "testing contracts is easy"
+
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.eth.account.html b/_build/html_zh_CN/web3.eth.account.html new file mode 100644 index 0000000000..f08cc18d54 --- /dev/null +++ b/_build/html_zh_CN/web3.eth.account.html @@ -0,0 +1,603 @@ + + + + + + + + + 账户 — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

账户

+
+

Local vs Hosted Nodes

+
+
Hosted Node

A hosted node is controlled by someone else. You may also see these referred to +as remote nodes. View a list of commercial node providers.

+
+
Local Node

A local node is started and controlled by you on your computer. For several reasons +(e.g., privacy, security), this is the recommended path, but it requires more resources +and work to set up and maintain. See ethereum.org for a guided tour.

+
+
+
+
+

Local vs Hosted Keys

+

An Ethereum private key is a 256-bit (32 bytes) random integer. +For each private key, you get one Ethereum address, +also known as an Externally Owned Account (EOA).

+

In Python, the private key is expressed as a 32-byte long Python bytes object. +When a private key is presented to users in a hexadecimal format, it may or may +not contain a starting 0x hexadecimal prefix.

+
+
Local Private Key

A local private key is a locally stored secret you import to your Python application. +Please read below how you can create and import a local private key +and use it to sign transactions.

+
+
Hosted Private Key

This is a legacy way to use accounts when working with unit test backends like +EthereumTesterProvider or Anvil. +Calling web3.eth.accounts gives you a +predefined list of accounts that have been funded with test ETH. +You can use send_transaction() on any of these accounts +without further configuration.

+

In the past, around 2015, this was also a way to use private keys +in a locally hosted node, but this practice is now discouraged.

+
+
+
+

警告

+

web3.eth.send_transaction does not work with modern node providers, +because they relied on a node state and all modern nodes are stateless. +You must always use local private keys when working with nodes hosted by +someone else.

+
+
+
+

Some Common Uses for Local Private Keys

+

A very common reason to work with local private keys is to interact +with a hosted node.

+

Some common things you might want to do with a Local Private Key are:

+ +

Using private keys usually involves w3.eth.account in one way or another. Read on for more, +or see a full list of things you can do in the docs for +eth_account.Account.

+
+
+

Creating a Private Key

+

Each Ethereum address has a matching private key. To create a new Ethereum +account you can just generate a random number that acts as a private key.

+
    +
  • A private key is just a random unguessable, or cryptographically safe, 256-bit integer number

  • +
  • A valid private key is > 0 and < max private key value (a number above the elliptic curve order FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141)

  • +
  • Private keys do not have checksums.

  • +
+

To create a private key using web3.py and command line you can do:

+
python -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(f'private key={w3.to_hex(acc.key)}, account={acc.address}')"
+
+
+

Which outputs a new private key and an account pair:

+
private key=0x480c4aec9fa..., account=0x9202a9d5D2d129CB400a40e00aC822a53ED81167
+
+
+
    +
  • Never store private key with your source. Use environment variables +to store the key. Read more below.

  • +
  • You can also import the raw hex private key to MetaMask and any other +wallet - the private key can be shared between your Python code +and any number of wallets.

  • +
+
+
+

Funding a New Account

+

If you create a private key, it comes with its own Ethereum address. +By default, the balance of this address is zero. +Before you can send any transactions with your account, +you need to top up.

+
    +
  • For a local test environment (e.g., EthereumTesterProvider), any +environment is bootstrapped with accounts that have test ETH in them. +Move ETH from default accounts to your newly created account.

  • +
  • For public mainnet, you need to buy ETH in a cryptocurrency exchange +and send it to your privately controlled account.

  • +
  • For a testnet, find a relevant testnet faucet.

  • +
+
+
+

Reading a Private Key from an Environment Variable

+

In this example we pass the private key to our Python application in an +environment variable. +This private key is then added to the transaction signing keychain +with Signing middleware.

+

If unfamiliar, note that you can export your private keys from Metamask and other wallets.

+
+

警告

+
    +
  • Never share your private keys.

  • +
  • Never put your private keys in source code.

  • +
  • Never commit private keys to a Git repository.

  • +
+
+

Example account_test_script.py

+
import os
+from eth_account import Account
+from eth_account.signers.local import LocalAccount
+from web3 import Web3, EthereumTesterProvider
+from web3.middleware import SignAndSendRawMiddlewareBuilder
+
+w3 = Web3(EthereumTesterProvider())
+
+private_key = os.environ.get("PRIVATE_KEY")
+assert private_key is not None, "You must set PRIVATE_KEY environment variable"
+assert private_key.startswith("0x"), "Private key must start with 0x hex prefix"
+
+account: LocalAccount = Account.from_key(private_key)
+w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(account), layer=0)
+
+print(f"Your hot wallet address is {account.address}")
+
+# Now you can use web3.eth.send_transaction(), Contract.functions.xxx.transact() functions
+# with your local private key through middleware and you no longer get the error
+# "ValueError: The method eth_sendTransaction does not exist/is not available
+
+
+

Example how to run this in UNIX shell:

+
# Generate a new 256-bit random integer using openssl UNIX command that acts as a private key.
+# You can also do:
+# python -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(f'private key={w3.to_hex(acc.key)}, account={acc.address}')"
+# Store this in a safe place, like in your password manager.
+export PRIVATE_KEY=0x`openssl rand -hex 32`
+
+# Run our script
+python account_test_script.py
+
+
+

This will print:

+
Your hot wallet address is 0x27C8F899bb69E1501BBB96d09d7477a2a7518918
+
+
+
+
+

Extract private key from geth keyfile

+
+

备注

+

The amount of available ram should be greater than 1GB.

+
+
with open('~/.ethereum/keystore/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E') as keyfile:
+    encrypted_key = keyfile.read()
+    private_key = w3.eth.account.decrypt(encrypted_key, 'correcthorsebatterystaple')
+    # tip: do not save the key or password anywhere, especially into a shared source file
+
+
+
+
+

Sign a Message

+
+

警告

+

There is no single message format that is broadly adopted +with community consensus. Keep an eye on several options, +like EIP-683, +EIP-712, and +EIP-719. Consider +the w3.eth.sign() approach be deprecated.

+
+

For this example, we will use the same message hashing mechanism that +is provided by w3.eth.sign().

+
>>> from web3 import Web3, EthereumTesterProvider
+>>> from eth_account.messages import encode_defunct
+
+>>> w3 = Web3(EthereumTesterProvider())
+>>> msg = "I♥SF"
+>>> private_key = b"\xb2\\}\xb3\x1f\xee\xd9\x12''\xbf\t9\xdcv\x9a\x96VK-\xe4\xc4rm\x03[6\xec\xf1\xe5\xb3d"
+>>> message = encode_defunct(text=msg)
+>>> signed_message = w3.eth.account.sign_message(message, private_key=private_key)
+>>> signed_message
+SignedMessage(message_hash=HexBytes('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750'),
+ r=104389933075820307925104709181714897380569894203213074526835978196648170704563,
+ s=28205917190874851400050446352651915501321657673772411533993420917949420456142,
+ v=28,
+ signature=HexBytes('0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb33e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce1c'))
+
+
+
+
+

Verify a Message

+

With the original message text and a signature:

+
>>> message = encode_defunct(text="I♥SF")
+>>> w3.eth.account.recover_message(message, signature=signed_message.signature)
+'0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E'
+
+
+
+
+

Prepare message for ecrecover in Solidity

+

Let's say you want a contract to validate a signed message, +like if you're making payment channels, and you want to +validate the value in Remix or web3.js.

+

You might have produced the signed_message locally, as in +Sign a Message. If so, this will prepare it for Solidity:

+
>>> from web3 import Web3
+
+# ecrecover in Solidity expects v as a uint8, but r and s as left-padded bytes32
+# Remix / web3.js expect r and s to be encoded to hex
+# This convenience method will do the pad & hex for us:
+>>> def to_32byte_hex(val):
+...   return Web3.to_hex(Web3.to_bytes(val).rjust(32, b'\0'))
+
+>>> ec_recover_args = (msghash, v, r, s) = (
+...   Web3.to_hex(signed_message.message_hash),
+...   signed_message.v,
+...   to_32byte_hex(signed_message.r),
+...   to_32byte_hex(signed_message.s),
+... )
+>>> ec_recover_args
+('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750',
+ 28,
+ '0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3',
+ '0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce')
+
+
+

Instead, you might have received a message and a signature encoded to hex. Then +this will prepare it for Solidity:

+
>>> from web3 import Web3
+>>> from eth_account.messages import encode_defunct, _hash_eip191_message
+
+>>> hex_message = '0x49e299a55346'
+>>> hex_signature = '0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb33e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce1c'
+
+# ecrecover in Solidity expects an encoded version of the message
+
+# - encode the message
+>>> message = encode_defunct(hexstr=hex_message)
+
+# - hash the message explicitly
+>>> message_hash = _hash_eip191_message(message)
+
+# Remix / web3.js expect the message hash to be encoded to a hex string
+>>> hex_message_hash = Web3.to_hex(message_hash)
+
+# ecrecover in Solidity expects the signature to be split into v as a uint8,
+#   and r, s as a bytes32
+# Remix / web3.js expect r and s to be encoded to hex
+>>> sig = Web3.to_bytes(hexstr=hex_signature)
+>>> v, hex_r, hex_s = Web3.to_int(sig[-1]), Web3.to_hex(sig[:32]), Web3.to_hex(sig[32:64])
+
+# ecrecover in Solidity takes the arguments in order = (msghash, v, r, s)
+>>> ec_recover_args = (hex_message_hash, v, hex_r, hex_s)
+>>> ec_recover_args
+('0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750',
+ 28,
+ '0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3',
+ '0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce')
+
+
+
+
+

Verify a message with ecrecover in Solidity

+

Create a simple ecrecover contract in Remix:

+
pragma solidity ^0.4.19;
+
+contract Recover {
+  function ecr (bytes32 msgh, uint8 v, bytes32 r, bytes32 s) public pure
+  returns (address sender) {
+    return ecrecover(msgh, v, r, s);
+  }
+}
+
+
+

Then call ecr with these arguments from Prepare message for ecrecover in Solidity in Remix, +"0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750", 28, "0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3", "0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce"

+

The message is verified, because we get the correct sender of +the message back in response: 0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12e.

+
+
+

Sign a Transaction

+

Create a transaction, sign it locally, and then send it to your node for broadcasting, +with send_raw_transaction().

+
>>> transaction = {
+...     'to': '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
+...     'value': 1000000000,
+...     'gas': 2000000,
+...     'maxFeePerGas': 2000000000,
+...     'maxPriorityFeePerGas': 1000000000,
+...     'nonce': 0,
+...     'chainId': 1,
+...     'type': '0x2',  # the type is optional and, if omitted, will be interpreted based on the provided transaction parameters
+...     'accessList': (  # accessList is optional for dynamic fee transactions
+...         {
+...             'address': '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae',
+...             'storageKeys': (
+...                 '0x0000000000000000000000000000000000000000000000000000000000000003',
+...                 '0x0000000000000000000000000000000000000000000000000000000000000007',
+...             )
+...         },
+...         {
+...             'address': '0xbb9bc244d798123fde783fcc1c72d3bb8c189413',
+...             'storageKeys': ()
+...         },
+...     )
+... }
+>>> key = '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318'
+>>> signed = w3.eth.account.sign_transaction(transaction, key)
+>>> signed.raw_transaction
+HexBytes('0x02f8e20180843b9aca008477359400831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca0080f872f85994de0b295669a9fd93d5f28d9ec85e40f4cb697baef842a00000000000000000000000000000000000000000000000000000000000000003a00000000000000000000000000000000000000000000000000000000000000007d694bb9bc244d798123fde783fcc1c72d3bb8c189413c001a0b9ec671ccee417ff79e06e9e52bfa82b37cf1145affde486006072ca7a11cf8da0484a9beea46ff6a90ac76e7bbf3718db16a8b4b09cef477fb86cf4e123d98fde')
+>>> signed.hash
+HexBytes('0xe85ce7efa52c16cb5c469c7bde54fbd4911639fdfde08003f65525a85076d915')
+>>> signed.r
+84095564551732371065849105252408326384410939276686534847013731510862163857293
+>>> signed.s
+32698347985257114675470251181312399332782188326270244072370350491677872459742
+>>> signed.v
+1
+
+# When you run send_raw_transaction, you get back the hash of the transaction:
+>>> w3.eth.send_raw_transaction(signed.raw_transaction)
+'0xe85ce7efa52c16cb5c469c7bde54fbd4911639fdfde08003f65525a85076d915'
+
+
+
+
+

Sign a Contract Transaction

+

To sign a transaction locally that will invoke a smart contract:

+
    +
  1. Initialize your Contract object

  2. +
  3. Build the transaction

  4. +
  5. Sign the transaction, with w3.eth.account.sign_transaction()

  6. +
  7. Broadcast the transaction with send_raw_transaction()

  8. +
+
# When running locally, execute the statements found in the file linked below to load the EIP20_ABI variable.
+# See: https://github.com/carver/ethtoken.py/blob/v0.0.1-alpha.4/ethtoken/abi.py
+
+>>> from web3 import Web3, EthereumTesterProvider
+>>> w3 = Web3(EthereumTesterProvider())
+
+>>> unicorns = w3.eth.contract(address="0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359", abi=EIP20_ABI)
+
+>>> nonce = w3.eth.get_transaction_count('0x5ce9454909639D2D17A3F753ce7d93fa0b9aB12E')
+
+# Build a transaction that invokes this contract's function, called transfer
+>>> unicorn_txn = unicorns.functions.transfer(
+...     '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359',
+...     1,
+... ).build_transaction({
+...     'chainId': 1,
+...     'gas': 70000,
+...     'maxFeePerGas': w3.to_wei('2', 'gwei'),
+...     'maxPriorityFeePerGas': w3.to_wei('1', 'gwei'),
+...     'nonce': nonce,
+... })
+
+>>> unicorn_txn
+{'value': 0,
+ 'chainId': 1,
+ 'gas': 70000,
+ 'maxFeePerGas': 2000000000,
+ 'maxPriorityFeePerGas': 1000000000,
+ 'nonce': 0,
+ 'to': '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359',
+ 'data': '0xa9059cbb000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000001'}
+
+>>> private_key = b"\xb2\\}\xb3\x1f\xee\xd9\x12''\xbf\t9\xdcv\x9a\x96VK-\xe4\xc4rm\x03[6\xec\xf1\xe5\xb3d"
+>>> signed_txn = w3.eth.account.sign_transaction(unicorn_txn, private_key=private_key)
+>>> signed_txn.hash
+HexBytes('0x748db062639a45e519dba934fce09c367c92043867409160c9989673439dc817')
+>>> signed_txn.raw_transaction
+HexBytes('0x02f8b00180843b9aca0084773594008301117094fb6916095ca1df60bb79ce92ce3ea74c37c5d35980b844a9059cbb000000000000000000000000fb6916095ca1df60bb79ce92ce3ea74c37c5d3590000000000000000000000000000000000000000000000000000000000000001c001a0cec4150e52898cf1295cc4020ac0316cbf186071e7cdc5ec44eeb7cdda05afa2a06b0b3a09c7fb0112123c0bef1fd6334853a9dcf3cb5bab3ccd1f5baae926d449')
+>>> signed_txn.r
+93522894155654168208483453926995743737629589441154283159505514235904280342434
+>>> signed_txn.s
+48417310681110102814014302147799665717176259465062324746227758019974374282313
+>>> signed_txn.v
+1
+
+>>> w3.eth.send_raw_transaction(signed_txn.raw_transaction)
+
+# When you run send_raw_transaction, you get the same result as the hash of the transaction:
+>>> w3.to_hex(w3.keccak(signed_txn.raw_transaction))
+'0x748db062639a45e519dba934fce09c367c92043867409160c9989673439dc817'
+
+
+
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.eth.html b/_build/html_zh_CN/web3.eth.html new file mode 100644 index 0000000000..a6538da4c5 --- /dev/null +++ b/_build/html_zh_CN/web3.eth.html @@ -0,0 +1,1683 @@ + + + + + + + + + web3.eth API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

web3.eth API

+
+
+class web3.eth.Eth
+
+ +

The web3.eth object exposes the following properties and methods to +interact with the RPC APIs under the eth_ namespace.

+

By default, when a property or method returns a mapping of keys to values, it +will return an AttributeDict which acts like a dict but you can +access the keys as attributes and cannot modify its fields. For example, +you can find the latest block number in these two ways:

+
+
>>> block = web3.eth.get_block('latest')
+AttributeDict({
+  'hash': '0xe8ad537a261e6fff80d551d8d087ee0f2202da9b09b64d172a5f45e818eb472a',
+  'number': 4022281,
+  # ... etc ...
+})
+
+>>> block['number']
+4022281
+>>> block.number
+4022281
+
+>>> block.number = 4022282
+Traceback # ... etc ...
+TypeError: This data is immutable -- create a copy instead of modifying
+
+
+
+

This feature is available via the AttributeDictMiddleware which is a default +middleware.

+
+

备注

+

Accessing an AttributeDict property via attribute will break type hinting. If +typing is crucial for your application, accessing via key / value, as well as +removing the AttributeDictMiddleware altogether, may be desired.

+
+
+

Properties

+

The following properties are available on the web3.eth namespace.

+
+
+Eth.default_account
+

The ethereum address that will be used as the default from address for +all transactions. Defaults to empty.

+
+ +
+
+Eth.default_block
+

The default block number that will be used for any RPC methods that accept +a block identifier. Defaults to 'latest'.

+
+ +
+
+Eth.syncing
+
    +
  • Delegates to eth_syncing RPC Method

  • +
+

Returns either False if the node is not syncing or a dictionary +showing sync status.

+
>>> web3.eth.syncing
+AttributeDict({
+    'currentBlock': 2177557,
+    'highestBlock': 2211611,
+    'knownStates': 0,
+    'pulledStates': 0,
+    'startingBlock': 2177365,
+})
+
+
+
+ +
+
+Eth.max_priority_fee
+
    +
  • Delegates to eth_maxPriorityFeePerGas RPC Method

  • +
+

Returns a suggestion for a max priority fee for dynamic fee transactions in Wei.

+
>>> web3.eth.max_priority_fee
+2000000000
+
+
+
+ +
+
+Eth.gas_price
+
    +
  • Delegates to eth_gasPrice RPC Method

  • +
+

Returns the current gas price in Wei.

+
>>> web3.eth.gas_price
+20000000000
+
+
+
+ +
+
+Eth.accounts
+
    +
  • Delegates to eth_accounts RPC Method

  • +
+

Returns the list of known accounts.

+
>>> web3.eth.accounts
+['0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD']
+
+
+
+ +
+
+Eth.block_number
+
    +
  • Delegates to eth_blockNumber RPC Method

  • +
+

Returns the number of the most recent block

+

Alias for get_block_number()

+
>>> web3.eth.block_number
+2206939
+
+
+
+ +
+
+Eth.chain_id
+
+
    +
  • Delegates to eth_chainId RPC Method

  • +
+

Returns an integer value for the currently configured "Chain Id" value introduced in EIP-155. Returns None if no Chain Id is available.

+
>>> web3.eth.chain_id
+61
+
+
+
+
+

备注

+

This property gets called frequently in validation middleware, but eth_chainId +is an allowed method for caching by default. Simply turn on request caching to +avoid repeated calls to this method.

+
+
>>> w3.provider.cache_allowed_requests = True
+
+
+
+
+
+ +
+
+

Methods

+

The following methods are available on the web3.eth namespace.

+
+
+Eth.get_balance(account, block_identifier=eth.default_block)
+
    +
  • Delegates to eth_getBalance RPC Method

  • +
+

Returns the balance of the given account at the block specified by +block_identifier.

+

account may be a checksum address or an ENS name

+
>>> web3.eth.get_balance('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
+77320681768999138915
+
+
+
+ +
+
+Eth.get_block_number()
+
    +
  • Delegates to eth_blockNumber RPC Method

  • +
+

Returns the number of the most recent block.

+
>>> web3.eth.get_block_number()
+2206939
+
+
+
+ +
+
+Eth.get_storage_at(account, position, block_identifier=eth.default_block)
+
    +
  • Delegates to eth_getStorageAt RPC Method

  • +
+

Returns the value from a storage position for the given account at the +block specified by block_identifier.

+

account may be a checksum address or an ENS name

+
>>> web3.eth.get_storage_at('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', 0)
+'0x00000000000000000000000000000000000000000000000000120a0b063499d4'
+
+
+
+ +
+
+Eth.blob_base_fee()
+

Fetches the expected base fee for blobs in the next block.

+
    +
  • Delegates to eth_blobBaseFee RPC Method

  • +
+

Returns the expected base fee in Wei.

+
>>> web3.eth.blob_base_fee()
+537070730
+
+
+
+ +
+
+Eth.get_proof(account, positions, block_identifier=eth.default_block)
+
    +
  • Delegates to eth_getProof RPC Method

  • +
+

Returns the values from an array of storage positions for the given account at the +block specified by block_identifier.

+

account may be a checksum address or an ENS name

+
>>> web3.eth.get_proof('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', [0], 3391)
+AttributeDict({
+    'address': '0x4CB06C43fcdABeA22541fcF1F856A6a296448B6c',
+    'accountProof': ['0xf90211a03841a7ddd65c70c94b8efa79190d00f0ab134b26f18dcad508f60a7e74559d0ba0464b07429a05039e22931492d6c6251a860c018ea390045d596b1ac11b5c7aa7a011f4b89823a03c9c4b5a8ab079ee1bc0e2a83a508bb7a5dc7d7fb4f2e95d3186a0b5f7c51c3b2d51d97f171d2b38a4df1a7c0acc5eb0de46beeff4d07f5ed20e19a0b591a2ce02367eda31cf2d16eca7c27fd44dbf0864b64ea8259ad36696eb2a04a02b646a7552b8392ae94263757f699a27d6e9176b4c06b9fc0a722f893b964795a02df05d68bceb88eebf68aafde61d10ab942097afc1c58b8435ffd3895358a742a0c2f16143c4d1db03276c433696dddb3e9f3b113bcd854b127962262e98f43147a0828820316cc02bfefd899aba41340659fd06df1e0a0796287ec2a4110239f6d2a050496598670b04df7bbff3718887fa36437d6d8c7afb4eff86f76c5c7097dcc4a0c14e9060c6b3784e35b9e6ae2ad2984142a75910ccc89eb89dc1e2f44b6c58c2a009804db571d0ce07913e1cbacc4f1dc4fb8265c936f5c612e3a47e91c64d8e9fa063d96f38b3cb51b1665c6641e25ffe24803f2941e5df79942f6a53b7169647e4a0899f71abb18c6c956118bf567fac629b75f7e9526873e429d3d8abb6dbb58021a00fd717235298742623c0b3cafb3e4bd86c0b5ab1f71097b4dd19f3d6925d758da0096437146c16097f2ccc1d3e910d65a4132803baee2249e72c8bf0bcaaeb37e580',
+                     '0xf90151a097b17a89fd2c03ee98cb6459c08f51b269da5cee46650e84470f62bf83b43efe80a03b269d284a4c3cf8f8deacafb637c6d77f607eec8d75e8548d778e629612310480a01403217a7f1416830c870087c524dabade3985271f6f369a12b010883c71927aa0f592ac54c879817389663be677166f5022943e2fe1b52617a1d15c2f353f27dda0ac8d015a9e668f5877fcc391fae33981c00577096f0455b42df4f8e8089ece24a003ba34a13e2f2fb4bf7096540b42d4955c5269875b9cf0f7b87632585d44c9a580a0b179e3230b07db294473ae57f0170262798f8c551c755b5665ace1215cee10ca80a0552d24252639a6ae775aa1df700ffb92c2411daea7286f158d44081c8172d072a0772a87d08cf38c4c68bfde770968571abd16fd3835cb902486bd2e515d53c12d80a0413774f3d900d2d2be7a3ad999ffa859a471dc03a74fb9a6d8275455f5496a548080',
+                     '0xf869a020d13b52a61d3c1325ce3626a51418adebd6323d4840f1bdd93906359d11c933b846f8440180a01ab7c0b0a2a4bbb5a1495da8c142150891fc64e0c321e1feb70bd5f881951f7ea0551332d96d085185ab4019ad8bcf89c45321e136c261eb6271e574a2edf1461f'
+                     ],
+    'balance': 0,
+    'codeHash': '0x551332d96d085185ab4019ad8bcf89c45321e136c261eb6271e574a2edf1461f',
+    'nonce': 1,
+    'storageHash': '0x1ab7c0b0a2a4bbb5a1495da8c142150891fc64e0c321e1feb70bd5f881951f7e',
+    'storageProof': [
+        AttributeDict({
+            'key': '0x00',
+            'value': '0x48656c6c6f00000000000000000000000000000000000000000000000000000a',
+            'proof': ['0xf9019180a01ace80e7bed79fbadbe390876bd1a7d9770edf9462049ef8f4b555d05715d53ea049347a3c2eac6525a3fd7e3454dab19d73b4adeb9aa27d29493b9843f3f88814a085079b4abcd07fd4a5d6c52d35f4c4574aecc85830e90c478ca8c18fcbe590de80a02e3f8ad7ea29e784007f51852b9c3e470aef06b11bac32586a8b691134e4c27da064d2157a14bc31f195f73296ea4dcdbe7698edbf3ca81c44bf7730179d98d94ca09e7dc2597c9b7f72ddf84d7eebb0fe2a2fa2ab54fe668cd14fee44d9b40b1a53a0aa5d4acc7ac636d16bc9655556770bc325e1901fb62dc53770ef9110009e080380a0d5fde962bd2fb5326ddc7a9ca7fe0ee47c5bb3227f838b6d73d3299c22457596a08691410eff46b88f929ef649ea25025f62a5362ca8dc8876e5e1f4fc8e79256d80a0673e88d3a8a4616f676793096b5ae87cff931bd20fb8dd466f97809a1126aad8a08b774a45c2273553e2daf4bbc3a8d44fb542ea29b6f125098f79a4d211b3309ca02fed3139c1791269acb9365eddece93e743900eba6b42a6a8614747752ba268f80',
+                      '0xf891808080a0c7d094301e0c54da37b696d85f72de5520b224ab2cf4f045d8db1a3374caf0488080a0fc5581783bfe27fab9423602e1914d719fd71433e9d7dd63c95fe7e58d10c9c38080a0c64f346fc7a21f6679cba8abdf37ca2de8c4fcd8f8bcaedb261b5f77627c93908080808080a0ddef2936a67a3ac7d3d4ff15a935a45f2cc4976c8f0310aed85daf763780e2b480',
+                      '0xf843a0200decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563a1a048656c6c6f00000000000000000000000000000000000000000000000000000a'
+                      ]
+        })
+    ]
+})
+
+
+
    +
  • Merkle proof verification using py-trie.

  • +
+

The following example verifies that the values returned in the AttributeDict +are included in the state of given trie root.

+
from eth_utils import (
+    keccak,
+)
+import rlp
+from rlp.sedes import (
+    Binary,
+    big_endian_int,
+)
+from trie import (
+    HexaryTrie,
+)
+from web3._utils.encoding import (
+    pad_bytes,
+)
+
+def format_proof_nodes(proof):
+    trie_proof = []
+    for rlp_node in proof:
+        trie_proof.append(rlp.decode(bytes(rlp_node)))
+    return trie_proof
+
+def verify_eth_get_proof(proof, root):
+    trie_root = Binary.fixed_length(32, allow_empty=True)
+    hash32 = Binary.fixed_length(32)
+
+    class _Account(rlp.Serializable):
+        fields = [
+                    ('nonce', big_endian_int),
+                    ('balance', big_endian_int),
+                    ('storage', trie_root),
+                    ('code_hash', hash32)
+                ]
+    acc = _Account(
+        proof.nonce, proof.balance, proof.storageHash, proof.codeHash
+    )
+    rlp_account = rlp.encode(acc)
+    trie_key = keccak(bytes.fromhex(proof.address[2:]))
+
+    assert rlp_account == HexaryTrie.get_from_proof(
+        root, trie_key, format_proof_nodes(proof.accountProof)
+    ), f"Failed to verify account proof {proof.address}"
+
+    for storage_proof in proof.storageProof:
+        trie_key = keccak(pad_bytes(b'\x00', 32, storage_proof.key))
+        root = proof.storageHash
+        if storage_proof.value == b'\x00':
+            rlp_value = b''
+        else:
+            rlp_value = rlp.encode(storage_proof.value)
+
+        assert rlp_value == HexaryTrie.get_from_proof(
+            root, trie_key, format_proof_nodes(storage_proof.proof)
+        ), f"Failed to verify storage proof {storage_proof.key}"
+
+    return True
+
+block = w3.eth.get_block(3391)
+proof = w3.eth.get_proof('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', [0, 1], 3391)
+assert verify_eth_get_proof(proof, block.stateRoot)
+
+
+
+ +
+
+Eth.get_code(account, block_identifier=eth.default_block)
+
    +
  • Delegates to eth_getCode RPC Method

  • +
+

Returns the bytecode for the given account at the block specified by +block_identifier.

+

account may be a checksum address or an ENS name

+
# For a contract address.
+>>> web3.eth.get_code('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B')
+'0x6060604052361561027c5760e060020a60003504630199.....'
+# For a private key address.
+>>> web3.eth.get_code('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
+'0x'
+
+
+
+ +
+
+Eth.get_block(block_identifier=eth.default_block, full_transactions=False)
+
    +
  • Delegates to eth_getBlockByNumber or eth_getBlockByHash RPC Methods

  • +
+

Returns the block specified by block_identifier. Delegates to +eth_getBlockByNumber if block_identifier is an integer or one of +the predefined block parameters 'latest', 'earliest', 'pending', +'safe', 'finalized' - otherwise delegates to eth_getBlockByHash. +Throws BlockNotFound error if the block is not found.

+

If full_transactions is True then the 'transactions' key will +contain full transactions objects. Otherwise it will be an array of +transaction hashes.

+
>>> web3.eth.get_block(2000000)
+AttributeDict({
+    'difficulty': 49824742724615,
+    'extraData': '0xe4b883e5bda9e7a59ee4bb99e9b1bc',
+    'gasLimit': 4712388,
+    'gasUsed': 21000,
+    'hash': '0xc0f4906fea23cf6f3cce98cb44e8e1449e455b28d684dfa9ff65426495584de6',
+    'logsBloom': '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
+    'miner': '0x61c808d82a3ac53231750dadc13c777b59310bd9',
+    'nonce': '0x3b05c6d5524209f1',
+    'number': 2000000,
+    'parentHash': '0x57ebf07eb9ed1137d41447020a25e51d30a0c272b5896571499c82c33ecb7288',
+    'receiptsRoot': '0x84aea4a7aad5c5899bd5cfc7f309cc379009d30179316a2a7baa4a2ea4a438ac',
+    'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
+    'size': 650,
+    'stateRoot': '0x96dbad955b166f5119793815c36f11ffa909859bbfeb64b735cca37cbf10bef1',
+    'timestamp': 1470173578,
+    'totalDifficulty': 44010101827705409388,
+    'transactions': ['0xc55e2b90168af6972193c1f86fa4d7d7b31a29c156665d15b9cd48618b5177ef'],
+    'transactionsRoot': '0xb31f174d27b99cdae8e746bd138a01ce60d8dd7b224f7c60845914def05ecc58',
+    'uncles': [],
+})
+
+
+
+ +
+
+Eth.get_block_transaction_count(block_identifier)
+
    +
  • Delegates to eth_getBlockTransactionCountByNumber or +eth_getBlockTransactionCountByHash RPC Methods

  • +
+

Returns the number of transactions in the block specified by +block_identifier. Delegates to +eth_getBlockTransactionCountByNumber if block_identifier is an +integer or one of the predefined block parameters 'latest', 'earliest', +'pending', 'safe', 'finalized', +otherwise delegates to eth_getBlockTransactionCountByHash. +Throws BlockNotFoundError if transactions are not found.

+
>>> web3.eth.get_block_transaction_count(46147)
+1
+>>> web3.eth.get_block_transaction_count('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd')  # block 46147
+1
+
+
+
+ +
+
+Eth.get_uncle_by_block(block_identifier, uncle_index)
+
+

警告

+

Deprecated. Will be removed in v8.

+
+
    +
  • Delegates to eth_getUncleByBlockHashAndIndex or +eth_getUncleByBlockNumberAndIndex RPC methods

  • +
+

Returns the uncle at the index specified by uncle_index +from the block specified by block_identifier. Delegates to +eth_getUncleByBlockNumberAndIndex if block_identifier is an +integer or one of the predefined block parameters 'latest', 'earliest', +'pending', otherwise delegates to +eth_getUncleByBlockHashAndIndex. Throws BlockNotFound if the block is not found.

+
>>> web3.eth.get_uncle_by_block(56160, 0)
+AttributeDict({
+  'author': '0xbe4532e1b1db5c913cf553be76180c1777055403',
+  'difficulty': '0x17dd9ca0afe',
+  'extraData': '0x476574682f686261722f76312e302e312f6c696e75782f676f312e342e32',
+  'gasLimit': '0x2fefd8',
+  'gasUsed': '0x0',
+  'hash': '0xc78c35720d930f9ef34b4e6fb9d02ffec936f9b02a8f0fa858456e4afd4d5614',
+  'logsBloom':'0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
+  'miner': '0xbe4532e1b1db5c913cf553be76180c1777055403',
+  'mixHash': '0x041e14603f35a82f6023802fec96ef760433292434a39787514f140950597e5e',
+  'nonce': '0x5d2b7e3f1af09995',
+  'number': '0xdb5e',
+  'parentHash': '0xcc30e8a9b15c548d5bf113c834143a8f0e1909fbfea96b2a208dc154293a78cf',
+  'receiptsRoot': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
+  'sealFields': ['0xa0041e14603f35a82f6023802fec96ef760433292434a39787514f140950597e5e', '0x885d2b7e3f1af09995'],
+  'sha3Uncles': '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
+  'size': None, 'stateRoot': '0x8ce2b1bf8e25a06a8ca34c647ff5fd0fa48ac725cc07f657ae1645ab8ef68c91',
+  'timestamp': '0x55c6a972',
+  'totalDifficulty': '0xce4c4f0a0b810b',
+  'transactions': [],
+  'transactionsRoot': '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
+  'uncles': []
+})
+
+# You can also refer to the block by hash:
+>>> web3.eth.get_uncle_by_block('0x685b2226cbf6e1f890211010aa192bf16f0a0cba9534264a033b023d7367b845', 0)
+AttributeDict({
+    ...
+})
+
+
+
+ +
+
+Eth.get_uncle_count(block_identifier)
+
+

警告

+

Deprecated. Will be removed in v8.

+
+
    +
  • Delegates to eth_getUncleCountByBlockHash or +eth_getUncleCountByBlockNumber RPC methods

  • +
+

Returns the (integer) number of uncles associated with the block specified by block_identifier. +Delegates to eth_getUncleCountByBlockNumber if block_identifier is an +integer or one of the predefined block parameters 'latest', 'earliest', +'pending', otherwise delegates to eth_getUncleCountByBlockHash. +Throws BlockNotFound if the block is not found.

+
>>> web3.eth.get_uncle_count(56160)
+1
+
+# You can also refer to the block by hash:
+>>> web3.eth.get_uncle_count('0x685b2226cbf6e1f890211010aa192bf16f0a0cba9534264a033b023d7367b845')
+1
+
+
+
+ +
+
+Eth.get_transaction(transaction_hash)
+
    +
  • Delegates to eth_getTransactionByHash RPC Method

  • +
+

Returns the transaction specified by transaction_hash. If the transaction cannot be found throws web3.exceptions.TransactionNotFound.

+
>>> web3.eth.get_transaction('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
+AttributeDict({'blockHash': HexBytes('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd'),
+    'blockNumber': 46147,
+    'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
+    'gas': 21000,
+    'gasPrice': 50000000000000,
+    'hash': HexBytes('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'),
+    'input': HexBytes('0x'),
+    'nonce': 0,
+     'r': HexBytes('0x88ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0'),
+     's': HexBytes('0x45e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a'),
+     'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
+     'transactionIndex': 0,
+     'type': 0,
+     'v': 28,
+     'value': 31337
+})
+
+
+
+ +
+
+Eth.get_raw_transaction(transaction_hash)
+
    +
  • Delegates to eth_getRawTransactionByHash RPC Method

  • +
+

Returns the raw form of transaction specified by transaction_hash.

+

If no transaction is found, TransactionNotFound is raised.

+
>>> web3.eth.get_raw_transaction('0x86fbfe56cce542ff0a2a2716c31675a0c9c43701725c4a751d20ee2ddf8a733d')
+HexBytes('0xf86907843b9aca0082520894dc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd018086eecac466e115a0f9db4e25484b28f486b247a372708d4cd0643fc63e604133afac577f4cc1eab8a044841d84e799d4dc18ba146816a937e8a0be8bc296bd8bb8aea126de5e627e06')
+
+
+
+ +
+
+Eth.get_transaction_by_block(block_identifier, transaction_index)
+
    +
  • Delegates to eth_getTransactionByBlockNumberAndIndex or +eth_getTransactionByBlockHashAndIndex RPC Methods

  • +
+

Returns the transaction at the index specified by transaction_index +from the block specified by block_identifier. Delegates to +eth_getTransactionByBlockNumberAndIndex if block_identifier is an +integer or one of the predefined block parameters 'latest', 'earliest', +'pending', 'safe', 'finalized', otherwise delegates to +eth_getTransactionByBlockHashAndIndex. +If a transaction is not found at specified arguments, throws web3.exceptions.TransactionNotFound.

+
>>> web3.eth.get_transaction_by_block(46147, 0)
+AttributeDict({
+    'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
+    'blockNumber': 46147,
+    'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
+    'gas': 21000,
+    'gasPrice': None,
+    'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
+    'input': '0x',
+    'maxFeePerGas': 2000000000,
+    'maxPriorityFeePerGas': 1000000000,
+    'nonce': 0,
+    'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
+    'transactionIndex': 0,
+    'value': 31337,
+})
+>>> web3.eth.get_transaction_by_block('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd', 0)
+AttributeDict({
+    'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
+    'blockNumber': 46147,
+    'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
+    'gas': 21000,
+    'gasPrice': None,
+    'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
+    'input': '0x',
+    'maxFeePerGas': 2000000000,
+    'maxPriorityFeePerGas': 1000000000,
+    'nonce': 0,
+    'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
+    'transactionIndex': 0,
+    'value': 31337,
+})
+
+
+
+ +
+
+Eth.get_raw_transaction_by_block(block_identifier, transaction_index)
+
    +
  • Delegates to eth_getRawTransactionByBlockNumberAndIndex or +eth_getRawTransactionByBlockHashAndIndex RPC Methods

  • +
+

Returns the raw transaction at the index specified by transaction_index +from the block specified by block_identifier. Delegates to +eth_getRawTransactionByBlockNumberAndIndex if block_identifier is an +integer or one of the predefined block parameters 'latest', 'earliest', +'pending', 'safe', 'finalized', otherwise delegates to +eth_getRawTransactionByBlockHashAndIndex. +If a transaction is not found at specified arguments, throws web3.exceptions.TransactionNotFound.

+
>>> web3.eth.get_raw_transaction_by_block('latest', 0)
+HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c')
+>>> web3.eth.get_raw_transaction_by_block(2, 0)
+HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c')
+>>> web3.eth.get_raw_transaction_by_block('0xca609fb606a04ce6aaec76415cd0b9d8c2bc83ad2a4d17db7fd403ee7d97bf40', 0)
+HexBytes('0x02f87582053901843b9aca00843b9aca008301d8a894e2dfcfa89a45abdc3de91f7a2844b276b8451d2e888ac7230489e8000080c001a028dcd2e11682288c00237f377280bc6a478a6b27e9c2d745262152add1b1dfcba04e7a33b7ce2a37fc3cd3af7bdc7d7beff721664d56508defa188df35afd77c2c')
+
+
+
+ +
+
+Eth.wait_for_transaction_receipt(transaction_hash, timeout=120, poll_latency=0.1)
+

Waits for the transaction specified by transaction_hash to be included in a block, then +returns its transaction receipt.

+

Optionally, specify a timeout in seconds. If timeout elapses before the transaction +is added to a block, then wait_for_transaction_receipt() raises a +web3.exceptions.TimeExhausted exception.

+
>>> web3.eth.wait_for_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
+# If transaction is not yet in a block, time passes, while the thread sleeps...
+# ...
+# Then when the transaction is added to a block, its receipt is returned:
+AttributeDict({
+    'blockHash': HexBytes('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd'),
+    'blockNumber': 46147,
+    'contractAddress': None,
+    'cumulativeGasUsed': 21000,
+    'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
+    'gasUsed': 21000,
+    'logs': [],
+    'logsBloom': HexBytes('0x000000000000000000000000000000000000000000000000...0000'),
+    'status': 1,
+    'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
+    'transactionHash': HexBytes('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'),
+    'transactionIndex': 0,
+})
+
+
+
+ +
+
+Eth.get_transaction_receipt(transaction_hash)
+
    +
  • Delegates to eth_getTransactionReceipt RPC Method

  • +
+

Returns the transaction receipt specified by transaction_hash. If the transaction cannot be found throws web3.exceptions.TransactionNotFound.

+

If status in response equals 1 the transaction was successful. If it is equals 0 the transaction was reverted by EVM.

+
>>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')  # not yet mined
+Traceback # ... etc ...
+TransactionNotFound: Transaction with hash: 0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060 not found.
+
+# wait for it to be mined....
+>>> web3.eth.get_transaction_receipt('0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060')
+AttributeDict({
+    'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
+    'blockNumber': 46147,
+    'contractAddress': None,
+    'cumulativeGasUsed': 21000,
+    'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
+    'gasUsed': 21000,
+    'logs': [],
+    'logsBloom': '0x000000000000000000000000000000000000000000000000...0000',
+    'status': 1, # 0 or 1
+    'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
+    'transactionHash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
+    'transactionIndex': 0,
+})
+
+
+
+ +
+
+Eth.get_transaction_count(account, block_identifier=web3.eth.default_block)
+
    +
  • Delegates to eth_getTransactionCount RPC Method

  • +
+

Returns the number of transactions that have been sent from account as +of the block specified by block_identifier.

+

account may be a checksum address or an ENS name

+
>>> web3.eth.get_transaction_count('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
+340
+
+
+
+ +
+
+Eth.send_transaction(transaction)
+
    +
  • Delegates to eth_sendTransaction RPC Method

  • +
+

Signs and sends the given transaction

+

The transaction parameter should be a dictionary with the following fields.

+
    +
  • from: bytes or text, checksum address or ENS name - (optional, default: +web3.eth.defaultAccount) The address the transaction is sent from.

  • +
  • to: bytes or text, checksum address or ENS name - (optional when creating new +contract) The address the transaction is directed to.

  • +
  • gas: integer - (optional) Integer of the gas +provided for the transaction execution. It will return unused gas.

  • +
  • maxFeePerGas: integer or hex - (optional) maximum amount you're willing +to pay, inclusive of baseFeePerGas and maxPriorityFeePerGas. The difference +between maxFeePerGas and baseFeePerGas + maxPriorityFeePerGas is refunded +to the user.

  • +
  • maxPriorityFeePerGas: integer or hex - (optional) the part of the fee +that goes to the miner

  • +
  • gasPrice: integer - Integer of the gasPrice used for each paid gas +LEGACY - unless you have a good reason to use gasPrice, use maxFeePerGas +and maxPriorityFeePerGas instead.

  • +
  • value: integer - (optional) Integer of the value send with this +transaction

  • +
  • data: bytes or text - The compiled code of a contract OR the hash +of the invoked method signature and encoded parameters. For details see +Ethereum Contract ABI.

  • +
  • nonce: integer - (optional) Integer of a nonce. This allows to +overwrite your own pending transactions that use the same nonce.

  • +
+

If the transaction specifies a data value but does not specify +gas then the gas value will be populated using the +estimate_gas() function with an additional buffer of 100000 +gas up to the gasLimit of the latest block. In the event that the +value returned by estimate_gas() method is greater than the +gasLimit a ValueError will be raised.

+
# simple example (web3.py and / or client determines gas and fees, typically defaults to a dynamic fee transaction post London fork)
+>>> web3.eth.send_transaction({
+  'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+  'from': web3.eth.accounts[0],
+  'value': 12345
+})
+
+# Dynamic fee transaction, introduced by EIP-1559:
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+>>> web3.eth.send_transaction({
+  'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+  'from': web3.eth.accounts[0],
+  'value': 12345,
+  'gas': 21000,
+  'maxFeePerGas': web3.to_wei(250, 'gwei'),
+  'maxPriorityFeePerGas': web3.to_wei(2, 'gwei'),
+})
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+
+# Legacy transaction (less efficient)
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+>>> web3.eth.send_transaction({
+  'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+  'from': web3.eth.accounts[0],
+  'value': 12345,
+  'gas': 21000,
+  'gasPrice': web3.to_wei(50, 'gwei'),
+})
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+
+
+
+ +
+
+Eth.sign_transaction(transaction)
+
    +
  • Delegates to eth_signTransaction RPC Method.

  • +
+

Returns a transaction that's been signed by the node's private key, but not yet submitted. +The signed tx can be submitted with Eth.send_raw_transaction

+
>>> signed_txn = w3.eth.sign_transaction(dict(
+    nonce=w3.eth.get_transaction_count(w3.eth.accounts[0]),
+    maxFeePerGas=2000000000,
+    maxPriorityFeePerGas=1000000000,
+    gas=100000,
+    to='0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
+    value=1,
+    data=b'',
+    )
+)
+b"\xf8d\x80\x85\x040\xe24\x00\x82R\x08\x94\xdcTM\x1a\xa8\x8f\xf8\xbb\xd2\xf2\xae\xc7T\xb1\xf1\xe9\x9e\x18\x12\xfd\x01\x80\x1b\xa0\x11\r\x8f\xee\x1d\xe5=\xf0\x87\x0en\xb5\x99\xed;\xf6\x8f\xb3\xf1\xe6,\x82\xdf\xe5\x97lF|\x97%;\x15\xa04P\xb7=*\xef \t\xf0&\xbc\xbf\tz%z\xe7\xa3~\xb5\xd3\xb7=\xc0v\n\xef\xad+\x98\xe3'"  # noqa: E501
+
+
+
+ +
+
+Eth.send_raw_transaction(raw_transaction)
+
    +
  • Delegates to eth_sendRawTransaction RPC Method

  • +
+

Sends a signed and serialized transaction. Returns the transaction hash as a HexBytes object.

+
>>> signed_txn = w3.eth.account.sign_transaction(dict(
+    nonce=w3.eth.get_transaction_count(public_address_of_senders_account),
+    maxFeePerGas=3000000000,
+    maxPriorityFeePerGas=2000000000,
+    gas=100000,
+    to='0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+    value=12345,
+    data=b'',
+    type=2,  # (optional) the type is now implicitly set based on appropriate transaction params
+    chainId=1,
+  ),
+  private_key_for_senders_account,
+)
+>>> w3.eth.send_raw_transaction(signed_txn.raw_transaction)
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+
+
+
+ +
+
+Eth.replace_transaction(transaction_hash, new_transaction)
+
    +
  • Delegates to eth_sendTransaction RPC Method

  • +
+

Sends a transaction that replaces the transaction with transaction_hash.

+

The transaction_hash must be the hash of a pending transaction.

+

The new_transaction parameter should be a dictionary with transaction fields +as required by send_transaction(). It will be used to entirely +replace the transaction of transaction_hash without using any of the pending +transaction's values.

+

If the new_transaction specifies a nonce value, it must match the pending +transaction's nonce.

+

If the new_transaction specifies maxFeePerGas and maxPriorityFeePerGas +values, they must be greater than the pending transaction's values for each field, +respectively.

+
    +
  • Legacy Transaction Support (Less Efficient - Not Recommended)

  • +
+

If the pending transaction specified a gasPrice value (legacy transaction), the +gasPrice value for the new_transaction must be greater than the pending +transaction's gasPrice.

+

If the new_transaction does not specify any of gasPrice, maxFeePerGas, or +maxPriorityFeePerGas values, one of the following will happen:

+
    +
  • If the pending transaction has a gasPrice value, this value will be used with a +multiplier of 1.125 - This is typically the minimum gasPrice increase a node requires +before it accepts a replacement transaction.

  • +
  • If a gas price strategy is set, the gasPrice value from the gas price +strategy(See Gas Price API) will be used.

  • +
  • If none of the above, the client will ultimately decide appropriate values for maxFeePerGas +and maxPriorityFeePerGas. These will likely be default values and may result in an +unsuccessful replacement of the pending transaction.

  • +
+

This method returns the transaction hash of the replacement transaction as a HexBytes object.

+
>>> tx = web3.eth.send_transaction({
+        'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+        'from': web3.eth.accounts[0],
+        'value': 1000
+    })
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+>>> web3.eth.replace_transaction('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', {
+        'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+        'from': web3.eth.accounts[0],
+        'value': 2000
+    })
+HexBytes('0x4177e670ec6431606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1528989')
+
+
+
+ +
+
+Eth.modify_transaction(transaction_hash, **transaction_params)
+
    +
  • Delegates to eth_sendTransaction RPC Method

  • +
+

Sends a transaction that modifies the transaction with transaction_hash.

+

transaction_params are keyword arguments that correspond to valid transaction +parameters as required by send_transaction(). The parameter values +will override the pending transaction's values to create the replacement transaction +to send.

+

The same validation and defaulting rules of replace_transaction() apply.

+

This method returns the transaction hash of the newly modified transaction as a HexBytes object.

+
>>> tx = web3.eth.send_transaction({
+        'to': '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+        'from': web3.eth.accounts[0],
+        'value': 1000
+    })
+HexBytes('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331')
+>>> web3.eth.modify_transaction('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', value=2000)
+HexBytes('0xec6434e6701771606e55d6b4ca35a1a6b75ee3d73315145a921026d15299d05')
+
+
+
+ +
+
+Eth.sign(account, data=None, hexstr=None, text=None)
+
    +
  • Delegates to eth_sign RPC Method

  • +
+

Caller must specify exactly one of: data, hexstr, or text.

+

Signs the given data with the private key of the given account. +The account must be unlocked.

+

account may be a checksum address or an ENS name

+
>>> web3.eth.sign(
+      '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+      text='some-text-tö-sign')
+'0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401'
+
+>>> web3.eth.sign(
+      '0x582AC4D8929f58c217d4a52aDD361AE470a8a4cD',
+      data=b'some-text-t\xc3\xb6-sign')
+'0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401'
+
+>>> web3.eth.sign(
+      '0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
+      hexstr='0x736f6d652d746578742d74c3b62d7369676e')
+'0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401'
+
+
+
+ +
+
+Eth.sign_typed_data(account, jsonMessage)
+
    +
  • Delegates to eth_signTypedData RPC Method

  • +
+
+

备注

+

eth_signTypedData is not currently supported by any major client (Besu, Erigon, Geth, or Nethermind)

+
+

Please note that the jsonMessage argument is the loaded JSON Object +and NOT the JSON String itself.

+

Signs the Structured Data (or Typed Data) with the private key of the given account. +The account must be unlocked.

+

account may be a checksum address or an ENS name

+
+ +
+
+Eth.call(transaction, block_identifier=web3.eth.default_block, state_override=None, ccip_read_enabled=True)
+
    +
  • Delegates to eth_call RPC Method

  • +
+

Executes the given transaction locally without creating a new transaction +on the blockchain. Returns the return value of the executed contract.

+

The transaction parameter is handled in the same manner as the +send_transaction() method.

+
>>> myContract.functions.setVar(1).transact()
+HexBytes('0x79af0c7688afba7588c32a61565fd488c422da7b5773f95b242ea66d3d20afda')
+>>> myContract.functions.getVar().call()
+1
+# The above call equivalent to the raw call:
+>>> web3.eth.call({'value': 0, 'gas': 21736, 'maxFeePerGas': 2000000000, 'maxPriorityFeePerGas': 1000000000, 'to': '0xc305c901078781C232A2a521C2aF7980f8385ee9', 'data': '0x477a5c98'})
+HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001')
+
+
+

In most cases it is better to make contract function call through the web3.contract.Contract interface.

+

Overriding state is a debugging feature available in Geth clients. +View their usage documentation +for a list of possible parameters.

+

EIP-3668 introduced support for the OffchainLookup revert / CCIP +Read support. In order to properly handle a call to a contract function that reverts with an OffchainLookup +error for offchain data retrieval, the ccip_read_enabled flag has been added to the eth_call method. +ccip_read_enabled is optional, yielding the default value for CCIP Read on calls to a global +global_ccip_read_enabled flag on the provider which is set to True by default. This means CCIP Read is +enabled by default for calls, as is recommended in EIP-3668. Therefore, calls to contract functions that revert with +an OffchainLookup will be handled appropriately by default.

+

The ccip_read_enabled flag on the call will always override the value of the global flag on the provider for +explicit control over specific calls. If the flag on the call is set to False, the call will raise the +OffchainLookup instead of properly handling the exception according to EIP-3668. This may be useful for +"preflighting" a transaction with a call (see CCIP Read support for offchain lookup within the examples section).

+

If the function called results in a revert error, a ContractLogicError will be raised. +If there is an error message with the error, web3.py attempts to parse the +message that comes back and return it to the user as the error string. +As of v6.3.0, the raw data is also returned and +can be accessed via the data attribute on ContractLogicError.

+
+ +
+
+Eth.simulateV1(payload, block_identifier)
+
    +
  • Delegates to eth_simulateV1 RPC Method

  • +
+

Executes a simulation for the given payload at the given block. Returns the simulation results.

+
>>> w3.eth.simulateV1(
+...   {
+...     "blockStateCalls": [
+...       {
+...         "blockOverrides": {
+...           "baseFeePerGas": Wei(10),
+...         },
+...         "stateOverrides": {
+...           "0xc100000000000000000000000000000000000000": {
+...             "balance": Wei(500000000),
+...           }
+...         },
+...         "calls": [
+...           {
+...             "from": "0xc100000000000000000000000000000000000000",
+...             "to": "0xc100000000000000000000000000000000000000",
+...             "maxFeePerGas": Wei(10),
+...             "maxPriorityFeePerGas": Wei(10),
+...           }
+...         ],
+...       }
+...     ],
+...     "validation": True,
+...     "traceTransfers": True,
+...   },
+...   "latest",
+... )
+[AttributeDict({
+  'baseFeePerGas': 10,
+  'blobGasUsed': 0,
+  'calls': [AttributeDict({
+    'returnData': HexBytes('0x'),
+    'logs': [],
+    'gasUsed': 21000,
+    'status': 1
+  })],
+  'difficulty': 0,
+  'excessBlobGas': 0,
+  'extraData': HexBytes('0x'),
+  'gasLimit': 983527531,
+  'gasUsed': 21000,
+  'hash': HexBytes('0xb2dba64c905dea42e940d67b8e0f44019f4a61c4833a9cba99c426b748d9e1a4'),
+  'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'),
+  'miner': '0x0000000000000000000000000000000000000000',
+  'mixHash': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'),
+  'nonce': HexBytes('0x0000000000000000'),
+  'number': 18,
+  'parentBeaconBlockRoot': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'),
+  'parentHash': HexBytes('0x71d32db179a1291de86b5f7fa15224292ef9ee6ebb3fa62484896601d9f20d5f'),
+  'receiptsRoot': HexBytes('0xf78dfb743fbd92ade140711c8bbc542b5e307f0ab7984eff35d751969fe57efa'),
+  'sha3Uncles': HexBytes('0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'),
+  'size': 626,
+  'stateRoot': HexBytes('0xbbbe846b616911d13780f58f500f8948e0878ba6f55cae7432da915cab3ba2b6'),
+  'timestamp': 1739921487,
+  'transactions': [HexBytes('0xfd801060af398c615f1ffb61586604aaf4fc688615cb1ff088531638a9b9e8e6')],
+  'transactionsRoot': HexBytes('0xa6bc01d7707e94b62dccb8d097df1db25d6b44fad35463ecc99c9e5822e7aa5f'),
+  'uncles': [],
+  'withdrawals': [],
+  'withdrawalsRoot': HexBytes('0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421')
+})]
+
+
+
+ +
+
+Eth.create_access_list(transaction, block_identifier=web3.eth.default_block)
+
    +
  • Delegates to eth_createAccessList RPC Method

  • +
+

This method creates an EIP-2930 type accessList based on a given +transaction. The accessList contains all storage slots and addresses read and written by the transaction, +except for the sender account and the precompiles. This method uses the same transaction call object and +block_identifier object as call(). An accessList can be used to access contracts that +became inaccessible due to gas cost increases.

+

The transaction parameter is handled in the same manner as the +send_transaction() method. +The optional block_identifier parameter is a block_number or latest or pending. Default is latest.

+
>>> w3.eth.create_access_list(
+...     {
+...         "to": to_checksum_address("0xF0109fC8DF283027b6285cc889F5aA624EaC1F55"),
+...         "gasPrice": 10**11,
+...         "value": 0,
+...         "data": "0x608060806080608155",
+...     },
+...     "pending",
+... )
+AttributeDict({
+    "accessList": [
+        AttributeDict({
+            "address": "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe",
+            "storageKeys": [
+                "0x0000000000000000000000000000000000000000000000000000000000000003",
+                "0x0000000000000000000000000000000000000000000000000000000000000007",
+            ]
+        }),
+        AttributeDict({
+            "address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+            "storageKeys": []
+        }),
+    ],
+    "gasUsed": 21000
+})
+
+
+

The method eth_createAccessList returns a list of addresses and storage keys used by the transaction, plus the gas +consumed when the accessList is included. Like eth_estimateGas, this is an estimation; the list could change when +the transaction is actually finalized. Adding an accessList to your transaction does not necessarily result in lower +gas usage compared to a transaction without an accessList.

+
+ +
+
+Eth.fee_history(block_count, newest_block, reward_percentiles=None)
+
    +
  • Delegates to eth_feeHistory RPC Method

  • +
+

Returns transaction fee data for up to 1,024 blocks.

+
+
参数:
+
    +
  • block_count (int or hexstring) -- The number of blocks in the requested range. Depending on the client, this +value should be either a int between 1 and 1024 or a hexstring. +Less than requested may be returned if not all blocks are available.

  • +
  • newest_block (int or BlockParams) -- The newest, highest-numbered, block in the requested range. This value may be an +int or one of the predefined block parameters 'latest', 'earliest', or 'pending'.

  • +
  • reward_percentiles (List[float] or None) -- (optional) A monotonically increasing list of percentile float values to +sample from each block's effective priority fees per gas in ascending order, weighted by gas used.

  • +
+
+
返回:
+

An AttributeDict containing the following keys:

+
+
+
    +
  • oldestBlock (int) -- The oldest, lowest-numbered, block in the range requested as a BlockNumber type +with int value.

  • +
  • baseFeePerGas (List[Wei]) -- An array of block base fees per gas. This includes the next block after the +newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for +pre-EIP-1559 blocks.

  • +
  • gasUsedRatio (List[float]) -- An array of gasUsed/gasLimit float values for the requested blocks.

  • +
  • reward (List[List[Wei]]) -- (optional) A two-dimensional array of effective priority fees per gas at the +requested block percentiles.

  • +
+
>>> w3.eth.fee_history(4, 'latest', [10, 90])
+AttributeDict({
+    'oldestBlock': 3,
+    'reward': [[220, 7145389], [1000000, 6000213], [550, 550], [125, 12345678]],
+    'baseFeePerGas': [202583058, 177634473, 155594425, 136217133, 119442408],
+    'gasUsedRatio': [0.007390479689642084, 0.0036988514889990873, 0.0018512333048507866, 0.00741217041320997]
+})
+
+
+
+ +
+
+Eth.estimate_gas(transaction, block_identifier=None, state_override=None)
+
    +
  • Delegates to eth_estimateGas RPC Method

  • +
+

Executes the given transaction locally without creating a new transaction +on the blockchain. Returns amount of gas consumed by execution which can +be used as a gas estimate.

+

The transaction and block_identifier parameters are handled in the +same manner as the send_transaction() method.

+

The state_override is useful when there is a chain of transaction calls. +It overrides state so that the gas estimate of a transaction is accurate in +cases where prior calls produce side effects.

+
>>> web3.eth.estimate_gas({'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'from':web3.eth.accounts[0], 'value': 12345})
+21000
+
+
+
+ +
+
+Eth.generate_gas_price(transaction_params=None)
+

Uses the selected gas price strategy to calculate a gas price. This method +returns the gas price denominated in wei.

+

The transaction_params argument is optional however some gas price strategies +may require it to be able to produce a gas price.

+
>>> web3.eth.generate_gas_price()
+20000000000
+
+
+
+

备注

+

For information about how gas price can be customized in web3 see +Gas Price API.

+
+
+ +
+
+Eth.set_gas_price_strategy(gas_price_strategy)
+

Set the selected gas price strategy. It must be a method of the signature +(web3, transaction_params) and return a gas price denominated in wei.

+
+ +
+
+Eth.subscribe(subscription_identifier, subscription_params)
+
    +
  • Delegates to eth_subscribe RPC Method

  • +
+

Only available on persistent connection providers: +WebSocketProvider and +AsyncIPCProvider.

+

Returns a subscription ID that can be used to track a particular subscription to, or unsubscribe from, an event. +For usage examples see the docs on Using Persistent Connection Providers.

+
>>> subscription_id = await web3.eth.subscribe('newHeaders')
+>>> subscription_id
+'0xbd63bb89e7475591a0a6fc9014307bc4'
+
+
+
+ +
+
+Eth.unsubscribe(subscription_id)
+
    +
  • Delegates to eth_unsubscribe RPC Method

  • +
+

Only available on persistent connection providers: +WebSocketProvider and +AsyncIPCProvider.

+

Returns True if successfully unsubscribed. For usage examples see the docs on +Using Persistent Connection Providers.

+
>>> result = await web3.eth.unsubscribe(subscription_id)
+>>> result
+True
+
+
+
+ +
+
+

Filters

+

The following methods are available on the web3.eth object for interacting +with the filtering API.

+
+
+Eth.filter(filter_params)
+
    +
  • Delegates to eth_newFilter, eth_newBlockFilter, and +eth_newPendingTransactionFilter RPC Methods.

  • +
+

This method delegates to one of three RPC methods depending on the value of +filter_params.

+
    +
  • If filter_params is the string 'pending' then a new filter is +registered using the eth_newPendingTransactionFilter RPC method. +This will create a new filter that will be called for each new unmined +transaction that the node receives.

  • +
  • If filter_params is the string 'latest' then a new filter is +registered using the eth_newBlockFilter RPC method. This will create +a new filter that will be called each time the node receives a new block.

  • +
  • If filter_params is a dictionary then a new filter is registered +using the eth_newFilter RPC method. This will create a new filter +that will be called for all log entries that match the provided +filter_params.

  • +
+

This method returns a web3.utils.filters.Filter object which can then +be used to either directly fetch the results of the filter or to register +callbacks which will be called with each result of the filter.

+

When creating a new log filter, the filter_params should be a +dictionary with the following keys. Note that the keys are camel-cased +strings, as is expected in a JSON-RPC request.

+
    +
  • fromBlock: integer/tag - (optional, default: "latest") Integer +block number, or one of predefined block identifiers +"latest", "pending", "earliest", "safe", or "finalized".

  • +
  • toBlock: integer/tag - (optional, default: "latest") Integer +block number, or one of predefined block identifiers +"latest", "pending", "earliest", "safe", or "finalized".

  • +
  • address: string or list of strings, each 20 Bytes - +(optional) Contract address or a list of addresses from which logs should +originate.

  • +
  • topics: list of 32 byte strings or null - (optional) Array of +topics that should be used for filtering. Topics are order-dependent. +This parameter can also be a list of topic lists in which case filtering +will match any of the provided topic arrays.

  • +
+
+

备注

+

Though "latest" and "safe" block identifiers are not yet part of the +specifications for eth_newFilter, they are supported by web3.py and may or +may not yield expected results depending on the node being accessed.

+
+

See Events and Logs for more information about filtering.

+
>>> web3.eth.filter('latest')
+<BlockFilter at 0x10b72dc28>
+>>> web3.eth.filter('pending')
+<TransactionFilter at 0x10b780340>
+>>> web3.eth.filter({'fromBlock': 1000000, 'toBlock': 1000100, 'address': '0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B'})
+<LogFilter at 0x10b7803d8>
+
+
+
+ +
+
+Eth.get_filter_changes(self, filter_id)
+
    +
  • Delegates to eth_getFilterChanges RPC Method.

  • +
+

Returns all new entries which occurred since the last call to this method +for the given filter_id

+
>>> filter = web3.eth.filter()
+>>> web3.eth.get_filter_changes(filter.filter_id)
+[
+    {
+        'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24',
+        'blockHash': '0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0',
+        'blockNumber': 2217196,
+        'data': '0x0000000000000000000000000000000000000000000000000000000000000001',
+        'logIndex': 0,
+        'topics': ['0xe65b00b698ba37c614af350761c735c5f4a82b4ab365a1f1022d49d9dfc8e930',
+        '0x000000000000000000000000754c50465885f1ed1fa1a55b95ee8ecf3f1f4324',
+        '0x296c7fb6ccafa3e689950b947c2895b07357c95b066d5cdccd58c301f41359a3'],
+        'transactionHash': '0xfe1289fd3915794b99702202f65eea2e424b2f083a12749d29b4dd51f6dce40d',
+        'transactionIndex': 1,
+    },
+    ...
+]
+
+
+
+ +
+
+Eth.get_filter_logs(self, filter_id)
+
    +
  • Delegates to eth_getFilterLogs RPC Method.

  • +
+

Returns all entries for the given filter_id

+
>>> filter = web3.eth.filter()
+>>> web3.eth.get_filter_logs(filter.filter_id)
+[
+    {
+        'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24',
+        'blockHash': '0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0',
+        'blockNumber': 2217196,
+        'data': '0x0000000000000000000000000000000000000000000000000000000000000001',
+        'logIndex': 0,
+        'topics': ['0xe65b00b698ba37c614af350761c735c5f4a82b4ab365a1f1022d49d9dfc8e930',
+        '0x000000000000000000000000754c50465885f1ed1fa1a55b95ee8ecf3f1f4324',
+        '0x296c7fb6ccafa3e689950b947c2895b07357c95b066d5cdccd58c301f41359a3'],
+        'transactionHash': '0xfe1289fd3915794b99702202f65eea2e424b2f083a12749d29b4dd51f6dce40d',
+        'transactionIndex': 1,
+    },
+    ...
+]
+
+
+
+ +
+
+Eth.uninstall_filter(self, filter_id)
+
    +
  • Delegates to eth_uninstallFilter RPC Method.

  • +
+

Uninstalls the filter specified by the given filter_id. Returns +boolean as to whether the filter was successfully uninstalled.

+
>>> filter = web3.eth.filter()
+>>> web3.eth.uninstall_filter(filter.filter_id)
+True
+>>> web3.eth.uninstall_filter(filter.filter_id)
+False  # already uninstalled.
+
+
+
+ +
+
+Eth.get_logs(filter_params)
+

This is the equivalent of: creating a new +filter, running get_filter_logs(), and then uninstalling the filter. See +filter() for details on allowed filter parameters.

+
+ +
+
+

Contracts

+
+
+Eth.contract(address=None, contract_name=None, ContractFactoryClass=Contract, **contract_factory_kwargs)
+

If address is provided, then this method will return an instance of the +contract defined by abi. The address may be a checksum string, +or an ENS name like 'mycontract.eth'.

+
from web3 import Web3
+
+w3 = Web3(...)
+
+contract = w3.eth.contract(address='0x000000000000000000000000000000000000dEaD', abi=...)
+
+# alternatively:
+contract = w3.eth.contract(address='mycontract.eth', abi=...)
+
+
+
+

备注

+

If you use an ENS name to initialize a contract, the contract will be looked up by +name on each use. If the name could ever change maliciously, first +Get the Address for an ENS Name, and then create the contract with the checksum address.

+
+

If address is not provided, the newly created contract class will be returned. That +class will then be initialized by supplying the address.

+
from web3 import Web3
+
+w3 = Web3(...)
+
+Contract = w3.eth.contract(abi=...)
+
+# later, initialize contracts with the same metadata at different addresses:
+contract1 = Contract(address='0x000000000000000000000000000000000000dEaD')
+contract2 = Contract(address='mycontract.eth')
+
+
+

contract_name will be used as the name of the contract class. If it is +None then the name of the ContractFactoryClass will be used.

+

ContractFactoryClass will be used as the base Contract class.

+

The following arguments are accepted for contract class creation.

+
+
参数:
+
    +
  • abi (ABI) -- Application Binary Interface. Usually provided since an abi is required to interact with any contract.

  • +
  • asm -- Assembly code generated by the compiler

  • +
  • ast -- Abstract Syntax Tree of the contract generated by the compiler

  • +
  • bytecode -- Bytecode of the contract generated by the compiler

  • +
  • bytecode_runtime -- Bytecode stored at the contract address, excludes the constructor and initialization code

  • +
  • clone_bin

  • +
  • dev_doc

  • +
  • decode_tuples -- Optionally convert tuples/structs to named tuples

  • +
  • interface

  • +
  • metadata -- Contract Metadata generated by the compiler

  • +
  • opcodes -- Opcodes for the contract generated by the compiler

  • +
  • src_map

  • +
  • src_map_runtime

  • +
  • user_doc

  • +
+
+
返回:
+

Instance of the contract

+
+
返回类型:
+

Contract

+
+
抛出:
+
+
+
+

See the Contracts documentation for more information about Contracts.

+
+ +
+
+Eth.set_contract_factory(contractFactoryClass)
+

Modify the default contract factory from Contract to contractFactoryClass. +Future calls to Eth.contract() will then default to contractFactoryClass.

+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.geth.html b/_build/html_zh_CN/web3.geth.html new file mode 100644 index 0000000000..9e14723c9f --- /dev/null +++ b/_build/html_zh_CN/web3.geth.html @@ -0,0 +1,757 @@ + + + + + + + + + Geth API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Geth API

+

The web3.geth object exposes modules that enable you to interact with the JSON-RPC endpoints supported by Geth that are not defined in the standard set of Ethereum JSONRPC endpoints according to EIP 1474.

+
+

GethAdmin API

+

The following methods are available on the web3.geth.admin namespace.

+

The web3.geth.admin object exposes methods to interact with the RPC APIs under the +admin_ namespace that are supported by the Geth client.

+
+
+web3.geth.admin.datadir()
+
    +
  • Delegates to admin_datadir RPC Method

  • +
+

Returns the system path of the node's data directory.

+
>>> web3.geth.admin.datadir()
+'/Users/snakecharmers/Library/Ethereum'
+
+
+
+ +
+
+web3.geth.admin.node_info()
+
    +
  • Delegates to admin_nodeInfo RPC Method

  • +
+

Returns information about the currently running node.

+
>>> web3.geth.admin.node_info()
+{
+    'enode': 'enode://e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3@[::]:30303',
+    'id': 'e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3',
+    'ip': '::',
+    'listenAddr': '[::]:30303',
+    'name': 'Geth/v1.4.11-stable-fed692f6/darwin/go1.7',
+    'ports': {'discovery': 30303, 'listener': 30303},
+    'protocols': {
+        'eth': {
+            'difficulty': 57631175724744612603,
+            'genesis': '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
+            'head': '0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796',
+            'network': 1,
+        },
+    },
+}
+
+
+
+ +
+
+web3.geth.admin.peers()
+
    +
  • Delegates to admin_peers RPC Method

  • +
+

Returns the current peers the node is connected to.

+
>>> web3.geth.admin.peers()
+[
+    {
+        'caps': ['eth/63'],
+        'id': '146e8e3e2460f1e18939a5da37c4a79f149c8b9837240d49c7d94c122f30064e07e4a42ae2c2992d0f8e7e6f68a30e7e9ad31d524349ec9d17effd2426a37b40',
+        'name': 'Geth/v1.4.10-stable/windows/go1.6.2',
+        'network': {
+            'localAddress': '10.0.3.115:64478',
+            'remoteAddress': '72.208.167.127:30303',
+        },
+        'protocols': {
+            'eth': {
+                'difficulty': 17179869184,
+                'head': '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
+                'version': 63,
+            },
+        }
+    },
+    {
+        'caps': ['eth/62', 'eth/63'],
+        'id': '76cb6cd3354be081923a90dfd4cda40aa78b307cc3cf4d5733dc32cc171d00f7c08356e9eb2ea47eab5aad7a15a3419b859139e3f762e1e1ebf5a04f530dcef7',
+        'name': 'Geth/v1.4.10-stable-5f55d95a/linux/go1.5.1',
+        'network': {
+            'localAddress': '10.0.3.115:64784',
+            'remoteAddress': '60.205.92.119:30303',
+        },
+        'protocols': {
+            'eth': {
+                'difficulty': 57631175724744612603,
+                'head': '0xaaef6b9dd0d34088915f4c62b6c166379da2ad250a88f76955508f7cc81fb796',
+                'version': 63,
+            },
+        },
+    },
+    ...
+]
+
+
+
+ +
+
+web3.geth.admin.add_peer(node_url)
+
    +
  • Delegates to admin_addPeer RPC Method

  • +
+

Requests adding a new remote node to the list of tracked static nodes.

+
>>> web3.geth.admin.add_peer('enode://e54eebad24dce1f6d246bea455ffa756d97801582420b9ed681a2ea84bf376d0bd87ae8dd6dc06cdb862a2ca89ecabe1be1050be35b4e70d62bc1a092cb7e2d3@52.71.255.237:30303')
+True
+
+
+
+ +
+
+web3.geth.admin.start_http(host='localhost', port=8545, cors='', apis='eth,net,web3')
+
    +
  • Delegates to admin_startHTTP RPC Method

  • +
+

Starts the HTTP based JSON RPC API webserver on the specified host and +port, with the rpccorsdomain set to the provided cors value and +with the APIs specified by apis enabled. Returns boolean as to whether +the server was successfully started.

+
>>> web3.geth.admin.start_http()
+True
+
+
+
+ +
+
+web3.geth.admin.start_ws(host='localhost', port=8546, cors='', apis='eth,net,web3')
+
    +
  • Delegates to admin_startWS RPC Method

  • +
+

Starts the WebSocket based JSON RPC API webserver on the specified host +and port, with the rpccorsdomain set to the provided cors value +and with the APIs specified by apis enabled. Returns boolean as to +whether the server was successfully started.

+
>>> web3.geth.admin.start_ws()
+True
+
+
+
+ +
+
+web3.geth.admin.stop_http()
+
    +
  • Delegates to admin_stopHTTP RPC Method

  • +
+

Stops the HTTP based JSON RPC server.

+
>>> web3.geth.admin.stop_http()
+True
+
+
+
+ +
+
+web3.geth.admin.stop_ws()
+
    +
  • Delegates to admin_stopWS RPC Method

  • +
+

Stops the WebSocket based JSON RPC server.

+
>>> web3.geth.admin.stop_ws()
+True
+
+
+
+ +
+
+

GethTxPool API

+

The web3.geth.txpool object exposes methods to interact with the RPC APIs under +the txpool_ namespace. These methods are only exposed under the geth namespace +since they are not standard.

+

The following methods are available on the web3.geth.txpool namespace.

+
+
+TxPool.inspect()
+
    +
  • Delegates to txpool_inspect RPC Method

  • +
+

Returns a textual summary of all transactions currently pending for +inclusion in the next block(s) as well as ones that are scheduled for +future execution.

+
>>> web3.geth.txpool.inspect()
+{
+    'pending': {
+        '0x26588a9301b0428d95e6Fc3A5024fcE8BEc12D51': {
+          31813: ["0x3375Ee30428b2A71c428afa5E89e427905F95F7e: 0 wei + 500000 × 20000000000 gas"]
+        },
+        '0x2a65Aca4D5fC5B5C859090a6c34d164135398226': {
+          563662: ["0x958c1Fa64B34db746925c6F8a3Dd81128e40355E: 1051546810000000000 wei + 90000 × 20000000000 gas"],
+          563663: ["0x77517B1491a0299A44d668473411676f94e97E34: 1051190740000000000 wei + 90000 × 20000000000 gas"],
+          563664: ["0x3E2A7Fe169c8F8eee251BB00d9fb6d304cE07d3A: 1050828950000000000 wei + 90000 × 20000000000 gas"],
+          563665: ["0xAF6c4695da477F8C663eA2D8B768Ad82Cb6A8522: 1050544770000000000 wei + 90000 × 20000000000 gas"],
+          563666: ["0x139B148094C50F4d20b01cAf21B85eDb711574dB: 1048598530000000000 wei + 90000 × 20000000000 gas"],
+          563667: ["0x48B3Bd66770b0D1EeceFCe090daFeE36257538aE: 1048367260000000000 wei + 90000 × 20000000000 gas"],
+          563668: ["0x468569500925D53e06Dd0993014aD166fD7Dd381: 1048126690000000000 wei + 90000 × 20000000000 gas"],
+          563669: ["0x3DcB4C90477a4b8Ff7190b79b524773CbE3bE661: 1047965690000000000 wei + 90000 × 20000000000 gas"],
+          563670: ["0x6DfeF5BC94b031407FFe71ae8076CA0FbF190963: 1047859050000000000 wei + 90000 × 20000000000 gas"]
+        },
+        '0x9174E688d7dE157C5C0583Df424EAAB2676aC162': {
+          3: ["0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413: 30000000000000000000 wei + 85000 × 21000000000 gas"]
+        },
+        '0xb18F9d01323e150096650ab989CfecD39D757Aec': {
+          777: ["0xcD79c72690750F079ae6AB6ccd7e7aEDC03c7720: 0 wei + 1000000 × 20000000000 gas"]
+        },
+        '0xB2916C870Cf66967B6510B76c07E9d13a5D23514': {
+          2: ["0x576f25199D60982A8f31A8DfF4da8aCB982e6ABa: 26000000000000000000 wei + 90000 × 20000000000 gas"]
+        },
+        '0xBc0CA4f217E052753614d6B019948824d0d8688B': {
+          0: ["0x2910543Af39abA0Cd09dBb2D50200b3E800A63D2: 1000000000000000000 wei + 50000 × 1171602790622 gas"]
+        },
+        '0xea674fdde714fd979de3edf0f56aa9716b898ec8': {
+          70148: ["0xe39c55ead9f997f7fa20ebe40fb4649943d7db66: 1000767667434026200 wei + 90000 × 20000000000 gas"]
+        }
+      },
+      'queued': {
+        '0x0F6000De1578619320aBA5e392706b131FB1dE6f': {
+          6: ["0x8383534d0bcd0186d326C993031311c0Ac0D9B2d: 9000000000000000000 wei + 21000 × 20000000000 gas"]
+        },
+        '0x5b30608c678e1ac464A8994C3B33E5CdF3497112': {
+          6: ["0x9773547e27f8303C87089dc42D9288aa2B9d8F06: 50000000000000000000 wei + 90000 × 50000000000 gas"]
+        },
+        '0x976A3Fc5d6f7d259EBfb4cc2Ae75115475E9867C': {
+          3: ["0x346FB27dE7E7370008f5da379f74dd49F5f2F80F: 140000000000000000 wei + 90000 × 20000000000 gas"]
+        },
+        '0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A': {
+          2: ["0x24a461f25eE6a318BDef7F33De634A67bb67Ac9D: 17000000000000000000 wei + 90000 × 50000000000 gas"],
+          6: ["0x6368f3f8c2B42435D6C136757382E4A59436a681: 17990000000000000000 wei + 90000 × 20000000000 gas", "0x8db7b4e0ecb095fbd01dffa62010801296a9ac78: 16998950000000000000 wei + 90000 × 20000000000 gas"],
+          7: ["0x6368f3f8c2B42435D6C136757382E4A59436a681: 17900000000000000000 wei + 90000 × 20000000000 gas"]
+        }
+      }
+}
+
+
+
+ +
+
+TxPool.status()
+
    +
  • Delegates to txpool_status RPC Method

  • +
+

Returns a textual summary of all transactions currently pending for +inclusion in the next block(s) as well as ones that are scheduled for +future execution.

+
{
+    pending: 10,
+    queued: 7,
+}
+
+
+
+ +
+
+TxPool.content()
+
    +
  • Delegates to txpool_content RPC Method

  • +
+

Returns the exact details of all transactions that are pending or queued.

+
>>> web3.geth.txpool.content()
+{
+  'pending': {
+    '0x0216D5032f356960Cd3749C31Ab34eEFF21B3395': {
+      806: [{
+        'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000",
+        'blockNumber': None,
+        'from': "0x0216D5032f356960Cd3749C31Ab34eEFF21B3395",
+        'gas': "0x5208",
+        'gasPrice': None,
+        'hash': "0xaf953a2d01f55cfe080c0c94150a60105e8ac3d51153058a1f03dd239dd08586",
+        'input': "0x",
+        'maxFeePerGas': '0x77359400',
+        'maxPriorityFeePerGas': '0x3b9aca00',
+        'nonce': "0x326",
+        'to': "0x7f69a91A3CF4bE60020fB58B893b7cbb65376db8",
+        'transactionIndex': None,
+        'value': "0x19a99f0cf456000"
+      }]
+    },
+    '0x24d407e5A0B506E1Cb2fae163100B5DE01F5193C': {
+      34: [{
+        'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000",
+        'blockNumber': None,
+        'from': "0x24d407e5A0B506E1Cb2fae163100B5DE01F5193C",
+        'gas': "0x44c72",
+        'gasPrice': None,
+        'hash': "0xb5b8b853af32226755a65ba0602f7ed0e8be2211516153b75e9ed640a7d359fe",
+        'input': "0xb61d27f600000000000000000000000024d407e5a0b506e1cb2fae163100b5de01f5193c00000000000000000000000000000000000000000000000053444835ec580000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+        'maxFeePerGas': '0x77359400',
+        'maxPriorityFeePerGas': '0x3b9aca00',
+        'nonce': "0x22",
+        'to': "0x7320785200f74861B69C49e4ab32399a71b34f1a",
+        'transactionIndex': None,
+        'value': "0x0"
+      }]
+    }
+  },
+  'queued': {
+    '0x976A3Fc5d6f7d259EBfb4cc2Ae75115475E9867C': {
+      3: [{
+        'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000",
+        'blockNumber': None,
+        'from': "0x976A3Fc5d6f7d259EBfb4cc2Ae75115475E9867C",
+        'gas': "0x15f90",
+        'gasPrice': None,
+        'hash': "0x57b30c59fc39a50e1cba90e3099286dfa5aaf60294a629240b5bbec6e2e66576",
+        'input': "0x",
+        'maxFeePerGas': '0x77359400',
+        'maxPriorityFeePerGas': '0x3b9aca00',
+        'nonce': "0x3",
+        'to': "0x346FB27dE7E7370008f5da379f74dd49F5f2F80F",
+        'transactionIndex': None,
+        'value': "0x1f161421c8e0000"
+      }]
+    },
+    '0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A': {
+      2: [{
+        'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000",
+        'blockNumber': None,
+        'from': "0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A",
+        'gas': "0x15f90",
+        'gasPrice': None,
+        'hash': "0x3a3c0698552eec2455ed3190eac3996feccc806970a4a056106deaf6ceb1e5e3",
+        'input': "0x",
+        'maxFeePerGas': '0x77359400',
+        'maxPriorityFeePerGas': '0x3b9aca00',
+        'nonce': "0x2",
+        'to': "0x24a461f25eE6a318BDef7F33De634A67bb67Ac9D",
+        'transactionIndex': None,
+        'value': "0xebec21ee1da40000"
+      }],
+      6: [{
+        'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000",
+        'blockNumber': None,
+        'from': "0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A",
+        'gas': "0x15f90",
+        'gasPrice': None,
+        'hash': "0xbbcd1e45eae3b859203a04be7d6e1d7b03b222ec1d66dfcc8011dd39794b147e",
+        'input': "0x",
+        'maxFeePerGas': '0x77359400',
+        'maxPriorityFeePerGas': '0x3b9aca00',
+        'nonce': "0x6",
+        'to': "0x6368f3f8c2B42435D6C136757382E4A59436a681",
+        'transactionIndex': None,
+        'value': "0xf9a951af55470000"
+      }, {
+        'blockHash': "0x0000000000000000000000000000000000000000000000000000000000000000",
+        'blockNumber': None,
+        'from': "0x9B11bF0459b0c4b2f87f8CEBca4cfc26f294B63A",
+        'gas': "0x15f90",
+        'gasPrice': None,
+        'hash': "0x60803251d43f072904dc3a2d6a084701cd35b4985790baaf8a8f76696041b272",
+        'input': "0x",
+        'maxFeePerGas': '0x77359400',
+        'maxPriorityFeePerGas': '0x3b9aca00',
+        'nonce': "0x6",
+        'to': "0x8DB7b4e0ECB095FBD01Dffa62010801296a9ac78",
+        'transactionIndex': None,
+        'value': "0xebe866f5f0a06000"
+      }],
+    }
+  }
+}
+
+
+
+ +
+
+

GethDebug API

+

The web3.geth.debug object exposes methods to interact with the RPC APIs under the +debug_ namespace. These methods are only exposed under the geth namespace. +Full documentation around options can be found in the +Geth docs.

+
+
+Debug.trace_transaction(transaction_hash)
+
    +
  • Delegates to debug_traceTransaction RPC Method

  • +
+

Returns the trace of the transaction with the given transaction_hash and trace_config.

+
>>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3')
+    AttributeDict({
+      'gas': 21000,
+      'failed': False,
+      'returnValue': '',
+      'structLogs': []
+    })
+
+>>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3', {
+        "tracer": "prestateTracer",
+    })
+    AttributeDict({
+      '0x0000000000000000000000000000000000000000': AttributeDict({'balance': 0}),
+      '0x7fE3e4C21bDE162214B715AabcE05391301e9F5B': AttributeDict({'balance': 115792089237316195423570985008687907853269984665640564039457584007913129639927}),
+      '0x91fe3039271d43d3f8479f60Cc5293Bc8A461b75': AttributeDict({'balance': 0})
+    })
+
+>>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3', {
+        "tracer": "prestateTracer",
+        "traceConfig": {"diffMode": True}
+    })
+    AttributeDict({
+      'post': AttributeDict({
+        '0x0000000000000000000000000000000000000000': AttributeDict({'balance': 63000}),
+        '0xcF888Cc4FAe8a3D774e574Ef8C6a261958287d04': AttributeDict({
+          'balance': 115792089237316195423570985008687907853269984665640564039457583959368602105927,
+          'nonce': 3
+        }),
+        '0xD2593D3445a9F0f4c776715f5206FBf4CA6A0475': AttributeDict({'balance': 100000})}),
+      'pre': AttributeDict({
+        '0x0000000000000000000000000000000000000000': AttributeDict({'balance': 42000}),
+        '0xcF888Cc4FAe8a3D774e574Ef8C6a261958287d04': AttributeDict({
+          'balance': 115792089237316195423570985008687907853269984665640564039457583973451623990927,
+          'nonce': 2
+        }),
+        '0xD2593D3445a9F0f4c776715f5206FBf4CA6A0475': AttributeDict({'balance': 0})
+      })
+    })
+
+>>> web3.geth.debug.trace_transaction('0x96014f00980a25dc7275a5eb5ed25ce0dd79c9233628c421ae373601236949b3', {
+        "tracer": "callTracer",
+        "tracerConfig": {"withLog": False},
+    })
+    AttributeDict({'calls': [AttributeDict({'from': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11',
+      'gas': 154003,
+      'gasUsed': 275,
+      'input': HexBytes('0xad5c4648'),
+      'output': HexBytes('0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
+      'to': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+      'type': 'STATICCALL'}),
+      AttributeDict({'from': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11',
+      'gas': 150633,
+      'gasUsed': 24678,
+      'input': HexBytes('0x095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000000000000000007e37be2022c0914b2680000000'),
+      'output': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001'),
+      'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B',
+      'type': 'CALL',
+      'value': 0}),
+      AttributeDict({'calls': [AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 121167,
+        'gasUsed': 27504,
+        'input': HexBytes('0x23b872dd000000000000000000000000a0457775a08b175cbb444ed923556dc67ec5dc1100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d000000000000000000000000000000000000007e37be2022c0914b2680000000'),
+        'output': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001'),
+        'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B',
+        'type': 'CALL',
+        'value': 0}),
+        AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 89911,
+        'gasUsed': 2504,
+        'input': HexBytes('0x0902f1ac'),
+        'output': HexBytes('0x00000000000000000000000000000000000000000000000053f54ccde429ceb70000000000000000000000000000000000000000001635eb93ecdb339a7dc022000000000000000000000000000000000000000000000000000000006641f6cf'),
+        'to': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d',
+        'type': 'STATICCALL'}),
+        AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 86926,
+        'gasUsed': 621,
+        'input': HexBytes('0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d'),
+        'output': HexBytes('0x000000000000000000000000000000000000007e37d4560e547e265a1a7dc022'),
+        'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B',
+        'type': 'STATICCALL'}),
+        AttributeDict({'calls': [AttributeDict({'from': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d',
+          'gas': 70279,
+          'gasUsed': 29962,
+          'input': HexBytes('0xa9059cbb0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000053f53dfc545d56a6'),
+          'output': HexBytes('0x0000000000000000000000000000000000000000000000000000000000000001'),
+          'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+          'type': 'CALL',
+          'value': 0}),
+          AttributeDict({'from': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d',
+          'gas': 40164,
+          'gasUsed': 534,
+          'input': HexBytes('0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d'),
+          'output': HexBytes('0x00000000000000000000000000000000000000000000000000000ed18fcc7811'),
+          'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+          'type': 'STATICCALL'}),
+          AttributeDict({'from': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d',
+          'gas': 39233,
+          'gasUsed': 621,
+          'input': HexBytes('0x70a0823100000000000000000000000036f0548a77bfb1d5935483d25cc40633b46e2f4d'),
+          'output': HexBytes('0x000000000000000000000000000000000000007e37d4560e547e265a1a7dc022'),
+          'to': '0xec4cF8dCB526080792bC98E1Ef41fB4775777b6B',
+          'type': 'STATICCALL'})],
+        'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 84769,
+        'gasUsed': 64940,
+        'input': HexBytes('0x022c0d9f00000000000000000000000000000000000000000000000053f53dfc545d56a600000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000'),
+        'to': '0x36f0548a77BFb1d5935483D25cc40633b46e2f4d',
+        'type': 'CALL',
+        'value': 0}),
+        AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 20382,
+        'gasUsed': 534,
+        'input': HexBytes('0x70a082310000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d'),
+        'output': HexBytes('0x00000000000000000000000000000000000000000000000053f53dfc545d56a6'),
+        'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+        'type': 'STATICCALL'}),
+        AttributeDict({'calls': [AttributeDict({'from': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+          'gas': 2300,
+          'gasUsed': 83,
+          'input': HexBytes('0x'),
+          'to': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+          'type': 'CALL',
+          'value': 6049809828398585510})],
+        'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 19432,
+        'gasUsed': 9223,
+        'input': HexBytes('0x2e1a7d4d00000000000000000000000000000000000000000000000053f53dfc545d56a6'),
+        'to': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
+        'type': 'CALL',
+        'value': 0}),
+        AttributeDict({'from': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+        'gas': 3353,
+        'gasUsed': 0,
+        'input': HexBytes('0x'),
+        'to': '0xE11418f9961248da36b1008b1090235f680AE8f5',
+        'type': 'CALL',
+        'value': 6049809828398585510})],
+      'from': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11',
+      'gas': 125270,
+      'gasUsed': 122013,
+      'input': HexBytes('0x791ac947000000000000000000000000000000000000007e37be2022c0914b2680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000e11418f9961248da36b1008b1090235f680ae8f5000000000000000000000000000000000000000000000000000000006641fe7f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ec4cf8dcb526080792bc98e1ef41fb4775777b6b000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
+      'to': '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
+      'type': 'CALL',
+      'value': 0})],
+    'from': '0xE11418f9961248da36b1008b1090235f680AE8f5',
+    'gas': 185574,
+    'gasUsed': 144300,
+    'input': HexBytes('0x56feb11b000000000000000000000000ec4cf8dcb526080792bc98e1ef41fb4775777b6b000000000000000000000000000000000000007e37be2022c0914b2680000000'),
+    'to': '0xa0457775a08b175Cbb444eD923556Dc67Ec5Dc11',
+    'type': 'CALL',
+    'value': 0})
+
+    >>> w3.geth.debug.trace_transaction(tx_hash, {'tracer': '4byteTracer'})
+
+
+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.main.html b/_build/html_zh_CN/web3.main.html new file mode 100644 index 0000000000..a9ab14d4d7 --- /dev/null +++ b/_build/html_zh_CN/web3.main.html @@ -0,0 +1,834 @@ + + + + + + + + + Web3 API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Web3 API

+ +
+
+class web3.Web3(provider)
+
+ +

Each Web3 instance exposes the following APIs.

+
+

Providers

+
+
+Web3.HTTPProvider
+

Convenience API to access web3.providers.rpc.HTTPProvider

+
+ +
+
+Web3.IPCProvider
+

Convenience API to access web3.providers.ipc.IPCProvider

+
+ +
+
+

Attributes

+
+
+Web3.api
+

Returns the current Web3 version.

+
>>> web3.api
+"4.7.0"
+
+
+
+ +
+
+Web3.client_version
+
    +
  • Delegates to web3_clientVersion RPC Method

  • +
+

Returns the current client version.

+
>>> web3.client_version
+'Geth/v1.4.11-stable-fed692f6/darwin/go1.7'
+
+
+
+ +
+
+

Batch Requests

+
+
+Web3.batch_requests()
+
+

The JSON-RPC API allows for batch requests, meaning you can send a single request +that contains an array of request objects. Generally, this may be useful when you want +to limit the number of requests you send to a node.

+

You can choose to build a batch of requests within or outside of a context manager:

+
with w3.batch_requests() as batch:
+    batch.add(w3.eth.get_block(6))
+    batch.add(w3.eth.get_block(4))
+    batch.add(w3.eth.get_block(2))
+
+    responses = batch.execute()
+    assert len(responses) == 3
+
+
+
+

备注

+

Within the batching context above, calls are suspended until +batch.execute() is called. Calling a method without +passing it to batch.add might result in unexpected behavior.

+
+

Using the batch object directly:

+
batch = w3.batch_requests()
+batch.add(w3.eth.get_block(1))
+batch.add(w3.eth.get_block(2))
+responses = batch.execute()
+assert len(responses) == 2
+
+
+

Contract interactions can be included in batch requests by omitting the call() method:

+
batch.add(math_contract.functions.multiply7(0))
+
+
+

Additionally, if you need to make multiple calls of the same function, you can add +a mapping of the function to its arguments:

+
batch = w3.batch_requests()
+batch.add_mapping(
+    {
+        math_contract.functions.multiply7: [1, 2],
+        w3.eth.get_block: [3, 4],
+    }
+)
+responses = batch.execute()
+assert len(responses) == 4
+
+
+

The execute method returns a list of responses in the order they were included in +the batch.

+

If you need to abandon or rebuild a batch request, utilize the clear method:

+
batch = w3.batch_requests()
+batch.add(w3.eth.get_block(1))
+batch.add(w3.eth.get_block(2))
+assert len(batch._requests_info) == 2
+
+batch.clear()
+assert batch._requests_info == []
+
+
+
+

备注

+

Only read-only operations that exist within modules on the Web3 class +(e.g. w3.eth, w3.net) are supported by batch_requests. +Unsupported methods include:

+ +
+
+
+

Async Batch Requests

+

If using one of the asynchronous providers, you'll need to make use of +the async_execute method and the async and await keywords as appropriate.

+
+

备注

+

If performance is a concern, consider using asyncio.gather() with single +concurrent requests instead of an asynchronous batch request. It will generally be +the faster option due to the overhead of batching.

+
+
# context manager:
+async with w3.batch_requests() as batch:
+    batch.add(w3.eth.get_block(6))
+    batch.add(w3.eth.get_block(4))
+    batch.add(w3.eth.get_block(2))
+
+    responses = await batch.async_execute()
+    assert len(responses) == 3
+
+# object:
+batch = w3.batch_requests()
+batch.add(w3.eth.get_block(1))
+batch.add(w3.eth.get_block(2))
+responses = await batch.async_execute()
+assert len(responses) == 2
+
+
+
+
+ +
+
+

Encoding and Decoding Helpers

+
+
+Web3.to_hex(primitive=None, hexstr=None, text=None)
+

Takes a variety of inputs and returns it in its hexadecimal representation. +It follows the rules for converting to hex in the +JSON-RPC spec

+
>>> Web3.to_hex(0)
+'0x0'
+>>> Web3.to_hex(1)
+'0x1'
+>>> Web3.to_hex(0x0)
+'0x0'
+>>> Web3.to_hex(0x000F)
+'0xf'
+>>> Web3.to_hex(b'')
+'0x'
+>>> Web3.to_hex(b'\x00\x0F')
+'0x000f'
+>>> Web3.to_hex(False)
+'0x0'
+>>> Web3.to_hex(True)
+'0x1'
+>>> Web3.to_hex(hexstr='0x000F')
+'0x000f'
+>>> Web3.to_hex(hexstr='000F')
+'0x000f'
+>>> Web3.to_hex(text='')
+'0x'
+>>> Web3.to_hex(text='cowmö')
+'0x636f776dc3b6'
+
+
+
+ +
+
+Web3.to_text(primitive=None, hexstr=None, text=None)
+

Takes a variety of inputs and returns its string equivalent. +Text gets decoded as UTF-8.

+
>>> Web3.to_text(0x636f776dc3b6)
+'cowmö'
+>>> Web3.to_text(b'cowm\xc3\xb6')
+'cowmö'
+>>> Web3.to_text(hexstr='0x636f776dc3b6')
+'cowmö'
+>>> Web3.to_text(hexstr='636f776dc3b6')
+'cowmö'
+>>> Web3.to_text(text='cowmö')
+'cowmö'
+
+
+
+ +
+
+Web3.to_bytes(primitive=None, hexstr=None, text=None)
+

Takes a variety of inputs and returns its bytes equivalent. +Text gets encoded as UTF-8.

+
>>> Web3.to_bytes(0)
+b'\x00'
+>>> Web3.to_bytes(0x000F)
+b'\x0f'
+>>> Web3.to_bytes(b'')
+b''
+>>> Web3.to_bytes(b'\x00\x0F')
+b'\x00\x0f'
+>>> Web3.to_bytes(False)
+b'\x00'
+>>> Web3.to_bytes(True)
+b'\x01'
+>>> Web3.to_bytes(hexstr='0x000F')
+b'\x00\x0f'
+>>> Web3.to_bytes(hexstr='000F')
+b'\x00\x0f'
+>>> Web3.to_bytes(text='')
+b''
+>>> Web3.to_bytes(text='cowmö')
+b'cowm\xc3\xb6'
+
+
+
+ +
+
+Web3.to_int(primitive=None, hexstr=None, text=None)
+

Takes a variety of inputs and returns its integer equivalent.

+
>>> Web3.to_int(0)
+0
+>>> Web3.to_int(0x000F)
+15
+>>> Web3.to_int(b'\x00\x0F')
+15
+>>> Web3.to_int(False)
+0
+>>> Web3.to_int(True)
+1
+>>> Web3.to_int(hexstr='0x000F')
+15
+>>> Web3.to_int(hexstr='000F')
+15
+
+
+
+ +
+
+Web3.to_json(obj)
+

Takes a variety of inputs and returns its JSON equivalent.

+
>>> Web3.to_json(3)
+'3'
+>>> Web3.to_json({'one': 1})
+'{"one": 1}'
+
+
+
+ +
+
+

Currency Conversions

+
+
+Web3.to_wei(value, currency)
+

Returns the value in the denomination specified by the currency argument +converted to wei.

+
>>> Web3.to_wei(1, 'ether')
+1000000000000000000
+
+
+
+ +
+
+Web3.from_wei(value, currency)
+

Returns the value in wei converted to the given currency. The value is returned +as a Decimal to ensure precision down to the wei.

+
>>> Web3.from_wei(1000000000000000000, 'ether')
+Decimal('1')
+
+
+
+ +
+
+

Addresses

+
+
+Web3.is_address(value)
+

Returns True if the value is one of the recognized address formats.

+
    +
  • Allows for both 0x prefixed and non-prefixed values.

  • +
  • If the address contains mixed upper and lower cased characters this function also +checks if the address checksum is valid according to EIP55

  • +
+
>>> Web3.is_address('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
+True
+
+
+
+ +
+
+Web3.is_checksum_address(value)
+

Returns True if the value is a valid EIP55 checksummed address

+
>>> Web3.is_checksum_address('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
+True
+>>> Web3.is_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601')
+False
+
+
+
+ +
+
+Web3.to_checksum_address(value)
+

Returns the given address with an EIP55 checksum.

+
>>> Web3.to_checksum_address('0xd3cda913deb6f67967b99d67acdfa1712c293601')
+'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'
+
+
+
+ +
+
+

Cryptographic Hashing

+
+
+classmethod Web3.keccak(primitive=None, hexstr=None, text=None)
+

Returns the Keccak-256 of the given value. Text is encoded to UTF-8 before +computing the hash, just like Solidity. Any of the following are +valid and equivalent:

+
>>> Web3.keccak(0x747874)
+>>> Web3.keccak(b'\x74\x78\x74')
+>>> Web3.keccak(hexstr='0x747874')
+>>> Web3.keccak(hexstr='747874')
+>>> Web3.keccak(text='txt')
+HexBytes('0xd7278090a36507640ea6b7a0034b69b0d240766fa3f98e3722be93c613b29d2e')
+
+
+
+ +
+
+classmethod Web3.solidity_keccak(abi_types, value)
+

Returns the Keccak-256 as it would be computed by the solidity keccak +function on a packed ABI encoding of the value list contents. The abi_types +argument should be a list of solidity type strings which correspond to each +of the provided values.

+
>>> Web3.solidity_keccak(['bool'], [True])
+HexBytes("0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2")
+
+>>> Web3.solidity_keccak(['uint8', 'uint8', 'uint8'], [97, 98, 99])
+HexBytes("0x4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45")
+
+>>> Web3.solidity_keccak(['uint8[]'], [[97, 98, 99]])
+HexBytes("0x233002c671295529bcc50b76a2ef2b0de2dac2d93945fca745255de1a9e4017e")
+
+>>> Web3.solidity_keccak(['address'], ["0x49EdDD3769c0712032808D86597B84ac5c2F5614"])
+HexBytes("0x2ff37b5607484cd4eecf6d13292e22bd6e5401eaffcc07e279583bc742c68882")
+
+>>> Web3.solidity_keccak(['address'], ["ethereumfoundation.eth"])
+HexBytes("0x913c99ea930c78868f1535d34cd705ab85929b2eaaf70fcd09677ecd6e5d75e9")
+
+
+

Comparable solidity usage:

+
bytes32 data1 = keccak256(abi.encodePacked(true));
+assert(data1 == hex"5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2");
+bytes32 data2 = keccak256(abi.encodePacked(uint8(97), uint8(98), uint8(99)));
+assert(data2 == hex"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45");
+
+
+
+ +
+
+

Check Encodability

+
+
+w3.is_encodable(_type, value)
+

Returns True if a value can be encoded as the given type. Otherwise returns False.

+
+
>>> from web3.auto.gethdev import w3
+>>> w3.is_encodable('bytes2', b'12')
+True
+>>> w3.is_encodable('bytes2', '0x1234')
+True
+>>> w3.is_encodable('bytes2', '1234')  # not 0x-prefixed, no assumptions will be made
+False
+>>> w3.is_encodable('bytes2', b'1')  # does not match specified bytes size
+False
+>>> w3.is_encodable('bytes2', b'123')  # does not match specified bytes size
+False
+
+
+
+
+ +
+
+w3.strict_bytes_type_checking
+

Disable the stricter bytes type checking that is loaded by default. For more +examples, see Disabling Strict Checks for Bytes Types

+
>>> from web3.auto.gethdev import w3
+
+>>> w3.is_encodable('bytes2', b'12')
+True
+
+>>>  # not of exact size bytes2
+>>> w3.is_encodable('bytes2', b'1')
+False
+
+>>> w3.strict_bytes_type_checking = False
+
+>>> # zero-padded, so encoded to: b'1\x00'
+>>> w3.is_encodable('bytes2', b'1')
+True
+
+>>> # re-enable it
+>>> w3.strict_bytes_type_checking = True
+>>> w3.is_encodable('bytes2', b'1')
+False
+
+
+
+ +
+
+

RPC API Modules

+

Each Web3 instance also exposes these namespaced API modules.

+
+
+Web3.eth
+

See web3.eth API

+
+ +
+
+Web3.geth
+

See Geth API

+
+ +

These internal modules inherit from the web3.module.Module class which give them some configurations internal to the +web3.py library.

+
+
+

Custom Methods

+

You may add or overwrite methods within any module using the attach_methods function. +To create a property instead, set is_property to True.

+
>>> w3.eth.attach_methods({
+...    'example_method': Method(
+...      'eth_example',
+...       mungers=[...],
+...       request_formatters=[...],
+...       result_formatters=[...],
+...       is_property=False,
+...    ),
+... })
+>>> w3.eth.example_method()
+
+
+
+
+

External Modules

+

External modules can be used to introduce custom or third-party APIs to your Web3 instance. External modules are simply +classes whose methods and properties can be made available within the Web3 instance. Optionally, the external module may +make use of the parent Web3 instance by accepting it as the first argument within the __init__ function:

+
>>> class ExampleModule:
+...     def __init__(self, w3):
+...         self.w3 = w3
+...
+...     def print_balance_of_shaq(self):
+...         print(self.w3.eth.get_balance('shaq.eth'))
+
+
+
+

警告

+

Given the flexibility of external modules, use caution and only import modules from trusted third parties +and open source code you've vetted!

+
+

Configuring external modules can occur either at instantiation of the Web3 instance or by making use of the +attach_modules() method. To instantiate the Web3 instance with external modules use the external_modules +keyword argument:

+
>>> from web3 import Web3, HTTPProvider
+>>> from external_module_library import (
+...     ModuleClass1,
+...     ModuleClass2,
+...     ModuleClass3,
+...     ModuleClass4,
+...     ModuleClass5,
+... )
+>>> w3 = Web3(
+...     HTTPProvider(provider_uri),
+...     external_modules={
+...         'module1': ModuleClass1,
+...         'module2': (ModuleClass2, {
+...             'submodule1': ModuleClass3,
+...             'submodule2': (ModuleClass4, {
+...                 'submodule2a': ModuleClass5,  # submodule children may be nested further if necessary
+...             })
+...         })
+...     }
+... )
+
+# `return_zero`, in this case, is an example attribute of the `ModuleClass1` object
+>>> w3.module1.return_zero()
+0
+>>> w3.module2.submodule1.return_one()
+1
+>>> w3.module2.submodule2.submodule2a.return_two()
+2
+
+
+
+
+w3.attach_modules(modules)
+

The attach_modules() method can be used to attach external modules after the Web3 instance has been +instantiated.

+

Modules are attached via a dict with module names as the keys. The values can either be the module classes +themselves, if there are no submodules, or two-item tuples with the module class as the 0th index and a similarly +built dict containing the submodule information as the 1st index. This pattern may be repeated as necessary.

+
>>> from web3 import Web3, HTTPProvider
+>>> from external_module_library import (
+...     ModuleClass1,
+...     ModuleClass2,
+...     ModuleClass3,
+...     ModuleClass4,
+...     ModuleClass5,
+... )
+>>> w3 = Web3(HTTPProvider(provider_uri))
+
+>>> w3.attach_modules({
+...     'module1': ModuleClass1,  # the module class itself may be used for a single module with no submodules
+...     'module2': (ModuleClass2, {  # a tuple with module class and corresponding submodule dict may be used for modules with submodules
+...         'submodule1': ModuleClass3,
+...         'submodule2': (ModuleClass4, {  # this pattern may be repeated as necessary
+...             'submodule2a': ModuleClass5,
+...         })
+...     })
+... })
+>>> w3.module1.return_zero()
+0
+>>> w3.module2.submodule1.return_one()
+1
+>>> w3.module2.submodule2.submodule2a.return_two()
+2
+
+
+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.net.html b/_build/html_zh_CN/web3.net.html new file mode 100644 index 0000000000..3bcfa48738 --- /dev/null +++ b/_build/html_zh_CN/web3.net.html @@ -0,0 +1,260 @@ + + + + + + + + + Net API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Net API

+

The web3.net object exposes methods to interact with the RPC APIs under +the net_ namespace.

+
+

Properties

+

The following properties are available on the web3.net namespace.

+
+
+web3.net.listening()
+
+..py:property::
+
+
    +
  • Delegates to net_listening RPC method

  • +
+

Returns true if client is actively listening for network connections.

+
>>> web3.net.listening
+True
+
+
+
+
+ +
+
+web3.net.peer_count()
+
+..py:property::
+
+
    +
  • Delegates to net_peerCount RPC method

  • +
+

Returns number of peers currently connected to the client.

+
>>> web3.net.peer_count
+1
+
+
+
+
+ +
+
+web3.net.version()
+
+..py:property::
+
+
    +
  • Delegates to net_version RPC Method

  • +
+

Returns the current network id.

+
>>> web3.net.version
+'8996'
+
+
+
+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.tracing.html b/_build/html_zh_CN/web3.tracing.html new file mode 100644 index 0000000000..f6f0799692 --- /dev/null +++ b/_build/html_zh_CN/web3.tracing.html @@ -0,0 +1,241 @@ + + + + + + + + + Tracing API — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Tracing API

+

The web3.tracing object exposes modules that enable you to interact with the JSON-RPC trace_ endpoints supported by Erigon and Nethermind.

+

The following methods are available on the web3.tracing namespace:

+
+
+web3.tracing.trace_replay_transaction()
+
+ +
+
+web3.tracing.trace_replay_block_transactions()
+
+ +
+
+web3.tracing.trace_filter()
+
+ +
+
+web3.tracing.trace_block()
+
+ +
+
+web3.tracing.trace_transaction()
+
+ +
+
+web3.tracing.trace_call()
+
+ +
+
+web3.tracing.trace_raw_transaction()
+
+ +
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/_build/html_zh_CN/web3.utils.html b/_build/html_zh_CN/web3.utils.html new file mode 100644 index 0000000000..3d3b295f14 --- /dev/null +++ b/_build/html_zh_CN/web3.utils.html @@ -0,0 +1,261 @@ + + + + + + + + + Utils — web3.py 7.13.0 文档 + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Utils

+

The utils module houses public utility functions and classes.

+
+

ABI

+
+
+

Address

+
+
+utils.get_create_address(sender, nonce)
+

Return the checksummed contract address generated by using the CREATE opcode by +a sender address with a given nonce.

+
+ +
+
+utils.get_create2_address(sender, salt, init_code)
+

Return the checksummed contract address generated by using the CREATE2 opcode by +a sender address with a given salt and contract bytecode. See +EIP-1014.

+
+ +
+
+

Caching

+
+
+class utils.SimpleCache
+

The main cache class being used internally by web3.py. In some cases, it may prove +useful to set your own cache size and pass in your own instance of this class where +supported.

+
+ +
+
+

Exception Handling

+
+
+utils.handle_offchain_lookup(offchain_lookup_payload, transaction)
+

Handle OffchainLookup reverts on contract function calls manually. For an example, see CCIP Read support for offchain lookup +within the examples section.

+
+ +
+
+utils.async_handle_offchain_lookup(offchain_lookup_payload, transaction)
+

The async version of the handle_offchain_lookup() utility method described above.

+
+ +
+
+ + +
+
+ +
+
+
+
+ +
+ + RTD + + + + + + + v: + + +
+
+
版本
+
+
+
下载
+
+
+ +
托管于 Read the Docs
+
+ 项目主页 +
+
+ 构建 +
+
+
+
+ + + diff --git a/docs/locales/zh_CN/LC_MESSAGES/code_of_conduct.po b/docs/locales/zh_CN/LC_MESSAGES/code_of_conduct.po new file mode 100644 index 0000000000..caeaf713cf --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/code_of_conduct.po @@ -0,0 +1,179 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../code_of_conduct.rst:2 +msgid "Code of Conduct" +msgstr "行为准则" + +#: ../../code_of_conduct.rst:5 +msgid "Our Pledge" +msgstr "我们的承诺" + +#: ../../code_of_conduct.rst:7 +msgid "" +"In the interest of fostering an open and welcoming environment, we as " +"contributors and maintainers pledge to make participation in our project " +"and our community a harassment-free experience for everyone, regardless " +"of age, body size, disability, ethnicity, gender identity and expression," +" level of experience, education, socio-economic status, nationality, " +"personal appearance, race, religion, or sexual identity and orientation." +msgstr "" +"为了促进一个开放和欢迎的环境,我们作为贡献者和维护者承诺,使我们的项目和社区成为一个无骚扰的体验,无论年龄、体型、残疾、种族、性别认同和表达、经验水平、教育、社会经济地位、国籍、个人外貌、宗教或性认同和性取向。" + +#: ../../code_of_conduct.rst:15 +msgid "Our Standards" +msgstr "我们的标准" + +#: ../../code_of_conduct.rst:17 +msgid "" +"Examples of behavior that contributes to creating a positive environment " +"include:" +msgstr "以下行为有助于营造积极的环境:" + +#: ../../code_of_conduct.rst:20 +msgid "Using welcoming and inclusive language" +msgstr "使用欢迎和包容的语言" + +#: ../../code_of_conduct.rst:21 +msgid "Being respectful of differing viewpoints and experiences" +msgstr "尊重不同的观点和经历" + +#: ../../code_of_conduct.rst:22 +msgid "Gracefully accepting constructive criticism" +msgstr "优雅地接受建设性的批评" + +#: ../../code_of_conduct.rst:23 +msgid "Focusing on what is best for the community" +msgstr "专注于社区的最佳利益" + +#: ../../code_of_conduct.rst:24 +msgid "Showing empathy towards other community members" +msgstr "对其他社区成员表示同情" + +#: ../../code_of_conduct.rst:26 +msgid "Examples of unacceptable behavior by participants include:" +msgstr "参与者的不当行为包括:" + +#: ../../code_of_conduct.rst:28 +msgid "" +"The use of sexualized language or imagery and unwelcome sexual attention " +"or advances" +msgstr "" +"使用性化语言或图像,以及不受欢迎的性关注或进展" + + +#: ../../code_of_conduct.rst:30 +msgid "Trolling, insulting/derogatory comments, and personal or political attacks" +msgstr "侮辱/贬低评论,以及个人或政治攻击" + +#: ../../code_of_conduct.rst:31 +msgid "Public or private harassment" +msgstr "公共或私人骚扰" + +#: ../../code_of_conduct.rst:32 +msgid "" +"Publishing others' private information, such as a physical or electronic " +"address, without explicit permission" +msgstr "" +"发布他人的私人信息,如物理或电子地址,未经明确许可" + +#: ../../code_of_conduct.rst:34 +msgid "" +"Other conduct which could reasonably be considered inappropriate in a " +"professional setting" +msgstr "" +"其他可能被认为不适当的行为,如在专业环境中" + +#: ../../code_of_conduct.rst:38 +msgid "Our Responsibilities" +msgstr "我们的责任" + +#: ../../code_of_conduct.rst:40 +msgid "" +"Project maintainers are responsible for clarifying the standards of " +"acceptable behavior and are expected to take appropriate and fair " +"corrective action in response to any instances of unacceptable behavior." +msgstr "" +"项目维护者有责任澄清可接受的行为标准,并应采取适当和公平的纠正措施,以回应任何不当行为的情况。" + +#: ../../code_of_conduct.rst:44 +msgid "" +"Project maintainers have the right and responsibility to remove, edit, or" +" reject comments, commits, code, wiki edits, issues, and other " +"contributions that are not aligned to this Code of Conduct, or to ban " +"temporarily or permanently any contributor for other behaviors that they " +"deem inappropriate, threatening, offensive, or harmful." +msgstr "" +"项目维护者有权和责任删除、编辑或拒绝与本行为准则不符的评论、提交、代码、wiki编辑、问题和其他贡献,或暂时或永久禁止任何被认为不适当、威胁、冒犯或有害的贡献者。" + +#: ../../code_of_conduct.rst:51 +msgid "Scope" +msgstr "范围" + +#: ../../code_of_conduct.rst:53 +msgid "" +"This Code of Conduct applies both within project spaces and in public " +"spaces when an individual is representing the project or its community. " +"Examples of representing a project or community include using an official" +" project e-mail address, posting via an official social media account, or" +" acting as an appointed representative at an online or offline event. " +"Representation of a project may be further defined and clarified by " +"project maintainers." +msgstr "" +"本行为准则适用于项目空间和公共空间,当个人代表项目或其社区时。代表项目的例子包括使用官方项目电子邮件地址、通过官方社交媒体账户发布、或作为在线或离线活动的指定代表。项目维护者可以进一步定义和澄清项目的代表性。" + +#: ../../code_of_conduct.rst:61 +msgid "Enforcement" +msgstr "执行" + +#: ../../code_of_conduct.rst:63 +msgid "" +"Instances of abusive, harassing, or otherwise unacceptable behavior may " +"be reported by contacting the project team at snakecharmers@ethereum.org." +" All complaints will be reviewed and investigated and will result in a " +"response that is deemed necessary and appropriate to the circumstances. " +"The project team is obligated to maintain confidentiality with regard to " +"the reporter of an incident. Further details of specific enforcement " +"policies may be posted separately." +msgstr "" +"任何形式的虐待、骚扰或其他不可接受的行为可以由项目团队通过 snakecharmers@ethereum.org 联系报告。所有投诉将被审查和调查,并根据情况需要和适当性作出回应。项目团队有义务对事件报告者保持保密。具体的执行政策细节可能单独发布。" + +#: ../../code_of_conduct.rst:70 +msgid "" +"Project maintainers who do not follow or enforce the Code of Conduct in " +"good faith may face temporary or permanent repercussions as determined by" +" other members of the project's leadership." +msgstr "" +"不遵守或执行本行为准则的善意项目维护者可能会面临临时或永久性的后果,由项目领导层其他成员决定。" + +#: ../../code_of_conduct.rst:75 +msgid "Attribution" +msgstr "归属" + +#: ../../code_of_conduct.rst:77 +msgid "" +"This Code of Conduct is adapted from the `Contributor Covenant " +"`_, version 1.4, available at " +"https://www.contributor-covenant.org/version/1/4/code-of-conduct.html" +msgstr "" +"本行为准则改编自 `Contributor Covenant" +"`_, 版本 1.4, 可在 " +"https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 查看。" diff --git a/docs/locales/zh_CN/LC_MESSAGES/constants.po b/docs/locales/zh_CN/LC_MESSAGES/constants.po new file mode 100644 index 0000000000..931acdc10f --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/constants.po @@ -0,0 +1,36 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../constants.rst:4 +msgid "Constants" +msgstr "" + +#: ../../constants.rst:6 +msgid "The web3.constants module contains commonly used values." +msgstr "" + +#: ../../constants.rst:9 +msgid "Strings" +msgstr "" + +#: ../../constants.rst:23 +msgid "Int" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/contributing.po b/docs/locales/zh_CN/LC_MESSAGES/contributing.po new file mode 100644 index 0000000000..0f304fa639 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/contributing.po @@ -0,0 +1,711 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../contributing.rst:4 +msgid "Contributing" +msgstr "贡献" + +#: ../../contributing.rst:6 +msgid "" +"Thanks for your interest in contributing to web3.py! Read on to learn " +"what would be helpful and how to go about it. If you get stuck along the " +"way, reach for help in the `Python Discord server`_." +msgstr "" + +#: ../../contributing.rst:12 +msgid "How to Help" +msgstr "" + +#: ../../contributing.rst:14 +msgid "Without code:" +msgstr "" + +#: ../../contributing.rst:16 +msgid "" +"Answer user questions within GitHub issues, Stack Overflow, or the " +"`Python Discord server`_." +msgstr "" + +#: ../../contributing.rst:17 +msgid "Write or record tutorial content." +msgstr "" + +#: ../../contributing.rst:18 +msgid "Improve our documentation (including typo fixes)." +msgstr "" + +#: ../../contributing.rst:19 +msgid "" +"`Open an issue `_ on " +"GitHub to document a bug. Include as much detail as possible, e.g., how " +"to reproduce the issue and any exception messages." +msgstr "" + +#: ../../contributing.rst:21 +msgid "With code:" +msgstr "" + +#: ../../contributing.rst:23 +msgid "Fix a bug that has been reported in an issue." +msgstr "" + +#: ../../contributing.rst:24 +msgid "Add a feature that has been documented in an issue." +msgstr "" + +#: ../../contributing.rst:25 +msgid "Add a missing test case." +msgstr "" + +#: ../../contributing.rst:29 +msgid "" +"**Before you start:** always ask if a change would be desirable or let us" +" know that you plan to work on something! We don't want to waste your " +"time on changes we can't accept or duplicated effort." +msgstr "" + +#: ../../contributing.rst:35 +msgid "Your Development Environment" +msgstr "" + +#: ../../contributing.rst:39 +msgid "" +"Use of a virtual environment is strongly advised for minimizing " +"dependency issues. See `this article `_ for usage patterns." +msgstr "" + +#: ../../contributing.rst:43 +msgid "" +"All pull requests are made from a fork of the repository; use the GitHub " +"UI to create a fork. web3.py depends on `submodules " +"`_, so when you clone your fork" +" to your local machine, include the ``--recursive`` flag:" +msgstr "" + +#: ../../contributing.rst:53 +msgid "Finally, install all development dependencies:" +msgstr "" + +#: ../../contributing.rst:62 +msgid "Using Docker" +msgstr "" + +#: ../../contributing.rst:64 +msgid "" +"Developing within Docker is not required, but if you prefer that " +"workflow, use the *sandbox* container provided in the **docker-" +"compose.yml** file." +msgstr "" + +#: ../../contributing.rst:67 +msgid "To start up the test environment, run:" +msgstr "" + +#: ../../contributing.rst:74 +msgid "" +"This will build a Docker container set up with an environment to run the " +"Python test code." +msgstr "" + +#: ../../contributing.rst:77 +msgid "To run the core tests from your local machine:" +msgstr "" + +#: ../../contributing.rst:84 +msgid "" +"The container does not have ``go-ethereum`` installed, so you can exclude" +" those tests by using the ``-k \"not goethereum\"`` flag." +msgstr "" + +#: ../../contributing.rst:92 +msgid "" +"You can run arbitrary commands inside the Docker container by using the " +"``bash -c`` prefix." +msgstr "" + +#: ../../contributing.rst:100 +msgid "Or, if you would like to open a session to the container, run:" +msgstr "" + +#: ../../contributing.rst:108 +msgid "Running The Tests" +msgstr "" + +#: ../../contributing.rst:110 +msgid "A great way to explore the code base is to run the tests." +msgstr "" + +#: ../../contributing.rst:113 +msgid "First, install the test dependencies:" +msgstr "" + +#: ../../contributing.rst:120 +msgid "You can run all tests with:" +msgstr "" + +#: ../../contributing.rst:127 +msgid "" +"However, running the entire test suite takes a very long time and is " +"generally impractical. Typically, you'll just want to run a subset " +"instead, like:" +msgstr "" + +#: ../../contributing.rst:135 +msgid "" +"Linting is also performed by the CI and locally with each commit. You can" +" save yourself some time by checking for linting errors manually:" +msgstr "" + +#: ../../contributing.rst:143 +msgid "" +"It is important to understand that each pull request must pass the full " +"test suite as part of the CI check. This test suite will run in the CI " +"anytime a pull request is opened or updated." +msgstr "" + +#: ../../contributing.rst:149 +msgid "Writing Tests" +msgstr "" + +#: ../../contributing.rst:151 +msgid "" +"We strongly encourage contributors to write good tests for their code as " +"part of the code review process. This helps ensure that your code is " +"doing what it should be doing." +msgstr "" + +#: ../../contributing.rst:155 +msgid "" +"We strongly encourage you to use our existing tests for both guidance and" +" homogeneity / consistency across our tests. We use ``pytest`` for our " +"tests. For more specific pytest guidance, please refer to the `pytest " +"documentation`_." +msgstr "" + +#: ../../contributing.rst:159 +msgid "" +"Within the ``pytest`` scope, :file:`conftest.py` files are used for " +"common code shared between modules that exist within the same directory " +"as that particular :file:`conftest.py` file." +msgstr "" + +#: ../../contributing.rst:165 +msgid "Unit Testing and eth-tester Tests" +msgstr "" + +#: ../../contributing.rst:167 +msgid "" +"Our unit tests are grouped together with tests against the ``eth-tester``" +" library, using the ``py-evm`` library as a backend, via the " +"``EthereumTesterProvider``." +msgstr "" + +#: ../../contributing.rst:170 +msgid "" +"These tests live under appropriately named child directories within the " +"``/tests`` directory. The core of these tests live under ``/tests/core``." +" Do your best to follow the existing structure when adding a test and " +"make sure that its location makes sense." +msgstr "" + +#: ../../contributing.rst:176 +msgid "Integration Testing" +msgstr "" + +#: ../../contributing.rst:178 +msgid "" +"Our integration test suite setup lives under the ``/tests/integration`` " +"directory. The integration test suite is dependent on what we call " +"\"fixtures\" (not to be confused with pytest fixtures). These zip file " +"fixtures, which also live in the ``/tests/integration`` directory, are " +"configured to run the specific client we are testing against along with a" +" genesis configuration that gives our tests some pre-determined useful " +"objects (like unlocked, pre-loaded accounts) to be able to interact with " +"the client when we run our tests." +msgstr "" + +#: ../../contributing.rst:186 +msgid "" +"The parent ``/integration`` directory houses some common configuration " +"shared across all client tests, whereas the ``/go_ethereum`` directory " +"houses common code to be shared across geth-specific provider tests. " +"Though the setup and run configurations exist across the different files " +"within ``/tests/integration``, our integration module tests are written " +"across different files within ``/web3/_utils/module_testing``." +msgstr "" + +#: ../../contributing.rst:192 +msgid "" +":file:`common.py` files within the client directories contain code that " +"is shared across all provider tests (http, ipc, and ws). This is mostly " +"used to override tests that span across all providers." +msgstr "" + +#: ../../contributing.rst:195 +msgid "" +":file:`conftest.py` files within each of these directories contain mostly" +" code that can be *used* by all test files that exist within the same " +"directory or subdirectories of the :file:`conftest.py` file. This is " +"mostly used to house pytest fixtures to be shared among our tests. Refer " +"to the `pytest documentation on fixtures`_ for more information." +msgstr "" + +#: ../../contributing.rst:200 +#, python-brace-format +msgid "" +"``test_{client}_{provider}.py`` files (e.g. " +":file:`test_goethereum_http.py`) are where client-and-provider-specific " +"test configurations exist. This is mostly used to override tests specific" +" to the provider type for the respective client." +msgstr "" + +#: ../../contributing.rst:204 +msgid "" +"The integration tests are each run in insolation to prevent muddied " +"contexts. Because they are run in isolation, they can be parallelized " +"with ``pytest-xdist`` in order to speed up the test suite. To run the " +"tests in parallel, you can use the ``-n`` flag with ``pytest``. For " +"example, to run the tests in parallel with 4 workers, you can use the " +"following command:" +msgstr "" + +#: ../../contributing.rst:216 +msgid "Working With Test Contracts" +msgstr "" + +#: ../../contributing.rst:218 +msgid "" +"Contracts used for testing exist under ``web3/_utils/contract_sources``. " +"These contracts get compiled via the ``compile_contracts.py`` script in " +"the same directory. To use this script, simply pass the Solidity version " +"to be used to compile the contracts as an argument at the command line." +msgstr "" + +#: ../../contributing.rst:223 +msgid "Arguments for the script are:" +msgstr "" + +#: ../../contributing.rst:224 +msgid "" +"-v or --version Solidity version to be used to compile the " +"contracts. If" +msgstr "" + +#: ../../contributing.rst:225 +msgid "blank, the script uses the latest available version from solcx." +msgstr "" + +#: ../../contributing.rst:228 +msgid "" +"-f or --filename If left blank, all .sol files will be compiled " +"and the" +msgstr "" + +#: ../../contributing.rst:229 +msgid "" +"respective contract data will be generated. Pass in a specific ``.sol`` " +"filename here to compile just one file." +msgstr "" + +#: ../../contributing.rst:233 +msgid "" +"To run the script, you will need the ``py-solc-x`` library for compiling " +"the files as well as ``black`` for code formatting. You can install those" +" with:" +msgstr "" + +#: ../../contributing.rst:240 +msgid "" +"The following example compiles all the contracts and generates their " +"respective contract data that is used across our test files for the test " +"suites. This data gets generated within the ``contract_data`` " +"subdirectory within the ``contract_sources`` folder." +msgstr "" + +#: ../../contributing.rst:254 +msgid "" +"To compile and generate contract data for only one ``.sol`` file, specify" +" using the filename with the ``-f`` (or ``--filename``) argument flag." +msgstr "" + +#: ../../contributing.rst:264 +msgid "" +"If there is any contract data that is not generated via the script but is" +" important to pass on to the integration tests, the " +"``_custom_contract_data.py`` file within the ``contract_data`` " +"subdirectory can be used to store that information when appropriate." +msgstr "" + +#: ../../contributing.rst:268 +msgid "" +"Be sure to re-generate the integration test fixture after running the " +"script to update the contract bytecodes for the integration test suite - " +"see the :ref:`generating_fixtures` section below." +msgstr "" + +#: ../../contributing.rst:274 +msgid "Manual Testing" +msgstr "" + +#: ../../contributing.rst:276 +msgid "" +"To import and test an unreleased version of web3.py in another context, " +"you can install it from your development directory:" +msgstr "" + +#: ../../contributing.rst:285 +msgid "Code Style" +msgstr "" + +#: ../../contributing.rst:287 +msgid "" +"We use `pre-commit `_ to enforce a consistent " +"code style across the library. This tool runs automatically with every " +"commit, but you can also run it manually with:" +msgstr "" + +#: ../../contributing.rst:296 +msgid "" +"If you need to make a commit that skips the ``pre-commit`` checks, you " +"can do so with ``git commit --no-verify``." +msgstr "" + +#: ../../contributing.rst:299 +msgid "" +"We use Black as part of our linting. To ignore the commits that " +"introduced Black in git history, you can configure your git environment " +"like so:" +msgstr "" + +#: ../../contributing.rst:307 +msgid "" +"This library uses `type hints`_, which are enforced by the ``mypy`` tool " +"(part of the ``pre-commit`` checks). All new code is required to land " +"with type hints, with the exception of code within the ``tests`` " +"directory." +msgstr "" + +#: ../../contributing.rst:313 +msgid "Documentation" +msgstr "" + +#: ../../contributing.rst:315 +msgid "" +"Good documentation will lead to quicker adoption and happier users. " +"Please check out our guide on `how to create documentation`_ for the " +"Python Ethereum ecosystem." +msgstr "" + +#: ../../contributing.rst:319 +msgid "" +"Pull requests generate their own preview of the latest documentation at " +"``https://web3py--.org.readthedocs.build/en//``." +msgstr "" + +#: ../../contributing.rst:324 +msgid "Pull Requests" +msgstr "" + +#: ../../contributing.rst:326 +msgid "" +"It's a good idea to make pull requests early on. A pull request " +"represents the start of a discussion, and doesn't necessarily need to be " +"the final, finished submission." +msgstr "" + +#: ../../contributing.rst:330 +msgid "See GitHub's documentation for `working on pull requests`_." +msgstr "" + +#: ../../contributing.rst:332 +msgid "" +"Once you've made a pull request take a look at the Circle CI build status" +" in the GitHub interface and make sure all tests are passing. In general," +" pull requests that do not pass the CI build yet won't get reviewed " +"unless explicitly requested." +msgstr "" + +#: ../../contributing.rst:337 +msgid "" +"If the pull request introduces changes that should be reflected in the " +"release notes, please add a **newsfragment** file as explained `here " +"`_." +msgstr "" + +#: ../../contributing.rst:341 +msgid "" +"If possible, the change to the release notes file should be included in " +"the commit that introduces the feature or bugfix." +msgstr "" + +#: ../../contributing.rst:347 +msgid "Generating New Fixtures" +msgstr "" + +#: ../../contributing.rst:349 +msgid "" +"Our integration tests make use of Geth private networks. When new " +"versions of the client software are introduced, new fixtures should be " +"generated." +msgstr "" + +#: ../../contributing.rst:353 +msgid "" +"Before generating new fixtures, make sure you have the test dependencies " +"installed:" +msgstr "" + +#: ../../contributing.rst:361 +msgid "" +"A \"fixture\" is a pre-synced network. It's the result of configuring and" +" running a client, deploying the test contracts, and saving the resulting" +" state for testing web3.py functionality against." +msgstr "" + +#: ../../contributing.rst:367 +msgid "Geth Fixtures" +msgstr "" + +#: ../../contributing.rst:369 +msgid "" +"Install the desired Geth version on your machine locally. We recommend " +"`py-geth`_ for this purpose, because it enables you to easily manage " +"multiple versions of Geth." +msgstr "" + +#: ../../contributing.rst:372 +msgid "" +"Note that ``py-geth`` will need updating to support each new Geth version" +" as well. Adding newer Geth versions to py-geth is straightforward; see " +"past commits for a template." +msgstr "" + +#: ../../contributing.rst:375 +msgid "" +"If py-geth has the Geth version you need, install that version locally. " +"For example:" +msgstr "" + +#: ../../contributing.rst:381 +msgid "" +"Specify the Geth binary and run the fixture creation script (from within " +"the web3.py directory):" +msgstr "" + +#: ../../contributing.rst:387 +msgid "" +"The output of this script is your fixture, a zip file, which is now " +"stored in ``/tests/integration/``. The " +"``/tests/integration/go_ethereum/conftest.py`` and " +"``/web3/tools/benchmark/node.py`` files should be updated automatically " +"to point to this new fixture. Delete the old fixture." +msgstr "" + +#: ../../contributing.rst:392 +msgid "" +"Run the tests. To ensure that the tests run with the correct Geth version" +" locally, you may again include the ``GETH_BINARY`` environment variable." +msgstr "" + +#: ../../contributing.rst:395 +msgid "" +"The ``geth_version`` and ``pygeth_version`` parameter defaults in " +"``/.circleci/config.yml`` should be automatically updated to match the " +"``go-ethereum`` version used to generate the test fixture and the ``py-" +"geth`` version that supports installing it." +msgstr "" + +#: ../../contributing.rst:402 +msgid "CI Testing With a Nightly Geth Build" +msgstr "" + +#: ../../contributing.rst:404 +msgid "" +"Occasionally you'll want to have CI run the test suite against an " +"unreleased version of Geth - e.g. to test upcoming hard fork changes. The" +" workflow described below is for testing only, as updates will only be " +"merged into main once the Geth release is published and the test runs are" +" updated to use the new stable version." +msgstr "" + +#: ../../contributing.rst:409 +msgid "" +"Configure ``tests/integration/generate_fixtures/go_ethereum/common.py`` " +"as needed." +msgstr "" + +#: ../../contributing.rst:411 +msgid "" +"Geth automagically compiles new builds for every commit that gets merged " +"into the codebase. Download the desired build from the `develop builds " +"`_." +msgstr "" + +#: ../../contributing.rst:414 +msgid "" +"Build your test fixture, passing in the binary you just downloaded via " +"``GETH_BINARY``. Don't forget to update the " +"``/tests/integration/go_ethereum/conftest.py`` file to point to your new " +"fixture." +msgstr "" + +#: ../../contributing.rst:417 +msgid "" +"Our CI runs on Ubuntu, so download the corresponding 64-bit Linux " +"`develop build `_, then add it to " +"the root of your web3.py directory. Rename the binary ``custom_geth``." +msgstr "" + +#: ../../contributing.rst:421 +msgid "" +"In ``.circleci/config.yml``, update the ``geth_version`` pipeline " +"parameter to \"custom\". This will trigger the custom Geth build to be " +"used in the CI test suite." +msgstr "" + +#: ../../contributing.rst:424 +msgid "Create a PR and let CI do its thing." +msgstr "" + +#: ../../contributing.rst:428 +msgid "Releasing" +msgstr "" + +#: ../../contributing.rst:430 +msgid "" +"Releases are typically done from the ``main`` branch, except when " +"releasing a beta (in which case the beta is released from ``main``, and " +"the previous stable branch is released from said branch)." +msgstr "" + +#: ../../contributing.rst:435 +msgid "Final test before each release" +msgstr "" + +#: ../../contributing.rst:437 +msgid "" +"Before releasing a new version, build and test the package that will be " +"released:" +msgstr "" + +#: ../../contributing.rst:444 +msgid "" +"This will build the package and install it in a temporary virtual " +"environment. Follow the instructions to activate the venv and test " +"whatever you think is important." +msgstr "" + +#: ../../contributing.rst:447 +msgid "Review the documentation that will get published:" +msgstr "" + +#: ../../contributing.rst:453 +msgid "Validate and preview the release notes:" +msgstr "" + +#: ../../contributing.rst:460 +msgid "Build the release notes" +msgstr "" + +#: ../../contributing.rst:462 +msgid "" +"Before bumping the version number, build the release notes. You must " +"include the part of the version to bump (see below), which changes how " +"the version number will show in the release notes." +msgstr "" + +#: ../../contributing.rst:470 +msgid "If there are any errors, be sure to re-run make notes until it works." +msgstr "" + +#: ../../contributing.rst:473 +msgid "Push the release to github & pypi" +msgstr "" + +#: ../../contributing.rst:475 +msgid "" +"After confirming that the release package looks okay, release a new " +"version:" +msgstr "" + +#: ../../contributing.rst:481 +msgid "This command will:" +msgstr "" + +#: ../../contributing.rst:483 +msgid "" +"Bump the version number as specified in ``.pyproject.toml`` and " +"``setup.py``." +msgstr "" + +#: ../../contributing.rst:484 +msgid "Create a git commit and tag for the new version." +msgstr "" + +#: ../../contributing.rst:485 +msgid "Build the package." +msgstr "" + +#: ../../contributing.rst:486 +msgid "Push the commit and tag to github." +msgstr "" + +#: ../../contributing.rst:487 +msgid "Push the new package files to pypi." +msgstr "" + +#: ../../contributing.rst:490 +msgid "Which version part to bump" +msgstr "" + +#: ../../contributing.rst:492 +msgid "" +"``$$VERSION_PART_TO_BUMP$$`` must be one of: ``major``, ``minor``, " +"``patch``, ``stage``, or ``devnum``." +msgstr "" + +#: ../../contributing.rst:495 +#, python-brace-format +msgid "" +"The version format for this repo is ``{major}.{minor}.{patch}`` for " +"stable, and ``{major}.{minor}.{patch}-{stage}.{devnum}`` for unstable " +"(``stage`` can be alpha or beta)." +msgstr "" + +#: ../../contributing.rst:499 +msgid "" +"If you are in a beta version, ``make release bump=stage`` will switch to " +"a stable." +msgstr "" + +#: ../../contributing.rst:501 +msgid "" +"To issue an unstable version when the current version is stable, specify " +"the new version explicitly, like ``make release bump=\"--new-version " +"4.0.0-alpha.1\"``." +msgstr "" + +#: ../../contributing.rst:504 +msgid "" +"You can see what the result of bumping any particular version part would " +"be with ``bump-my-version show-bump``." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/ens.po b/docs/locales/zh_CN/LC_MESSAGES/ens.po new file mode 100644 index 0000000000..73ea93b78d --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/ens.po @@ -0,0 +1,46 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../ens.rst:4 +msgid "ENS API" +msgstr "ENS API" + +#: ../../ens.rst:6 +msgid ":doc:`ens_overview` has a friendly overview." +msgstr "" + +#: ../../ens.rst:8 +msgid "" +"Continue below for the detailed specs on each method and class in the ens" +" module." +msgstr "" + +#: ../../ens.rst:11 +msgid "ens\\.ens module" +msgstr "" + +#: ../../ens.rst:17 +msgid "ens\\.async_ens module" +msgstr "" + +#: ../../ens.rst:23 +msgid "ens\\.exceptions module" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/ens_overview.po b/docs/locales/zh_CN/LC_MESSAGES/ens_overview.po new file mode 100644 index 0000000000..6a4180c113 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/ens_overview.po @@ -0,0 +1,290 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../ens_overview.rst:4 +msgid "Ethereum Name Service (ENS)" +msgstr "以太坊名称服务 (ENS)" + +#: ../../ens_overview.rst:6 +msgid "" +"The Ethereum Name Service (ENS) is analogous to the Domain Name Service. " +"It enables users and developers to use human-friendly names in place of " +"error-prone hexadecimal addresses, content hashes, and more." +msgstr "" + +#: ../../ens_overview.rst:10 +msgid "" +"The :mod:`ens` module is included with web3.py. It provides an interface " +"to look up domains and addresses, add resolver records, or get and set " +"metadata." +msgstr "" + +#: ../../ens_overview.rst:15 +msgid "Setup" +msgstr "" + +#: ../../ens_overview.rst:17 +msgid "" +"Create an :class:`~ens.ENS` object (named ``ns`` below) in one of three " +"ways:" +msgstr "" + +#: ../../ens_overview.rst:19 +msgid "Automatic detection" +msgstr "" + +#: ../../ens_overview.rst:20 +msgid "Specify an instance of a :ref:`provider `" +msgstr "" + +#: ../../ens_overview.rst:21 +msgid "From an existing :class:`web3.Web3` object" +msgstr "" + +#: ../../ens_overview.rst:43 +msgid "Asynchronous support is available via the ``AsyncENS`` module:" +msgstr "" + +#: ../../ens_overview.rst:52 +msgid "" +"Note that an ``ens`` module instance is also available on the ``w3`` " +"instance. The first time it's used, web3.py will create the ``ens`` " +"instance using ``ENS.from_web3(w3)`` or ``AsyncENS.from_web3(w3)`` as " +"appropriate." +msgstr "" + +#: ../../ens_overview.rst:68 +msgid "" +"The ``ENS`` instance has a ``strict_bytes_type_checking`` flag that " +"toggles the flag with the same name on the ``Web3`` instance attached to " +"the ``ENS`` instance. You may disable the stricter bytes type checking " +"that is loaded by default using this flag. For more examples, see :ref" +":`disable-strict-byte-check`" +msgstr "" + +#: ../../ens_overview.rst:73 +msgid "" +"If instantiating a standalone ENS instance using ``ENS.from_web3()``, the" +" ENS instance will inherit the value of the flag on the Web3 instance at " +"time of instantiation." +msgstr "" + +#: ../../ens_overview.rst:107 +msgid "" +"However, if accessing the ``ENS`` class via the ``Web3`` instance as a " +"module (``w3.ens``), since all modules use the same ``Web3`` object " +"reference under the hood (the parent ``w3`` object), changing the " +"``strict_bytes_type_checking`` flag value on ``w3`` also changes the flag" +" state for ``w3.ens.w3`` and all modules." +msgstr "" + +#: ../../ens_overview.rst:138 +msgid "Usage" +msgstr "" + +#: ../../ens_overview.rst:141 +msgid "Name Info" +msgstr "" + +#: ../../ens_overview.rst:146 +msgid "Get the Address for an ENS Name" +msgstr "" + +#: ../../ens_overview.rst:154 +msgid "" +"The ``ENS`` module has no opinion as to which **TLD (Top Level Domain)** " +"you can use, but will not infer a TLD if it is not provided with the " +"name." +msgstr "" + +#: ../../ens_overview.rst:158 +msgid "Multichain Address Resolution" +msgstr "" + +#: ../../ens_overview.rst:160 +msgid "" +"`ENSIP-9 `_ introduced multichain " +"address resolution, allowing users to resolve addresses from different " +"chains, specified by the coin type index from `SLIP44 " +"`_. The " +"``address()`` method on the ``ENS`` class supports multichain address " +"resolution via the ``coin_type`` keyword argument." +msgstr "" + +#: ../../ens_overview.rst:175 +msgid "Get the ENS Name for an Address" +msgstr "" + +#: ../../ens_overview.rst:187 +msgid "" +"For accuracy, and as a recommendation from the ENS documentation on " +"`reverse resolution `_, the ``ENS`` module now verifies that the forward " +"resolution matches the address with every call to get the ``name()`` for " +"an address. This is the only sure way to know whether the reverse " +"resolution is correct. Anyone can claim any name, only forward resolution" +" implies that the owner of the name gave their stamp of approval." +msgstr "" + +#: ../../ens_overview.rst:194 +msgid "Get the Owner of a Name" +msgstr "" + +#: ../../ens_overview.rst:203 +msgid "Set Up Your Name and Address" +msgstr "" + +#: ../../ens_overview.rst:206 +msgid "Link a Name to an Address" +msgstr "" + +#: ../../ens_overview.rst:208 +msgid "" +"You can set up your name so that :meth:`~ens.ENS.address` will show the " +"address it points to. In order to do so, you must already be the owner of" +" the domain (or its parent)." +msgstr "" + +#: ../../ens_overview.rst:215 +msgid "" +"In the common case where you want to point the name to the owning " +"address, you can skip the address." +msgstr "" + +#: ../../ens_overview.rst:221 +msgid "You can claim arbitrarily deep subdomains." +msgstr "" + +#: ../../ens_overview.rst:233 +msgid "Gas costs scale up with the number of subdomains!" +msgstr "" + +#: ../../ens_overview.rst:236 +msgid "Multichain Address Support" +msgstr "" + +#: ../../ens_overview.rst:238 +msgid "" +"`ENSIP-9 `_ introduced multichain " +"address resolution, allowing users to resolve addresses from different " +"chains, specified by the coin type index from `SLIP44 " +"`_. The " +"``setup_address()`` method on the ``ENS`` class supports multichain " +"address setup via the ``coin_type`` keyword argument." +msgstr "" + +#: ../../ens_overview.rst:252 +msgid "Link an Address to a Name" +msgstr "" + +#: ../../ens_overview.rst:254 +msgid "" +"You can set up your address so that :meth:`~ens.ENS.name` will show the " +"name that points to it." +msgstr "" + +#: ../../ens_overview.rst:256 +msgid "" +"This is like Caller ID. It enables you and others to take an account and " +"determine what name points to it. Sometimes this is referred to as " +"\"reverse\" resolution. The ENS Reverse Resolver is used for this " +"functionality." +msgstr "" + +#: ../../ens_overview.rst:263 +msgid "" +"If you don't supply the address, :meth:`~ens.ENS.setup_name` will assume " +"you want the address returned by :meth:`~ens.ENS.address`." +msgstr "" + +#: ../../ens_overview.rst:270 +msgid "" +"If the name doesn't already point to an address, " +":meth:`~ens.ENS.setup_name` will call :meth:`~ens.ENS.setup_address` for " +"you." +msgstr "" + +#: ../../ens_overview.rst:273 +msgid "Wait for the transaction to be mined, then:" +msgstr "" + +#: ../../ens_overview.rst:282 +msgid "Text Records" +msgstr "" + +#: ../../ens_overview.rst:285 +msgid "Set Text Metadata for an ENS Record" +msgstr "" + +#: ../../ens_overview.rst:287 +msgid "" +"As the owner of an ENS record, you can add text metadata. A list of " +"supported fields can be found in the `ENS documentation " +"`_. You'll need " +"to setup the address first, and then the text can be set:" +msgstr "" + +#: ../../ens_overview.rst:297 +msgid "A transaction dictionary can be passed as the last argument if desired:" +msgstr "" + +#: ../../ens_overview.rst:304 +msgid "" +"If the transaction dictionary is not passed, sensible defaults will be " +"used, and if a transaction dictionary is passed but does not have a " +"``from`` value, the default will be the ``owner``." +msgstr "" + +#: ../../ens_overview.rst:309 +msgid "Read Text Metadata for an ENS Record" +msgstr "" + +#: ../../ens_overview.rst:311 +msgid "Anyone can read the data from an ENS Record:" +msgstr "" + +#: ../../ens_overview.rst:321 +msgid "Working With Resolvers" +msgstr "" + +#: ../../ens_overview.rst:324 +msgid "Get the Resolver for an ENS Record" +msgstr "" + +#: ../../ens_overview.rst:326 +msgid "" +"You can get the resolver for an ENS name via the " +":meth:`~ens.ENS.resolver` method." +msgstr "" + +#: ../../ens_overview.rst:337 +msgid "Wildcard Resolution Support" +msgstr "" + +#: ../../ens_overview.rst:339 +msgid "" +"The ``ENS`` module supports Wildcard Resolution for resolvers that " +"implement the ``ExtendedResolver`` interface as described in `ENSIP-10 " +"`_. Resolvers that implement the " +"extended resolver interface should return ``True`` when calling the " +"``supportsInterface()`` function with the extended resolver interface id " +"``\"0x9061b923\"`` and should resolve subdomains to a unique address." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/filters.po b/docs/locales/zh_CN/LC_MESSAGES/filters.po new file mode 100644 index 0000000000..7221815ba4 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/filters.po @@ -0,0 +1,501 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../filters.rst:4 +msgid "Events and Logs" +msgstr "事件和日志" + +#: ../../filters.rst:6 +msgid "" +"If you're on this page, you're likely looking for an answer to this " +"question: **How do I know when a specific contract is used?** You have " +"several options:" +msgstr "" + +#: ../../filters.rst:9 +msgid "" +"Query blocks for transactions that include the contract address in the " +"``\"to\"`` field. This contrived example is searching the latest block " +"for any transactions sent to the WETH_ contract." +msgstr "" + +#: ../../filters.rst:23 +msgid "" +"Query for logs emitted by a contract. After instantiating a web3.py " +"Contract object, you can :ref:`fetch logs ` for any " +"event listed in the ABI. In this example, we query for ``Transfer`` " +"events in the latest block and log out the results." +msgstr "" + +#: ../../filters.rst:40 +msgid "" +"See an advanced example of fetching log history :ref:`here " +"`." +msgstr "" + +#: ../../filters.rst:42 +msgid "" +"Subscribe to events for real-time updates. When using a persistent " +"connection provider " +"(:class:`~web3.providers.persistent.WebSocketProvider` or " +":class:`~web3.providers.persistent.AsyncIPCProvider`), the " +":meth:`subscribe() ` method can be used to " +"establish a new event subscription. This example subscribes to " +"``Transfer`` events of the WETH contract." +msgstr "" + +#: ../../filters.rst:78 +msgid "For more usage examples see the docs on :ref:`subscription-examples`." +msgstr "" + +#: ../../filters.rst:80 +msgid "Use a filter." +msgstr "" + +#: ../../filters.rst:84 +msgid "" +"While filters can be a very convenient way to monitor for blocks, " +"transactions, or events, they are notoriously unreliable. Both remote and" +" locally hosted nodes have a reputation for occasionally dropping " +"filters, and some remote node providers don't support filter-related RPC " +"calls at all." +msgstr "" + +#: ../../filters.rst:91 +msgid "The :meth:`web3.eth.Eth.filter` method can be used to set up filters for:" +msgstr "" + +#: ../../filters.rst:93 +msgid "Pending Transactions: ``w3.eth.filter(\"pending\")``" +msgstr "" + +#: ../../filters.rst:95 +msgid "New Blocks ``w3.eth.filter(\"latest\")``" +msgstr "" + +#: ../../filters.rst:97 +msgid "Event Logs" +msgstr "" + +#: ../../filters.rst:99 +msgid "Through the contract instance api:" +msgstr "" + +#: ../../filters.rst:105 +msgid "" +"Or built manually by supplying `valid filter params " +"`_:" +msgstr "" + +#: ../../filters.rst:111 +msgid "Attaching to an existing filter" +msgstr "" + +#: ../../filters.rst:119 +msgid "" +"Creating event filters requires that your Ethereum node has an API " +"support enabled for filters. Note that Infura support for filters does " +"not offer access to `pending` filters. To get event logs on other " +"stateless nodes please see :class:`web3.contract.ContractEvents`." +msgstr "" + +#: ../../filters.rst:126 +msgid "Filter Class" +msgstr "" + +#: ../../filters.rst:132 +msgid "" +"The ``filter_id`` for this filter as returned by the ``eth_newFilter`` " +"RPC method when this filter was created." +msgstr "" + +#: ../../filters.rst:138 +msgid "Retrieve new entries for this filter." +msgstr "" + +#: ../../filters.rst:140 +msgid "" +"Logs will be retrieved using the :func:`web3.eth.Eth.get_filter_changes` " +"which returns only new entries since the last poll." +msgstr "" + +#: ../../filters.rst:147 +msgid "Retrieve all entries for this filter." +msgstr "" + +#: ../../filters.rst:149 +msgid "" +"Logs will be retrieved using the :func:`web3.eth.Eth.get_filter_logs` " +"which returns all entries that match the given filter." +msgstr "" + +#: ../../filters.rst:156 +msgid "" +"Hook for subclasses to modify the format of the log entries this filter " +"returns, or passes to its callback functions." +msgstr "" + +#: ../../filters.rst:159 +msgid "By default this returns the ``entry`` parameter unmodified." +msgstr "" + +#: ../../filters.rst:164 +msgid "" +"Hook for subclasses to add additional programmatic filtering. The " +"default implementation always returns ``True``." +msgstr "" + +#: ../../filters.rst:169 +msgid "Block and Transaction Filter Classes" +msgstr "" + +#: ../../filters.rst:173 +msgid "``BlockFilter`` is a subclass of :class:`Filter`." +msgstr "" + +#: ../../filters.rst:175 +msgid "" +"You can setup a filter for new blocks using ``web3.eth.filter('latest')``" +" which will return a new :class:`BlockFilter` object." +msgstr "" + +#: ../../filters.rst:185 +msgid "" +"``\"safe\"`` and ``\"finalized\"`` block identifiers are not yet " +"supported for ``eth_newBlockFilter``." +msgstr "" + +#: ../../filters.rst:190 +msgid "``TransactionFilter`` is a subclass of :class:`Filter`." +msgstr "" + +#: ../../filters.rst:192 +msgid "" +"You can setup a filter for new blocks using " +"``web3.eth.filter('pending')`` which will return a new " +":class:`TransactionFilter` object." +msgstr "" + +#: ../../filters.rst:202 +msgid "Event Log Filters" +msgstr "" + +#: ../../filters.rst:204 +msgid "" +"You can set up a filter for event logs using the web3.py contract api: " +":meth:`web3.contract.Contract.events.your_event_name.create_filter`, " +"which provides some conveniences for creating event log filters. Refer to" +" the following example:" +msgstr "" + +#: ../../filters.rst:213 +msgid "" +"See :meth:`web3.contract.Contract.events.your_event_name.create_filter()`" +" documentation for more information." +msgstr "" + +#: ../../filters.rst:215 +msgid "" +"You can set up an event log filter like the one above with " +"``web3.eth.filter`` by supplying a dictionary containing the standard " +"filter parameters. Assuming that ``arg1`` is indexed, the equivalent " +"filter creation would look like:" +msgstr "" + +#: ../../filters.rst:228 +msgid "" +"The ``topics`` argument is order-dependent. For non-anonymous events, the" +" first item in the topic list is always the keccack hash of the event " +"signature. Subsequent topic items are the hex encoded values for indexed " +"event arguments. In the above example, the second item is the ``arg1`` " +"value ``10`` encoded to its hex string representation." +msgstr "" + +#: ../../filters.rst:230 +msgid "" +"In addition to being order-dependent, there are a few more points to " +"recognize when specifying topic filters:" +msgstr "" + +#: ../../filters.rst:232 +msgid "" +"Given a transaction log with topics [A, B], the following topic filters " +"will yield a match:" +msgstr "" + +#: ../../filters.rst:234 +msgid "[] \"anything\"" +msgstr "" + +#: ../../filters.rst:235 +msgid "[A] \"A in first position (and anything after)\"" +msgstr "" + +#: ../../filters.rst:236 +msgid "" +"[None, B] \"anything in first position AND B in second position (and " +"anything after)\"" +msgstr "" + +#: ../../filters.rst:237 +msgid "" +"[A, B] \"A in first position AND B in second position (and anything " +"after)\"" +msgstr "" + +#: ../../filters.rst:238 +msgid "" +"[[A, B], [A, B]] \"(A OR B) in first position AND (A OR B) in second " +"position (and anything after)\"" +msgstr "" + +#: ../../filters.rst:240 +msgid "" +"See the JSON-RPC documentation for `eth_newFilter " +"`_ " +"more information on the standard filter parameters." +msgstr "" + +#: ../../filters.rst:244 +msgid "" +"Though ``\"finalized\"`` and ``\"safe\"`` block identifiers are not yet " +"part of the specifications for ``eth_newFilter``, they are supported by " +"web3.py and may or may not yield expected results depending on the node " +"being accessed." +msgstr "" + +#: ../../filters.rst:248 +msgid "" +"Creating a log filter by either of the above methods will return a " +":class:`LogFilter` instance." +msgstr "" + +#: ../../filters.rst:252 +msgid "" +"The :py:class:`LogFilter` class is a subclass of :class:`Filter`. See " +"the :class:`Filter` documentation for inherited methods." +msgstr "" + +#: ../../filters.rst:255 +msgid ":class:`LogFilter` provides the following additional methods:" +msgstr "" + +#: ../../filters.rst:260 +msgid "" +"Provides a means to filter on the log data, in other words the ability to" +" filter on values from un-indexed event arguments. The parameter " +"``data_filter_set`` should be a list or set of 32-byte hex encoded " +"values." +msgstr "" + +#: ../../filters.rst:264 +msgid "Examples: Listening For Events" +msgstr "" + +#: ../../filters.rst:267 +msgid "Synchronous" +msgstr "" + +#: ../../filters.rst:296 +msgid "Asynchronous Filter Polling" +msgstr "" + +#: ../../filters.rst:298 +msgid "" +"Starting with web3 version 4, the ``watch`` method was taken out of the " +"web3 filter objects. There are many decisions to be made when designing a" +" system regarding threading and concurrency. Rather than force a " +"decision, web3 leaves these choices up to the user. Below are some " +"example implementations of asynchronous filter-event handling that can " +"serve as starting points." +msgstr "" + +#: ../../filters.rst:304 +msgid "Single threaded concurrency with ``async`` and ``await``" +msgstr "" + +#: ../../filters.rst:306 +msgid "" +"Beginning in python 3.5, the ``async`` and ``await`` built-in keywords " +"were added. These provide a shared api for coroutines that can be " +"utilized by modules such as the built-in asyncio_. Below is an example " +"event loop using asyncio_, that polls multiple web3 filter object, and " +"passes new entries to a handler." +msgstr "" + +#: ../../filters.rst:344 +msgid "Read the asyncio_ documentation for more information." +msgstr "" + +#: ../../filters.rst:347 +msgid "Running the event loop in a separate thread" +msgstr "" + +#: ../../filters.rst:349 +msgid "" +"Here is an extended version of above example, where the event loop is run" +" in a separate thread, releasing the ``main`` function for other tasks." +msgstr "" + +#: ../../filters.rst:382 +msgid "" +"Here are some other libraries that provide frameworks for writing " +"asynchronous python:" +msgstr "" + +#: ../../filters.rst:384 +msgid "gevent_" +msgstr "" + +#: ../../filters.rst:385 +msgid "twisted_" +msgstr "" + +#: ../../filters.rst:386 +msgid "celery_" +msgstr "" + +#: ../../filters.rst:390 +msgid "Examples" +msgstr "" + +#: ../../filters.rst:395 +msgid "Advanced example: Fetching all token transfer events" +msgstr "" + +#: ../../filters.rst:397 +msgid "" +"In this example, we show how to fetch all events of a certain event type " +"from the Ethereum blockchain. There are three challenges when working " +"with a large set of events:" +msgstr "" + +#: ../../filters.rst:399 +msgid "How to incrementally update an existing database of fetched events" +msgstr "" + +#: ../../filters.rst:401 +msgid "How to deal with interruptions in long running processes" +msgstr "" + +#: ../../filters.rst:403 +msgid "How to deal with `eth_getLogs` JSON-RPC call query limitations" +msgstr "" + +#: ../../filters.rst:405 +msgid "" +"How to handle Ethereum minor chain reorganisations in (near) real-time " +"data" +msgstr "" + +#: ../../filters.rst:409 +msgid "eth_getLogs limitations" +msgstr "" + +#: ../../filters.rst:411 +msgid "" +"Ethereum JSON-RPC API servers, like Geth, do not provide an easy way to " +"paginate over events, only over blocks. There's no request that can find " +"the first block with an event or how many events occur within a range of " +"blocks. The only feedback the JSON-RPC service will give you is whether " +"the ``eth_getLogs`` call failed." +msgstr "" + +#: ../../filters.rst:413 +msgid "" +"In this example script, we provide two kinds of heuristics to deal with " +"this issue. The script scans events in a chunk of blocks (start block " +"number - end block number). Then it uses two methods to find how many " +"events there are likely to be in a block window:" +msgstr "" + +#: ../../filters.rst:415 +msgid "" +"Dynamically set the block range window size, while never exceeding a " +"threshold (e.g., 10,000 blocks)." +msgstr "" + +#: ../../filters.rst:417 +msgid "" +"In the case of ``eth_getLogs``, the JSON-RPC call gives a timeout error, " +"decrease the end block number and tries again with a smaller block range " +"window." +msgstr "" + +#: ../../filters.rst:421 +msgid "Example code" +msgstr "" + +#: ../../filters.rst:423 +msgid "" +"The following example code is divided into a reusable ``EventScanner`` " +"class and then a demo script that:" +msgstr "" + +#: ../../filters.rst:425 +msgid "" +"fetches all transfer events for `RCC token " +"`_," +msgstr "" + +#: ../../filters.rst:427 +msgid "can incrementally run again to check if there are new events," +msgstr "" + +#: ../../filters.rst:429 +msgid "handles interruptions (e.g., CTRL+C abort) gracefully," +msgstr "" + +#: ../../filters.rst:431 +msgid "" +"writes all ``Transfer`` events in a single file JSON database, so that " +"other process can consume them," +msgstr "" + +#: ../../filters.rst:433 +msgid "" +"uses the `tqdm `_ library for progress " +"bar output in a console," +msgstr "" + +#: ../../filters.rst:435 +msgid "" +"only supports ``HTTPS`` providers, because JSON-RPC retry logic depends " +"on the implementation details of the underlying protocol," +msgstr "" + +#: ../../filters.rst:437 +msgid "" +"disables the default exception retry configuration because it does not " +"know how to handle the shrinking block range window for ``eth_getLogs``, " +"and" +msgstr "" + +#: ../../filters.rst:439 +msgid "consumes around 20k JSON-RPC API calls." +msgstr "" + +#: ../../filters.rst:441 +msgid "" +"The script can be run with: ``python ./eventscanner.py ``." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/gas_price.po b/docs/locales/zh_CN/LC_MESSAGES/gas_price.po new file mode 100644 index 0000000000..b1528271b3 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/gas_price.po @@ -0,0 +1,161 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../gas_price.rst:4 +msgid "Gas Price API" +msgstr "" + +#: ../../gas_price.rst:7 +msgid "" +"Gas price strategy is only supported for legacy transactions. The London " +"fork introduced ``maxFeePerGas`` and ``maxPriorityFeePerGas`` transaction" +" parameters which should be used over ``gasPrice`` whenever possible." +msgstr "" + +#: ../../gas_price.rst:11 +msgid "" +"For Ethereum (legacy) transactions, gas price is a delicate property. For" +" this reason, Web3 includes an API for configuring it." +msgstr "" + +#: ../../gas_price.rst:14 +msgid "" +"The Gas Price API allows you to define Web3's behaviour for populating " +"the gas price. This is done using a \"Gas Price Strategy\" - a method " +"which takes the Web3 object and a transaction dictionary and returns a " +"gas price (denominated in wei)." +msgstr "" + +#: ../../gas_price.rst:19 +msgid "Retrieving gas price" +msgstr "" + +#: ../../gas_price.rst:21 +msgid "" +"To retrieve the gas price using the selected strategy simply call " +":meth:`~web3.eth.Eth.generate_gas_price`" +msgstr "" + +#: ../../gas_price.rst:30 +msgid "Creating a gas price strategy" +msgstr "" + +#: ../../gas_price.rst:32 +msgid "" +"A gas price strategy is implemented as a python method with the following" +" signature:" +msgstr "" + +#: ../../gas_price.rst:40 +msgid "" +"The method must return a positive integer representing the gas price in " +"wei." +msgstr "" + +#: ../../gas_price.rst:42 +msgid "" +"To demonstrate, here is a rudimentary example of a gas price strategy " +"that returns a higher gas price when the value of the transaction is " +"higher than 1 Ether." +msgstr "" + +#: ../../gas_price.rst:57 +msgid "Selecting the gas price strategy" +msgstr "" + +#: ../../gas_price.rst:59 +msgid "" +"The gas price strategy can be set by calling " +":meth:`~web3.eth.Eth.set_gas_price_strategy`." +msgstr "" + +#: ../../gas_price.rst:72 +msgid "Available gas price strategies" +msgstr "" + +#: ../../gas_price.rst:78 +msgid "" +"Makes a call to the `JSON-RPC eth_gasPrice method " +"`_ " +"which returns the gas price configured by the connected Ethereum node." +msgstr "" + +#: ../../gas_price.rst:86 +msgid "" +"Constructs a strategy which will compute a gas price such that the " +"transaction will be mined within a number of seconds defined by " +"``max_wait_seconds`` with a probability defined by ``probability``. The " +"gas price is computed by sampling ``sample_size`` of the most recently " +"mined blocks. If ``weighted=True``, the block time will be weighted " +"towards more recently mined blocks." +msgstr "" + +#: ../../gas_price.rst:93 +msgid "" +"``max_wait_seconds`` The desired maximum number of seconds the " +"transaction should take to mine." +msgstr "" + +#: ../../gas_price.rst:95 +msgid "``sample_size`` The number of recent blocks to sample" +msgstr "" + +#: ../../gas_price.rst:96 +msgid "" +"``probability`` An integer representation of the desired probability that" +" the transaction will be mined within ``max_wait_seconds``. 0 means 0% " +"and 100 means 100%." +msgstr "" + +#: ../../gas_price.rst:100 +msgid "The following ready to use versions of this strategy are available." +msgstr "" + +#: ../../gas_price.rst:102 +msgid "" +"``web3.gas_strategies.time_based.fast_gas_price_strategy``: Transaction " +"mined within 60 seconds." +msgstr "" + +#: ../../gas_price.rst:103 +msgid "" +"``web3.gas_strategies.time_based.medium_gas_price_strategy``: Transaction" +" mined within 5 minutes." +msgstr "" + +#: ../../gas_price.rst:104 +msgid "" +"``web3.gas_strategies.time_based.slow_gas_price_strategy``: Transaction " +"mined within 1 hour." +msgstr "" + +#: ../../gas_price.rst:105 +msgid "" +"``web3.gas_strategies.time_based.glacial_gas_price_strategy``: " +"Transaction mined within 24 hours." +msgstr "" + +#: ../../gas_price.rst:107 +msgid "" +"Due to the overhead of sampling the recent blocks it is recommended that " +"a caching solution be used to reduce the amount of chain data that needs " +"to be re-fetched for each request." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/index.po b/docs/locales/zh_CN/LC_MESSAGES/index.po new file mode 100644 index 0000000000..665131240a --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/index.po @@ -0,0 +1,145 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: 2025-08-06 11:51+0800\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../toc.rst:4 +msgid "Intro" +msgstr "介绍" + +#: ../../toc.rst:12 +msgid "Guides" +msgstr "指南" + +#: ../../toc.rst:28 +msgid "API" +msgstr "API" + +#: ../../toc.rst:43 +msgid "Community" +msgstr "社区" + +#: ../../index.rst:-1 +msgid "Python Web3 SDK for Ethereum and EVM blockchains" +msgstr "适用于以太坊和EVM区块链的Python Web3 SDK" + +#: ../../index.rst:5 +msgid "gm" +msgstr "gm(早安)" + +#: ../../index.rst:7 +msgid "Banner Image" +msgstr "横幅图片" + +#: ../../index.rst:10 +msgid "**web3.py** is a Python library for interacting with Ethereum." +msgstr "**web3.py** 是一个用于与以太坊交互的Python库。" + +#: ../../index.rst:12 +msgid "" +"It's commonly found in `decentralized apps (dapps)`_ to help with sending" +" transactions, interacting with smart contracts, reading block data, and " +"a variety of other use cases." +msgstr "" +"它常用于 `去中心化应用(dapps)`_,帮助发送交易、与智能合约交互、读取区块数据,以及其他多种用例。" + +#: ../../index.rst:16 +msgid "" +"For project updates, follow `@EthereumPython`_ and sign up for new post " +"notifications on the `blog`_." +msgstr "" +"获取项目更新,请关注 `@EthereumPython`_ 并在 `博客`_ 订阅新文章通知。" + + +#: ../../index.rst:21 +msgid "Getting Started" +msgstr "快速开始" + +#: ../../index.rst:24 +msgid "👋 Brand new to Ethereum?" +msgstr "👋 以太坊新手?" + +#: ../../index.rst:26 +msgid "Don't travel alone! Join the Ethereum Python Community `Discord`_." +msgstr "不要独自前行!加入以太坊Python社区" + +#: ../../index.rst:27 +msgid "" +"Read this `blog post series`_ for a gentle introduction to Ethereum " +"blockchain concepts." +msgstr "阅读这个 `博客系列`_,轻松了解以太坊区块链的相关概念。" + +#: ../../index.rst:28 +msgid "" +"The :ref:`Overview` page will give you a quick idea of what else web3.py " +"can do." +msgstr "" +":ref:`Overview` 页面将帮助你快速了解 web3.py 的更多功能。" + +#: ../../index.rst:29 +msgid "Try building a little something!" +msgstr "试着构建一些小项目吧!" + +#: ../../index.rst:31 +msgid "Ready to code? → :ref:`quickstart`" +msgstr "准备好编写代码了吗?→ :ref:`quickstart`" + +#: ../../index.rst:32 +msgid "Quick tour? → :ref:`overview`" +msgstr "快速浏览?→ :ref:`overview`" + +#: ../../index.rst:33 +msgid "Synchronous help? → `Discord`_" +msgstr "要实时帮助?→ `Discord`_" + +#: ../../index.rst:34 +msgid "Asynchronous help? → `StackExchange`_" +msgstr "要异步帮助?→ `StackExchange`_" + +#: ../../index.rst:35 +msgid "Report a bug? → `Github`_" +msgstr "现Bug?→ `Github`_" + +#: ../../index.rst:36 +msgid "Want to help us? → :ref:`Contribute `" +msgstr "想要帮助我们?→ :ref:`Contribute `" + +#: ../../index.rst:37 +msgid "Looking for inspiration? → :ref:`resources`" +msgstr "寻找灵感?→ :ref:`resources`" + +#: ../../toc.rst:2 +msgid "Table of Contents" +msgstr "目录" + +#: ../../toc.rst:52 +msgid "Indices and tables" +msgstr "索引和表格" + +#: ../../toc.rst:54 +msgid ":ref:`genindex`" +msgstr ":ref:`genindex`" + +#: ../../toc.rst:55 +msgid ":ref:`modindex`" +msgstr ":ref:`modindex`" + +#: ../../toc.rst:56 +msgid ":ref:`search`" +msgstr ":ref:`search`" diff --git a/docs/locales/zh_CN/LC_MESSAGES/internals.po b/docs/locales/zh_CN/LC_MESSAGES/internals.po new file mode 100644 index 0000000000..98676ea86c --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/internals.po @@ -0,0 +1,705 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../internals.rst:2 +msgid "Web3 Internals" +msgstr "Web3 内部实现" + +#: ../../internals.rst:5 +msgid "" +"This section of the documentation is for advanced users. You should " +"probably stay away from these APIs if you don't know what you are doing." +msgstr "" + +#: ../../internals.rst:7 +msgid "" +"The Web3 library has multiple layers of abstraction between the public " +"api exposed by the web3 object and the backend or node that web3 is " +"connecting to." +msgstr "" + +#: ../../internals.rst:10 +msgid "" +"**Providers** are responsible for the actual communication with the " +"blockchain such as sending JSON-RPC requests over HTTP or an IPC socket." +msgstr "" + +#: ../../internals.rst:12 +msgid "" +"**Middleware** provide hooks for monitoring and modifying requests and " +"responses to and from the provider." +msgstr "" + +#: ../../internals.rst:14 +msgid "" +"**Managers** provide thread safety and primitives to allow for " +"asynchronous usage of web3." +msgstr "" + +#: ../../internals.rst:16 +msgid "Here are some common things you might want to do with these APIs." +msgstr "" + +#: ../../internals.rst:18 +msgid "" +"Redirect certain RPC requests to different providers such as sending all " +"*read* operations to a provider backed by a remote node and all *write* " +"operations to a local node that you control." +msgstr "" + +#: ../../internals.rst:21 +msgid "" +"Transparently intercept transactions sent over ``eth_sendTransaction``, " +"sign them locally, and then send them through ``eth_sendRawTransaction``." +msgstr "" + +#: ../../internals.rst:23 +msgid "" +"Modify the response from an RPC request so that it is returned in " +"different format such as converting all integer values to their " +"hexadecimal representation." +msgstr "" + +#: ../../internals.rst:26 +msgid "Validate the inputs to RPC requests" +msgstr "" + +#: ../../internals.rst:30 +msgid "Request Lifecycle" +msgstr "" + +#: ../../internals.rst:32 +msgid "Each web3 RPC call passes through these layers in the following manner." +msgstr "" + +#: ../../internals.rst:56 +msgid "" +"You can visualize this relationship like an onion, with the Provider at " +"the center. The request originates from the ``Manager``, outside of the " +"onion, passing down through each layer of the onion until it reaches the " +"``Provider`` at the center. The ``Provider`` then handles the request, " +"producing a response which will then pass back out from the center of the" +" onion, through each layer until it is finally returned by the " +"``Manager``." +msgstr "" + +#: ../../internals.rst:65 +msgid "Providers" +msgstr "" + +#: ../../internals.rst:67 +msgid "" +"A provider is responsible for all direct blockchain interactions. In " +"most cases this means interacting with the JSON-RPC server for an " +"ethereum node over HTTP or an IPC socket. There is however nothing which" +" requires providers to be RPC based, allowing for providers designed for " +"testing purposes which use an in-memory EVM to fulfill requests." +msgstr "" + +#: ../../internals.rst:75 +msgid "Writing your own Provider" +msgstr "" + +#: ../../internals.rst:77 +msgid "" +"Writing your own provider requires implementing two required methods as " +"well as setting the middleware the provider should use." +msgstr "" + +#: ../../internals.rst:83 +msgid "" +"Each provider class **must** implement this method. This method " +"**should** return a JSON object with either a ``'result'`` key in the " +"case of success, or an ``'error'`` key in the case of failure." +msgstr "" + +#: ../../internals.rst:88 +msgid "" +"``method`` This will be a string representing the JSON-RPC method that " +"is being called such as ``'eth_sendTransaction'``." +msgstr "" + +#: ../../internals.rst:90 +msgid "" +"``params`` This will be a list or other iterable of the parameters for " +"the JSON-RPC method being called." +msgstr "" + +#: ../../internals.rst:96 +msgid "" +"This function should return ``True`` or ``False`` depending on whether " +"the provider should be considered *connected*. For example, an IPC " +"socket based provider should return ``True`` if the socket is open and " +"``False`` if the socket is closed." +msgstr "" + +#: ../../internals.rst:101 +msgid "" +"If set to ``True``, the optional ``show_traceback`` boolean will raise a " +"``ProviderConnectionError`` and provide information on why the provider " +"should not be considered *connected*." +msgstr "" + +#: ../../internals.rst:108 +msgid "This should be an iterable of middleware." +msgstr "" + +#: ../../internals.rst:110 +msgid "" +"You can set a new list of middleware by assigning to " +"``provider.middleware``, with the first middleware that processes the " +"request at the beginning of the list." +msgstr "" + +#: ../../internals.rst:115 +msgid "Provider Configurations" +msgstr "" + +#: ../../internals.rst:120 +msgid "Request Caching" +msgstr "" + +#: ../../internals.rst:123 +msgid "" +"Familiarize yourself with the validation logic for request caching before" +" enabling it. Since this feature often requires making additional " +"requests under the hood to try to guarantee the validity of the data, it " +"may create unnecessary overhead for your use case. Validation can be " +"turned off by setting the ``request_cache_validation_threshold`` option " +"to ``None``, caching all allowed requests, or configured for adjusting " +"performance to your needs." +msgstr "" + +#: ../../internals.rst:131 +msgid "" +"Request caching can be configured at the provider level via the following" +" configuration options on the provider instance:" +msgstr "" + +#: ../../internals.rst:134 +msgid "``cache_allowed_requests: bool = False``" +msgstr "" + +#: ../../internals.rst:135 +msgid "``cacheable_requests: Optional[Set[RPCEndpoint]]``" +msgstr "" + +#: ../../internals.rst:136 +msgid "" +"``request_cache_validation_threshold: " +"Optional[Union[RequestCacheValidationThreshold, int]]``" +msgstr "" + +#: ../../internals.rst:138 +msgid "" +"For requests that don't rely on block data (e.g., ``eth_chainId``), " +"enabling request caching by setting the ``cache_allowed_requests`` option" +" to ``True`` will cache all responses. This is safe to do." +msgstr "" + +#: ../../internals.rst:142 +msgid "" +"However, for requests that rely on block data (e.g., " +"``eth_getBlockByNumber``), it is not safe to always cache their responses" +" because block data can change - during a chain reorganization or while " +"finality has not been reached, for example. The " +"``request_cache_validation_threshold`` option allows configuring a safe " +"threshold for caching responses that depend on block data. By default, " +"this option is configured to internal values deemed \"safe\" for the " +"chain id you are connected to. If you are connected to mainnet Ethereum, " +"this value is set to the ``finalized`` block number. If you are connected" +" to another chain, this value is set to a time interval in seconds, from " +"the current time, that is deemed \"safe\" for that chain's finality " +"mechanism." +msgstr "" + +#: ../../internals.rst:152 +msgid "" +"**It's important to understand that, in order to perform these " +"validations, extra requests are sometimes made to the node to get the " +"appropriate information. For a transaction request, for example, it is " +"necessary to get the block information to validate the transaction is " +"beyond the safe threshold. This can create overhead, especially for high-" +"frequency requests. For this reason, it is important to understand when " +"to turn on caching and how to configure the validation appropriately for " +"your use case in order to avoid unnecessary overhead.**" +msgstr "" + +#: ../../internals.rst:160 +msgid "" +"We keep a list of some reasonable values for bigger chains and use the " +"time interval of 1 hour for everything else. Below is a list of the " +"default values for internally configured chains:" +msgstr "" + +#: ../../internals.rst:164 +msgid "ETH: RequestCacheValidationThreshold.FINALIZED (\"finalized\" block)" +msgstr "" + +#: ../../internals.rst:165 +msgid "ARB1: 7 days" +msgstr "" + +#: ../../internals.rst:166 +msgid "ZKSYNC: 1 hour" +msgstr "" + +#: ../../internals.rst:167 +msgid "OETH: 3 minutes" +msgstr "" + +#: ../../internals.rst:168 +msgid "MATIC: 30 minutes" +msgstr "" + +#: ../../internals.rst:169 +msgid "ZKEVM: 1 hour" +msgstr "" + +#: ../../internals.rst:170 +msgid "BASE: 7 days" +msgstr "" + +#: ../../internals.rst:171 +msgid "SCR: 1 hour" +msgstr "" + +#: ../../internals.rst:172 +msgid "GNO: 5 minutes" +msgstr "" + +#: ../../internals.rst:173 +msgid "AVAX: 2 minutes" +msgstr "" + +#: ../../internals.rst:174 +msgid "BNB: 2 minutes" +msgstr "" + +#: ../../internals.rst:175 +msgid "FTM: 1 minute" +msgstr "" + +#: ../../internals.rst:177 +msgid "" +"For Ethereum mainnet, for example, this means that a request's response " +"will be cached if the block number the request relies on is less than or " +"equal to the ``finalized`` block number. If the block number exceeds the " +"``finalized`` block number, the response won't be cached. For all others," +" the response will be cached if the block timestamp related to the data " +"that is being requested is older than or equal to the time interval " +"configured for that chain. For any chain not on this list, the default " +"value is set to 1 hour (this includes all testnets)." +msgstr "" + +#: ../../internals.rst:185 +msgid "" +"This behavior can be modified by setting the " +"``request_cache_validation_threshold`` option to " +"``RequestCacheValidationThreshold.SAFE``, which uses the ``safe`` block " +"as the threshold (Ethereum mainnet only), to your own time interval in " +"seconds (for any chain, including mainnet Ethereum), or to ``None``, " +"which disables any validation and caches all requests (this is not " +"recommended for non testnet chains). The " +"``RequestCacheValidationThreshold`` enum, for mainnet ``finalized`` and " +"``safe`` values, is imported from the ``web3.utils`` module." +msgstr "" + +#: ../../internals.rst:193 +msgid "" +"Note that the ``cacheable_requests`` option can be used to specify a set " +"of RPC endpoints that are allowed to be cached. By default, this option " +"is set to an internal list of deemed-safe-to-cache endpoints, excluding " +"endpoints such as ``eth_call``, whose responses can vary and are not safe" +" to cache. The default list of cacheable requests is below, with requests" +" validated by the ``request_cache_validation_threshold`` option in bold:" +msgstr "" + +#: ../../internals.rst:200 +msgid "eth_chainId" +msgstr "" + +#: ../../internals.rst:201 +msgid "web3_clientVersion" +msgstr "" + +#: ../../internals.rst:202 +msgid "net_version" +msgstr "" + +#: ../../internals.rst:203 +msgid "**eth_getBlockByNumber**" +msgstr "" + +#: ../../internals.rst:204 +msgid "**eth_getRawTransactionByBlockNumberAndIndex**" +msgstr "" + +#: ../../internals.rst:205 +msgid "**eth_getBlockTransactionCountByNumber**" +msgstr "" + +#: ../../internals.rst:206 +msgid "**eth_getUncleByBlockNumberAndIndex**" +msgstr "" + +#: ../../internals.rst:207 +msgid "**eth_getUncleCountByBlockNumber**" +msgstr "" + +#: ../../internals.rst:208 +msgid "**eth_getBlockByHash**" +msgstr "" + +#: ../../internals.rst:209 +msgid "**eth_getTransactionByHash**" +msgstr "" + +#: ../../internals.rst:210 +msgid "**eth_getTransactionByBlockNumberAndIndex**" +msgstr "" + +#: ../../internals.rst:211 +msgid "**eth_getTransactionByBlockHashAndIndex**" +msgstr "" + +#: ../../internals.rst:212 +msgid "**eth_getBlockTransactionCountByHash**" +msgstr "" + +#: ../../internals.rst:213 +msgid "**eth_getRawTransactionByBlockHashAndIndex**" +msgstr "" + +#: ../../internals.rst:214 +msgid "**eth_getUncleByBlockHashAndIndex**" +msgstr "" + +#: ../../internals.rst:215 +msgid "**eth_getUncleCountByBlockHash**" +msgstr "" + +#: ../../internals.rst:239 +msgid "Retry Requests for HTTP Providers" +msgstr "" + +#: ../../internals.rst:241 +msgid "" +"``HTTPProvider`` and ``AsyncHTTPProvider`` instances retry certain " +"requests by default on exceptions. This can be configured via the " +"``exception_retry_configuration`` property on the provider instance, " +"which takes a " +":class:`~web3.providers.rpc.utils.ExceptionRetryConfiguration` class as " +"its value. The retry mechanism employs an exponential backoff strategy, " +"starting from the initial value determined by the ``backoff_factor``, and" +" doubling the delay with each attempt, up to the ``retries`` value. Below" +" is an example showing the default options for the retry configuration " +"and how to override them." +msgstr "" + +#: ../../internals.rst:255 +msgid "" +"A tuple of exceptions that the provider should retry on. The default is " +"``HTTPProvider``: ``(ConnectionError, requests.HTTPError, " +"requests.Timeout)`` and ``AsyncHTTPProvider``: ``(aiohttp.ClientError, " +"asyncio.TimeoutError)``." +msgstr "" + +#: ../../internals.rst:261 +msgid "The number of retries to attempt. The default is 5." +msgstr "" + +#: ../../internals.rst:265 +msgid "" +"The initial delay multiplier, which doubles with each retry attempt. The " +"default is 0.125." +msgstr "" + +#: ../../internals.rst:270 +msgid "" +"A list of retryable methods. The default is an in-house list of deemed-" +"safe-to- retry methods." +msgstr "" + +#: ../../internals.rst:297 +msgid "For the different http providers, ``DEFAULT_EXCEPTIONS`` is defined as:" +msgstr "" + +#: ../../internals.rst:299 +msgid "" +"``HTTPProvider``: ``(ConnectionError, requests.HTTPError, " +"requests.Timeout)``" +msgstr "" + +#: ../../internals.rst:300 +msgid "" +"``AsyncHTTPProvider``: ``(ConnectionError, aiohttp.ClientError, " +"asyncio.TimeoutError)``" +msgstr "" + +#: ../../internals.rst:302 +msgid "" +"Setting ``retry_configuration`` to ``None`` will disable retries on " +"exceptions for the provider instance." +msgstr "" + +#: ../../internals.rst:314 +msgid "Managers" +msgstr "" + +#: ../../internals.rst:316 +msgid "" +"The Manager acts as a gatekeeper for the request/response lifecycle. It " +"is unlikely that you will need to change the Manager as most " +"functionality can be implemented in the Middleware layer." +msgstr "" + +#: ../../internals.rst:323 +msgid "Request Processing for Persistent Connection Providers" +msgstr "" + +#: ../../internals.rst:327 +msgid "" +"The ``RequestProcessor`` class is responsible for the storing and syncing" +" up of asynchronous requests to responses for a " +"``PersistentConnectionProvider``. The " +":class:`~web3.providers.persistent.WebSocketProvider` and the " +":class:`~web3.providers.persistent.AsyncIPCProvider` are two persistent " +"connection providers. In order to send a request and receive a response " +"to that same request, ``PersistentConnectionProvider`` instances have to " +"match request *id* values to response *id* values coming back from the " +"socket connection. Any provider that does not adhere to the `JSON-RPC 2.0" +" specification `_ in this way will" +" not work with ``PersistentConnectionProvider`` instances. The specifics " +"of how the request processor handles this are outlined below." +msgstr "" + +#: ../../internals.rst:339 +msgid "Listening for Responses" +msgstr "" + +#: ../../internals.rst:341 +msgid "" +"Implementations of the ``PersistentConnectionProvider`` class have a " +"message listener background task that is called when the socket " +"connection is established. This task is responsible for listening for any" +" and all messages coming in over the socket connection and storing them " +"in the ``RequestProcessor`` instance internal to the " +"``PersistentConnectionProvider`` instance. The ``RequestProcessor`` " +"instance is responsible for storing the messages in the correct cache, " +"either the one-to-one cache or the one-to-many (subscriptions) queue, " +"depending on whether the message has a JSON-RPC *id* value or not." +msgstr "" + +#: ../../internals.rst:352 +msgid "One-To-One Requests" +msgstr "" + +#: ../../internals.rst:354 +msgid "" +"One-to-one requests can be summarized as any request that expects only " +"one response back. An example is using the ``eth`` module API to request " +"the latest block number." +msgstr "" + +#: ../../internals.rst:366 +msgid "" +"With persistent socket connections, we have to call ``send()`` and " +"asynchronously receive responses via another means, generally by calling " +"``recv()`` or by iterating on the socket connection for messages. As " +"outlined above, the ``PersistentConnectionProvider`` class has a message " +"listener background task that handles the receiving of messages." +msgstr "" + +#: ../../internals.rst:372 +msgid "" +"Due to this asynchronous nature of sending and receiving, in order to " +"make one-to-one request-to-response calls work, we have to save the " +"request information somewhere so that, when the response is received, we " +"can match it to the original request that was made (i.e. the request with" +" a matching *id* to the response that was received). The stored request " +"information is then used to process the response when it is received, " +"piping it through the response formatters and middleware internal to the " +"*web3.py* library." +msgstr "" + +#: ../../internals.rst:380 +msgid "" +"In order to store the request information, the ``RequestProcessor`` class" +" has an internal ``RequestInformation`` cache. The ``RequestInformation``" +" class saves important information about a request." +msgstr "" + +#: ../../internals.rst:388 +msgid "The name of the method - e.g. \"eth_subscribe\"." +msgstr "" + +#: ../../internals.rst:392 +msgid "" +"The params used when the call was made - e.g. " +"(\"newPendingTransactions\", True)." +msgstr "" + +#: ../../internals.rst:396 +msgid "The formatters that will be used to process the response." +msgstr "" + +#: ../../internals.rst:400 +msgid "" +"Any middleware that processes responses that is present on the instance " +"at the time of the request is appended here, in order, so the response " +"may be piped through that logic when it comes in." +msgstr "" + +#: ../../internals.rst:406 +msgid "" +"If the request is an ``eth_subscribe`` request, rather than popping this " +"information from the cache when the response to the subscription call " +"comes in (i.e. the subscription *id*), we save the subscription id with " +"the request information so that we can correctly process all subscription" +" messages that come in with that subscription *id*. For one-to-one " +"request-to-response calls, this value is always ``None``." +msgstr "" + +#: ../../internals.rst:413 +msgid "" +"One-to-one responses, those that include a JSON-RPC *id* in the response " +"object, are stored in an internal ``SimpleCache`` class, isolated from " +"any one-to-many responses. When the ``PersistentConnectionProvider`` is " +"looking for a response internally, it will expect the message listener " +"task to store the response in this cache. Since the request *id* is used " +"in the cache key generation, it will then look for a cache key that " +"matches the response *id* with that of the request *id*. If the cache key" +" is found, the response is processed and returned to the user. If the " +"cache key is not found, the operation will time out and raise a " +"``TimeExhausted`` exception. This timeout can be configured by the user " +"when instantiating the ``PersistentConnectionProvider`` instance via the " +"``response_timeout`` keyword argument." +msgstr "" + +#: ../../internals.rst:425 +msgid "One-To-Many Requests" +msgstr "" + +#: ../../internals.rst:427 +msgid "" +"One-to-many requests can be summarized by any request that expects many " +"responses as a result of the initial request. The only current example is" +" the ``eth_subscribe`` request. The initial ``eth_subscribe`` request " +"expects only one response, the subscription *id* value, but it also " +"expects to receive many ``eth_subscription`` messages if and when the " +"request is successful. For this reason, the original request is " +"considered a one-to-one request so that a subscription *id* can be " +"returned to the user on the same line. The many responses this call will " +"produce can be handled in one of a few ways." +msgstr "" + +#: ../../internals.rst:436 +msgid "" +"The recommended way to handle one-to-many responses is to use the " +"subscription manager API. The subscription manager API is a public API on" +" the ``AsyncWeb3`` class, when connected to a " +"``PersistentConnectionProvider`` instance, that allows the user to " +"subscribe to a subscription and handle the many responses asynchronously." +" The ``subscription_manager`` instance is responsible for handling the " +"many responses that come in over the socket connection, as long as " +"handlers are passed to each subscription call. The subscription manager " +"can also be used to unsubscribe from a subscription when the user is done" +" with it." +msgstr "" + +#: ../../internals.rst:468 +msgid "" +"The manager can also subscribe to many subscriptions at one time. The " +"``EthSubscription`` classes, available via ``web3.utils.subscriptions``, " +"provide a friendly API for managing subscriptions. Since each connection " +"and provider instance has its own message listener task and subscription " +"manager instance, you can subscribe to many subscriptions at once and " +"handle the many responses that come in over the socket connections via " +"handlers. The handlers contain:" +msgstr "" + +#: ../../internals.rst:475 +msgid "" +"``async_w3``: The ``AsyncWeb3`` instance that the subscription was made " +"on." +msgstr "" + +#: ../../internals.rst:476 +msgid "" +"``subscription``: The subscription instance that the handler is attached " +"to." +msgstr "" + +#: ../../internals.rst:477 +msgid "" +"``result``: The response that came in over the socket connection for the " +"subscription." +msgstr "" + +#: ../../internals.rst:479 +msgid "" +"Subscriptions also accept a ``handler_context`` argument that can be used" +" to pass additional information to the handler when subscribing to a " +"subscription. This can be used to pass in an event object, for example, " +"that can be used to parse a log event when it comes in." +msgstr "" + +#: ../../internals.rst:571 +msgid "" +"The ``process_subscriptions()`` method on the " +":class:`~web3.providers.persistent.PersistentConnection` class, the " +"public API for interacting with the active persistent socket connection, " +"is also set up to receive ``eth_subscription`` responses over an " +"asynchronous iterator pattern. You can use this method to listen for raw " +"messages and process them as they come in." +msgstr "" + +#: ../../internals.rst:603 +msgid "" +"One-to-many responses, those that do not include a JSON-RPC *id* in the " +"response object, are stored in an internal ``asyncio.Queue`` instance, " +"isolated from any one-to-one responses. When the " +"``PersistentConnectionProvider`` is looking for one-to-many responses " +"internally, it will expect the message listener task to store these " +"messages in this queue. Since the order of the messages is important, the" +" queue is a FIFO queue. The ``process_subscriptions()`` method on the " +"``PersistentConnection`` class is set up to pop messages from this queue " +"as FIFO over an asynchronous iterator pattern." +msgstr "" + +#: ../../internals.rst:611 +msgid "" +"If the stream of messages from the socket is not being interrupted by any" +" other tasks, the queue will generally be in sync with the messages " +"coming in over the socket. That is, the message listener will put a " +"message in the queue and the ``process_subscriptions()`` method will pop " +"that message from the queue and yield control of the loop back to the " +"listener. This will continue until the socket connection is closed or the" +" user unsubscribes from the subscription. If the stream of messages lags " +"a bit, or the provider is not consuming messages but has subscribed to a " +"subscription, this internal queue may fill up with messages until it " +"reaches its max size and then trigger a waiting ``asyncio.Event`` until " +"the provider begins consuming messages from the queue again. For this " +"reason, it's important to begin consuming messages from the queue, via " +"the ``process_subscriptions()`` method, as soon as a subscription is " +"made." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/middleware.po b/docs/locales/zh_CN/LC_MESSAGES/middleware.po new file mode 100644 index 0000000000..9da220a8d7 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/middleware.po @@ -0,0 +1,512 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../middleware.rst:4 +msgid "Middleware" +msgstr "中间件" + +#: ../../middleware.rst:6 +msgid "" +"``Web3`` is instantiated with layers of middleware by default. They sit " +"between the public ``Web3`` methods and the :doc:`providers`, and are " +"used to perform sanity checks, convert data types, enable ENS support, " +"and more. Each layer can modify the request and/or response. While " +"several middleware are enabled by default, others are available for " +"optional use, and you're free to create your own!" +msgstr "" + +#: ../../middleware.rst:12 +msgid "" +"Each middleware layer gets invoked before the request reaches the " +"provider, and then processes the result after the provider returns, in " +"reverse order. However, it is possible for a middleware to return early " +"from a call without the request ever getting to the provider (or even " +"reaching the middleware that are in deeper layers)." +msgstr "" + +#: ../../middleware.rst:21 +msgid "Configuring Middleware" +msgstr "" + +#: ../../middleware.rst:23 +msgid "" +"Middleware can be added, removed, replaced, and cleared at runtime. To " +"make that easier, you can name the middleware for later reference." +msgstr "" + +#: ../../middleware.rst:27 +msgid "Middleware Order" +msgstr "" + +#: ../../middleware.rst:29 +msgid "" +"Think of the middleware as being layered in an onion, where you initiate " +"a web3.py request at the outermost layer of the onion, and the Ethereum " +"node (like geth) receives and responds to the request inside the " +"innermost layer of the onion. Here is a (simplified) diagram:" +msgstr "" + +#: ../../middleware.rst:86 +msgid "" +"The middleware are maintained in ``Web3.middleware_onion``. See below for" +" the API." +msgstr "" + +#: ../../middleware.rst:88 +msgid "" +"When specifying middleware in a list, or retrieving the list of " +"middleware, they will be returned in the order of outermost layer first " +"and innermost layer last. In the above example, that means that " +"``w3.middleware_onion.middleware`` would return the middleware in the " +"order of: ``[2, 1, 0]``." +msgstr "" + +#: ../../middleware.rst:97 +msgid "Middleware Stack API" +msgstr "" + +#: ../../middleware.rst:99 +msgid "To add or remove items in different layers, use the following API:" +msgstr "" + +#: ../../middleware.rst:103 +msgid "" +"Middleware will be added to the outermost layer. That means the new " +"middleware will modify the request first, and the response last. You can " +"optionally name it with any hashable object, typically a string." +msgstr "" + +#: ../../middleware.rst:116 +msgid "Inject a named middleware to an arbitrary layer." +msgstr "" + +#: ../../middleware.rst:118 +msgid "" +"The current implementation only supports injection at the innermost or " +"outermost layers. Note that injecting to the outermost layer is " +"equivalent to calling :meth:`Web3.middleware_onion.add` ." +msgstr "" + +#: ../../middleware.rst:132 +msgid "" +"Middleware will be removed from whatever layer it was in. If you added " +"the middleware with a name, use the name to remove it. If you added the " +"middleware as an object, use the object again later to remove it:" +msgstr "" + +#: ../../middleware.rst:145 +msgid "" +"Middleware will be replaced from whatever layer it was in. If the " +"middleware was named, it will continue to have the same name. If it was " +"un-named, then you will now reference it with the new middleware object." +msgstr "" + +#: ../../middleware.rst:166 +msgid "Empty all the middleware, including the default ones." +msgstr "" + +#: ../../middleware.rst:176 +msgid "" +"Return all the current middleware for the ``Web3`` instance in the " +"appropriate order for importing into a new ``Web3`` instance." +msgstr "" + +#: ../../middleware.rst:194 +msgid "Instantiate with Custom Middleware" +msgstr "" + +#: ../../middleware.rst:196 +msgid "" +"Instead of working from the default list, you can specify a custom list " +"of middleware when initializing Web3:" +msgstr "" + +#: ../../middleware.rst:204 +msgid "" +"This will *replace* the default middleware. To keep the default " +"functionality, either use ``middleware_onion.add()`` from above, or add " +"the default middleware to your list of new middleware." +msgstr "" + +#: ../../middleware.rst:212 +msgid "Default Middleware" +msgstr "" + +#: ../../middleware.rst:214 +msgid "The following middleware are included by default:" +msgstr "" + +#: ../../middleware.rst:216 +msgid "``gas_price_strategy``" +msgstr "" + +#: ../../middleware.rst:217 +msgid "``ens_name_to_address``" +msgstr "" + +#: ../../middleware.rst:218 +msgid "``attrdict``" +msgstr "" + +#: ../../middleware.rst:219 +msgid "``validation``" +msgstr "" + +#: ../../middleware.rst:220 +msgid "``gas_estimate``" +msgstr "" + +#: ../../middleware.rst:222 +msgid "" +"The defaults are defined in the ``get_default_middleware()`` method in " +"``web3/manager.py``." +msgstr "" + +#: ../../middleware.rst:225 +msgid "AttributeDict" +msgstr "" + +#: ../../middleware.rst:229 +msgid "" +"This middleware recursively converts any dictionary type in the result of" +" a call to an ``AttributeDict``. This enables dot-syntax access, like " +"``eth.get_block('latest').number`` in addition to " +"``eth.get_block('latest')['number']``." +msgstr "" + +#: ../../middleware.rst:235 +msgid "" +"Accessing a property via attribute breaks type hinting. For this reason, " +"this feature is available as a middleware, which may be removed if " +"desired." +msgstr "" + +#: ../../middleware.rst:239 +msgid "ENS Name to Address Resolution" +msgstr "" + +#: ../../middleware.rst:243 +msgid "" +"This middleware converts Ethereum Name Service (ENS) names into the " +"address that the name points to. For example " +":meth:`w3.eth.send_transaction ` will " +"accept .eth names in the 'from' and 'to' fields." +msgstr "" + +#: ../../middleware.rst:248 +msgid "" +"This middleware only converts ENS names on chains where the proper ENS " +"contracts are deployed to support this functionality. All other cases " +"will result in a ``NameNotFound`` error." +msgstr "" + +#: ../../middleware.rst:253 +msgid "Gas Price Strategy" +msgstr "" + +#: ../../middleware.rst:259 +msgid "" +"Gas price strategy is only supported for legacy transactions. The London " +"fork introduced ``maxFeePerGas`` and ``maxPriorityFeePerGas`` transaction" +" parameters which should be used over ``gasPrice`` whenever possible." +msgstr "" + +#: ../../middleware.rst:263 +msgid "" +"This adds a ``gasPrice`` to transactions if applicable and when a gas " +"price strategy has been set. See :ref:`Gas_Price` for information about " +"how gas price is derived." +msgstr "" + +#: ../../middleware.rst:267 +msgid "Buffered Gas Estimate" +msgstr "" + +#: ../../middleware.rst:271 +msgid "" +"This adds a gas estimate to transactions if ``gas`` is not present in the" +" transaction parameters. Sets gas to: ``min(w3.eth.estimate_gas + " +"gas_buffer, gas_limit)`` where the gas_buffer default is 100,000" +msgstr "" + +#: ../../middleware.rst:277 +msgid "Validation" +msgstr "" + +#: ../../middleware.rst:281 +msgid "" +"This middleware includes block and transaction validators which perform " +"validations for transaction parameters." +msgstr "" + +#: ../../middleware.rst:286 +msgid "Optional Middleware" +msgstr "" + +#: ../../middleware.rst:288 +msgid "" +"``Web3`` includes optional middleware for common use cases. Below is a " +"list of available middleware which are not enabled by default." +msgstr "" + +#: ../../middleware.rst:292 +msgid "Stalecheck" +msgstr "" + +#: ../../middleware.rst:296 +msgid "" +"This middleware checks how stale the blockchain is, and interrupts calls " +"with a failure if the blockchain is too old." +msgstr "" + +#: ../../middleware.rst:299 +msgid "" +"``allowable_delay`` is the length in seconds that the blockchain is " +"allowed to be behind of ``time.time()``" +msgstr "" + +#: ../../middleware.rst:302 +msgid "" +"Because this middleware takes an argument, you must create the middleware" +" with a method call." +msgstr "" + +#: ../../middleware.rst:310 +msgid "" +"If the latest block in the blockchain is older than 2 days in this " +"example, then the middleware will raise a ``StaleBlockchain`` exception " +"on every call except ``web3.eth.get_block()``." +msgstr "" + +#: ../../middleware.rst:318 +msgid "Proof of Authority" +msgstr "" + +#: ../../middleware.rst:323 +msgid "" +"It is **crucial** that this middleware is injected at the 0th layer of " +"the middleware onion, using " +"``w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)``, to " +"guarantee it is the *first* middleware to process the response and modify" +" the ``extraData`` field. This ensures it processes the field before any " +"other middleware attempts to validate it." +msgstr "" + +#: ../../middleware.rst:330 +msgid "" +"``ExtraDataToPOAMiddleware`` is required to connect to ``geth --dev`` and" +" may also be needed for other EVM compatible blockchains like Polygon or " +"BNB Chain (Binance Smart Chain)." +msgstr "" + +#: ../../middleware.rst:334 +msgid "" +"If the middleware is not injected at the 0th layer of the middleware " +"onion, you may get errors like the example below when interacting with " +"your EVM node." +msgstr "" + +#: ../../middleware.rst:344 +msgid "" +"The easiest way to connect to a default ``geth --dev`` instance which " +"loads the middleware is:" +msgstr "" + +#: ../../middleware.rst:355 +msgid "" +"This example connects to a local ``geth --dev`` instance on Linux with a " +"unique IPC location and loads the middleware:" +msgstr "" + +#: ../../middleware.rst:375 +msgid "Why is ``ExtraDataToPOAMiddleware`` necessary?" +msgstr "" + +#: ../../middleware.rst:377 +msgid "" +"There is no strong community consensus on a single Proof-of-Authority " +"(PoA) standard yet. Some nodes have successful experiments running " +"though. One is go-ethereum (geth), which uses a prototype PoA for its " +"development mode and the Goerli test network." +msgstr "" + +#: ../../middleware.rst:381 +msgid "" +"Unfortunately, it does deviate from the yellow paper specification, which" +" constrains the ``extraData`` field in each block to a maximum of " +"32-bytes. Geth is one such example where PoA uses more than 32 bytes, so " +"this middleware modifies the block data a bit before returning it." +msgstr "" + +#: ../../middleware.rst:389 +msgid "Locally Managed Log and Block Filters" +msgstr "" + +#: ../../middleware.rst:393 +msgid "" +"This middleware provides an alternative to ethereum node managed filters." +" When used, Log and Block filter logic are handled locally while using " +"the same web3 filter api. Filter results are retrieved using JSON-RPC " +"endpoints that don't rely on server state." +msgstr "" + +#: ../../middleware.rst:412 +msgid "Signing" +msgstr "" + +#: ../../middleware.rst:416 +msgid "" +"This middleware automatically captures transactions, signs them, and " +"sends them as raw transactions. The ``from`` field on the transaction, or" +" ``w3.eth.default_account`` must be set to the address of the private key" +" for this middleware to have any effect." +msgstr "" + +#: ../../middleware.rst:420 +msgid "The ``build`` method for this middleware builder takes a single argument:" +msgstr "" + +#: ../../middleware.rst:422 +msgid "" +"``private_key_or_account`` A single private key or a tuple, list or set " +"of private keys." +msgstr "" + +#: ../../middleware.rst:424 +msgid "Keys can be in any of the following formats:" +msgstr "" + +#: ../../middleware.rst:426 +msgid "An ``eth_account.LocalAccount`` object" +msgstr "" + +#: ../../middleware.rst:427 +msgid "An ``eth_keys.PrivateKey`` object" +msgstr "" + +#: ../../middleware.rst:428 +msgid "A raw private key as a hex string or byte string" +msgstr "" + +#: ../../middleware.rst:431 +msgid "" +"Since this middleware signs transactions, it must always run after any " +"middleware that modifies the transaction. Therefore, it is recommended to" +" inject the signing middleware at the 0th layer of the middleware onion " +"using " +"``w3.middleware_onion.inject(SignAndSendRawMiddlewareBuilder.build(...), " +"layer=0)``. Ensure that any transaction-modifying middleware exists in a " +"higher layer within the onion so that it runs before the signing " +"middleware." +msgstr "" + +#: ../../middleware.rst:439 +msgid "" +"If used with ``ExtraDataToPOAMiddleware``, the injection order doesn't " +"matter, as the ``extraData`` field isn't involved in transaction signing." +" The key is ensuring ``SignAndSendRawMiddlewareBuilder`` runs after any " +"middleware that modifies the transaction." +msgstr "" + +#: ../../middleware.rst:455 +msgid "" +":ref:`Hosted nodes` (like Infura or Alchemy) only " +"support signed transactions. This often results in " +"``send_raw_transaction`` being used repeatedly. Instead, we can automate " +"this process with " +"``SignAndSendRawMiddlewareBuilder.build(private_key_or_account)``." +msgstr "" + +#: ../../middleware.rst:475 +msgid "Similarly, with AsyncWeb3:" +msgstr "" + +#: ../../middleware.rst:492 +msgid "" +"Now you can send a transaction from acct.address without having to build " +"and sign each raw transaction." +msgstr "" + +#: ../../middleware.rst:494 +msgid "" +"When making use of this signing middleware, when sending dynamic fee " +"transactions (recommended over legacy transactions), the transaction " +"``type`` of ``2`` (or ``'0x2'``) is necessary. This is because " +"transaction signing is validated based on the transaction ``type`` " +"parameter. This value defaults to ``'0x2'`` when ``maxFeePerGas`` and / " +"or ``maxPriorityFeePerGas`` are present as parameters in the transaction " +"as these params imply a dynamic fee transaction. Since these values " +"effectively replace the legacy ``gasPrice`` value, do not set a " +"``gasPrice`` for dynamic fee transactions. Doing so will lead to " +"validation issues." +msgstr "" + +#: ../../middleware.rst:514 +msgid "" +"A legacy transaction still works in the same way as it did before " +"EIP-1559 was introduced:" +msgstr "" + +#: ../../middleware.rst:527 +msgid "Creating Custom Middleware" +msgstr "" + +#: ../../middleware.rst:529 +msgid "" +"To write your own middleware, create a class and extend from the base " +"``Web3Middleware`` class, then override only the parts of the middleware " +"that make sense for your use case." +msgstr "" + +#: ../../middleware.rst:532 +msgid "" +"The Middleware API borrows from the Django middleware API introduced in " +"version 1.10.0." +msgstr "" + +#: ../../middleware.rst:535 +msgid "" +"If all you need is to modify the params before a request is made, you can" +" override the ``request_processor`` method, make the necessary tweaks to " +"the params, and pass the arguments to the next element in the middleware " +"stack. Need to do some processing on the response? Override the " +"``response_processor`` method and return the modified response." +msgstr "" + +#: ../../middleware.rst:540 +msgid "The pattern:" +msgstr "" + +#: ../../middleware.rst:567 +msgid "" +"If you wish to prevent making a call under certain conditions, you can " +"override the ``wrap_make_request`` method. This allows for defining pre-" +"request processing, skipping or making the request under certain " +"conditions, as well as response processing before passing it to the next " +"middleware." +msgstr "" + +#: ../../middleware.rst:600 +msgid "" +"Custom middleware can be added to the stack via the class itself, using " +"the :ref:`middleware_stack_api`. The ``name`` kwarg is optional. For " +"example:" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/migration.po b/docs/locales/zh_CN/LC_MESSAGES/migration.po new file mode 100644 index 0000000000..fd66a7fd9f --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/migration.po @@ -0,0 +1,1374 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../migration.rst:2 +msgid "Migration Guide" +msgstr "迁移指南" + +#: ../../migration.rst:7 +msgid "Migrating from v6 to v7" +msgstr "" + +#: ../../migration.rst:9 +msgid "" +"web3.py follows `Semantic Versioning `_, which means " +"that version 7 introduced backwards-incompatible changes. If you're " +"upgrading from web3.py ``v6`` or earlier, you can expect to need to make " +"some changes. Refer to this guide for a summary of breaking changes when " +"updating from ``v6`` to ``v7``. If you are more than one major version " +"behind, you should also review the migration guides for the versions in " +"between." +msgstr "" + +#: ../../migration.rst:18 +msgid "Provider Updates" +msgstr "" + +#: ../../migration.rst:22 +msgid "WebSocketProvider" +msgstr "" + +#: ../../migration.rst:24 +msgid "" +"``WebsocketProviderV2``, introduced in web3.py ``v6``, has taken priority" +" over the legacy ``WebsocketProvider``. The ``LegacyWebSocketProvider`` " +"has been deprecated in ``v7`` and is slated for removal in the next major" +" version of the library. In summary:" +msgstr "" + +#: ../../migration.rst:28 +msgid "``WebsocketProvider`` -> ``LegacyWebSocketProvider`` (and deprecated)" +msgstr "" + +#: ../../migration.rst:29 +msgid "``WebsocketProviderV2`` -> ``WebSocketProvider``" +msgstr "" + +#: ../../migration.rst:31 +msgid "" +"If migrating from ``WebSocketProviderV2`` to ``WebSocketProvider``, you " +"can expect the following changes:" +msgstr "" + +#: ../../migration.rst:34 +msgid "Instantiation no longer requires the ``persistent_websocket`` method:" +msgstr "" + +#: ../../migration.rst:44 +msgid "" +"Handling incoming subscription messages now occurs under a more flexible " +"namespace: ``socket``. The ``AsyncIPCProvider`` uses the same API to " +"listen for messages via an IPC socket." +msgstr "" + +#: ../../migration.rst:60 +msgid "AsyncIPCProvider (non-breaking feature)" +msgstr "" + +#: ../../migration.rst:62 +msgid "" +"An asynchronous IPC provider, ``AsyncIPCProvider``, is newly available in" +" ``v7``. This provider makes use of some of the same internals that the " +"new ``WebSocketProvider`` introduced, allowing it to also support " +"``eth_subscription``." +msgstr "" + +#: ../../migration.rst:68 +msgid "EthereumTesterProvider" +msgstr "" + +#: ../../migration.rst:70 +msgid "" +"``EthereumTesterProvider`` now returns ``input`` instead of ``data`` for " +"``eth_getTransaction*`` calls, as expected." +msgstr "" + +#: ../../migration.rst:75 +msgid "Middlewares -> Middleware" +msgstr "" + +#: ../../migration.rst:77 +msgid "" +"All references to ``middlewares`` have been replaced with the more " +"grammatically correct ``middleware``. Notably, this includes when a " +"provider needs to be instantiated with custom middleware." +msgstr "" + +#: ../../migration.rst:83 +msgid "Class-Based Middleware Model" +msgstr "" + +#: ../../migration.rst:85 +msgid "The middleware model has been changed to a class-based model." +msgstr "" + +#: ../../migration.rst:97 +msgid "" +"Previously, middleware were defined as functions that tightly wrapped the" +" provider's ``make_request`` function, where transformations could be " +"conditionally applied before and after the request was made." +msgstr "" + +#: ../../migration.rst:101 +msgid "" +"Now, middleware logic can be separated into ``request_processor`` and " +"``response_processor`` functions that enable pre-request and post-" +"response logic, respectively. This change offers a simpler, clearer " +"interface for defining middleware, gives more flexibility for " +"asynchronous operations and also paved the way for supporting " +":ref:`batch_requests`." +msgstr "" + +#: ../../migration.rst:106 +msgid "" +"Major changes for migration are highlighted in this section. Consult the " +":ref:`middleware_internals` section of the documentation for specifics " +"and examples on the new class-based design." +msgstr "" + +#: ../../migration.rst:112 +msgid "Middleware Builder Classes" +msgstr "" + +#: ../../migration.rst:114 +msgid "" +"In ``v6``, certain middleware needed to be constructed with parameters. " +"This was done by passing the parameters to a constructor method." +msgstr "" + +#: ../../migration.rst:123 +msgid "" +"In the class-based ``v7`` middleware model, a middleware builder class is" +" instantiated with the necessary parameters via the ``build()`` method." +msgstr "" + +#: ../../migration.rst:134 +msgid "Middleware Renaming and Removals" +msgstr "" + +#: ../../migration.rst:136 +msgid "The following middleware have been renamed for generalization or clarity:" +msgstr "" + +#: ../../migration.rst:138 +msgid "``name_to_address_middleware`` -> ``ENSNameToAddressMiddleware``" +msgstr "" + +#: ../../migration.rst:139 +msgid "``geth_poa_middleware`` -> ``ExtraDataToPOAMiddleware``" +msgstr "" + +#: ../../migration.rst:141 ../../migration.rst:156 ../../migration.rst:174 +msgid "The following middleware have been removed:" +msgstr "" + +#: ../../migration.rst:145 +msgid "ABI Middleware" +msgstr "" + +#: ../../migration.rst:147 +msgid "" +"``abi_middleware`` is no longer necessary and has been removed. All of " +"the functionality of the ``abi_middleware`` was already handled by " +"web3.py's ABI formatters. For additional context: a bug in the ENS name-" +"to-address middleware would override the formatters. Fixing this bug has " +"removed the need for the ``abi_middleware``." +msgstr "" + +#: ../../migration.rst:154 +msgid "Caching Middleware" +msgstr "" + +#: ../../migration.rst:158 +msgid "``simple_cache_middleware``" +msgstr "" + +#: ../../migration.rst:159 +msgid "``latest_block_based_cache_middleware``" +msgstr "" + +#: ../../migration.rst:160 +msgid "``time_based_cache_middleware``" +msgstr "" + +#: ../../migration.rst:162 +msgid "" +"All caching middleware has been removed in favor of a decorator/wrapper " +"around the ``make_request`` methods of providers with configuration " +"options on the provider class. The configuration options are outlined in " +"the documentation in the :ref:`request_caching` section." +msgstr "" + +#: ../../migration.rst:167 +msgid "" +"If desired, the previous caching middleware can be re-created using the " +"new class-based middleware model overriding the ``wrap_make_request`` (or" +" ``async_wrap_make_request``) method in the middleware class." +msgstr "" + +#: ../../migration.rst:173 +msgid "Result Generating Middleware" +msgstr "" + +#: ../../migration.rst:176 +msgid "``fixture_middleware``" +msgstr "" + +#: ../../migration.rst:177 +msgid "``result_generator_middleware``" +msgstr "" + +#: ../../migration.rst:179 +msgid "" +"The ``fixture_middleware`` and ``result_generator_middleware`` which were" +" used for testing/mocking purposes have been removed. These have been " +"replaced internally by the ``RequestMocker`` class, utilized for testing " +"via a ``request_mocker`` pytest fixture." +msgstr "" + +#: ../../migration.rst:185 +msgid "HTTP Retry Request Middleware" +msgstr "" + +#: ../../migration.rst:187 +msgid "" +"The ``http_retry_request_middleware`` has been removed in favor of a " +"configuration option on the ``HTTPProvider`` and ``AsyncHTTPProvider`` " +"classes. The configuration options are outlined in the documentation in " +"the :ref:`http_retry_requests` section." +msgstr "" + +#: ../../migration.rst:193 +msgid "Normalize Request Parameters Middleware" +msgstr "" + +#: ../../migration.rst:195 +msgid "" +"The ``normalize_request_parameters`` middleware was not used anywhere " +"internally and has been removed." +msgstr "" + +#: ../../migration.rst:200 +msgid "Remaining camelCase -> snake_case Updates" +msgstr "" + +#: ../../migration.rst:202 +msgid "" +"The following arguments have been renamed across the library from " +"camelCase to snake_case in all methods where they are passed in as a " +"kwarg." +msgstr "" + +#: ../../migration.rst:205 +msgid "``fromBlock`` -> ``from_block``" +msgstr "" + +#: ../../migration.rst:206 +msgid "``toBlock`` -> ``to_block``" +msgstr "" + +#: ../../migration.rst:207 +msgid "``blockHash`` -> ``block_hash``" +msgstr "" + +#: ../../migration.rst:209 +msgid "" +"Note that if a dictionary is used instead, say to a call such as " +"`eth_getLogs`, the keys in the dictionary should be camelCase. This is " +"because the dictionary is passed directly to the JSON-RPC request, where " +"the keys are expected to be in camelCase." +msgstr "" + +#: ../../migration.rst:215 +msgid "Changes to Exception Handling" +msgstr "" + +#: ../../migration.rst:217 +msgid "" +"All Python standard library exceptions that were raised from within " +"web3.py have been replaced with custom ``Web3Exception`` classes. This " +"change allows for better control over exception handling, being able to " +"distinguish between exceptions raised by web3.py and those raised from " +"elsewhere in a codebase. The following exceptions have been replaced:" +msgstr "" + +#: ../../migration.rst:223 +msgid "``AssertionError`` -> ``Web3AssertionError``" +msgstr "" + +#: ../../migration.rst:224 +msgid "``ValueError`` -> ``Web3ValueError``" +msgstr "" + +#: ../../migration.rst:225 +msgid "``TypeError`` -> ``Web3TypeError``" +msgstr "" + +#: ../../migration.rst:226 +msgid "``AttributeError`` -> ``Web3AttributeError``" +msgstr "" + +#: ../../migration.rst:228 +msgid "" +"A new ``MethodNotSupported`` exception is now raised when a method is not" +" supported by web3.py. This allows a user to distinguish between when a " +"method is not available on the current provider, ``MethodUnavailable``, " +"and when a method is not supported by web3.py under certain conditions, " +"``MethodNotSupported``." +msgstr "" + +#: ../../migration.rst:233 +msgid "" +"A ``MismatchedABI`` exception is now raised instead of a " +"``Web3ValidationError`` in cases where an ABI is not compatible with the " +"data being passed to it. This change allows for more specific error " +"handling when using certain ABI types." +msgstr "" + +#: ../../migration.rst:239 +msgid "JSON-RPC Error Handling" +msgstr "" + +#: ../../migration.rst:241 +msgid "" +"Rather than a ``ValueError`` being replaced with a ``Web3ValueError`` " +"when a JSON-RPC response comes back with an ``error`` object, a new " +"``Web3RPCError`` exception is now raised to provide more distinction for " +"JSON-RPC error responses. Some previously existing exceptions now extend " +"from this class since they too are related to JSON-RPC errors:" +msgstr "" + +#: ../../migration.rst:247 +msgid "``MethodUnavailable``" +msgstr "" + +#: ../../migration.rst:248 +msgid "``BlockNotFound``" +msgstr "" + +#: ../../migration.rst:249 +msgid "``TransactionNotFound``" +msgstr "" + +#: ../../migration.rst:250 +msgid "``TransactionIndexingInProgress``" +msgstr "" + +#: ../../migration.rst:254 +msgid "End of Support and Feature Removals" +msgstr "" + +#: ../../migration.rst:257 +msgid "Python 3.7 Support Dropped" +msgstr "" + +#: ../../migration.rst:259 +msgid "" +"Python 3.7 support has been dropped in favor of Python 3.8+. Python 3.7 " +"is no longer supported by the Python core team, and we want to focus our " +"efforts on supporting the latest versions of Python." +msgstr "" + +#: ../../migration.rst:265 +msgid "EthPM Module Removed" +msgstr "" + +#: ../../migration.rst:267 +msgid "" +"The EthPM module has been removed from the library. It was not widely " +"used and has not been functional since around October 2022. It was " +"deprecated in ``v6`` and has been completely removed in ``v7``." +msgstr "" + +#: ../../migration.rst:271 +msgid "" +"Types in the `eth_typing.ethpm `_" +" module have been deprecated and will be removed from ``eth-typing`` in " +"the next major release." +msgstr "" + +#: ../../migration.rst:278 +msgid "Geth Miner Namespace Removed" +msgstr "" + +#: ../../migration.rst:280 +msgid "" +"The ``geth.miner`` namespace, deprecated in ``v6``, has been removed in " +"``v7``. The ``miner`` namespace was used for managing the concept of a " +"miner in geth. This is no longer a feature in geth and is planned for " +"complete removal in the future, with Ethereum having transitioned to " +"proof-of-stake." +msgstr "" + +#: ../../migration.rst:287 +msgid "Geth Personal Namespace Removed" +msgstr "" + +#: ../../migration.rst:289 +msgid "" +"The ``geth.personal`` namespace, deprecated in ``v6``, has been removed " +"in ``v7``. The ``personal`` namespace was used for managing accounts and " +"keys and was deprecated in geth in ``v1.11.0``. Geth has moved to using " +"``clef`` for account and key management." +msgstr "" + +#: ../../migration.rst:295 +msgid "ABI Types Removed" +msgstr "" + +#: ../../migration.rst:297 +msgid "" +"The type definitions for ABIs, deprecated in ``v6``, have been removed in" +" ``v7``. New types have been introduced in the ``eth_typing`` ``v5`` " +"package for ABIs. Improvements have been made to make required types more" +" explicit and to offer better semantics." +msgstr "" + +#: ../../migration.rst:301 +msgid "" +"The following types from ``web3.types`` have been removed: - " +"``ABIEventParams`` is no longer available. Use ``ABIComponentIndexed`` " +"from ``eth_typing`` to represent event input components. - ``ABIEvent`` " +"now resides in ``eth_typing``. ``ABIEvent.type`` and ``ABIEvent.name`` " +"are now required fields. - ``ABIFunctionComponents`` and " +"``ABIFunctionParams`` are no longer available. Use ``ABIComponent`` from " +"``eth_typing`` to represent function input components. - ``ABIFunction`` " +"now resides in ``eth_typing``. ``ABIFunction.type`` and " +"``ABIFunction.name`` are now required fields. - ``ABIElement`` now " +"resides in ``eth_typing`` and represents a ``Union`` of all valid ABI " +"element types, ``ABICallable``, ``ABIEvent`` and ``ABIError``." +msgstr "" + +#: ../../migration.rst:315 +msgid "Miscellaneous Changes" +msgstr "" + +#: ../../migration.rst:317 +msgid "" +"``LRU`` has been removed from the library and dependency on ``lru-dict`` " +"library was dropped." +msgstr "" + +#: ../../migration.rst:319 +msgid "" +"``CallOverride`` type was changed to ``StateOverride`` since more methods" +" than ``eth_call`` utilize the state override params." +msgstr "" + +#: ../../migration.rst:321 +msgid "``User-Agent`` header was changed to a more readable format." +msgstr "" + +#: ../../migration.rst:322 +msgid "" +"``BaseContractFunctions`` iterator now returns instances of " +"``ContractFunction`` rather than the function names." +msgstr "" + +#: ../../migration.rst:324 +msgid "" +"``BaseContractFunction`` class attribute ``function_identifier`` has been" +" removed in favor of the ``abi_element_identifier`` attribute." +msgstr "" + +#: ../../migration.rst:326 +msgid "" +"``web3.contract.utils.call_contract_function()`` no longer uses " +"``fn_abi`` as a parameter. Instead, the ``abi_callable`` parameter of " +"type ``ABICallable`` is used." +msgstr "" + +#: ../../migration.rst:328 +msgid "Beacon API filename change: ``beacon/main.py`` -> ``beacon/beacon.py``." +msgstr "" + +#: ../../migration.rst:329 +msgid "" +"The asynchronous version of ``w3.eth.wait_for_transaction_receipt()`` " +"changes its signature to use ``Optional[float]`` instead of ``float`` " +"since it may be ``None``." +msgstr "" + +#: ../../migration.rst:331 +msgid "" +"``get_default_ipc_path()`` and ``get_dev_ipc_path()`` now return the path" +" value without checking if the ``geth.ipc`` file exists." +msgstr "" + +#: ../../migration.rst:333 +msgid "``Web3.is_address()`` returns ``True`` for non-checksummed addresses." +msgstr "" + +#: ../../migration.rst:334 +msgid "" +"``Contract.encodeABI()`` has been renamed to ``Contract.encode_abi()``. " +"The ``fn_name`` argument has been changed to ``abi_element_identifier``." +msgstr "" + +#: ../../migration.rst:336 +msgid "" +"JSON-RPC responses are now more strictly validated against the JSON-RPC " +"2.0 specification while providing more informative error messages for " +"invalid responses." +msgstr "" + +#: ../../migration.rst:343 +msgid "Migrating from v5 to v6" +msgstr "" + +#: ../../migration.rst:345 +msgid "" +"web3.py follows `Semantic Versioning `_, which means " +"that version 6 introduced backwards-incompatible changes. If your project" +" depends on web3.py v6, then you'll probably need to make some changes." +msgstr "" + +#: ../../migration.rst:349 +msgid "Breaking Changes:" +msgstr "" + +#: ../../migration.rst:352 +msgid "Strict Bytes Checking by Default" +msgstr "" + +#: ../../migration.rst:354 +msgid "" +"web3.py v6 moved to requiring strict bytes checking by default. This " +"means that if an ABI specifies a ``bytes4`` argument, web3.py will " +"invalidate any entry that is not encodable as a bytes type with length of" +" 4. This means only 0x-prefixed hex strings with a length of 4 and bytes " +"types with a length of 4 will be considered valid. This removes doubt " +"that comes from inferring values and assuming they should be padded." +msgstr "" + +#: ../../migration.rst:360 +msgid "" +"This behavior was previously available in via the " +"``w3.enable_strict_bytes_checking()`` method. This is now, however, a " +"toggleable flag on the ``Web3`` instance via the " +"``w3.strict_bytes_type_checking`` property. As outlined above, this " +"property is set to ``True`` by default but can be toggled on and off via " +"the property's setter (e.g. ``w3.strict_bytes_type_checking = False``)." +msgstr "" + +#: ../../migration.rst:368 +msgid "Snake Case" +msgstr "" + +#: ../../migration.rst:370 +msgid "" +"web3.py v6 moved to the more Pythonic convention of snake_casing wherever" +" possible. There are some exceptions to this pattern:" +msgstr "" + +#: ../../migration.rst:373 +msgid "" +"Contract methods and events use whatever is listed in the ABI. If the " +"smart contract convention is to use camelCase for method and event names," +" web3.py won't do any magic to convert it to snake_casing." +msgstr "" + +#: ../../migration.rst:376 +msgid "" +"Arguments to JSON-RPC methods. For example: transaction and filter " +"parameters still use camelCasing. The reason for this is primarily due to" +" error messaging. It would be confusing to pass in a snake_cased " +"parameter and get an error message with a camelCased parameter." +msgstr "" + +#: ../../migration.rst:380 +msgid "" +"Data that is returned from JSON-RPC methods. For example: The keys in a " +"transaction receipt will still be returned as camelCase." +msgstr "" + +#: ../../migration.rst:385 +msgid "Python 3.10 and 3.11 Support" +msgstr "" + +#: ../../migration.rst:387 +msgid "" +"Support for Python 3.10 and 3.11 is here. In order to support Python " +"3.10, we had to update the ``websockets`` dependency to v10+." +msgstr "" + +#: ../../migration.rst:391 +msgid "Exceptions" +msgstr "" + +#: ../../migration.rst:394 +msgid "Exceptions inherit from a base class" +msgstr "" + +#: ../../migration.rst:396 +msgid "In v5, some web3.py exceptions inherited from ``AttributeError``, namely:" +msgstr "" + +#: ../../migration.rst:398 +msgid "``NoABIFunctionsFound``" +msgstr "" + +#: ../../migration.rst:399 +msgid "``NoABIFound``" +msgstr "" + +#: ../../migration.rst:400 +msgid "``NoABIEventsFound``" +msgstr "" + +#: ../../migration.rst:402 +msgid "Others inherited from ``ValueError``, namely:" +msgstr "" + +#: ../../migration.rst:404 +msgid "``InvalidAddress``" +msgstr "" + +#: ../../migration.rst:405 +msgid "``NameNotFound``" +msgstr "" + +#: ../../migration.rst:406 +msgid "``LogTopicError``" +msgstr "" + +#: ../../migration.rst:407 +msgid "``InvalidEventABI``" +msgstr "" + +#: ../../migration.rst:409 +msgid "Now web3.py exceptions inherit from the same base ``Web3Exception``." +msgstr "" + +#: ../../migration.rst:411 +msgid "" +"As such, any code that was expecting a ``ValueError`` or an " +"``AttributeError`` from web3.py must update to expecting one of the " +"exceptions listed above, or ``Web3Exception``." +msgstr "" + +#: ../../migration.rst:415 +msgid "" +"Similarly, exceptions raised in the EthPM and ENS modules inherit from " +"the base ``EthPMException`` and ``ENSException``, respectively." +msgstr "" + +#: ../../migration.rst:419 +msgid "ValidationError" +msgstr "" + +#: ../../migration.rst:421 +msgid "" +"The Python dev tooling ecosystem is moving towards standardizing " +"``ValidationError``, so users know that they're catching the correct " +"``ValidationError``. The base ``ValidationError`` is imported from " +"``eth_utils``. However, we also wanted to empower users to catch all " +"errors emitted by a particular module. So we now have a " +"``Web3ValidationError``, ``EthPMValidationError``, and an " +"``ENSValidationError`` that all inherit from the generic " +"``eth_utils.exceptions.ValidationError``." +msgstr "" + +#: ../../migration.rst:430 +msgid "Web3 class split into Web3 and AsyncWeb3" +msgstr "" + +#: ../../migration.rst:432 +msgid "" +"The `Web3` class previously contained both sync and async methods. We've " +"separated `Web3` and `AsyncWeb3` functionality to tighten up typing. For " +"example:" +msgstr "" + +#: ../../migration.rst:443 +msgid "`dict` to `AttributeDict` conversion moved to middleware" +msgstr "" + +#: ../../migration.rst:445 +msgid "" +"`Eth` module data returned as key-value pairs was previously " +"automatically converted to an `AttributeDict` by result formatters, which" +" could cause problems with typing. This conversion has been moved to a " +"default `attrdict_middleware` where it can be easily removed if " +"necessary. See the `Eth module `_ docs for " +"more detail." +msgstr "" + +#: ../../migration.rst:451 +msgid "Other Misc Changes" +msgstr "" + +#: ../../migration.rst:453 +msgid "" +"``InfuraKeyNotFound`` exception has been changed to " +"``InfuraProjectIdNotFound``" +msgstr "" + +#: ../../migration.rst:454 +msgid "``SolidityError`` has been removed in favor of ``ContractLogicError``" +msgstr "" + +#: ../../migration.rst:455 +msgid "" +"When a method is unavailable from a node provider (i.e. a response error " +"code of -32601 is returned), a ``MethodUnavailable`` error is now raised " +"instead of ``ValueError``" +msgstr "" + +#: ../../migration.rst:458 +msgid "" +"Logs' `data` field was previously formatted with `to_ascii_if_bytes`, now" +" formatted to `HexBytes`" +msgstr "" + +#: ../../migration.rst:459 +msgid "" +"Receipts' `type` field was previously not formatted, now formatted with " +"`to_integer_if_hex`" +msgstr "" + +#: ../../migration.rst:462 +msgid "Removals" +msgstr "" + +#: ../../migration.rst:464 +msgid "Removed unused IBAN module" +msgstr "" + +#: ../../migration.rst:465 +msgid "" +"Removed ``WEB3_INFURA_API_KEY`` environment variable in favor of " +"``WEB3_INFURA_PROJECT_ID``" +msgstr "" + +#: ../../migration.rst:466 +msgid "Removed Kovan auto provider" +msgstr "" + +#: ../../migration.rst:467 +msgid "" +"Removed deprecated ``sha3`` and ``soliditySha3`` methods in favor of " +"``keccak`` and ``solidityKeccak``" +msgstr "" + +#: ../../migration.rst:468 +msgid "Remove Parity Module and References" +msgstr "" + +#: ../../migration.rst:472 +msgid "Other notable changes" +msgstr "" + +#: ../../migration.rst:474 +msgid "" +"The ``ipfshttpclient`` library is now opt-in via a web3 install extra. " +"This only affects the ethpm ipfs backends, which rely on the library." +msgstr "" + +#: ../../migration.rst:481 +msgid "Migrating from v4 to v5" +msgstr "" + +#: ../../migration.rst:483 +msgid "" +"Web3.py follows `Semantic Versioning `_, which means " +"that version 5 introduced backwards-incompatible changes. If your project" +" depends on Web3.py v4, then you'll probably need to make some changes." +msgstr "" + +#: ../../migration.rst:487 ../../migration.rst:623 +msgid "Here are the most common required updates:" +msgstr "" + +#: ../../migration.rst:490 +msgid "Python 3.5 no longer supported" +msgstr "" + +#: ../../migration.rst:492 +msgid "You will need to upgrade to either Python 3.6 or 3.7" +msgstr "" + +#: ../../migration.rst:495 +msgid "``eth-abi`` v1 no longer supported" +msgstr "" + +#: ../../migration.rst:497 +msgid "You will need to upgrade the ``eth-abi`` dependency to v2" +msgstr "" + +#: ../../migration.rst:500 +msgid "Changes to base API" +msgstr "" + +#: ../../migration.rst:503 +msgid "JSON-RPC Updates" +msgstr "" + +#: ../../migration.rst:505 +msgid "" +"In v4, JSON-RPC calls that looked up transactions or blocks and didn't " +"find them, returned ``None``. Now if a transaction or block is not found," +" a ``BlockNotFound`` or a ``TransactionNotFound`` error will be thrown as" +" appropriate. This applies to the following web3 methods:" +msgstr "" + +#: ../../migration.rst:511 +msgid "" +":meth:`~web3.eth.Eth.getTransaction` will throw a ``TransactionNotFound``" +" error" +msgstr "" + +#: ../../migration.rst:512 +msgid "" +":meth:`~web3.eth.Eth.getTransactionReceipt` will throw a " +"``TransactionNotFound`` error" +msgstr "" + +#: ../../migration.rst:513 +msgid "" +":meth:`~web3.eth.Eth.getTransactionByBlock` will throw a " +"``TransactionNotFound`` error" +msgstr "" + +#: ../../migration.rst:514 +msgid "" +":meth:`~web3.eth.Eth.getTransactionCount` will throw a ``BlockNotFound`` " +"error" +msgstr "" + +#: ../../migration.rst:515 +msgid ":meth:`~web3.eth.Eth.getBlock` will throw a ``BlockNotFound`` error" +msgstr "" + +#: ../../migration.rst:516 +msgid ":meth:`~web3.eth.Eth.getUncleCount` will throw a ``BlockNotFound`` error" +msgstr "" + +#: ../../migration.rst:517 +msgid ":meth:`~web3.eth.Eth.getUncleByBlock` will throw a ``BlockNotFound`` error" +msgstr "" + +#: ../../migration.rst:520 ../../migration.rst:737 +msgid "Removed Methods" +msgstr "" + +#: ../../migration.rst:522 +msgid "" +"``contract.buildTransaction`` was removed for " +"``contract.functions.buildTransaction.``" +msgstr "" + +#: ../../migration.rst:523 +msgid "``contract.deploy`` was removed for ``contract.constructor.transact``" +msgstr "" + +#: ../../migration.rst:524 +msgid "" +"``contract.estimateGas`` was removed for ``contract.functions..estimateGas``" +msgstr "" + +#: ../../migration.rst:525 +msgid "" +"``contract.call`` was removed for ``contract...call``" +msgstr "" + +#: ../../migration.rst:526 +msgid "" +"``contract.transact`` was removed for " +"``contract...transact``" +msgstr "" + +#: ../../migration.rst:527 +msgid "" +"``contract.eventFilter`` was removed for ``contract.events..createFilter``" +msgstr "" + +#: ../../migration.rst:528 +msgid "``middleware_stack`` was renamed to :meth:`~Web3.middleware_onion`" +msgstr "" + +#: ../../migration.rst:529 +msgid "" +"``web3.miner.hashrate`` was a duplicate of :meth:`~web3.eth.Eth.hashrate`" +" and was removed." +msgstr "" + +#: ../../migration.rst:530 +msgid "" +"``web3.version.network`` was a duplicate of :meth:`~web3.net.Net.version`" +" and was removed." +msgstr "" + +#: ../../migration.rst:531 +msgid "" +"``web3.providers.tester.EthereumTesterProvider`` and " +"``web3.providers.tester.TestRPCProvider`` have been removed for " +":meth:`~web3.providers.eth_tester.EthereumTesterProvider`" +msgstr "" + +#: ../../migration.rst:532 +msgid "``web3.eth.enableUnauditedFeatures`` was removed" +msgstr "" + +#: ../../migration.rst:533 +msgid "``web3.txpool`` was moved to :meth:`~web3.geth.txpool`" +msgstr "" + +#: ../../migration.rst:534 +msgid "``web3.version.node`` was removed for ``web3.clientVersion``" +msgstr "" + +#: ../../migration.rst:535 +msgid "" +"``web3.version.ethereum`` was removed for " +":meth:`~web3.eth.Eth.protocolVersion`" +msgstr "" + +#: ../../migration.rst:536 +msgid "" +"Relocated personal RPC endpoints to reflect Parity and Geth " +"implementations:" +msgstr "" + +#: ../../migration.rst:538 +msgid "" +"``web3.personal.listAccounts`` was removed for " +":meth:`~web3.geth.personal.listAccounts` or " +":meth:`~web3.parity.personal.listAccounts`" +msgstr "" + +#: ../../migration.rst:539 +msgid "" +"``web3.personal.importRawKey`` was removed for " +":meth:`~web3.geth.personal.importRawKey` or " +":meth:`~web3.parity.personal.importRawKey`" +msgstr "" + +#: ../../migration.rst:540 +msgid "" +"``web3.personal.newAccount`` was removed for " +":meth:`~web3.geth.personal.newAccount` or " +":meth:`~web3.parity.personal.newAccount`" +msgstr "" + +#: ../../migration.rst:541 +msgid "" +"``web3.personal.lockAccount`` was removed for " +":meth:`~web3.geth.personal.lockAccount`" +msgstr "" + +#: ../../migration.rst:542 +msgid "" +"``web3.personal.unlockAccount`` was removed for " +":meth:`~web3.geth.personal.unlockAccount` or " +":meth:`~web3.parity.personal.unlockAccount`" +msgstr "" + +#: ../../migration.rst:543 +msgid "" +"``web3.personal.sendTransaction`` was removed for " +":meth:`~web3.geth.personal.sendTransaction` or " +":meth:`~web3.parity.personal.sendTransaction`" +msgstr "" + +#: ../../migration.rst:545 +msgid "Relocated ``web3.admin`` module to ``web3.geth`` namespace" +msgstr "" + +#: ../../migration.rst:546 +msgid "Relocated ``web3.miner`` module to ``web3.geth`` namespace" +msgstr "" + +#: ../../migration.rst:549 +msgid "Deprecated Methods" +msgstr "" + +#: ../../migration.rst:551 +msgid "Expect the following methods to be removed in v6:" +msgstr "" + +#: ../../migration.rst:553 +msgid "``web3.sha3`` was deprecated for :meth:`~Web3.keccak`" +msgstr "" + +#: ../../migration.rst:554 +msgid "``web3.soliditySha3`` was deprecated for :meth:`~Web3.solidityKeccak`" +msgstr "" + +#: ../../migration.rst:555 +msgid "" +":meth:`~web3.net.Net.chainId` was deprecated for " +":meth:`~web3.eth.Eth.chainId`. Follow issue `#1293 " +"`_ for details" +msgstr "" + +#: ../../migration.rst:557 +msgid "``web3.eth.getCompilers()`` was deprecated and will not be replaced" +msgstr "" + +#: ../../migration.rst:558 +msgid "" +":meth:`~web3.eth.getTransactionFromBlock()` was deprecated for " +":meth:`~Web3.getTransactionByBlock`" +msgstr "" + +#: ../../migration.rst:561 +msgid "Deprecated ConciseContract and ImplicitContract" +msgstr "" + +#: ../../migration.rst:562 +msgid "" +"The ConciseContract and ImplicitContract have been deprecated and will be" +" removed in v6." +msgstr "" + +#: ../../migration.rst:564 +msgid "" +"ImplicitContract instances will need to use the verbose syntax. For " +"example:" +msgstr "" + +#: ../../migration.rst:566 +#, python-brace-format +msgid "``contract.functions..transact({})``" +msgstr "" + +#: ../../migration.rst:568 +msgid "" +"ConciseContract has been replaced with the ContractCaller API. Instead of" +" using the ConciseContract factory, you can now use:" +msgstr "" + +#: ../../migration.rst:570 +msgid "``contract.caller.``" +msgstr "" + +#: ../../migration.rst:572 +msgid "or the classic contract syntax:" +msgstr "" + +#: ../../migration.rst:574 +msgid "``contract.functions..call()``." +msgstr "" + +#: ../../migration.rst:576 +msgid "" +"Some more concrete examples can be found in the `ContractCaller docs " +"`_" +msgstr "" + +#: ../../migration.rst:580 +msgid "Manager Provider" +msgstr "" + +#: ../../migration.rst:582 +msgid "" +"In v5, only a single provider will be allowed. While allowing multiple " +"providers is a feature we'd like to support in the future, the way that " +"multiple providers was handled in v4 wasn't ideal. The only thing they " +"could do was fall back. There was no mechanism for any round robin, nor " +"was there any control around which provider was chosen. Eventually, the " +"idea is to expand the Manager API to support injecting custom logic into " +"the provider selection process." +msgstr "" + +#: ../../migration.rst:590 +msgid "" +"For now, ``manager.providers`` has changed to ``manager.provider``. " +"Similarly, instances of ``web3.providers`` have been changed to " +"``web3.provider``." +msgstr "" + +#: ../../migration.rst:595 +msgid "Testnet Changes" +msgstr "" + +#: ../../migration.rst:597 +msgid "" +"Web3.py will no longer automatically look up a testnet connection in " +"IPCProvider." +msgstr "" + +#: ../../migration.rst:601 +msgid "ENS" +msgstr "" + +#: ../../migration.rst:603 +msgid "" +"Web3.py has stopped inferring the ``.eth`` TLD on domain names. If a " +"domain name is used instead of an address, you'll need to specify the " +"TLD. An ``InvalidTLD`` error will be thrown if the TLD is missing." +msgstr "" + +#: ../../migration.rst:609 +msgid "Required Infura API Key" +msgstr "" + +#: ../../migration.rst:611 +msgid "" +"In order to interact with Infura after March 27, 2019, you'll need to set" +" an environment variable called ``WEB3_INFURA_PROJECT_ID``. You can get a" +" project id by visiting https://infura.io/register." +msgstr "" + +#: ../../migration.rst:617 +msgid "Migrating from v3 to v4" +msgstr "" + +#: ../../migration.rst:619 +msgid "" +"Web3.py follows `Semantic Versioning `_, which means " +"that version 4 introduced backwards-incompatible changes. If your project" +" depends on Web3.py v3, then you'll probably need to make some changes." +msgstr "" + +#: ../../migration.rst:626 +msgid "Python 2 to Python 3" +msgstr "" + +#: ../../migration.rst:628 +msgid "" +"Only Python 3 is supported in v4. If you are running in Python 2, it's " +"time to upgrade. We recommend using `2to3` which can make most of your " +"code compatible with Python 3, automatically." +msgstr "" + +#: ../../migration.rst:632 +msgid "" +"The most important update, relevant to Web3.py, is the new :class:`bytes`" +" type. It is used regularly, throughout the library, whenever dealing " +"with data that is not guaranteed to be text." +msgstr "" + +#: ../../migration.rst:636 +msgid "" +"Many different methods in Web3.py accept text or binary data, like " +"contract methods, transaction details, and cryptographic functions. The " +"following example uses :meth:`~Web3.sha3`, but the same pattern applies " +"elsewhere." +msgstr "" + +#: ../../migration.rst:640 +msgid "" +"In v3 & Python 2, you might have calculated the hash of binary data this " +"way:" +msgstr "" + +#: ../../migration.rst:647 +msgid "Or, you might have calculated the hash of text data this way:" +msgstr "" + +#: ../../migration.rst:654 +msgid "After switching to Python 3, these would instead be executed as:" +msgstr "" + +#: ../../migration.rst:664 +msgid "" +"Note that the return value is different too: you can treat " +":class:`hexbytes.main.HexBytes` like any other bytes value, but the " +"representation on the console shows you the hex encoding of those bytes, " +"for easier visual comparison." +msgstr "" + +#: ../../migration.rst:668 +msgid "" +"It takes a little getting used to, but the new py3 types are much better." +" We promise." +msgstr "" + +#: ../../migration.rst:671 +msgid "Filters" +msgstr "" + +#: ../../migration.rst:673 +msgid "Filters usually don't work quite the way that people want them to." +msgstr "" + +#: ../../migration.rst:675 +msgid "" +"The first step toward fixing them was to simplify them by removing the " +"polling logic. Now, you must request an update on your filters " +"explicitly. That means that any exceptions during the request will bubble" +" up into your code." +msgstr "" + +#: ../../migration.rst:679 +msgid "" +"In v3, those exceptions (like \"filter is not found\") were swallowed " +"silently in the automated polling logic. Here was the invocation for " +"printing out new block hashes as they appear:" +msgstr "" + +#: ../../migration.rst:691 +msgid "In v4, that same logic:" +msgstr "" + +#: ../../migration.rst:699 +msgid "" +"The caller is responsible for polling the results from " +"``get_new_entries()``. See :ref:`asynchronous_filters` for examples of " +"filter-event handling with web3 v4." +msgstr "" + +#: ../../migration.rst:703 +msgid "TestRPCProvider and EthereumTesterProvider" +msgstr "" + +#: ../../migration.rst:705 +msgid "" +"These providers are fairly uncommon. If you don't recognize the names, " +"you can probably skip the section." +msgstr "" + +#: ../../migration.rst:708 +msgid "" +"However, if you were using web3.py for testing contracts, you might have " +"been using TestRPCProvider or EthereumTesterProvider." +msgstr "" + +#: ../../migration.rst:711 +msgid "" +"In v4 there is a new :class:`EthereumTesterProvider`, and the old v3 " +"implementation has been removed. Web3.py v4 uses " +":class:`eth_tester.main.EthereumTester` under the hood, instead of eth-" +"testrpc. While ``eth-tester`` is still in beta, many parts are already in" +" better shape than testrpc, so we decided to replace it in v4." +msgstr "" + +#: ../../migration.rst:716 +msgid "" +"If you were using TestRPC, or were explicitly importing " +"EthereumTesterProvider, like: ``from web3.providers.tester import " +"EthereumTesterProvider``, then you will need to update." +msgstr "" + +#: ../../migration.rst:719 +msgid "" +"With v4 you should import with ``from web3 import " +"EthereumTesterProvider``. As before, you'll need to install Web3.py with " +"the ``tester`` extra to get these features, like:" +msgstr "" + +#: ../../migration.rst:728 +msgid "Changes to base API convenience methods" +msgstr "" + +#: ../../migration.rst:731 +msgid "Web3.toDecimal()" +msgstr "" + +#: ../../migration.rst:733 +msgid "" +"In v4 ``Web3.toDecimal()`` is renamed: :meth:`~Web3.toInt` for improved " +"clarity. It does not return a :class:`decimal.Decimal`, it returns an " +":class:`int`." +msgstr "" + +#: ../../migration.rst:739 +msgid "``Web3.toUtf8`` was removed for :meth:`~Web3.toText`." +msgstr "" + +#: ../../migration.rst:740 +msgid "``Web3.fromUtf8`` was removed for :meth:`~Web3.toHex`." +msgstr "" + +#: ../../migration.rst:741 +msgid "``Web3.toAscii`` was removed for :meth:`~Web3.toBytes`." +msgstr "" + +#: ../../migration.rst:742 +msgid "``Web3.fromAscii`` was removed for :meth:`~Web3.toHex`." +msgstr "" + +#: ../../migration.rst:743 +msgid "``Web3.fromDecimal`` was removed for :meth:`~Web3.toHex`." +msgstr "" + +#: ../../migration.rst:746 +msgid "Provider Access" +msgstr "" + +#: ../../migration.rst:748 +msgid "In v4, ``w3.currentProvider`` was removed, in favor of ``w3.providers``." +msgstr "" + +#: ../../migration.rst:751 +msgid "Disambiguating String Inputs" +msgstr "" + +#: ../../migration.rst:753 +msgid "" +"There are a number of places where an arbitrary string input might be " +"either a byte-string that has been hex-encoded, or unicode characters in " +"text. These are named ``hexstr`` and ``text`` in Web3.py. You specify " +"which kind of :class:`str` you have by using the appropriate keyword " +"argument. See examples in :ref:`overview_type_conversions`." +msgstr "" + +#: ../../migration.rst:759 +msgid "" +"In v3, some methods accepted a :class:`str` as the first positional " +"argument. In v4, you must pass strings as one of ``hexstr`` or ``text`` " +"keyword arguments." +msgstr "" + +#: ../../migration.rst:762 +msgid "Notable methods that no longer accept ambiguous strings:" +msgstr "" + +#: ../../migration.rst:764 +msgid ":meth:`~Web3.sha3`" +msgstr "" + +#: ../../migration.rst:765 +msgid ":meth:`~Web3.toBytes`" +msgstr "" + +#: ../../migration.rst:768 +msgid "Contracts" +msgstr "" + +#: ../../migration.rst:770 +msgid "" +"When a contract returns the ABI type ``string``, Web3.py v4 now returns a" +" :class:`str` value by decoding the underlying bytes using UTF-8." +msgstr "" + +#: ../../migration.rst:772 +msgid "" +"When a contract returns the ABI type ``bytes`` (of any length), Web3.py " +"v4 now returns a :class:`bytes` value" +msgstr "" + +#: ../../migration.rst:776 +msgid "Personal API" +msgstr "" + +#: ../../migration.rst:778 +msgid "" +"``w3.personal.signAndSendTransaction`` is no longer available. Use " +":meth:`w3.personal.sendTransaction() ` " +"instead." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/overview.po b/docs/locales/zh_CN/LC_MESSAGES/overview.po new file mode 100644 index 0000000000..a21f7a831b --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/overview.po @@ -0,0 +1,588 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../overview.rst:4 +msgid "Overview" +msgstr "概览" + +#: ../../overview.rst:6 +msgid "" +"The purpose of this page is to give you a sense of everything web3.py can" +" do and to serve as a quick reference guide. You'll find a summary of " +"each feature with links to learn more." +msgstr "" + +#: ../../overview.rst:11 +msgid "Configuration" +msgstr "" + +#: ../../overview.rst:13 +msgid "" +"After installing web3.py (via ``pip install web3``), you'll need to " +"configure a provider endpoint and any middleware you want to use beyond " +"the defaults." +msgstr "" + +#: ../../overview.rst:18 +msgid "Providers" +msgstr "" + +#: ../../overview.rst:20 +msgid "" +":doc:`providers` are how web3.py connects to a blockchain. The library " +"comes with the following built-in providers:" +msgstr "" + +#: ../../overview.rst:23 +msgid "" +":class:`~web3.providers.rpc.HTTPProvider` for connecting to http and " +"https based JSON-RPC servers." +msgstr "" + +#: ../../overview.rst:24 +msgid "" +":class:`~web3.providers.ipc.IPCProvider` for connecting to ipc socket " +"based JSON-RPC servers." +msgstr "" + +#: ../../overview.rst:25 +msgid "" +":class:`~web3.providers.legacy_websocket.LegacyWebSocketProvider` " +"(deprecated) for connecting to websocket based JSON-RPC servers." +msgstr "" + +#: ../../overview.rst:26 +msgid "" +":class:`~web3.providers.async_rpc.AsyncHTTPProvider` for connecting to " +"http and https based JSON-RPC servers asynchronously." +msgstr "" + +#: ../../overview.rst:27 +msgid "" +":class:`~web3.providers.persistent.AsyncIPCProvider` for connecting to " +"ipc socket based JSON-RPC servers asynchronously via a persistent " +"connection." +msgstr "" + +#: ../../overview.rst:28 +msgid "" +":class:`~web3.providers.persistent.WebSocketProvider` for connecting to " +"websocket based JSON-RPC servers asynchronously via a persistent " +"connection." +msgstr "" + +#: ../../overview.rst:31 +msgid "Examples" +msgstr "" + +#: ../../overview.rst:65 +msgid "For more context, see the :doc:`providers` documentation." +msgstr "" + +#: ../../overview.rst:69 +msgid "Middleware" +msgstr "" + +#: ../../overview.rst:71 +msgid "Your web3.py instance may be further configured via :doc:`middleware`." +msgstr "" + +#: ../../overview.rst:73 +msgid "" +"web3.py middleware is described using an onion metaphor, where each layer" +" of middleware may affect both the incoming request and outgoing response" +" from your provider. The documentation includes a :ref:`visualization " +"` of this idea." +msgstr "" + +#: ../../overview.rst:78 +msgid "" +"Several middleware are :ref:`included by default `. " +"You may add to (:meth:`add `, :meth:`inject " +"`, :meth:`replace " +"`) or disable (:meth:`remove " +"`, :meth:`clear " +"`) any of these middleware." +msgstr "" + +#: ../../overview.rst:86 +msgid "Accounts and Private Keys" +msgstr "" + +#: ../../overview.rst:88 +msgid "" +"Private keys are required to approve any transaction made on your behalf." +" The manner in which your key is secured will determine how you create " +"and send transactions in web3.py." +msgstr "" + +#: ../../overview.rst:91 +msgid "" +"A local node, like `Geth `_, may manage your " +"keys for you. You can reference those keys using the " +":attr:`web3.eth.accounts ` property." +msgstr "" + +#: ../../overview.rst:95 +msgid "" +"A hosted node, like `Infura `_, will have no " +"knowledge of your keys. In this case, you'll need to have your private " +"key available locally for signing transactions." +msgstr "" + +#: ../../overview.rst:99 +msgid "" +"Full documentation on the distinction between keys can be found " +":ref:`here `. The separate guide to :doc:`transactions` may " +"also help clarify how to manage keys." +msgstr "" + +#: ../../overview.rst:104 +msgid "Base API" +msgstr "" + +#: ../../overview.rst:106 +msgid "" +"The :ref:`Web3 ` class includes a number of convenient utility" +" functions:" +msgstr "" + +#: ../../overview.rst:110 +msgid "Encoding and Decoding Helpers" +msgstr "" + +#: ../../overview.rst:112 +msgid ":meth:`Web3.is_encodable() `" +msgstr "" + +#: ../../overview.rst:113 +msgid ":meth:`Web3.to_bytes() `" +msgstr "" + +#: ../../overview.rst:114 +msgid ":meth:`Web3.to_hex() `" +msgstr "" + +#: ../../overview.rst:115 +msgid ":meth:`Web3.to_int() `" +msgstr "" + +#: ../../overview.rst:116 +msgid ":meth:`Web3.to_json() `" +msgstr "" + +#: ../../overview.rst:117 +msgid ":meth:`Web3.to_text() `" +msgstr "" + +#: ../../overview.rst:121 +msgid "Address Helpers" +msgstr "" + +#: ../../overview.rst:123 +msgid ":meth:`Web3.is_address() `" +msgstr "" + +#: ../../overview.rst:124 +msgid ":meth:`Web3.is_checksum_address() `" +msgstr "" + +#: ../../overview.rst:125 +msgid ":meth:`Web3.to_checksum_address() `" +msgstr "" + +#: ../../overview.rst:129 +msgid "Currency Conversions" +msgstr "" + +#: ../../overview.rst:131 +msgid ":meth:`Web3.from_wei() `" +msgstr "" + +#: ../../overview.rst:132 +msgid ":meth:`Web3.to_wei() `" +msgstr "" + +#: ../../overview.rst:136 +msgid "Cryptographic Hashing" +msgstr "" + +#: ../../overview.rst:138 +msgid ":meth:`Web3.keccak() `" +msgstr "" + +#: ../../overview.rst:139 +msgid ":meth:`Web3.solidity_keccak() `" +msgstr "" + +#: ../../overview.rst:143 +msgid "web3.eth API" +msgstr "" + +#: ../../overview.rst:145 +msgid "" +"The most commonly used APIs for interacting with Ethereum can be found " +"under the :ref:`web3-eth` namespace." +msgstr "" + +#: ../../overview.rst:150 +msgid "Fetching Data" +msgstr "" + +#: ../../overview.rst:152 +msgid "" +"Viewing account balances (:meth:`get_balance " +"`), transactions (:meth:`get_transaction " +"`), and block data (:meth:`get_block " +"`) are some of the most common starting points in" +" web3.py." +msgstr "" + +#: ../../overview.rst:159 ../../overview.rst:190 ../../overview.rst:257 +#: ../../overview.rst:283 +msgid "API" +msgstr "" + +#: ../../overview.rst:161 +msgid ":meth:`web3.eth.get_balance() `" +msgstr "" + +#: ../../overview.rst:162 +msgid ":meth:`web3.eth.get_block() `" +msgstr "" + +#: ../../overview.rst:163 +msgid "" +":meth:`web3.eth.get_block_transaction_count() " +"`" +msgstr "" + +#: ../../overview.rst:164 +msgid ":meth:`web3.eth.get_code() `" +msgstr "" + +#: ../../overview.rst:165 +msgid ":meth:`web3.eth.get_proof() `" +msgstr "" + +#: ../../overview.rst:166 +msgid ":meth:`web3.eth.get_storage_at() `" +msgstr "" + +#: ../../overview.rst:167 +msgid ":meth:`web3.eth.get_transaction() `" +msgstr "" + +#: ../../overview.rst:168 +msgid "" +":meth:`web3.eth.get_transaction_by_block() " +"`" +msgstr "" + +#: ../../overview.rst:169 +msgid "" +":meth:`web3.eth.get_transaction_count() " +"`" +msgstr "" + +#: ../../overview.rst:170 +msgid ":meth:`web3.eth.get_uncle_by_block() `" +msgstr "" + +#: ../../overview.rst:171 +msgid ":meth:`web3.eth.get_uncle_count() `" +msgstr "" + +#: ../../overview.rst:175 +msgid "Sending Transactions" +msgstr "" + +#: ../../overview.rst:177 +msgid "" +"The most common use cases will be satisfied with :meth:`send_transaction " +"` or the combination of " +":meth:`sign_transaction ` and " +":meth:`send_raw_transaction `. For " +"more context, see the full guide to :doc:`transactions`." +msgstr "" + +#: ../../overview.rst:185 +msgid "" +"If interacting with a smart contract, a dedicated API exists. See the " +"next section, :ref:`Contracts `." +msgstr "" + +#: ../../overview.rst:192 +msgid ":meth:`web3.eth.send_transaction() `" +msgstr "" + +#: ../../overview.rst:193 +msgid ":meth:`web3.eth.sign_transaction() `" +msgstr "" + +#: ../../overview.rst:194 +msgid "" +":meth:`web3.eth.send_raw_transaction() " +"`" +msgstr "" + +#: ../../overview.rst:195 +msgid ":meth:`web3.eth.replace_transaction() `" +msgstr "" + +#: ../../overview.rst:196 +msgid ":meth:`web3.eth.modify_transaction() `" +msgstr "" + +#: ../../overview.rst:197 +msgid "" +":meth:`web3.eth.wait_for_transaction_receipt() " +"`" +msgstr "" + +#: ../../overview.rst:198 +msgid "" +":meth:`web3.eth.get_transaction_receipt() " +"`" +msgstr "" + +#: ../../overview.rst:199 +msgid ":meth:`web3.eth.sign() `" +msgstr "" + +#: ../../overview.rst:200 +msgid ":meth:`web3.eth.sign_typed_data() `" +msgstr "" + +#: ../../overview.rst:201 +msgid ":meth:`web3.eth.estimate_gas() `" +msgstr "" + +#: ../../overview.rst:202 +msgid ":meth:`web3.eth.generate_gas_price() `" +msgstr "" + +#: ../../overview.rst:203 +msgid "" +":meth:`web3.eth.set_gas_price_strategy() " +"`" +msgstr "" + +#: ../../overview.rst:209 +msgid "Contracts" +msgstr "" + +#: ../../overview.rst:211 +msgid "" +"web3.py can help you deploy, read from, or execute functions on a " +"deployed contract." +msgstr "" + +#: ../../overview.rst:213 +msgid "" +"Deployment requires that the contract already be compiled, with its " +"bytecode and ABI available. This compilation step can be done within " +"`Remix `_ or one of the many contract " +"development frameworks, such as `Ape " +"`_." +msgstr "" + +#: ../../overview.rst:218 +msgid "" +"Once the contract object is instantiated, calling ``transact`` on the " +":meth:`constructor ` method will " +"deploy an instance of the contract:" +msgstr "" + +#: ../../overview.rst:230 +msgid "" +"Once a deployed contract is loaded into a Contract object, the functions " +"of that contract are available on the ``functions`` namespace:" +msgstr "" + +#: ../../overview.rst:238 +msgid "" +"If you want to read data from a contract (or see the result of " +"transaction locally, without executing it on the network), you can use " +"the :meth:`ContractFunction.call ` " +"method, or the more concise :attr:`ContractCaller " +"` syntax:" +msgstr "" + +#: ../../overview.rst:253 +msgid "For more, see the full :ref:`Contracts` documentation." +msgstr "" + +#: ../../overview.rst:259 +msgid ":meth:`web3.eth.contract() `" +msgstr "" + +#: ../../overview.rst:260 +msgid ":attr:`Contract.address `" +msgstr "" + +#: ../../overview.rst:261 +msgid ":attr:`Contract.abi `" +msgstr "" + +#: ../../overview.rst:262 +msgid ":attr:`Contract.bytecode `" +msgstr "" + +#: ../../overview.rst:263 +msgid "" +":attr:`Contract.bytecode_runtime " +"`" +msgstr "" + +#: ../../overview.rst:264 +msgid ":attr:`Contract.functions `" +msgstr "" + +#: ../../overview.rst:265 +msgid ":attr:`Contract.events `" +msgstr "" + +#: ../../overview.rst:266 +msgid ":attr:`Contract.fallback `" +msgstr "" + +#: ../../overview.rst:267 +msgid ":meth:`Contract.constructor() `" +msgstr "" + +#: ../../overview.rst:268 +msgid ":meth:`Contract.encode_abi() `" +msgstr "" + +#: ../../overview.rst:269 +msgid ":attr:`web3.contract.ContractFunction `" +msgstr "" + +#: ../../overview.rst:270 +msgid ":attr:`web3.contract.ContractEvents `" +msgstr "" + +#: ../../overview.rst:274 +msgid "Events, Logs, and Filters" +msgstr "" + +#: ../../overview.rst:276 +msgid "" +"If you want to react to new blocks being mined or specific events being " +"emitted by a contract, you can leverage ``get_logs``, subscriptions, or " +"filters." +msgstr "" + +#: ../../overview.rst:279 +msgid "See the :doc:`filters` guide for more information." +msgstr "" + +#: ../../overview.rst:285 +msgid ":meth:`web3.eth.subscribe() `" +msgstr "" + +#: ../../overview.rst:286 +msgid ":meth:`web3.eth.filter() `" +msgstr "" + +#: ../../overview.rst:287 +msgid ":meth:`web3.eth.get_filter_changes() `" +msgstr "" + +#: ../../overview.rst:288 +msgid ":meth:`web3.eth.get_filter_logs() `" +msgstr "" + +#: ../../overview.rst:289 +msgid ":meth:`web3.eth.uninstall_filter() `" +msgstr "" + +#: ../../overview.rst:290 +msgid ":meth:`web3.eth.get_logs() `" +msgstr "" + +#: ../../overview.rst:291 +msgid "" +":meth:`Contract.events.your_event_name.create_filter() " +"`" +msgstr "" + +#: ../../overview.rst:292 +msgid "" +":meth:`Contract.events.your_event_name.build_filter() " +"`" +msgstr "" + +#: ../../overview.rst:293 +msgid "" +":meth:`Filter.get_new_entries() " +"`" +msgstr "" + +#: ../../overview.rst:294 +msgid "" +":meth:`Filter.get_all_entries() " +"`" +msgstr "" + +#: ../../overview.rst:295 +msgid ":meth:`Filter.format_entry() `" +msgstr "" + +#: ../../overview.rst:296 +msgid ":meth:`Filter.is_valid_entry() `" +msgstr "" + +#: ../../overview.rst:300 +msgid "Net API" +msgstr "" + +#: ../../overview.rst:302 +msgid "Some basic network properties are available on the ``web3.net`` object:" +msgstr "" + +#: ../../overview.rst:304 +msgid ":attr:`web3.net.listening`" +msgstr "" + +#: ../../overview.rst:305 +msgid ":attr:`web3.net.peer_count`" +msgstr "" + +#: ../../overview.rst:306 +msgid ":attr:`web3.net.version`" +msgstr "" + +#: ../../overview.rst:310 +msgid "ENS" +msgstr "" + +#: ../../overview.rst:312 +msgid "" +"`Ethereum Name Service (ENS) `_ provides the " +"infrastructure for human-readable addresses. If an address is registered " +"with the ENS registry, the domain name can be used in place of the " +"address itself. For example, the registered domain name ``ethereum.eth`` " +"will resolve to the address " +"``0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe``. web3.py has support for " +"ENS, documented :ref:`here `." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/providers.po b/docs/locales/zh_CN/LC_MESSAGES/providers.po new file mode 100644 index 0000000000..27a0e86fef --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/providers.po @@ -0,0 +1,660 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../providers.rst:4 +msgid "Providers" +msgstr "提供者" + +#: ../../providers.rst:6 +msgid "" +"Using Ethereum requires access to an Ethereum node. If you have the " +"means, you're encouraged to `run your own node`_. (Note that you do not " +"need to stake ether to run a node.) If you're unable to run your own " +"node, you can use a `remote node`_." +msgstr "" + +#: ../../providers.rst:10 +msgid "" +"Once you have access to a node, you can connect to it using a " +"**provider**. Providers generate `JSON-RPC`_ requests and return the " +"response. This is done by submitting the request to an HTTP, WebSocket, " +"or IPC socket-based server." +msgstr "" + +#: ../../providers.rst:16 +msgid "" +"web3.py supports one provider per instance. If you have an advanced use " +"case that requires multiple providers, create and configure a new web3 " +"instance per connection." +msgstr "" + +#: ../../providers.rst:20 +msgid "" +"If you are already happily connected to your Ethereum node, then you can " +"skip the rest of this providers section." +msgstr "" + +#: ../../providers.rst:30 +msgid "Choosing a Provider" +msgstr "" + +#: ../../providers.rst:32 +msgid "Most nodes have a variety of ways to connect to them. Most commonly:" +msgstr "" + +#: ../../providers.rst:34 +msgid "IPC (uses local filesystem: fastest and most secure)" +msgstr "" + +#: ../../providers.rst:35 +msgid "WebSocket (works remotely, faster than HTTP)" +msgstr "" + +#: ../../providers.rst:36 +msgid "HTTP (more nodes support it)" +msgstr "" + +#: ../../providers.rst:38 +msgid "If you're not sure how to decide, choose this way:" +msgstr "" + +#: ../../providers.rst:40 +msgid "" +"If you have the option of running web3.py on the same machine as the " +"node, choose IPC." +msgstr "" + +#: ../../providers.rst:41 +msgid "If you must connect to a node on a different computer, use WebSocket." +msgstr "" + +#: ../../providers.rst:42 +msgid "If your node does not support WebSocket, use HTTP." +msgstr "" + +#: ../../providers.rst:44 +msgid "" +"Once you have decided how to connect, you'll select and configure the " +"appropriate provider class:" +msgstr "" + +#: ../../providers.rst:47 +msgid ":class:`~web3.providers.rpc.HTTPProvider`" +msgstr "" + +#: ../../providers.rst:48 +msgid ":class:`~web3.providers.ipc.IPCProvider`" +msgstr "" + +#: ../../providers.rst:49 +msgid ":class:`~web3.providers.async_rpc.AsyncHTTPProvider`" +msgstr "" + +#: ../../providers.rst:50 +msgid "" +":class:`~web3.providers.persistent.AsyncIPCProvider` (Persistent " +"Connection Provider)" +msgstr "" + +#: ../../providers.rst:51 +msgid "" +":class:`~web3.providers.persistent.WebSocketProvider` (Persistent " +"Connection Provider)" +msgstr "" + +#: ../../providers.rst:53 +msgid "" +"Each provider above links to the documentation on how to properly " +"initialize that provider. Once you have reviewed the relevant " +"documentation for the provider of your choice, you are ready to :ref:`get" +" started with web3.py`." +msgstr "" + +#: ../../providers.rst:58 +msgid "Provider via Environment Variable" +msgstr "" + +#: ../../providers.rst:60 +msgid "" +"Alternatively, you can set the environment variable ``WEB3_PROVIDER_URI``" +" before starting your script, and web3 will look for that provider first." +msgstr "" + +#: ../../providers.rst:63 +msgid "Valid formats for this environment variable are:" +msgstr "" + +#: ../../providers.rst:65 +msgid "``file:///path/to/node/rpc-json/file.ipc``" +msgstr "" + +#: ../../providers.rst:66 +msgid "``http://192.168.1.2:8545``" +msgstr "" + +#: ../../providers.rst:67 +msgid "``https://node.ontheweb.com``" +msgstr "" + +#: ../../providers.rst:68 +msgid "``ws://127.0.0.1:8546``" +msgstr "" + +#: ../../providers.rst:72 +msgid "Auto-initialization Provider Shortcuts" +msgstr "" + +#: ../../providers.rst:75 +msgid "Geth dev Proof of Authority" +msgstr "" + +#: ../../providers.rst:77 +msgid "" +"To connect to a ``geth --dev`` Proof of Authority instance with the POA " +"middleware loaded by default:" +msgstr "" + +#: ../../providers.rst:88 +msgid "Or, connect to an async web3 instance:" +msgstr "" + +#: ../../providers.rst:101 +msgid "Built In Providers" +msgstr "" + +#: ../../providers.rst:103 +msgid "" +"Web3 ships with the following providers which are appropriate for " +"connecting to local and remote JSON-RPC servers." +msgstr "" + +#: ../../providers.rst:108 +msgid "HTTPProvider" +msgstr "" + +#: ../../providers.rst:112 +msgid "" +"This provider handles interactions with an HTTP or HTTPS based JSON-RPC " +"server." +msgstr "" + +#: ../../providers.rst:114 ../../providers.rst:192 +msgid "" +"``endpoint_uri`` should be the full URI to the RPC endpoint such as " +"``'https://localhost:8545'``. For RPC servers behind HTTP connections " +"running on port 80 and HTTPS connections running on port 443 the port can" +" be omitted from the URI." +msgstr "" + +#: ../../providers.rst:118 ../../providers.rst:196 +msgid "" +"``request_kwargs`` should be a dictionary of keyword arguments which will" +" be passed onto each http/https POST request made to your node." +msgstr "" + +#: ../../providers.rst:120 +msgid "" +"``session`` allows you to pass a ``requests.Session`` object initialized " +"as desired." +msgstr "" + +#: ../../providers.rst:122 ../../providers.rst:198 +msgid "" +"``exception_retry_configuration`` is an instance of the " +":class:`~web3.providers.rpc.utils.ExceptionRetryConfiguration` class " +"which allows you to configure how the provider should handle exceptions " +"when making certain requests. Setting this to ``None`` will disable " +"exception retries." +msgstr "" + +#: ../../providers.rst:133 +msgid "" +"Note that you should create only one HTTPProvider with the same provider " +"URL per python process, as the HTTPProvider recycles underlying TCP/IP " +"network connections, for better performance. Multiple HTTPProviders with " +"different URLs will work as expected." +msgstr "" + +#: ../../providers.rst:138 +msgid "" +"Under the hood, the ``HTTPProvider`` uses the python requests library for" +" making requests. If you would like to modify how requests are made, you" +" can use the ``request_kwargs`` to do so. A common use case for this is " +"increasing the timeout for each request." +msgstr "" + +#: ../../providers.rst:150 +msgid "" +"To tune the connection pool size, you can pass your own " +"``requests.Session``." +msgstr "" + +#: ../../providers.rst:163 +msgid "IPCProvider" +msgstr "" + +#: ../../providers.rst:167 +msgid "" +"This provider handles interaction with an IPC Socket based JSON-RPC " +"server." +msgstr "" + +#: ../../providers.rst:170 ../../providers.rst:282 +msgid "``ipc_path`` is the filesystem path to the IPC socket:" +msgstr "" + +#: ../../providers.rst:177 ../../providers.rst:293 +msgid "" +"If no ``ipc_path`` is specified, it will use a default depending on your " +"operating system." +msgstr "" + +#: ../../providers.rst:180 ../../providers.rst:296 +msgid "On Linux and FreeBSD: ``~/.ethereum/geth.ipc``" +msgstr "" + +#: ../../providers.rst:181 ../../providers.rst:297 +msgid "On Mac OS: ``~/Library/Ethereum/geth.ipc``" +msgstr "" + +#: ../../providers.rst:182 ../../providers.rst:298 +msgid "On Windows: ``\\\\.\\pipe\\geth.ipc``" +msgstr "" + +#: ../../providers.rst:186 +msgid "AsyncHTTPProvider" +msgstr "" + +#: ../../providers.rst:190 +msgid "" +"This provider handles interactions with an HTTP or HTTPS based JSON-RPC " +"server asynchronously." +msgstr "" + +#: ../../providers.rst:204 +msgid "" +"The ``cache_async_session()`` method allows you to use your own " +"``aiohttp.ClientSession`` object." +msgstr "" + +#: ../../providers.rst:220 +msgid "" +"Under the hood, the ``AsyncHTTPProvider`` uses the python `aiohttp " +"`_ library for making requests." +msgstr "" + +#: ../../providers.rst:224 +msgid "Persistent Connection Providers" +msgstr "" + +#: ../../providers.rst:227 +msgid "Persistent Connection Base Class" +msgstr "" + +#: ../../providers.rst:230 +msgid "" +"This class is not meant to be used directly. If your provider class " +"inherits from this class, look to these docs for additional configuration" +" options." +msgstr "" + +#: ../../providers.rst:241 +msgid "This is a base provider class, inherited by the following providers:" +msgstr "" + +#: ../../providers.rst:243 +msgid ":class:`~web3.providers.persistent.WebSocketProvider`" +msgstr "" + +#: ../../providers.rst:244 +msgid ":class:`~web3.providers.persistent.AsyncIPCProvider`" +msgstr "" + +#: ../../providers.rst:246 +msgid "" +"It handles interactions with a persistent connection to a JSON-RPC " +"server. Among its configuration, it houses all of the " +":class:`~web3.providers.persistent.request_processor.RequestProcessor` " +"logic for handling the asynchronous sending and receiving of requests and" +" responses. See the :ref:`internals__persistent_connection_providers` " +"section for more details on the internals of persistent connection " +"providers." +msgstr "" + +#: ../../providers.rst:253 +msgid "" +"``request_timeout`` is the timeout in seconds, used when sending data " +"over the connection and waiting for a response to be received from the " +"listener task. Defaults to ``50.0``." +msgstr "" + +#: ../../providers.rst:257 +msgid "" +"``subscription_response_queue_size`` is the size of the queue used to " +"store subscription responses, defaults to ``500``. While messages are " +"being consumed, this queue should never fill up as it is a transient " +"queue and meant to handle asynchronous receiving and processing of " +"responses. When in sync with the socket stream, this queue should only " +"ever store 1 to a few messages at a time." +msgstr "" + +#: ../../providers.rst:263 +msgid "" +"``silence_listener_task_exceptions`` is a boolean that determines whether" +" exceptions raised by the listener task are silenced. Defaults to " +"``False``, raising any exceptions that occur in the listener task." +msgstr "" + +#: ../../providers.rst:267 +msgid "" +"``max_connection_retries`` is the maximum number of times to retry a " +"connection to the provider when initializing the provider. Defaults to " +"``5``." +msgstr "" + +#: ../../providers.rst:270 +msgid "" +"``request_information_cache_size`` specifies the size of the transient " +"cache for storing request details, enabling the provider to process " +"responses based on the original request information. Defaults to ``500``." +msgstr "" + +#: ../../providers.rst:275 +msgid "AsyncIPCProvider" +msgstr "" + +#: ../../providers.rst:279 +msgid "" +"This provider handles asynchronous, persistent interaction with an IPC " +"Socket based JSON-RPC server." +msgstr "" + +#: ../../providers.rst:283 +msgid "" +"``read_buffer_limit`` is the maximum size of data, in bytes, that can be " +"read from the socket at one time. Defaults to 20MB (20 * 1024 * 1024). " +"Raises ``ReadBufferLimitReached`` if the limit is reached, suggesting " +"that the buffer limit be increased." +msgstr "" + +#: ../../providers.rst:288 ../../providers.rst:314 +msgid "" +"This provider inherits from the " +":class:`~web3.providers.persistent.PersistentConnectionProvider` class. " +"Refer to the " +":class:`~web3.providers.persistent.PersistentConnectionProvider` " +"documentation for details on additional configuration options available " +"for this provider." +msgstr "" + +#: ../../providers.rst:301 +msgid "WebSocketProvider" +msgstr "" + +#: ../../providers.rst:305 ../../providers.rst:541 +msgid "" +"This provider handles interactions with an WS or WSS based JSON-RPC " +"server." +msgstr "" + +#: ../../providers.rst:307 ../../providers.rst:543 +msgid "" +"``endpoint_uri`` should be the full URI to the RPC endpoint such as " +"``'ws://localhost:8546'``." +msgstr "" + +#: ../../providers.rst:309 ../../providers.rst:547 +msgid "" +"``websocket_kwargs`` this should be a dictionary of keyword arguments " +"which will be passed onto the ws/wss websocket connection." +msgstr "" + +#: ../../providers.rst:311 +msgid "" +"``use_text_frames`` will ensure websocket data is sent as text frames for" +" servers that do not support binary communication." +msgstr "" + +#: ../../providers.rst:319 +msgid "" +"Under the hood, the ``WebSocketProvider`` uses the python websockets " +"library for making requests. If you would like to modify how requests " +"are made, you can use the ``websocket_kwargs`` to do so. See the " +"`websockets documentation`_ for available arguments." +msgstr "" + +#: ../../providers.rst:328 +msgid "Using Persistent Connection Providers" +msgstr "" + +#: ../../providers.rst:330 +msgid "" +"The ``AsyncWeb3`` class may be used as a context manager, utilizing the " +"``async with`` syntax, when instantiating with a " +":class:`~web3.providers.persistent.PersistentConnectionProvider`. This " +"will automatically close the connection when the context manager exits " +"and is the recommended way to initiate a persistent connection to the " +"provider." +msgstr "" + +#: ../../providers.rst:336 +msgid "" +"A similar example using a ``websockets`` connection as an asynchronous " +"context manager can be found in the `websockets connection`_ docs." +msgstr "" + +#: ../../providers.rst:383 +msgid "" +"The ``AsyncWeb3`` class may also be used as an asynchronous iterator, " +"utilizing the ``async for`` syntax, when instantiating with a " +":class:`~web3.providers.persistent.PersistentConnectionProvider`. This " +"may be used to set up an indefinite websocket connection and reconnect " +"automatically if the connection is lost." +msgstr "" + +#: ../../providers.rst:389 +msgid "" +"A similar example using a ``websockets`` connection as an asynchronous " +"iterator can be found in the `websockets connection`_ docs." +msgstr "" + +#: ../../providers.rst:416 +msgid "" +"Awaiting the instantiation with a " +":class:`~web3.providers.persistent.PersistentConnectionProvider`, or " +"instantiating and awaiting the ``connect()`` method is also possible. " +"Both of these examples are shown below." +msgstr "" + +#: ../../providers.rst:450 +msgid "" +":class:`~web3.providers.persistent.PersistentConnectionProvider` classes " +"use the " +":class:`~web3.providers.persistent.request_processor.RequestProcessor` " +"class under the hood to sync up the receiving of responses and response " +"processing for one-to-one and one-to-many request-to-response requests. " +"Refer to the " +":class:`~web3.providers.persistent.request_processor.RequestProcessor` " +"documentation for details." +msgstr "" + +#: ../../providers.rst:458 +msgid "AsyncWeb3 with Persistent Connection Providers" +msgstr "" + +#: ../../providers.rst:460 +msgid "" +"When an ``AsyncWeb3`` class is connected to a " +":class:`~web3.providers.persistent.PersistentConnectionProvider`, some " +"attributes and methods become available." +msgstr "" + +#: ../../providers.rst:466 +msgid "" +"The public API for interacting with the websocket connection is available" +" via the ``socket`` attribute of the ``Asyncweb3`` class. This attribute " +"is an instance of the " +":class:`~web3.providers.persistent.persistent_connection.PersistentConnection`" +" class and is the main interface for interacting with the socket " +"connection." +msgstr "" + +#: ../../providers.rst:474 +msgid "Interacting with the Persistent Connection" +msgstr "" + +#: ../../providers.rst:478 +msgid "" +"This class handles interactions with a persistent socket connection. It " +"is available via the ``socket`` attribute on the ``AsyncWeb3`` class. The" +" ``PersistentConnection`` class has the following methods and attributes:" +msgstr "" + +#: ../../providers.rst:484 +msgid "" +"This attribute returns the current active subscriptions as a dict mapping" +" the subscription ``id`` to a dict of metadata about the subscription " +"request." +msgstr "" + +#: ../../providers.rst:490 +msgid "" +"This method is available for listening to websocket subscriptions " +"indefinitely. It is an asynchronous iterator that yields strictly one-to-" +"many (e.g. ``eth_subscription`` responses) request-to-response messages " +"from the websocket connection. To receive responses for one-to-one " +"request-to-response calls, use the standard API for making requests via " +"the appropriate module (e.g. ``block_num = await w3.eth.block_number``)" +msgstr "" + +#: ../../providers.rst:497 +msgid "" +"The responses from this method are formatted by *web3.py* formatters and " +"run through the middleware that were present at the time of subscription." +" Examples on how to use this method can be seen above in the `Using " +"Persistent Connection Providers`_ section." +msgstr "" + +#: ../../providers.rst:504 +msgid "" +"This method is available strictly for sending raw requests to the socket," +" if desired. It is not recommended to use this method directly, as the " +"responses will not be formatted by *web3.py* formatters or run through " +"the middleware. Instead, use the methods available on the respective web3" +" module. For example, use ``w3.eth.get_block(\"latest\")`` instead of " +"``w3.socket.send(\"eth_getBlockByNumber\", [\"latest\", True])``." +msgstr "" + +#: ../../providers.rst:513 +msgid "" +"The ``recv()`` method can be used to receive the next response for a " +"request from the socket. The response from this method is the raw " +"response. This is not the recommended way to receive a response for a " +"request, as it is not formatted by *web3.py* formatters or run through " +"the middleware. Instead, use the methods available on the respective web3" +" module (e.g. ``block_num = await w3.eth.block_number``) for retrieving " +"responses for one-to-one request-to-response calls." +msgstr "" + +#: ../../providers.rst:523 +msgid "" +"This method is available for making requests to the socket and retrieving" +" the response. It is not recommended to use this method directly, as the " +"responses will not be properly formatted by *web3.py* formatters or run " +"through the middleware. Instead, use the methods available on the " +"respective web3 module. For example, use ``w3.eth.get_block(\"latest\")``" +" instead of ``w3.socket.make_request(\"eth_getBlockByNumber\", " +"[\"latest\", True])``." +msgstr "" + +#: ../../providers.rst:532 +msgid "LegacyWebSocketProvider" +msgstr "" + +#: ../../providers.rst:536 +msgid "" +"``LegacyWebSocketProvider`` is deprecated and is likely to be removed in " +"a future major release. Please use ``WebSocketProvider`` instead." +msgstr "" + +#: ../../providers.rst:545 +msgid "" +"``websocket_timeout`` is the timeout in seconds, used when receiving or " +"sending data over the connection. Defaults to 10." +msgstr "" + +#: ../../providers.rst:555 +msgid "" +"Under the hood, ``LegacyWebSocketProvider`` uses the python " +"``websockets`` library for making requests. If you would like to modify " +"how requests are made, you can use the ``websocket_kwargs`` to do so. " +"See the `websockets documentation`_ for available arguments." +msgstr "" + +#: ../../providers.rst:562 +msgid "" +"Unlike HTTP connections, the timeout for WS connections is controlled by " +"a separate ``websocket_timeout`` argument, as shown below." +msgstr "" + +#: ../../providers.rst:573 +msgid "AutoProvider" +msgstr "" + +#: ../../providers.rst:575 +msgid "" +":class:`~web3.providers.auto.AutoProvider` is the default used when " +"initializing :class:`web3.Web3` without any providers. There's rarely a " +"reason to use it explicitly." +msgstr "" + +#: ../../providers.rst:582 +msgid "EthereumTesterProvider" +msgstr "" + +#: ../../providers.rst:584 +msgid "" +"Experimental: This provider is experimental. There are still significant" +" gaps in functionality. However it is being actively developed and " +"supported." +msgstr "" + +#: ../../providers.rst:590 +msgid "" +"This provider integrates with the ``eth-tester`` library. The " +"``ethereum_tester`` constructor argument should be an instance of the " +":class:`~eth_tester.EthereumTester` or a subclass of " +":class:`~eth_tester.backends.base.BaseChainBackend` class provided by the" +" ``eth-tester`` library. The ``api_endpoints`` argument should be a " +"``dict`` of RPC endpoints. You can see the structure and defaults `here " +"`_." +" If you would like a custom ``eth-tester`` instance to test with, see the" +" ``eth-tester`` library `documentation `_ for details." +msgstr "" + +#: ../../providers.rst:604 +msgid "" +"To install the needed dependencies to use EthereumTesterProvider, you can" +" install the pip extras package that has the correct interoperable " +"versions of the ``eth-tester`` and ``py-evm`` dependencies needed: e.g. " +"``pip install \"web3[tester]\"``" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/quickstart.po b/docs/locales/zh_CN/LC_MESSAGES/quickstart.po new file mode 100644 index 0000000000..1b1b9f9902 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/quickstart.po @@ -0,0 +1,164 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../quickstart.rst:4 +msgid "Quickstart" +msgstr "快速开始" + +#: ../../quickstart.rst:8 +msgid "" +"All code starting with a ``$`` is meant to run on your terminal. All code" +" starting with a ``>>>`` is meant to run in a python interpreter, like " +"`ipython `_." +msgstr "" + +#: ../../quickstart.rst:13 +msgid "Installation" +msgstr "安装" + +#: ../../quickstart.rst:15 +msgid "" +"web3.py can be installed (preferably in a :ref:`virtualenv " +"`) using ``pip`` as follows:" +msgstr "" + + +#: ../../quickstart.rst:23 +msgid "" +"If you run into problems during installation, you might have a broken " +"environment. See the troubleshooting guide to :ref:`setting up a clean " +"environment `." +msgstr "" + +#: ../../quickstart.rst:29 +msgid "Using Web3" +msgstr "使用 Web3" + +#: ../../quickstart.rst:31 +msgid "" +"This library depends on a connection to an Ethereum node. We call these " +"connections *Providers* and there are several ways to configure them. The" +" full details can be found in the :ref:`Providers` " +"documentation. This Quickstart guide will highlight a couple of the most " +"common use cases." +msgstr "" + +#: ../../quickstart.rst:38 +msgid "Test Provider" +msgstr "" + +#: ../../quickstart.rst:40 +msgid "" +"If you're just learning the ropes or doing some quick prototyping, you " +"can use a test provider, `eth-tester `_. This provider includes some accounts prepopulated with test " +"ether and instantly includes each transaction into a block. web3.py makes" +" this test provider available via ``EthereumTesterProvider``." +msgstr "" + +#: ../../quickstart.rst:47 +msgid "" +"The ``EthereumTesterProvider`` requires additional dependencies. Install " +"them via ``pip install \"web3[tester]\"``, then import and instantiate " +"the provider as seen below." +msgstr "" + +#: ../../quickstart.rst:59 +msgid "Local Providers" +msgstr "" + +#: ../../quickstart.rst:61 +msgid "" +"The hardware requirements are `steep " +"`_, but the safest way to interact with Ethereum " +"is to run an Ethereum client on your own hardware. For locally run nodes," +" an IPC connection is the most secure option, but HTTP and websocket " +"configurations are also available. By default, the popular `Geth client " +"`_ exposes port ``8545`` to serve HTTP " +"requests and ``8546`` for websocket requests. Connecting to this local " +"node can be done as follows:" +msgstr "" + +#: ../../quickstart.rst:101 +msgid "Remote Providers" +msgstr "" + +#: ../../quickstart.rst:103 +msgid "" +"The quickest way to interact with the Ethereum blockchain is to use a " +"`remote node provider `_. You can connect to " +"a remote node by specifying the endpoint, just like the previous local " +"node example:" +msgstr "" + +#: ../../quickstart.rst:116 +msgid "" +"This endpoint is provided by the remote node service, typically after you" +" create an account." +msgstr "" + +#: ../../quickstart.rst:122 +msgid "Getting Blockchain Info" +msgstr "" + +#: ../../quickstart.rst:124 +msgid "" +"It's time to start using web3.py! Once properly configured, the ``w3`` " +"instance will allow you to interact with the Ethereum blockchain. Try " +"getting all the information about the latest block:" +msgstr "" + +#: ../../quickstart.rst:151 +msgid "" +"web3.py can help you read block data, sign and send transactions, deploy " +"and interact with contracts, and a number of other features." +msgstr "" + +#: ../../quickstart.rst:154 +msgid "A few suggestions from here:" +msgstr "" + +#: ../../quickstart.rst:156 +msgid "The :doc:`overview` page provides a summary of web3.py's features." +msgstr "" + +#: ../../quickstart.rst:157 +msgid "" +"The :class:`w3.eth ` API contains the most frequently used " +"methods." +msgstr "" + +#: ../../quickstart.rst:158 +msgid "A guide to :ref:`contracts` includes deployment and usage examples." +msgstr "" + +#: ../../quickstart.rst:159 +msgid "The nuances of :doc:`transactions` are explained in another guide." +msgstr "" + +#: ../../quickstart.rst:161 +msgid "" +"It is recommended that your development environment have the " +"``PYTHONWARNINGS=default`` environment variable set. Some deprecation " +"warnings will not show up without this variable being set." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/release_notes.po b/docs/locales/zh_CN/LC_MESSAGES/release_notes.po new file mode 100644 index 0000000000..902646647b --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/release_notes.po @@ -0,0 +1,9333 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../release_notes.rst:2 +msgid "Release Notes" +msgstr "发布说明" + +#: ../../release_notes.rst:4 +msgid "v7 Breaking Changes Summary" +msgstr "" + +#: ../../release_notes.rst:5 +msgid "See the :ref:`v7 Migration Guide`" +msgstr "" + +#: ../../release_notes.rst:10 +msgid "web3.py v7.13.0 (2025-08-04)" +msgstr "" + +#: ../../release_notes.rst:13 ../../release_notes.rst:41 +#: ../../release_notes.rst:62 ../../release_notes.rst:102 +#: ../../release_notes.rst:126 ../../release_notes.rst:172 +#: ../../release_notes.rst:217 ../../release_notes.rst:256 +#: ../../release_notes.rst:285 ../../release_notes.rst:315 +#: ../../release_notes.rst:367 ../../release_notes.rst:390 +#: ../../release_notes.rst:413 ../../release_notes.rst:459 +#: ../../release_notes.rst:474 ../../release_notes.rst:586 +#: ../../release_notes.rst:607 ../../release_notes.rst:639 +#: ../../release_notes.rst:712 ../../release_notes.rst:744 +#: ../../release_notes.rst:802 ../../release_notes.rst:848 +#: ../../release_notes.rst:906 ../../release_notes.rst:970 +#: ../../release_notes.rst:985 ../../release_notes.rst:1061 +#: ../../release_notes.rst:1099 ../../release_notes.rst:1133 +#: ../../release_notes.rst:1154 ../../release_notes.rst:1183 +#: ../../release_notes.rst:1216 ../../release_notes.rst:1234 +#: ../../release_notes.rst:1287 ../../release_notes.rst:1332 +#: ../../release_notes.rst:1378 ../../release_notes.rst:1414 +#: ../../release_notes.rst:1438 ../../release_notes.rst:1474 +#: ../../release_notes.rst:1491 ../../release_notes.rst:1551 +#: ../../release_notes.rst:1644 ../../release_notes.rst:1737 +#: ../../release_notes.rst:1790 ../../release_notes.rst:1829 +#: ../../release_notes.rst:1865 ../../release_notes.rst:1949 +#: ../../release_notes.rst:2028 ../../release_notes.rst:2141 +#: ../../release_notes.rst:2191 ../../release_notes.rst:2223 +#: ../../release_notes.rst:2285 ../../release_notes.rst:2332 +#: ../../release_notes.rst:2375 ../../release_notes.rst:2439 +#: ../../release_notes.rst:2465 ../../release_notes.rst:2496 +#: ../../release_notes.rst:2516 ../../release_notes.rst:2555 +#: ../../release_notes.rst:2691 ../../release_notes.rst:2718 +#: ../../release_notes.rst:2742 ../../release_notes.rst:2766 +#: ../../release_notes.rst:2793 ../../release_notes.rst:2817 +#: ../../release_notes.rst:2868 ../../release_notes.rst:2877 +#: ../../release_notes.rst:2900 ../../release_notes.rst:2916 +#: ../../release_notes.rst:2942 ../../release_notes.rst:2964 +#: ../../release_notes.rst:2988 ../../release_notes.rst:3014 +#: ../../release_notes.rst:3057 ../../release_notes.rst:3080 +#: ../../release_notes.rst:3116 ../../release_notes.rst:3153 +#: ../../release_notes.rst:3162 ../../release_notes.rst:3191 +#: ../../release_notes.rst:3221 ../../release_notes.rst:3259 +#: ../../release_notes.rst:3280 ../../release_notes.rst:3307 +#: ../../release_notes.rst:3316 ../../release_notes.rst:3339 +#: ../../release_notes.rst:3379 ../../release_notes.rst:3431 +#: ../../release_notes.rst:3533 ../../release_notes.rst:3622 +#: ../../release_notes.rst:3694 ../../release_notes.rst:3735 +#: ../../release_notes.rst:3867 ../../release_notes.rst:3879 +#: ../../release_notes.rst:3898 ../../release_notes.rst:3922 +#: ../../release_notes.rst:3958 ../../release_notes.rst:3975 +#: ../../release_notes.rst:4001 ../../release_notes.rst:4034 +#: ../../release_notes.rst:4062 +msgid "Bugfixes" +msgstr "" + +#: ../../release_notes.rst:15 +msgid "" +"Raise ``BadResponseFormat`` from within ``FormattingMiddleware`` if the " +"raw response is not a dict. (`#3735 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:19 ../../release_notes.rst:179 +#: ../../release_notes.rst:226 ../../release_notes.rst:293 +#: ../../release_notes.rst:344 ../../release_notes.rst:375 +#: ../../release_notes.rst:397 ../../release_notes.rst:421 +#: ../../release_notes.rst:480 ../../release_notes.rst:512 +#: ../../release_notes.rst:541 ../../release_notes.rst:614 +#: ../../release_notes.rst:645 ../../release_notes.rst:718 +#: ../../release_notes.rst:752 ../../release_notes.rst:809 +#: ../../release_notes.rst:855 ../../release_notes.rst:913 +#: ../../release_notes.rst:946 ../../release_notes.rst:991 +#: ../../release_notes.rst:1009 ../../release_notes.rst:1027 +#: ../../release_notes.rst:1068 ../../release_notes.rst:1107 +#: ../../release_notes.rst:1143 ../../release_notes.rst:1160 +#: ../../release_notes.rst:1192 ../../release_notes.rst:1244 +#: ../../release_notes.rst:1295 ../../release_notes.rst:1344 +#: ../../release_notes.rst:1386 ../../release_notes.rst:1420 +#: ../../release_notes.rst:1445 ../../release_notes.rst:1502 +#: ../../release_notes.rst:1561 ../../release_notes.rst:1663 +#: ../../release_notes.rst:1798 ../../release_notes.rst:2235 +#: ../../release_notes.rst:2297 ../../release_notes.rst:2340 +#: ../../release_notes.rst:2382 ../../release_notes.rst:2416 +#: ../../release_notes.rst:2446 ../../release_notes.rst:2473 +#: ../../release_notes.rst:2507 ../../release_notes.rst:2522 +#: ../../release_notes.rst:2561 ../../release_notes.rst:2595 +#: ../../release_notes.rst:2631 ../../release_notes.rst:2663 +#: ../../release_notes.rst:2697 ../../release_notes.rst:2727 +#: ../../release_notes.rst:2772 ../../release_notes.rst:2850 +#: ../../release_notes.rst:2883 ../../release_notes.rst:2906 +#: ../../release_notes.rst:2925 ../../release_notes.rst:2948 +#: ../../release_notes.rst:3029 ../../release_notes.rst:3093 +#: ../../release_notes.rst:3125 ../../release_notes.rst:3169 +#: ../../release_notes.rst:3199 ../../release_notes.rst:3236 +#: ../../release_notes.rst:3265 ../../release_notes.rst:3286 +msgid "Improved Documentation" +msgstr "" + +#: ../../release_notes.rst:21 +msgid "" +"Fix broken link to external ``eth_gasPrice`` documentation. (`#3717 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:25 ../../release_notes.rst:77 +#: ../../release_notes.rst:133 ../../release_notes.rst:185 +#: ../../release_notes.rst:233 ../../release_notes.rst:263 +#: ../../release_notes.rst:321 ../../release_notes.rst:350 +#: ../../release_notes.rst:381 ../../release_notes.rst:429 +#: ../../release_notes.rst:465 ../../release_notes.rst:487 +#: ../../release_notes.rst:547 ../../release_notes.rst:592 +#: ../../release_notes.rst:620 ../../release_notes.rst:658 +#: ../../release_notes.rst:691 ../../release_notes.rst:724 +#: ../../release_notes.rst:759 ../../release_notes.rst:862 +#: ../../release_notes.rst:929 ../../release_notes.rst:954 +#: ../../release_notes.rst:1033 ../../release_notes.rst:1076 +#: ../../release_notes.rst:1113 ../../release_notes.rst:1166 +#: ../../release_notes.rst:1199 ../../release_notes.rst:1255 +#: ../../release_notes.rst:1307 ../../release_notes.rst:1351 +#: ../../release_notes.rst:1368 ../../release_notes.rst:1406 +#: ../../release_notes.rst:1430 ../../release_notes.rst:1484 +#: ../../release_notes.rst:1544 ../../release_notes.rst:1626 +#: ../../release_notes.rst:1719 ../../release_notes.rst:1836 +#: ../../release_notes.rst:1908 ../../release_notes.rst:1973 +#: ../../release_notes.rst:2052 ../../release_notes.rst:2106 +#: ../../release_notes.rst:2149 ../../release_notes.rst:2174 +#: ../../release_notes.rst:2207 ../../release_notes.rst:2261 +#: ../../release_notes.rst:2324 ../../release_notes.rst:2364 +#: ../../release_notes.rst:2410 ../../release_notes.rst:2432 +#: ../../release_notes.rst:2455 ../../release_notes.rst:2490 +#: ../../release_notes.rst:2541 ../../release_notes.rst:2578 +#: ../../release_notes.rst:2610 ../../release_notes.rst:2653 +#: ../../release_notes.rst:2672 ../../release_notes.rst:2711 +#: ../../release_notes.rst:2750 ../../release_notes.rst:2787 +#: ../../release_notes.rst:2843 ../../release_notes.rst:2893 +#: ../../release_notes.rst:2935 ../../release_notes.rst:2958 +#: ../../release_notes.rst:2980 ../../release_notes.rst:2998 +#: ../../release_notes.rst:3049 ../../release_notes.rst:3072 +#: ../../release_notes.rst:3108 ../../release_notes.rst:3147 +#: ../../release_notes.rst:3185 ../../release_notes.rst:3215 +#: ../../release_notes.rst:3252 ../../release_notes.rst:3274 +#: ../../release_notes.rst:3334 ../../release_notes.rst:3366 +#: ../../release_notes.rst:3400 ../../release_notes.rst:3420 +#: ../../release_notes.rst:3457 ../../release_notes.rst:3479 +#: ../../release_notes.rst:3517 ../../release_notes.rst:3594 +#: ../../release_notes.rst:3617 ../../release_notes.rst:3632 +#: ../../release_notes.rst:3657 ../../release_notes.rst:3701 +#: ../../release_notes.rst:3768 ../../release_notes.rst:3791 +#: ../../release_notes.rst:3840 ../../release_notes.rst:3889 +#: ../../release_notes.rst:3913 ../../release_notes.rst:3954 +#: ../../release_notes.rst:3991 ../../release_notes.rst:4017 +msgid "Features" +msgstr "" + +#: ../../release_notes.rst:27 +msgid "" +"Support parallelization of subscription handling globally via the " +"subscription manager ``parallelize`` flag, and on a per-subscription " +"basis via the ``parallelize`` flag on the subscription itself. (`#3709 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:31 ../../release_notes.rst:47 +#: ../../release_notes.rst:83 ../../release_notes.rst:115 +#: ../../release_notes.rst:140 ../../release_notes.rst:192 +#: ../../release_notes.rst:239 ../../release_notes.rst:299 +#: ../../release_notes.rst:329 ../../release_notes.rst:357 +#: ../../release_notes.rst:404 ../../release_notes.rst:436 +#: ../../release_notes.rst:494 ../../release_notes.rst:518 +#: ../../release_notes.rst:563 ../../release_notes.rst:598 +#: ../../release_notes.rst:627 ../../release_notes.rst:665 +#: ../../release_notes.rst:697 ../../release_notes.rst:733 +#: ../../release_notes.rst:767 ../../release_notes.rst:872 +#: ../../release_notes.rst:919 ../../release_notes.rst:935 +#: ../../release_notes.rst:960 ../../release_notes.rst:997 +#: ../../release_notes.rst:1016 ../../release_notes.rst:1039 +#: ../../release_notes.rst:1083 ../../release_notes.rst:1123 +#: ../../release_notes.rst:1174 ../../release_notes.rst:1206 +#: ../../release_notes.rst:1265 ../../release_notes.rst:1314 +#: ../../release_notes.rst:1357 ../../release_notes.rst:1395 +#: ../../release_notes.rst:1453 ../../release_notes.rst:1516 +#: ../../release_notes.rst:1572 ../../release_notes.rst:1686 +#: ../../release_notes.rst:1750 ../../release_notes.rst:1812 +msgid "Internal Changes - for web3.py Contributors" +msgstr "" + +#: ../../release_notes.rst:33 +msgid "" +"Update integration test suite fixture to test against geth ``v1.16.2``. " +"(`#1162 `__)" +msgstr "" + +#: ../../release_notes.rst:34 +msgid "" +"Add missing async tests for ``FormattingMiddleware`` as a sanity check. " +"(`#3735 `__)" +msgstr "" + +#: ../../release_notes.rst:38 +msgid "web3.py v7.12.1 (2025-07-14)" +msgstr "" + +#: ../../release_notes.rst:43 +msgid "" +"Fix ``AutoProvider`` batching setup by adding a proxy batch request. " +"(`#3712 `__)" +msgstr "" + +#: ../../release_notes.rst:49 +msgid "" +"Update integrations tests to use geth ``v1.16.0``. (`#3727 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:53 ../../release_notes.rst:163 +#: ../../release_notes.rst:202 ../../release_notes.rst:270 +#: ../../release_notes.rst:306 ../../release_notes.rst:335 +#: ../../release_notes.rst:444 ../../release_notes.rst:570 +#: ../../release_notes.rst:774 ../../release_notes.rst:817 +#: ../../release_notes.rst:884 ../../release_notes.rst:976 +#: ../../release_notes.rst:1046 ../../release_notes.rst:1272 +#: ../../release_notes.rst:1323 +msgid "Miscellaneous Changes" +msgstr "" + +#: ../../release_notes.rst:55 +msgid "" +"`#3698 `__, `#3710 " +"`__" +msgstr "" + +#: ../../release_notes.rst:59 +msgid "web3.py v7.12.0 (2025-05-22)" +msgstr "" + +#: ../../release_notes.rst:64 +msgid "" +"Thread safety for batching and better consistency with " +"``PersistentConnectionProvider`` implementations:" +msgstr "" + +#: ../../release_notes.rst:66 +msgid "" +"Make request batching threadsafe by using ``contextvars.ContextVar`` " +"rather than a global flag for setting the batching state." +msgstr "" + +#: ../../release_notes.rst:67 +msgid "" +"Deterministically match responses with request ids for " +"``PersistentConnectionProvider`` batch requests. (`#3705 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:71 ../../release_notes.rst:109 +#: ../../release_notes.rst:685 ../../release_notes.rst:1338 +msgid "Deprecations" +msgstr "" + +#: ../../release_notes.rst:73 +msgid "" +"Deprecate ``ens_encode_name`` in favor of ``dns_encode_name``. (`#3700 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:79 +msgid "" +"Introduce ``ens.utils.dns_encode_name`` as a rename of the current " +"``ens_encode_name``, for consistency across other language " +"implementations and with the ENS docs. Returns ``HexBytes`` instead of " +"``bytes``. (`#3700 `__)" +msgstr "" + +#: ../../release_notes.rst:85 +msgid "" +"Update some types in ``web3._utils.method_formatters`` (`#3669 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:86 +msgid "" +"Fix issues and start running the core tests with `pytest-xdist`, " +"effectively reducing the CI test times by ~75-80%. (`#3705 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:90 ../../release_notes.rst:149 +#: ../../release_notes.rst:247 ../../release_notes.rst:276 +#: ../../release_notes.rst:450 ../../release_notes.rst:780 +#: ../../release_notes.rst:890 +msgid "Performance Improvements" +msgstr "" + +#: ../../release_notes.rst:92 +msgid "" +"optimize message formatting for logging (`#3643 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:93 +msgid "" +"Optimize web3._utils.decorators.reject_recursive_repeats (`#3668 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:94 +msgid "" +"optimize Method.method_selector_function (`#3696 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:95 +msgid "" +"optimize map_abi_data (`#3697 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:99 +msgid "web3.py v7.11.1 (2025-05-12)" +msgstr "" + +#: ../../release_notes.rst:104 +msgid "" +"Fix contract event ``FilterParams`` to validate and normalize ``address``" +" parameters. (`#3618 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:105 +msgid "" +"Properly handle ``PersistentConnectionClosedOK`` for " +"``subscription_manager.handle_subscriptions()``. (`#3690 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:111 +msgid "" +"Deprecate eth.get_uncle* methods. Will be removed in v8. (`#3683 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:117 +msgid "" +"Re-compile test contracts with new Solidity ``v0.8.30`` and re-generate " +"integration test fixture to test against latest geth ``v1.15.11``. " +"(`#3692 `__)" +msgstr "" + +#: ../../release_notes.rst:118 +msgid "" +"Remove old test fixtures when generating a new test fixture. (`#3693 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:119 +msgid "" +"Address some flaky tests due to a geth bug in state synchronization. " +"(`#3695 `__)" +msgstr "" + +#: ../../release_notes.rst:123 +msgid "web3.py v7.11.0 (2025-04-29)" +msgstr "" + +#: ../../release_notes.rst:128 +msgid "" +"Checks that ``PersistentConnectionProvider`` response cache value is a " +"dict before attempting to access it like one. Also adds checks to " +"``make_batch_request`` to make sure it is in batching mode before being " +"called and is not after. (`#3642 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:129 +msgid "" +"Moves base providers' ``_is_batching`` and ``_batch_request_func_cache`` " +"from class to instance attrs to help with thread safety. (`#3661 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:135 +msgid "" +"Support for Prague network upgrade, mainly ``requests_hash`` and " +"``authorization_list`` formatters. Add support for serializing " +"``SignedSetCodeTransaction`` (`eth-account` pydantic model) directly " +"added to transaction dicts. (`#3659 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:136 +msgid "" +"Allow setting the ``request_information_cache_size`` for " +"``PersistentConnectionProvider`` implementations. (`#3662 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:142 +msgid "" +"Update some outdated TODO notes in code & remove old un-tested uncles " +"tests as no longer relevant post-merge. (`#3605 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:143 +msgid "" +"Run each integration test in isolation and parallelize, instead of " +"running them all within a single `geth` (for example) process. This " +"prevents muddied test contexts. (`#3659 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:144 +msgid "" +"Bound hypothesis integers in some tests to a max of uint256 value (`#3665" +" `__)" +msgstr "" + +#: ../../release_notes.rst:145 +msgid "" +"AsyncENS tests were xfailing for the wrong reason. (`#3675 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:151 +msgid "Optimize performance for:" +msgstr "" + +#: ../../release_notes.rst:153 +msgid "web3._utils.utility_methods.all_in_dict" +msgstr "" + +#: ../../release_notes.rst:154 +msgid "web3._utils.utility_methods.any_in_dict" +msgstr "" + +#: ../../release_notes.rst:155 +msgid "" +"web3._utils.utility_methods.none_in_dict (`#3667 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:156 +msgid "" +"optimize web3._utils.rpc_abi.apply_abi_formatters_to_dict (`#3671 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:160 +msgid "web3.py v7.10.0 (2025-03-27)" +msgstr "" + +#: ../../release_notes.rst:165 +msgid "`#3653 `__" +msgstr "" + +#: ../../release_notes.rst:169 +msgid "web3.py v7.9.0 (2025-03-12)" +msgstr "" + +#: ../../release_notes.rst:174 +msgid "" +"Prevent mutating list of subscriptions when unsubscribing via the " +"``subscription_manager`` by iterating over a copy of the provided list. " +"(`#3604 `__)" +msgstr "" + +#: ../../release_notes.rst:175 +msgid "" +"Batching can now be used with the AutoProvider (`#3607 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:181 +msgid "" +"Update and clean up Contributing docs. (`#3610 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:187 +msgid "" +"Add ``use_text_frames`` flag for ``WebSocketProvider`` to work around " +"websocket servers that don't support binary frames (`#3619 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:188 +msgid "" +"Sync and async support for ``eth_simulateV1`` RPC method. (`#3622 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:194 +msgid "" +"Renames a test so pytest finds it. (`#3606 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:195 +msgid "" +"Merge template, replacing ``bumpversion`` with ``bump-my-version``. " +"(`#3610 `__)" +msgstr "" + +#: ../../release_notes.rst:196 +msgid "" +"Update integration test fixture to use latest geth version ``v1.15.5``. " +"(`#3636 `__)" +msgstr "" + +#: ../../release_notes.rst:197 +msgid "" +"Use ``-U`` to install latest `py-geth` version for CI geth steps. This is" +" usually a requirement if we're missing the binary for the newly-" +"generated fixture geth version. (`#3637 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:198 +msgid "" +"Re-compile test contracts with newly released Solidity ``v0.8.29``. " +"(`#3640 `__)" +msgstr "" + +#: ../../release_notes.rst:204 +msgid "`#3623 `__" +msgstr "" + +#: ../../release_notes.rst:208 +msgid "web3.py v7.8.0 (2025-02-03)" +msgstr "" + +#: ../../release_notes.rst:211 ../../release_notes.rst:504 +#: ../../release_notes.rst:527 ../../release_notes.rst:579 +#: ../../release_notes.rst:677 ../../release_notes.rst:796 +#: ../../release_notes.rst:832 ../../release_notes.rst:1228 +#: ../../release_notes.rst:1846 ../../release_notes.rst:1937 +#: ../../release_notes.rst:2021 ../../release_notes.rst:2077 +#: ../../release_notes.rst:2130 ../../release_notes.rst:3561 +#: ../../release_notes.rst:3576 ../../release_notes.rst:3610 +#: ../../release_notes.rst:3651 ../../release_notes.rst:3685 +#: ../../release_notes.rst:3721 ../../release_notes.rst:3764 +msgid "Breaking Changes" +msgstr "" + +#: ../../release_notes.rst:213 +msgid "" +"The bugfix to match ``unsubscribe`` to ``subscribe`` for multiple " +"subscriptions breaks the function signature for ``unsubscribe``, changing" +" the ``subscription`` argument to ``subscriptions``. (`#3585 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:219 +msgid "" +"Handle the case when a single RPC error response is returned for a batch " +"request, instead of always expecting a list of responses. (`#3585 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:220 +msgid "" +"Don't raise on non-unique default subscription labels (no label " +"provided). Only raise if a non-unique custom label is explicitly set for " +"a subscription. (`#3594 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:221 +msgid "" +"Fix bugs related to subscription manager: ``run_forever`` can start with " +"``0`` subscriptions and remains alive, ``unsubscribe`` accepts single or " +"multiple subs as objects or hexstrs, ``subscribe`` for many subs returns " +"a list of hexstr ids. (`#3595 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:222 +msgid "" +"Fix issue where ``.values()`` raised a ``KeyError`` in " +"``NamedTupledOnion`` (`#3596 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:228 +msgid "" +"Include ``topic`` attribute in ``ContractEvent`` docs. (`#3586 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:229 +msgid "" +"Introduce Event Subscriptions docs guide (`#3600 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:235 +msgid "" +"New ``Beacon`` and ``AsyncBeacon`` endpoints: ``get_peer_count``, " +"``get_attester_duties``, ``get_block_proposer_duties``, " +"``get_sync_committee_duties``, and ``get_attestation_rewards``. (`#3504 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:241 +msgid "" +"Move duplicate code into ``BaseContract`` class from ``Contract`` and " +"``AsyncContract``. (`#3579 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:242 +msgid "" +"Address flaky tests in CI runs. (`#3583 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:243 +msgid "" +"Update copyright year from 2024 to 2025 in the LICENSE file. (`#3592 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:249 +msgid "" +"Avoid unnecessary extra call to resolver when resolving an ENS address " +"with no ``coin_type`` specified (default). (`#3584 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:253 +msgid "web3.py v7.7.0 (2025-01-15)" +msgstr "" + +#: ../../release_notes.rst:258 +msgid "" +"Add a ``disconnect`` method to the AsyncHTTPProvider that closes all " +"sessions and clears the cache (`#3557 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:259 +msgid "" +"Fix a bug related to building the ipc path for connecting to a geth " +"``--dev`` instance via ``web3.auto.gethdev``. (`#3576 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:265 +msgid "" +"Add a subscription manager to persistent connection providers, with " +"support for handler methods for ``eth_subscribe`` subscriptions. (`#3554 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:266 +msgid "" +"Implement a ``topic`` property for contract events to retrieve the topic " +"for the event. (`#3578 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:272 +msgid "`#3546 `__" +msgstr "" + +#: ../../release_notes.rst:278 +msgid "" +"Improve ``AttributeDict.recursive()`` and ``AttributeDictMiddleware`` " +"performance, effectively speeding up response processing for attrdict " +"middleware by nearly 2x. (`#3575 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:282 +msgid "web3.py v7.6.1 (2024-12-18)" +msgstr "" + +#: ../../release_notes.rst:287 +msgid "" +"Include an end-of-line delimiter when sending messages via IPC with the " +"``IPCProvider`` and ``AsyncIPCProvider``. (`#3537 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:288 +msgid "" +"Contract functions and events no longer initialize for each call. " +"Retrieval of overloaded functions and events is now deterministic. Any " +"ambiguity will result in an exception being raised. (`#3540 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:289 +msgid "" +"Bump the eth-tester version to one that works in the tester dependency " +"extras (`#3555 `__)" +msgstr "" + +#: ../../release_notes.rst:295 +msgid "" +"Update ENS-related links (`#3563 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:301 +msgid "" +"Upgrade Geth Fixture to 1.14.12 (`#3533 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:302 +msgid "" +"Delete ``ARCHITECTURE.md`` as unused (`#3547 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:308 +msgid "`#3525 `__" +msgstr "" + +#: ../../release_notes.rst:312 +msgid "web3.py v7.6.0 (2024-11-22)" +msgstr "" + +#: ../../release_notes.rst:317 +msgid "" +"Update the `ContractEvents` class to raise a `NoABIFound` exception if " +"the `Contract` is initialized without an `ABI` and an attempt to access " +"an event is made. This exception makes `ContractEvents` consistent with " +"`ContractFunctions`. (`#3491 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:323 +msgid "" +"Contracts with overloaded functions or events are now supported. The " +"Contract initializes functions and events using an identifier to " +"distinguish between them. The identifier is the function or event " +"signature, which consists of the name and the parameter types. (`#3491 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:324 +msgid "Support for ``w3.eth.blob_base_fee``" +msgstr "" + +#: ../../release_notes.rst:325 +msgid "" +"Async support for ``w3.eth.blob_base_fee`` (`#3527 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:331 +msgid "" +"Pin ``websockets<14`` due to breaking changes (`#3529 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:337 +msgid "`#3491 `__" +msgstr "" + +#: ../../release_notes.rst:341 +msgid "web3.py v7.5.0 (2024-11-06)" +msgstr "" + +#: ../../release_notes.rst:346 +msgid "" +"Polish docs index page (`#3522 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:352 +msgid "" +"Add support for Geth Debug traceTransaction. (`#3334 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:353 +msgid "" +"New contract methods to obtain event elements from a contract ABI using a" +" name, signature, selector, or topic. (`#3472 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:359 +msgid "" +"Add python 3.13 support (`#3493 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:360 +msgid "" +"Compile test contracts with newly released Solidity ``v0.8.28`` to ensure" +" compatibility. (`#3515 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:364 +msgid "web3.py v7.4.0 (2024-10-16)" +msgstr "" + +#: ../../release_notes.rst:369 +#, python-brace-format +msgid "" +"Fix a bug where CCIP-Read expected a ``{sender}`` in the url for a POST " +"request. If ``{data}`` is missing from the url, assume a POST request is " +"being made regardless of whether ``{sender}`` is present. (`#3291 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:370 +msgid "" +"Fix a bug where non-mainnet chains could not cache requests based on " +"missing ``finalized`` block number. (`#3508 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:371 +msgid "" +"Send ``json``, not ``data`` with CCIP-Read POST requests. (`#3512 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:377 +msgid "" +"Update the request caching documentation to clarify on when to reach for " +"request caching and how to configure the request validation threshold for" +" certain endpoints. (`#3508 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:383 +msgid "" +"Allow a time interval, in seconds, to be used as the " +"``request_cache_validation_threshold`` for request caching. Keep a list " +"of internal default values based on the chain id for some of the bigger " +"chains. (`#3508 `__)" +msgstr "" + +#: ../../release_notes.rst:387 +msgid "web3.py v7.3.1 (2024-10-14)" +msgstr "" + +#: ../../release_notes.rst:392 +msgid "" +"Properly wrap ``AsyncBeacon.request_timeout`` float in a " +"``aiohttp.ClientTimeout`` when making requests. (`#3503 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:393 +msgid "" +"Changes related to an `eth-typing` bugfix, input types for ``ABIEvent``: " +"``ABIComponent`` -> ``ABIComponentIndexed``. (`#3510 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:399 +msgid "" +"Fix ``EthereumTesterProvider`` signature in docs, added an ``eth_tester``" +" example. (`#3500 `__)" +msgstr "" + +#: ../../release_notes.rst:400 +msgid "" +"Fix `pip install -e \".[dev]\"` command in linux README. (`#3505 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:406 +msgid "" +"Update the ENSIP-15 to the latest spec and update the test suite. (`#3501" +" `__)" +msgstr "" + +#: ../../release_notes.rst:410 +msgid "web3.py v7.3.0 (2024-09-25)" +msgstr "" + +#: ../../release_notes.rst:415 +msgid "" +"Base default ``maxFeePerGas`` calculation off of existing " +"``maxPriorityFeePerGas`` key instead of separate RPC call (`#3052 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:416 +msgid "" +"Add back dependency extra for 'tester'. (`#3480 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:417 +msgid "" +"Fix a bug where sensitive requests that make use of block data should not" +" be cached until some validation threshold deems it is safe to do so, " +"when request caching is turned on. (`#3483 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:423 +msgid "" +"Update ``contract.encode_abi`` signature in docs and migration guide " +"(`#3473 `__)" +msgstr "" + +#: ../../release_notes.rst:424 +msgid "" +"Update documentation around ``SignAndSendRawMiddlewareBuilder`` injection" +" into the middleware onion. It should be injected lower in the stack than" +" any middleware that modifies the transaction, in order to ensure those " +"modified fields are signed. (`#3488 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:425 +msgid "" +"Docs cleanups related to ``test`` vs ``tester`` install extras. (`#3496 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:431 +msgid "" +"Add a configuration for request caching that sets a threshold for " +"validating cached requests that make use of block data. This can be " +"turned off altogether by setting the threshold to ``None``. (`#3483 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:432 +msgid "" +"Add a configuration option for the ``read_buffer_limit`` for " +"``AsyncIPCProvider`` in order to control the expected message size limit " +"(defaults to 20MB). Add ``ReadBufferLimitReached`` for when the read " +"limit is reached, extend from ``PersistentConnectionError``. (`#3492 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:438 +msgid "" +"Test warning cleanup (`#3468 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:439 +msgid "" +"Re-compile test contracts with recently released Solidity ``v0.8.27``. " +"(`#3475 `__)" +msgstr "" + +#: ../../release_notes.rst:440 +msgid "" +"Re-organize the install extras. Re-define the ``test`` extra to always " +"include the ``tester`` extra since it's needed for testing. (`#3495 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:446 +msgid "`#3490 `__" +msgstr "" + +#: ../../release_notes.rst:452 +msgid "" +"Improve logic for reading from the async IPC socket in order to properly " +"handle and adjust the handling of large messages. This improves reading " +"speeds in general. (`#3492 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:456 +msgid "web3.py v7.2.0 (2024-08-29)" +msgstr "" + +#: ../../release_notes.rst:461 +msgid "" +"Fix a bug with newer ``hexbytes`` versions that yield non-0x-prefixed hex" +" for ``HexBytes``: ``raw_transaction.hex()`` -> " +"``raw_transaction.to_0x_hex()``. (`#3471 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:467 +msgid "" +"HTTPProvider and AsyncHTTPProvider's get_request_headers is now available" +" on both the class and the instance (`#3467 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:471 +msgid "web3.py v7.1.0 (2024-08-28)" +msgstr "" + +#: ../../release_notes.rst:476 +msgid "" +"Specify a unique ``__hash__()`` for unhashable ``Web3Middleware`` types " +"and use this hash as the middleware onion key when a name is not provided" +" for the middleware. This fixes a bug where different middleware were " +"given the same name and therefore raised errors. (`#3463 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:482 +msgid "" +"Fix bug in filters example code (`#3455 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:483 +msgid "" +"Update ``v6`` -> ``v7`` migration guide with examples for importing and " +"adding middleware, as well as examples on how to use the " +"``MiddlewareBuilder`` classes. (`#3462 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:489 +msgid "" +"Add sync and async support for beacon ``/eth/v1/beacon/blob_sidecars`` " +"endpoint. (`#3407 `__)" +msgstr "" + +#: ../../release_notes.rst:490 +msgid "" +"Allow user to call ContractFunctions without parentheses (`#3444 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:496 +msgid "" +"Refactor and DRY up CI run setup and reduce surface area for errors. " +"Include pre-releases in CI runs for internally maintained libraries to " +"try and catch any conflicts. (`#3452 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:497 +msgid "" +"Bump `py-geth` to ``>=5.0.0`` from ``>=5.0.0b1`` now that stable has been" +" released. This only matters for the ``test`` install extra (CI and dev " +"purposes). (`#3458 `__)" +msgstr "" + +#: ../../release_notes.rst:501 +msgid "web3.py v7.0.0 (2024-08-21)" +msgstr "" + +#: ../../release_notes.rst:506 +msgid "Update `eth-utils` and `eth-typing` to latest major versions" +msgstr "" + +#: ../../release_notes.rst:508 +msgid "" +"`eth-utils` v5 and `eth-typing` v5 (`#3450 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:514 +msgid "" +"Improve batch request documentation. (`#3448 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:520 +msgid "" +"Fix Release Notes formatting (`#3454 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:524 +msgid "web3.py v7.0.0-beta.9 (2024-08-01)" +msgstr "" + +#: ../../release_notes.rst:529 +msgid "" +"Upgrades to use latest ``ABI`` utilities and typings from ``eth-utils`` " +"and ``eth-typing``." +msgstr "" + +#: ../../release_notes.rst:531 +msgid "" +"Typings for ``ABI`` components are now available in the ``eth-typing`` " +"package. ``ABI`` types previously in ``web3.types`` have been removed." +msgstr "" + +#: ../../release_notes.rst:532 +msgid "" +"New versions of existing ABI functions were added to ``eth-utils`` and " +"are now exposed in `web3.py` via ``web3.utils.abi``." +msgstr "" + +#: ../../release_notes.rst:533 +msgid "" +"ABI exceptions have been renamed in ``web3.exceptions``. The " +"``ABIEventFunctionNotFound`` and ``FallbackNotFound`` exceptions have " +"been removed. Use ``ABIEventNotFound`` and ``ABIFallbackNotFound`` " +"instead." +msgstr "" + +#: ../../release_notes.rst:534 +msgid "" +"``MismatchedABI`` exceptions are raised instead of a " +"``Web3ValidationError`` for ABI related errors." +msgstr "" + +#: ../../release_notes.rst:535 +msgid "" +"``encode_abi`` arguments have been updated to use ``abi_element_name`` " +"instead of ``fn_name``. (`#3408 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:537 +msgid "" +"Remove ``Web3ValidationError`` dependence / inheritance from `eth-utils` " +"``ValidationError``. (`#3443 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:543 +msgid "" +"Use autodoc and update ABI functions with docstrings and doctests. " +"(`#3408 `__)" +msgstr "" + +#: ../../release_notes.rst:549 +msgid "" +"Utilities to extract function and event ``ABI`` attributes from a " +"contract. Utilities in the ``web3.utils.abi`` module parse ABI elements " +"and check encodability of provided arguments. ABI functions in ``eth-" +"utils`` are exposed by the ``web3.utils.abi`` module." +msgstr "" + +#: ../../release_notes.rst:551 +msgid "" +"``get_abi_element_info`` returns an ``ABIElementInfo`` TypedDict with the" +" ``abi``, ``selector``, and ``arguments``." +msgstr "" + +#: ../../release_notes.rst:552 +msgid "" +"``get_abi_element`` returns the ``ABI`` of a function, event, or error " +"given the name and arguments." +msgstr "" + +#: ../../release_notes.rst:553 +msgid "" +"``check_if_arguments_can_be_encoded`` returns true if the arguments can " +"be encoded with the given ABI." +msgstr "" + +#: ../../release_notes.rst:554 +msgid "``get_event_abi`` returns the ``ABI`` of an event given the name." +msgstr "" + +#: ../../release_notes.rst:555 +msgid "" +"``get_event_log_topics`` returns the log topics of an event given the " +"name." +msgstr "" + +#: ../../release_notes.rst:556 +msgid "" +"``log_topics_to_bytes`` returns the log topics as bytes. (`#3408 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:558 +msgid "" +"Add explicit stream kwarg to HTTPProvider so that timeout can be more " +"finely tuned. (`#3428 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:559 +msgid "" +"Implement a ``RequestTimedOut`` exception, extending from " +"``Web3RPCError``, for when requests to the node time out. (`#3440 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:565 +msgid "" +"Run ``mypy`` locally using ``pre-commit`` hook, instead of within ``pre-" +"commit`` container (`#3414 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:566 +msgid "" +"Mitigate inconsistently failing tests for CI runs with appropriate " +"``flaky`` or ``pytest.mark.xfail()`` decorators. (`#3440 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:572 +msgid "" +"`#3408 `__, `#3445 " +"`__" +msgstr "" + +#: ../../release_notes.rst:576 +msgid "web3.py v7.0.0-beta.8 (2024-07-24)" +msgstr "" + +#: ../../release_notes.rst:581 +msgid "" +"Refactor the public ``socket`` api for persistent connection providers to" +" properly define ``send()``, ``recv()``, and ``make_request()`` (send and" +" wait for response) methods for interacting with the open socket. (`#3433" +" `__)" +msgstr "" + +#: ../../release_notes.rst:582 +msgid "" +"Format entries in ``accessList`` ``storageKeys`` to be ``HexStr`` instead" +" of ``HexBytes`` (`#3434 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:588 +msgid "" +"Handle ``ConnectionClosedOK`` case for ``WebSocketProvider``. If a " +"persistent connection is closed gracefully, log and raise a silent " +"``PersistentConnectionClosedOK`` exception, triggering an end to the " +"message listener task and breaking out of the ``process_subscriptions()``" +" iterator. (`#3432 `__)" +msgstr "" + +#: ../../release_notes.rst:594 +msgid "" +"Add ``popitem()`` functionality to the ``SimpleCache`` class as well as " +"an async utility method to wait for the next item, " +"``async_await_and_popitem()``. (`#3433 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:600 +msgid "" +"Refactor some common logic for persistent connection providers back into " +"the base ``PersistentConnectionProvider`` class to reduce code " +"duplication and improve maintainability. (`#3433 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:604 +msgid "web3.py v7.0.0-beta.7 (2024-06-26)" +msgstr "" + +#: ../../release_notes.rst:609 +msgid "" +"Change the ``exception_retry_configuration`` typing on http providers to " +"be an ``Optional``, as setting this property to ``None`` effectively " +"turns off retries on exceptions for requests. (`#3412 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:610 +msgid "" +"A bugfix, pre-release, to update the ``Beacon`` APIs (sync and async) to " +"properly use the new ``HTTPSessionManager``. (`#3421 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:616 +msgid "" +"Add an ``eth_subscribe`` example to the events guide (`#3403 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:622 +msgid "" +"Properly handle ``InsufficientDataBytes`` errors when processing receipts" +" (`#3388 `__)" +msgstr "" + +#: ../../release_notes.rst:623 +msgid "" +"Provide explicit ``__all__`` exports for providers in " +"`web3/providers/__init__.py`; update `web3/__init__.py` to include all " +"provider classes including base classes. (`#3409 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:629 +msgid "" +"Re-compile test contracts with Solidity v0.8.25 to ensure compatibility. " +"(`#3307 `__)" +msgstr "" + +#: ../../release_notes.rst:630 +msgid "" +"Increase allowable range of eth-tester: 0.11.x and 0.12.x (`#3400 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:631 +msgid "" +"Remove uses of signHash in tests, require eth-account >=0.13.0 in " +"doctests (`#3404 `__)" +msgstr "" + +#: ../../release_notes.rst:632 +msgid "" +"Use a ``HTTPSessionManager`` to manage sessions for http providers, " +"rather than have them share a single session manager / cache. (`#3412 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:636 +msgid "web3.py v7.0.0-beta.6 (2024-05-15)" +msgstr "" + +#: ../../release_notes.rst:641 +msgid "" +"Properly propagate exceptions from the message listener task to the main " +"loop for persistent connection providers. (`#3378 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:647 +msgid "" +"Prunes the node onboarding text (`#3371 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:648 +msgid "" +"Stale example cleanup (`#3374 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:649 +msgid "" +"Merge migration guides into one page (`#3379 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:650 +msgid "" +"Simplify titles of docs guides (`#3381 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:651 +msgid "" +"Move ABI Types guide into the Troubleshooting page (`#3382 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:652 +msgid "" +"Distribute examples into relevant guides and delete Example page (`#3383 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:653 +msgid "" +"Add subscribe/unsubscribe API (`#3386 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:654 +msgid "" +"Introduces batch request API (`#3393 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:660 +msgid "" +"Add support for request batching via ``w3.batch_requests()`` context " +"manager (sync and async). (`#3370 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:661 +msgid "" +"Allow request cache configuration on provider ``__init__()`` for all " +"provider classes. (`#3395 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:667 +msgid "" +"Merge the python project template, notably adding python 3.12 support " +"(`#3363 `__)" +msgstr "" + +#: ../../release_notes.rst:668 +msgid "" +"Increase python-asyncio dependency to be >=0.21.2,<0.23 (`#3369 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:669 +msgid "" +"Bump to ``mypy==1.10.0`` for ``pre-commit`` (`#3377 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:670 +msgid "" +"Move signed.rawTransaction -> signed.raw_transaction in eth module tests " +"(`#3380 `__)" +msgstr "" + +#: ../../release_notes.rst:674 +msgid "web3.py v7.0.0-beta.5 (2024-04-26)" +msgstr "" + +#: ../../release_notes.rst:679 +msgid "" +"Snake-case remaining arguments ``fromBlock``, ``toBlock``, and " +"``blockHash`` in contract and filter methods where they are passed in as " +"kwargs. (`#3353 `__)" +msgstr "" + +#: ../../release_notes.rst:680 +msgid "" +"Employ an exponential backoff strategy using the ``backoff_factor`` in " +"``ExceptionRetryConfiguration`` for ``HTTPProvider`` and " +"``AsyncHTTPProvider``. Reduce the default initial delay to ``0.125`` " +"seconds. (`#3358 `__)" +msgstr "" + +#: ../../release_notes.rst:681 +msgid "" +"Validate JSON-RPC responses more strictly against the JSON-RPC 2.0 " +"specifications. ``BlockNumberOutofRange`` -> ``BlockNumberOutOfRange``. " +"(`#3359 `__)" +msgstr "" + +#: ../../release_notes.rst:687 +msgid "" +"``messageHash`` and ``rawTransaction`` from ``eth-account`` have been " +"deprecated for snake_case versions (`#3348 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:693 +msgid "" +"Raise ``Web3RPCError`` on JSON-RPC errors rather than ``Web3ValueError``." +" Raise ``MethodNotSupported`` exception when a method is not supported " +"within *web3.py*; keep ``MethodUnavailable`` for when a method is not " +"available on the current provider (JSON-RPC error). (`#3359 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:699 +msgid "" +"Bump ``eth-account`` dependency to ``>=0.12.2`` (`#3348 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:703 ../../release_notes.rst:787 +#: ../../release_notes.rst:823 ../../release_notes.rst:896 +#: ../../release_notes.rst:1278 +msgid "Removals" +msgstr "" + +#: ../../release_notes.rst:705 +msgid "" +"Remove the deprecated ``personal`` namespace and all references to it. " +"(`#3350 `__)" +msgstr "" + +#: ../../release_notes.rst:709 +msgid "web3.py v7.0.0-beta.4 (2024-04-11)" +msgstr "" + +#: ../../release_notes.rst:714 +msgid "" +"Fix misused call to `endpoint_uri` for all cases of " +"``PersistentConnectionProvider`` by being able to retrieve either the " +"``ipc_path`` or the ``endpoint_uri`` from the base class with " +"``endpoint_uri_or_ipc_path`` property. (`#3319 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:720 +msgid "" +"Fix ``eth_createAccessList`` docs to reflect the correct behavior. " +"(`#3327 `__)" +msgstr "" + +#: ../../release_notes.rst:726 +msgid "" +"Use in-house exception wrappers for common Python exceptions, such as " +"``ValueError``, ``TypeError``, ``AttributeError``, and " +"``AssertionError``, for better control over exception handling. (`#3300 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:727 +msgid "" +"Add request formatter for ``maxFeePerBlobGas`` when sending blob " +"transactions. Add formatters for ``blobGasPrice`` and ``blobGasUsed`` for" +" *eth_getTransactionReceipt*. (`#3322 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:728 +msgid "" +"Add formatters to ensure that the result of a ``eth_createAccessList`` " +"response can be plugged directly into an ``accessList`` in a transaction." +" (`#3327 `__)" +msgstr "" + +#: ../../release_notes.rst:729 +msgid "" +"Add Cancun support to ``EthereumTesterProvider``; update Cancun-related " +"fields in some internal types. (`#3332 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:735 +msgid "" +"Use ``pre-commit`` for linting, run updated lint tools and fix errors " +"(`#3297 `__)" +msgstr "" + +#: ../../release_notes.rst:736 +msgid "" +"Dependency updates: ``eth-abi>=5.0.1``, ``eth-account>=0.12.0`` ``eth-" +"typing>=4.0.0`` and ``hexbytes>=1.2.0`` with relevant changes to support " +"these. (`#3298 `__)" +msgstr "" + +#: ../../release_notes.rst:737 +msgid "" +"Remove code conditionally necessary for ``python<=3.7`` (`#3317 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:741 +msgid "web3.py v7.0.0-beta.3 (2024-03-28)" +msgstr "" + +#: ../../release_notes.rst:746 +msgid "" +"Fix ``process_log()`` when parsing logs for events with indexed and non-" +"indexed inputs. ``get_event_data()`` now compares log topics and event " +"ABIs as hex values. (`#3289 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:747 +msgid "" +"Fix ``process_log`` for ``HexStr`` inputs. Explicit type coercion of " +"entry ``topics`` and ``data`` values. (`#3293 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:748 +msgid "" +"Fix typing for json data argument to ``eth_signTypedData``. (`#3308 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:754 +msgid "" +"Add note about middlewares change to v7 migration guide. (`#3277 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:755 +msgid "" +"Rearrange v7 migration guide and include upgrade path from " +"WebsocketProviderV2 (`#3310 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:761 +msgid "" +"Add support for ``eth_getRawTransactionByHash`` RPC method (`#3247 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:762 +msgid "" +"Add ``user_message`` kwarg for human readable ``Web3Exception`` messages." +" (`#3263 `__)" +msgstr "" + +#: ../../release_notes.rst:763 +msgid "" +"Add formatters for type 3 transaction fields ``maxFeePerBlobGas`` and " +"``blobVersionedHashes``. (`#3314 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:769 +msgid "" +"Add a daily CI run (`#3272 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:770 +msgid "" +"Add linting for non-inclusive language with ``blocklint``. (`#3275 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:776 +msgid "`#3304 `__" +msgstr "" + +#: ../../release_notes.rst:782 +msgid "" +"Importing ``ens._normalization`` is deferred until the first call of " +"``ens.utils.normalize_name`` in order to speed up ``import web3``. " +"(`#3285 `__)" +msgstr "" + +#: ../../release_notes.rst:783 +msgid "" +"Utilize ``async`` functionality when popping responses from request " +"manager cache for persistent connection providers. (`#3306 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:789 +msgid "" +"Remove ``Contract.encodeABI()`` in favor of ``Contract.encode_abi()`` to " +"follow standard conventions. (`#3281 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:793 +msgid "web3.py v7.0.0-beta.2 (2024-03-11)" +msgstr "" + +#: ../../release_notes.rst:798 +msgid "" +"Move ``middlewares`` -> ``middleware`` (`#3276 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:804 +msgid "" +"Fix/update methods and decorators in ``web3/_utils/abi.py`` to address " +"issues raised by ``mypy`` (`#3269 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:805 +msgid "" +"Catch all types of ``eth-abi`` ``DecodingError`` in " +"``EthereumTesterProvider->_make_request()`` (`#3271 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:811 +msgid "" +"Remove annual user survey prompt from docs (`#3218 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:812 +msgid "" +"Introduce feedback form banner prompt on docs (`#3253 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:813 +msgid "" +"Refresh of the middleware docs (`#3266 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:819 +msgid "" +"`#3259 `__, `#3262 " +"`__" +msgstr "" + +#: ../../release_notes.rst:825 +msgid "" +"Remove the ``ethpm`` module and related docs, tests, and dependencies " +"(`#3261 `__)" +msgstr "" + +#: ../../release_notes.rst:829 +msgid "web3.py v7.0.0-beta.1 (2024-02-28)" +msgstr "" + +#: ../../release_notes.rst:834 +msgid "" +"Refactor the middleware setup so that request processors and response " +"processors are separated. This will allow for more flexibility in the " +"future and aid in the implementation of features such as batched " +"requests. This PR also closes out a few outstanding issues and will be " +"the start of the breaking changes for `web3.py` ``v7``. Review PR for a " +"full list of changes. (`#3169 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:835 +msgid "" +"Use a message listener background task for ``WebsocketProviderV2`` rather" +" than relying on ``ws.recv()`` blocking. Some breaking changes to API, " +"notably ``listen_to_websocket`` -> ``process_subscriptions``. (`#3179 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:836 +msgid "" +"Drop dependency on ``lru-dict`` library. (`#3196 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:837 +msgid "" +"Drop support for python 3.7 (`#3198 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:838 +msgid "" +"Return iterable of ``ABIFunction``s from the ``BaseContractFunctions`` " +"iterator. (`#3200 `__)" +msgstr "" + +#: ../../release_notes.rst:839 +msgid "" +"Name changes internal to the library related to ``v7``: " +"``WebsocketProvider`` -> ``LegacyWebSocketProvider``, " +"``WebsocketProviderV2`` -> ``WebSocketProvider`` (`#3225 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:840 +msgid "" +"``CallOverride`` type change to ``StateOverride`` to reflect better the " +"type name for the state override. ``eth_call`` is also not the only " +"method with this param, making the name more generic. (`#3227 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:841 +msgid "" +"Rename `beacon/main.py` -> `beacon/beacon.py` (`#3233 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:842 +msgid "" +"``EthereumTesterProvider`` now returns ``input`` for " +"`eth_getTransaction*` for better consistency with JSON-RPC spec. (`#3235 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:843 +msgid "" +"Change the signature for the async version of " +"``wait_for_transaction_receipt()`` to use ``Optional[float]`` instead of " +"``float``. (`#3237 `__)" +msgstr "" + +#: ../../release_notes.rst:844 +msgid "" +"``get_default_ipc_path()`` and ``get_dev_ipc_path()`` now return the path" +" value without checking if the ``geth.ipc`` file exists. (`#3245 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:850 +msgid "" +"Fix return type of ``AsyncContract.constructor`` (`#3192 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:851 +msgid "" +"Handle new geth errors related to waiting for a transaction receipt while" +" transactions are still being indexed. (`#3216 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:857 +msgid "" +"Documentation was updated to reflect early changes to ``v7`` from ``v6``." +" A ``v6`` -> ``v7`` migration guide was also started and will be added to" +" as ``v7`` breaking changes are introduced. (`#3211 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:858 +msgid "" +"Remove ENS v6 breaking change warning from v7 (`#3254 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:864 +msgid "" +"Add AsyncIPCProvider (`#2984 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:865 +msgid "" +"Implement ``state_override`` parameter for ``eth_estimateGas`` method. " +"(`#3164 `__)" +msgstr "" + +#: ../../release_notes.rst:866 +msgid "" +"Upgrade `eth-tester` to ``v0.10.0-b.1`` and turn on ``eth_feeHistory`` " +"support for ``EthereumTesterProvider``. (`#3172 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:867 +msgid "" +"Add formatters for new ``Cancun`` network upgrade block header fields: " +"``blobGasUsed``, ``excessBlobGas``, and ``parentBeaconBlockRoot``. " +"(`#3223 `__)" +msgstr "" + +#: ../../release_notes.rst:868 +msgid "" +"Contract event ``get_logs`` results sorted by each ``ContractEvent`` " +"``logIndex``. (`#3228 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:874 +msgid "" +"Create test fixture for latest ``geth`` version. Run tests with ``geth`` " +"in ``--dev`` mode. (`#3191 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:875 +msgid "" +"Validate geth version used to generate the integration test fixture " +"against the version in the binary that is used to run the tests. (`#3193 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:876 +msgid "" +"Internal change to ``WebsocketProviderV2`` before release: raise " +"exceptions in message listener task by default; opting to silence them " +"via a flag. (`#3202 `__)" +msgstr "" + +#: ../../release_notes.rst:877 +msgid "" +"Compile contracts with and test against new Solidity version ``v0.8.24``." +" (`#3204 `__)" +msgstr "" + +#: ../../release_notes.rst:878 +msgid "" +"Formatting updates for ``black==24.1.0``. (`#3207 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:879 +msgid "" +"Allow HTTP provider request retry configuration to be turned off " +"appropriately. Internal change since ``v7`` has not yet been released. " +"(`#3211 `__)" +msgstr "" + +#: ../../release_notes.rst:880 +msgid "" +"Upgraded geth fixture version (`#3231 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:886 +msgid "" +"`#2964 `__, `#3248 " +"`__" +msgstr "" + +#: ../../release_notes.rst:892 +msgid "" +"Remove call to ``parse_block_identifier`` when initializing " +"``ContractCaller`` functions. (`#3257 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:898 +msgid "" +"``normalize_request_parameters`` middleware was in a stale state and not " +"being used or tested. This middleware has been removed. (`#3211 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:899 +msgid "" +"Remove deprecated ``geth.miner`` namespace and methods. (`#3236 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:903 +msgid "web3.py v6.14.0 (2024-01-10)" +msgstr "" + +#: ../../release_notes.rst:908 +msgid "" +"Change ``fee_history`` default behavior. If ``reward_percentiles`` arg " +"not included, pass it to the provider as an empty list instead of " +"``None``. (`#3185 `__)" +msgstr "" + +#: ../../release_notes.rst:909 +msgid "" +"Use ``importlib.metadata`` for version info if python>=3.8 (`#3187 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:915 +msgid "" +"Remove docs reference for removed ``protocol_version`` RPC method (`#3183" +" `__)" +msgstr "" + +#: ../../release_notes.rst:921 +msgid "" +"Re-define how async vs sync core test suites are ran. (`#3180 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:922 +msgid "" +"Add basic import and version tests for the ``web3`` module (`#3187 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:926 +msgid "web3.py v6.13.0 (2023-12-20)" +msgstr "" + +#: ../../release_notes.rst:931 +msgid "" +"Implement async ``eth_createAccessList`` RPC method to create an EIP-2930" +" access list. (`#3167 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:937 +msgid "" +"Add flaky async Geth integration tests to CI (`#3170 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:938 +msgid "" +"Fix wrong test reference for ``EthereumTesterProvider`` integration test " +"suite. (`#3171 `__)" +msgstr "" + +#: ../../release_notes.rst:939 +msgid "" +"Small fix for integration tests for ``tox`` to recognize independent " +"patterns for each test run. (`#3173 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:943 +msgid "web3.py v6.12.0 (2023-12-11)" +msgstr "" + +#: ../../release_notes.rst:948 +msgid "" +"Make downloadable versions of docs available in ``pdf``, ``htmlzip``, and" +" ``epub`` formats (`#3153 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:949 +msgid "" +"Add 2023 user survey fine art banner in the docs (`#3159 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:950 +msgid "" +"Polish the community resources docs page (`#3162 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:956 +msgid "" +"Implement ``createAccessList`` RPC endpoint to create an EIP-2930 access " +"list. (`#2381 `__)" +msgstr "" + +#: ../../release_notes.rst:962 +msgid "" +"Run flaky eth-tester tests on CI (`#3157 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:963 +msgid "" +"Pin ``pytest-asyncio`` dependency to <0.23 (`#3160 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:967 +msgid "web3.py v6.11.4 (2023-11-27)" +msgstr "" + +#: ../../release_notes.rst:972 +msgid "" +"Fix collision of ``w3`` variable when initializing contract with function" +" of the same name (`#3147 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:978 +msgid "`#3148 `__" +msgstr "" + +#: ../../release_notes.rst:982 +msgid "web3.py v6.11.3 (2023-11-08)" +msgstr "" + +#: ../../release_notes.rst:987 +msgid "" +"When coming back through the middleware onion after a request is made, we" +" have the response ``id``. Use it to match to the cached request " +"information and process the response accordingly. (`#3140 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:993 +msgid "" +"Adds Discord bot template repo to Resources page (`#3143 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:999 +msgid "" +"Additional contract ``abi`` documentation to make it a clear requirement " +"for contract instances. (`#2539 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1000 +msgid "" +"Fix type annotations for ``web3`` constants. (`#3138 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1001 +msgid "" +"Add upper pin to deprecated dependency ``lru-dict`` whose new minor " +"version release introduced a typing issue with CI lint builds. (`#3144 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1002 +msgid "" +"Recompile test contracts with new Solidity version ``v0.8.23`` to ensure " +"compatibility. (`#3146 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1006 +msgid "web3.py v6.11.2 (2023-10-30)" +msgstr "" + +#: ../../release_notes.rst:1011 +msgid "" +"Fix formatting in documentation for creating an account. (`#3128 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1012 +msgid "" +"Fix broken links for Apeworx and Sepolia faucet (`#3130 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1018 +msgid "" +"Speed up the core test suite by splitting up sync and async tests. This " +"reduces the CI build times to ~8min from ~12min. (`#3111 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1019 +msgid "" +"Re-compile test contracts with Solidity ``v0.8.22`` to ensure " +"compatibility with this latest Solidity version. (`#3134 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1020 +msgid "" +"Improvements on yielding to the event loop while searching in response " +"caches and calling ``recv()`` on the websocket connection for " +"``WebSocketProviderV2``. (`#3135 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1024 +msgid "web3.py v6.11.1 (2023-10-18)" +msgstr "" + +#: ../../release_notes.rst:1029 +msgid "" +"Update ``WebsocketProviderV2`` documentation. Document a general overview" +" of the ``RequestProcessor`` class and its internal caches. (`#3125 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1035 +msgid "" +"Properly define an ``__await__()`` method on the " +"``_PersistentConnectionWeb3`` class so a persistent connection may be " +"initialized using the ``await`` pattern. Integration tests added for " +"initializing the persistent connection using the ``await`` pattern. " +"(`#3125 `__)" +msgstr "" + +#: ../../release_notes.rst:1041 +msgid "" +"Updates and refactoring for the ``WebsocketProviderV2`` class and its " +"internal supporting classes and logic. Separation of one-to-one and one-" +"to-many request responses. Storing of one-to-many responses in a " +"``deque`` and one-to-one responses in a ``SimpleCache`` class. Provide an" +" async lock around the websocket ``recv()``. (`#3125 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1042 +msgid "" +"Add upper pin to ``hexbytes`` dependency to due incoming breaking change " +"(`#3127 `__)" +msgstr "" + +#: ../../release_notes.rst:1048 +msgid "" +"`#3114 `__, `#3129 " +"`__" +msgstr "" + +#: ../../release_notes.rst:1052 +msgid "web3.py v6.11.0 (2023-10-11)" +msgstr "" + +#: ../../release_notes.rst:1055 ../../release_notes.rst:1093 +msgid "Breaking Changes (to Beta APIs)" +msgstr "" + +#: ../../release_notes.rst:1057 +msgid "" +"Refactor the async iterator pattern for message streams from the " +"websocket connection for ``WebsocketProviderV2`` to a proper async " +"iterator. This allows for a more natural usage of the iterator pattern " +"and mimics the behavior of the underlying ``websockets`` library. (`#3116" +" `__)" +msgstr "" + +#: ../../release_notes.rst:1063 +msgid "" +"Use hashes to compare equality of two ``AttributeDict`` classes (`#3104 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1064 +msgid "" +"Fix issues with formatting middleware, such as " +"``async_geth_poa_middleware`` and subscription responses for " +"``WebsocketProviderV2``. (`#3116 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1070 +msgid "" +"Change ``docker-compose`` to ``docker compose`` in the Contributing docs " +"examples. (`#3107 `__)" +msgstr "" + +#: ../../release_notes.rst:1071 +msgid "" +"Updates to the ``WebsocketProviderV2`` documentation async iterator " +"example for iterating over a persistent stream of messages from the " +"websocket connection via ``async for``. (`#3116 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1072 +msgid "" +"Update outdated node and private key management verbiage. (`#3117 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1078 +msgid "" +"Allow passing in a ``float`` for a ``request_timeout`` for requests for " +"the ``Beacon`` class. Update some Beacon API endpoints (sync and async). " +"(`#3106 `__)" +msgstr "" + +#: ../../release_notes.rst:1079 +msgid "" +"Add ``allow_list`` kwarg for ``exception_retry_middleware`` to allow for " +"a custom list of RPC endpoints. Add a sleep between retries and a " +"customizable ``backoff_factor`` to control the sleep time between retry " +"attempts. (`#3120 `__)" +msgstr "" + +#: ../../release_notes.rst:1085 +msgid "" +"Refactor logic for the ``input_munger()`` method on the ``Method`` class." +" (`#2987 `__)" +msgstr "" + +#: ../../release_notes.rst:1086 +msgid "" +"Pin mypy to v1.4.1, the last to support py37 (`#3122 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1090 +msgid "web3.py v6.10.0 (2023-09-21)" +msgstr "" + +#: ../../release_notes.rst:1095 +msgid "" +"Breaking change to the API for interacting with a persistent websocket " +"connection via ``AsyncWeb3`` and ``WebsocketProviderV2``. This change " +"internalizes the ``provider.ws`` property and opts for a ``w3.ws`` API " +"achieved via a new ``WebsocketConnection`` class. With these changes, " +"``eth_subscription`` messages now return the subscription id as the " +"``subscription`` param and the formatted message as the ``result`` param." +" (`#3096 `__)" +msgstr "" + +#: ../../release_notes.rst:1101 +msgid "" +"Return `w3.eth.gas_price` when calculating time based gas price strategy " +"for an empty chain. (`#1149 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1102 +msgid "" +"Update `LogReceipt` and `TxReceipt` declarations. Remove `LogReceipt`'s " +"`payload` and `topic` attributes. Refactor `LogEntry` to `LogReceipt`. " +"(`#3043 `__)" +msgstr "" + +#: ../../release_notes.rst:1103 +msgid "" +"Fixes ``AsyncEth.max_priority_fee_per_gas``. It wasn't falling back to " +"``eth_feeHistory`` since the ``MethodUnavailable`` error was introduced. " +"(`#3084 `__)" +msgstr "" + +#: ../../release_notes.rst:1109 +msgid "" +"Update ``WebsocketProviderV2`` documentation to reflect the new public " +"websocket API via the ``WebsocketConnection`` class. (`#3096 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1115 +msgid "" +"Improved error messaging for exceptions from malformed JSON-RPC " +"responses. (`#3053 `__)" +msgstr "" + +#: ../../release_notes.rst:1116 +msgid "" +"Enable filtering by non-indexed arguments for contract event " +"``get_logs()``. (`#3078 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1117 +msgid "" +"Add ``eth_maxPriorityFeePerGas`` to ``exception_retry_middleware`` " +"whitelist (`#3090 `__)" +msgstr "" + +#: ../../release_notes.rst:1118 +msgid "" +"Sync responses for ``WebsocketProviderV2`` open connections with requests" +" via matching RPC ``id`` values. (`#3096 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1119 +msgid "" +"Properly JSON encode ``AttributeDict``, ``bytes``, and ``HexBytes`` when " +"sending a JSON-RPC request by utilizing the in-house ``Web3JsonEncoder`` " +"class. (`#3101 `__)" +msgstr "" + +#: ../../release_notes.rst:1125 +msgid "" +"Fix an issue with an IPC test present only on MacOSX. (`#929 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1126 +msgid "" +"Ignore flake8 rule F401 (unused import) in all ``__init__.py`` files " +"(`#3097 `__)" +msgstr "" + +#: ../../release_notes.rst:1130 +msgid "web3.py v6.9.0 (2023-08-23)" +msgstr "" + +#: ../../release_notes.rst:1135 +msgid "" +"Fix the type for ``input`` in ``TxData`` from ``HexStr`` -> ``HexBytes``." +" (`#3074 `__)" +msgstr "" + +#: ../../release_notes.rst:1136 +msgid "" +"Fix an issue with ``WebsocketProviderV2`` when responses to a request " +"aren't found in the cache (``None`` values). (`#3075 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1137 +msgid "" +"Re-expose some websockets constants found in " +"``web3.providers.websocket.websocket`` via ``web3.providers.websocket``. " +"(`#3076 `__)" +msgstr "" + +#: ../../release_notes.rst:1138 +msgid "" +"Return ``NotImplemented`` constant, rather than raising " +"``NotImplementedError`` for ``NamedElementOnion.__add__()``, based on " +"Python standards. (`#3080 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1139 +msgid "" +"Only release ``async_lock`` if it's locked to begin with. (`#3083 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1145 +msgid "" +"Add MEV blocking tutorial to Resources docs page (`#3072 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1146 +msgid "" +"Fix documentation around current state of ``get_logs()`` usage and " +"arguments. (`#3073 `__)" +msgstr "" + +#: ../../release_notes.rst:1147 +msgid "" +"Add an Ape hackathon kit to Resources documentation page (`#3082 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1151 +msgid "web3.py v6.8.0 (2023-08-02)" +msgstr "" + +#: ../../release_notes.rst:1156 +msgid "" +"Fix the type for the optional param asking for \"full transactions\" when" +" subscribing to ``newPendingTransactions`` via ``eth_subscribe`` to " +"``bool``. (`#3067 `__)" +msgstr "" + +#: ../../release_notes.rst:1162 +msgid "" +"Change docs to reflect AsyncHTTPProvider does accept ENS names now " +"(`#3070 `__)" +msgstr "" + +#: ../../release_notes.rst:1168 +msgid "" +"Return structured JSON-RPC errors for missing or unimplemented eth-tester" +" methods. (`#3061 `__)" +msgstr "" + +#: ../../release_notes.rst:1169 +msgid "" +"ENS name-to-address support for ``eth_subscribe``. (`#3066 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1170 +msgid "" +"Asynchronous iterator support for ``AsyncWeb3`` with " +"``WebsocketProviderV2`` using ``async for`` syntax. (`#3067 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1176 +msgid "" +"Minor fixes to type hinting in the core tests setup fixtures. (`#3069 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1180 +msgid "web3.py v6.7.0 (2023-07-26)" +msgstr "" + +#: ../../release_notes.rst:1185 +msgid "" +"Test wheel build in separate directory and virtualenv (`#3046 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1186 +msgid "" +"Handle case where data gets returned as ``None`` in a JSON-RPC error " +"response (`#3054 `__)" +msgstr "" + +#: ../../release_notes.rst:1187 +msgid "" +"Fixed default windows IPC provider path to work with python 3.11 (`#3058 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1188 +msgid "" +"Fix return type for ``rpc_gas_price_strategy`` to ``int`` but also only " +"convert the ``strategy_based_gas_price`` to ``hex`` if it is an ``int`` " +"in the ``gas_price_strategy_middleware``. (`#3065 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1194 +msgid "" +"Add note to Release Notes about v5 end-of-life and v6.6.0 yank (`#3045 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1195 +msgid "" +"Add documentation for ``WebsocketProviderV2`` (beta). (`#3048 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1201 +msgid "" +"Add ENSIP-9 (Multichain Address Resolution) support for ``address()`` and" +" ``setup_address()`` for ``ENS`` and ``AsyncENS`` classes. (`#3030 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1202 +msgid "" +"Support for ``eth_subscribe`` and ``eth_unsubscribe`` methods has been " +"added with the introduction of a new websocket provider, " +"``WebsocketProviderV2``. (`#3048 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1208 +msgid "" +"Added recursive typing to ``ABIFunctionComponents`` type (`#3063 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1209 +msgid "" +"Upgrade eth-tester requirement to v0.9.0-b.1 (`#3064 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1213 +msgid "web3.py v6.6.1 (2023-07-12)" +msgstr "" + +#: ../../release_notes.rst:1218 +msgid "" +"Add ``ens/specs`` to MANIFEST.in (`#3039 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1222 +msgid "web3.py v6.6.0 (2023-07-12)" +msgstr "" + +#: ../../release_notes.rst:1224 +msgid "" +"**Note: This release was missing the required ``ens/specs`` directory, so" +" it was yanked from Pypi in favor of v6.6.1**" +msgstr "" + +#: ../../release_notes.rst:1230 +#, python-format +msgid "" +"ENS name normalization now uses ENSIP-15 by default. This is technically " +"a breaking change introduced by ENS but, according to ENSIP-15, 99% of " +"existing names should be unaffected. (`#3024 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1236 +msgid "" +"Handle ``None`` in the formatting middleware (`#2546 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1237 +msgid "" +"Fix for a possible bug in ``construct_sign_and_send_raw_middleware`` " +"where the signed transaction was sent as bytes and expected to be " +"converted to hex by formatting later on. It is now explicitly sent as the" +" hex string hash within the middleware. (`#2936 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1238 +msgid "" +"Fixes ``max_priority_fee_per_gas``. It wasn't falling back to " +"``eth_feeHistory`` since the ``MethodUnavailable`` error was introduced. " +"(`#3002 `__)" +msgstr "" + +#: ../../release_notes.rst:1239 +msgid "" +"Properly initialize logger in ``AsyncHTTPProvider``. (`#3026 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1240 +msgid "" +"Fix ``AsyncWeb3.solidity_keccak`` to match ``Web3.solidity_keccak``. " +"(`#3034 `__)" +msgstr "" + +#: ../../release_notes.rst:1246 +msgid "" +"Replaced transaction examples with unused account addresses. (`#2011 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1247 +msgid "" +"Removed obsolete docs for camelCase miner methods and ``deploy`` (`#2039 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1248 +msgid "" +"Update documentation relating to ENS only being available on mainnet. ENS" +" is available on all networks where the ENS contracts are deployed. " +"(`#3012 `__)" +msgstr "" + +#: ../../release_notes.rst:1249 +msgid "" +"Add first steps section and tidy up learning resources (`#3013 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1250 +msgid "" +"Replace references to ``jasoncarver.eth`` with ``ens.eth``. (`#3020 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1251 +msgid "" +"Adds \"Hackathon Helpers\" section to Resources page (`#3035 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1257 +msgid "" +"Update ENS Resolver ABI (`#1839 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1258 +msgid "" +"``async_http_retry_request_middleware``, an async http request retry " +"middleware for ``AsyncHTTPProvider``. (`#3009 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1259 +msgid "" +"Add ``eth_getStorageAt()`` support for ``EthereumTesterProvider``. " +"(`#3011 `__)" +msgstr "" + +#: ../../release_notes.rst:1260 +msgid "" +"Add async support for ENS name-to-address resolution via " +"``async_name_to_address_middleware``. (`#3012 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1261 +msgid "" +"Add async support for the sign-and-send raw transaction middleware via " +"``construct_async_sign_and_send_raw_middleware()``. (`#3025 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1267 +msgid "" +"Remove some warnings from test output (`#2991 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1268 +msgid "" +"Introduced the logic for ENSIP-15 ENS name normalization. Originally this" +" was done via a flag in this PR but changed to the default behavior in " +"#3024 before release. (`#3000 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1274 +msgid "" +"`#2997 `__, `#3011 " +"`__, `#3023 " +"`__, `#3037 " +"`__" +msgstr "" + +#: ../../release_notes.rst:1280 +msgid "" +"Removed references to deprecated middlewares with new tests to check " +"default middlewares (`#2972 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1284 +msgid "web3.py v6.5.0 (2023-06-15)" +msgstr "" + +#: ../../release_notes.rst:1289 +msgid "" +"Properly create a fresh cache for each instance of " +"``simple_cache_middleware`` if no cache is provided. Fixes a bug when " +"using this middleware with multiple instances of ``Web3``. (`#2979 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1290 +msgid "" +"Fix potential race condition when writing cache entries in " +"``simple_cache_middleware`` (`#2981 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1291 +msgid "" +"Catch ``UnicodeDecodeError`` for contract revert messages that cannot be " +"decoded and issue a warning instead, raising a ``ContractLogicError`` " +"with the raw ``data`` from the response. (`#2989 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1297 +msgid "" +"Introduces resources page to documentation (`#2957 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1298 +msgid "" +"Completed docstrings for ``ContractFunction`` and " +"``AsyncContractFunction`` classes (`#2960 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1299 +msgid "" +"Added 'unsupported by any current clients' note to the " +"``Eth.sign_typed_data`` docs (`#2961 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1300 +msgid "" +"Removed list of ``AsyncHTTPProvider``-supported methods, it supports them" +" all now (`#2962 `__)" +msgstr "" + +#: ../../release_notes.rst:1301 +msgid "" +"Modernize the filtering guide, emphasizing ``get_logs`` (`#2968 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1302 +msgid "" +"Removed references to defunct providers in ``IPCProvider`` docs (`#2971 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1303 +msgid "" +"Update Matomo analytics script to move to cloud services (`#2978 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1309 +msgid "" +"Add the ``sign_typed_data`` method to the ``AsyncEth`` class (`#2920 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1310 +msgid "" +"Add support for Solidity ``Panic`` errors, available since Solidity " +"0.8.0. Raises ``ContractPanicError`` with appropriate messaging based on " +"the known panic error codes. (`#2986 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1316 +msgid "" +"``lint-roll`` - dropped ``isort`` ``--recursive`` flag, not needed as of " +"their ``v5``, added black (`#2930 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1317 +msgid "" +"Moved ``ethpm`` deprecation warning to only show when the module is " +"explicitly enabled (`#2983 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1318 +msgid "" +"Update make release to check remote upstream is pointing to " +"ethereum/web3.py. (`#2988 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1319 +msgid "" +"Removed `pluggy` from dev requirements (`#2992 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1325 +msgid "" +"`#2960 `__, `#2965 " +"`__" +msgstr "" + +#: ../../release_notes.rst:1329 +msgid "web3.py v6.4.0 (2023-05-15)" +msgstr "" + +#: ../../release_notes.rst:1334 +msgid "" +"fix AttributeDicts unhashable if they contain lists recursively " +"tupleizing them (`#2908 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1340 ../../release_notes.rst:1347 +msgid "" +"add deprecation notice for the `ethPM` module (`#2953 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1346 +msgid "" +"remove reference to the ability to specify a list of providers - you " +"can't anymore (`#2949 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1353 +msgid "" +"Update ``eth-tester`` to pull in Shanghai changes and make additional " +"changes to fully support Shanghai with ``eth-tester``. (`#2958 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1359 +msgid "" +"bump sphinx and readthedocs py versions (`#2945 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1360 +msgid "" +"re-compile test contracts with Solidity ``v0.8.20`` (`#2951 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1361 +msgid "" +"Set towncrier settings in `pyproject.toml` to match the python project " +"template and change newfragment type \"doc\" to \"docs\" (`#2959 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1365 +msgid "v6.3.0 (2023-05-03)" +msgstr "" + +#: ../../release_notes.rst:1370 +msgid "" +"Add support for custom revert errors (`#2795 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1371 +msgid "" +"Add the ``modify_transaction`` method to the ``AsyncEth`` class (`#2825 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1372 +msgid "" +"add show_traceback flag to is_connected to allow user to see connection " +"error reason (`#2912 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1373 +msgid "" +"Add a ``data`` attribute on the ``ContractLogicError`` class that returns" +" raw data returned by the node. (`#2922 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1374 +msgid "" +"Add support via result formatters for ``reward`` type trace actions on " +"tracing calls. (`#2929 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1380 +msgid "" +"Typing was being ignored for the ``get_ipc_path`` and " +"``get_dev_ipc_path`` functions because of a missing ``None`` return. " +"Those two methods now explicitly return ``None`` and have an ``Optional``" +" in their type definition. (`#2917 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1381 +msgid "" +"fix AsyncEventFilterBuilder looking for Web3 instead of AsyncWeb3 (`#2931" +" `__)" +msgstr "" + +#: ../../release_notes.rst:1382 +msgid "" +"Add check for null withdrawal field on get_block response (`#2941 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1388 +msgid "" +"Add a decision tree guide for sending transactions (`#2919 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1389 +msgid "" +"Update references to master branch (`#2933 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1390 +msgid "" +"Cleanup Quickstart guide and next steps (`#2935 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1391 +msgid "" +"Cleanup Overview page links and context (`#2938 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1397 +msgid "" +"Added ``build`` to towncrier commands in Makefile (`#2915 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1398 +msgid "" +"Update win wheel CI builds to use ``python -m tox -r`` instead of " +"specifying the ``tox`` executable directly. (`#2923 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1399 +msgid "" +"update pip and tox install on CI containers (`#2927 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1403 +msgid "v6.2.0 (2023-04-12)" +msgstr "" + +#: ../../release_notes.rst:1408 +msgid "" +"Adds async version of `eth_getUncleCount` methods (`#2822 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1409 +msgid "" +"Add the ``sign_transaction`` method to the ``AsyncEth`` class (`#2827 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1410 +msgid "" +"Add the ``replace_transaction`` method to the ``AsyncEth`` class (`#2847 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1416 +msgid "" +"Use ``TraceFilterParams`` instead of ``FilterParams`` for " +"``trace_filter`` typing (`#2913 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1422 +msgid "" +"Add welcome banner for Ethereum newcomers (`#2905 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1423 +msgid "" +"Added breaking changes from pr2448 to v6 migration guide (`#2907 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1427 +msgid "v6.1.0 (2023-04-05)" +msgstr "" + +#: ../../release_notes.rst:1432 +msgid "" +"Add tracing functionality back in via the ``tracing`` module, add " +"formatters for human-readable input and output, and attach this module to" +" ``Web3`` on init / make it a default module. (`#2851 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1433 +msgid "" +"Add result formatters for ``withdrawals_root`` and ``withdrawals`` as " +"part of ``Shanghai`` hard fork support. (`#2868 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1434 +msgid "" +"add eth_chainId to exception_retry_middleware whitelist (`#2892 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1440 +msgid "" +"Mark `test_async_eth_sign` with `@pytest.mark.asyncio` (`#2858 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1441 +msgid "" +"fix readthedocs broken version selector (`#2883 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1447 +msgid "" +"remove camelCased method deprecation notices from web3.eth docs (`#2882 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1448 +msgid "" +"Add doc blurb about multiple HTTPProviders with the same URL (`#2889 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1449 +msgid "" +"fix styling and external link formatting (`#2897 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1455 +msgid "" +"Bump pytest from 6.2.5 to 7+ because of CI ``DeprecationWarning`` (`#2863" +" `__)" +msgstr "" + +#: ../../release_notes.rst:1456 +msgid "" +"Require eth-abi v4 stable (`#2886 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1457 +msgid "" +"remove unused docs dependencies and bump version of remaining (`#2890 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1458 +msgid "" +"Update go-ethereum integration test fixture to use the latest version of " +"geth - ``v1.11.5``. (`#2896 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1459 +msgid "" +"Update ``geth_steps`` in CircleCI builds to pip install the proper " +"version of ``py-geth``. (`#2898 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1460 +msgid "" +"Update CircleCI windows orb path since it now uses python 3.11. (`#2899 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1461 +msgid "" +"Bump go version used in CI jobs that install and run go-ethereum and " +"parameterize the version in circleci config file for ease of " +"configuration. (`#2900 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1465 ../../release_notes.rst:1698 +#: ../../release_notes.rst:1758 ../../release_notes.rst:1819 +msgid "Miscellaneous changes" +msgstr "" + +#: ../../release_notes.rst:1467 +msgid "`#2887 `__" +msgstr "" + +#: ../../release_notes.rst:1471 +msgid "v6.0.0 (2023-03-14)" +msgstr "" + +#: ../../release_notes.rst:1476 +msgid "" +"fix dict_to_namedtuple unable to handle empty dict as input (`#2867 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1481 +msgid "v6.0.0-beta.11 (2023-02-24)" +msgstr "" + +#: ../../release_notes.rst:1486 +msgid "" +"Add the ``sign`` method to the ``AsyncEth`` class (`#2833 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1493 +msgid "" +"More accurately define the ``eth_call`` return type as ``HexBytes`` since" +" the response is converted to ``HexBytes`` in the pythonic formatters and" +" there are differences between ``HexBytes`` and ``bytes`` types. (`#2842 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1497 +msgid "" +"Set default block_identifier in ContractFunction.call() to None (`#2846 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1504 +msgid "" +"Remove unused module lines to instantiate the AsyncHTTPProvider (`#2789 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1506 +msgid "" +"Typos fix in docs (`#2817 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1508 +msgid "" +"Add/cleanup docs for the ``AsyncHTTPProvider`` in light of the new " +"``AsyncWeb3`` class (`#2821 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1511 +msgid "" +"Remove user survey banner following close of survey (`#2831 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1518 +msgid "" +"Do not invoke ``setup.py`` directly; use ``python -m build`` where " +"appropriate. (`#2714 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1520 +msgid "" +"clean up ignored unused imports (`#2838 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1522 +msgid "" +"Recompile test contracts with the new Solidity version ``0.8.19``. " +"(`#2840 `__)" +msgstr "" + +#: ../../release_notes.rst:1524 +msgid "" +"Update ``py-geth`` version and re-generate integration test fixture with " +"geth ``v1.11.2``. (`#2841 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1529 ../../release_notes.rst:1590 +#: ../../release_notes.rst:1704 ../../release_notes.rst:1765 +msgid "Breaking changes" +msgstr "" + +#: ../../release_notes.rst:1531 +msgid "" +"Use ``AsyncWeb3`` class and preserve typing for the async api calls. " +"(`#2819 `__)" +msgstr "" + +#: ../../release_notes.rst:1533 +msgid "" +"Fix typing for ``CallOverrideParams`` and add proper request formatters " +"for call state overrides. (`#2843 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1536 +msgid "" +"Remove python warning and doc notes related to unstable async providers. " +"(`#2845 `__)" +msgstr "" + +#: ../../release_notes.rst:1541 +msgid "v6.0.0-beta.10 (2023-02-15)" +msgstr "" + +#: ../../release_notes.rst:1546 +msgid "" +"add decode_tuples option to contract instantiation (`#2799 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1553 +msgid "" +"Fix ``ethpm`` import issues after making ``ipfshttpclient`` optional. " +"(`#2775 `__)" +msgstr "" + +#: ../../release_notes.rst:1555 +msgid "" +"Fix for recently-broken ``eth-tester`` exception message parsing for some" +" exception cases. (`#2783 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1563 +msgid "" +"Added a v6 Migraion Guide (`#2778 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1565 +msgid "" +"Rebrand the library to lowercase \"web3.py\" (`#2804 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1567 +msgid "" +"remove references to Rinkeby or replace with Goerli (`#2815 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1574 +msgid "" +"Organize the ``eth`` module into separate files for better readability. " +"(`#2753 `__)" +msgstr "" + +#: ../../release_notes.rst:1576 +msgid "" +"Rename the newly-split ``eth`` module files to match convention. (`#2772 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1578 +msgid "" +"Re-compile all test contracts with latest Solidity version. Refactor test" +" fixtures. Adds a script that compiles all test contracts to the same " +"directory with selected Solidity version. (`#2797 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1582 +msgid "" +"Updates to ``isort`` and ``black`` required some formatting changes and " +"isort config refactoring. (`#2802 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1585 +msgid "" +"Compile test contracts using newly-released Solidity version ``0.8.18``. " +"(`#2803 `__)" +msgstr "" + +#: ../../release_notes.rst:1592 +msgid "" +"All exceptions inherit from a custom class. EthPM exceptions inherit from" +" EthPMException, ENS exceptions inherit from ENSException, and all other " +"web3.py exceptions inherit from Web3Exception (`#1478 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1596 +msgid "" +"Reorganized contract to contract.py, async_contract.py, base_contract.py " +"and utils.py. In this change there was a small breaking change where the " +"constructor of BaseContractCaller contract_function_class was defaulting " +"to a ContractFunction now there is no default. This was done to separate " +"the base class from the implementation. (`#2567 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1602 +msgid "" +"When calling a contract, use ``w3.eth.default_block`` if no " +"block_identifier is specified instead of ``latest``. (`#2777 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1605 +msgid "" +"Strict bytes type checking is now default for ``web3.py``. This change " +"also adds a boolean flag on the ``Web3`` class for turning this feature " +"on and off, as well as a flag on the ``ENS`` class for control over a " +"standalone ``ENS`` instance. (`#2788 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1610 +msgid "" +"When a method is not supported by a node provider, raise a " +"MethodUnavailable error instead of the generic ValueError. (`#2796 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1613 +msgid "" +"``dict`` to ``AttributeDict`` conversion is no longer a default result " +"formatter. This conversion is now done via a default middleware that may " +"be removed. (`#2805 `__)" +msgstr "" + +#: ../../release_notes.rst:1616 +msgid "" +"Removed deprecated ``manager.request_async`` and associated methods. " +"(`#2810 `__)" +msgstr "" + +#: ../../release_notes.rst:1618 +msgid "" +"removed Rinkeby from list of allowed chains in EthPM (`#2815 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1623 +msgid "v6.0.0-beta.9 (2023-01-03)" +msgstr "" + +#: ../../release_notes.rst:1628 +msgid "" +"Add async ``w3.eth.get_block_transaction_count`` (`#2687 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1630 +msgid "" +"Support Python 3.11 (`#2699 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1632 +msgid "" +"Load the ``AsyncHTTPProvider`` with default async middleware and default " +"async modules, just as the ``HTTPProvider``. (`#2736 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1635 +msgid "" +"Add support for Nethermind/Gnosis revert reason formatting (`#2739 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1637 +msgid "" +"Added async functionality to filter (`#2744 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1639 +msgid "" +"Get contract address from ``CREATE`` and ``CREATE2`` opcodes (`#2762 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1646 +msgid "" +"Fixing abi encoding for multidimensional arrays. (`#2764 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1651 +msgid "Performance improvements" +msgstr "" + +#: ../../release_notes.rst:1653 +msgid "" +"Some minor performance improvements to the ``SimpleCache`` class and " +"simple cache middlewares (sync and async). (`#2719 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1656 +msgid "" +"Remove unnecessary ``await`` for ``generate_gas_price()`` method as it " +"does not need to be awaited. Move this method to ``BaseEth`` to be used " +"directly by both ``Eth`` and ``AsyncEth`` modules. (`#2735 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1665 +msgid "" +"Add user survey to docs banner (`#2720 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1667 +msgid "" +"Document improvements for private key info and account funding. (`#2722 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1669 +msgid "" +"Include eth-tester install note in quickstart (`#2755 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1674 ../../release_notes.rst:1805 +msgid "Deprecations and Removals" +msgstr "" + +#: ../../release_notes.rst:1676 +msgid "" +"Removal of Infura auto provider support. (`#2706 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1678 +msgid "" +"Removal of ``version`` module. (`#2729 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1680 +msgid "" +"Remove already-deprecated ``start_rpc`` and ``stop_rpc`` from the " +"``w3.geth.admin`` module. (`#2731 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1688 +msgid "" +"Use regex pattern for ``black`` command for ``tox`` / ``make lint`` " +"linting commands. (`#2727 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1690 +msgid "" +"Use regex pattern for ``mypy`` command for ``tox`` / ``make lint`` " +"linting commands. (`#2734 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1692 +msgid "" +"Remove internal method ``apply_formatter_to_array`` and use the method " +"with the same name from the ``eth-utils`` library. (`#2737 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1700 +msgid "`#2751 `__" +msgstr "" + +#: ../../release_notes.rst:1706 +msgid "" +"Snakecase the processReceipt, processLog, createFilter, and getLogs " +"methods (`#2709 `__)" +msgstr "" + +#: ../../release_notes.rst:1708 +msgid "" +"Remove Parity module and references. (`#2718 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1710 +msgid "" +"Make the ``ipfshttpclient`` library opt-in via a web3 install extra. This" +" only affects the ``ethpm`` ``ipfs`` backends, which rely on the library." +" (`#2730 `__)" +msgstr "" + +#: ../../release_notes.rst:1716 +msgid "v6.0.0-beta.8 (2022-11-14)" +msgstr "" + +#: ../../release_notes.rst:1721 +msgid "" +"Async support for caching certain methods via " +"``async_simple_cache_middleware`` as well as constructing custom async " +"caching middleware via ``async_construct_simple_cache_middleware``. " +"``SimpleCache`` class was also added to the public ``utils`` module. " +"(`#2579 `__)" +msgstr "" + +#: ../../release_notes.rst:1726 +msgid "" +"Remove upper pins on dependencies (`#2648 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1728 +msgid "" +"Async support for beacon api. (`#2689 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1730 +msgid "" +"If the loop for a cached async session is closed, or the session itself " +"was closed, create a new session at that cache key and properly close and" +" evict the stale session. (`#2713 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1739 +msgid "" +"bump `sphinx_rtd_theme` version to fix missing unordered list bullets " +"(`#2688 `__)" +msgstr "" + +#: ../../release_notes.rst:1741 +msgid "" +"Fix bug to generate unique cache keys when multi-threading & with unique " +"event loops for async. (`#2690 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1744 +msgid "" +"Properly release ``async_lock`` for session requests if an exception is " +"raised during a task. (`#2695 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1752 +msgid "" +"move definition of RTD install requirements file from their dashboard " +"into `.readthedocs.yml`, and remove unused `sphinx-better-theme` from " +"requirements (`#2688 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1760 +msgid "" +"`#2690 `__, `#2694 " +"`__" +msgstr "" + +#: ../../release_notes.rst:1767 +msgid "" +"Remove support for dictionary-based caches, for simple-cache-middleware, " +"in favor of the internal ``SimpleCache`` class. (`#2579 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1770 +msgid "" +"Snakecase the clientVersion method (`#2686 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1772 +msgid "" +"change instances of `createFilter` to `create_filter` (`#2692 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1774 +msgid "" +"Remove ``SolidityError`` in favor of ``ContractLogicError`` (`#2697 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1776 +msgid "" +"Snakecase the solidityKeccak method (`#2702 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1778 +msgid "" +"Snakecase the fromWeb3 method (`#2703 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1780 +msgid "" +"Snakecase the toBytes, toHex, toInt, toJSON, and toText methods (`#2707 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1782 +msgid "" +"Snakecase the toAddress, isChecksumAddress, and toChecksumAddress methods" +" (`#2708 `__)" +msgstr "" + +#: ../../release_notes.rst:1787 +msgid "v6.0.0-beta.7 (2022-10-19)" +msgstr "" + +#: ../../release_notes.rst:1792 +msgid "" +"Protobuf dependency had a DoS-able bug. It was fixed in v4.21.6. See: " +"https://nvd.nist.gov/vuln/detail/CVE-2022-1941 (`#2666 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1800 +msgid "" +"Added Chainstack link to quickstart docs. (`#2677 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1807 +msgid "" +"Remove Ropsten auto provider and the relevant references to Ropsten " +"across the repo (`#2672 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1814 +msgid "" +"Clean up remaining uses of deprecated ``eth_abi`` methods. (`#2668 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1821 +msgid "" +"`#2671 `__, `#2682 " +"`__" +msgstr "" + +#: ../../release_notes.rst:1826 +msgid "v6.0.0-beta.6 (2022-09-26)" +msgstr "" + +#: ../../release_notes.rst:1831 +msgid "" +"Protobuf dependency breaks at version ``3.20.2`` and above; pin to " +"``3.20.1`` for now. (`#2657 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1838 +msgid "" +"Add new predefined block identifiers ``safe`` and ``finalized``. (`#2652 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1843 +msgid "v6.0.0-beta.5 (2022-09-19)" +msgstr "" + +#: ../../release_notes.rst:1848 +msgid "" +"Removed IBAN since it was an unused feature (`#2537 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1850 +msgid "" +"Update eth-tester dependency to v0.7.0-beta.1; Update eth-account version" +" to >=0.7.0,<0.8.0 (`#2623 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1852 +msgid "" +"Remove ``WEB3_INFURA_API_KEY`` environment variable in favor of " +"``WEB3_INFURA_PROJECT_ID``. Change ``InfuraKeyNotFound`` exception to " +"``InfuraProjectIdNotFound`` (`#2634 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1856 +msgid "" +"Remove Kovan auto provider (`#2635 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1858 +msgid "" +"Snakecase the `isConnected` method (`#2643 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1860 +msgid "" +"Snakecase the ``toWei`` and ``fromWei`` methods (`#2647 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1867 +msgid "" +"Fix ``eth-tester`` key remapping for ``logsBloom`` and ``receiptsRoot`` " +"(`#1630 `__)" +msgstr "" + +#: ../../release_notes.rst:1869 +msgid "" +"Improve upon issues with session caching - better support for " +"multithreading and make sure session eviction from cache does not happen " +"prematurely. (`#2409 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1872 +msgid "" +"Allow classes to inherit from the ``Web3`` class by attaching modules " +"appropriately. (`#2592 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1874 +msgid "" +"fixed bug in how async_eth_tester_middleware fills default fields (`#2600" +" `__)" +msgstr "" + +#: ../../release_notes.rst:1876 +msgid "" +"Allow hex for ``value`` field when validating via ``validate_payable()`` " +"contracts method (`#2602 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1879 +msgid "" +"Update Beacon API to v2.3.0 (`#2616 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1881 +msgid "" +"Move ``flaky`` option to top-level conftest.py (`#2642 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1886 ../../release_notes.rst:1962 +#: ../../release_notes.rst:2041 ../../release_notes.rst:2092 +msgid "Documentation Updates" +msgstr "" + +#: ../../release_notes.rst:1888 +msgid "" +"Update Proof of Authority middleware (`geth_poa_middleware`) " +"documentation for better clarity. (`#2538 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1891 +msgid "" +"Add some missing supported async middlewares to docs. (`#2574 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1893 +msgid "" +"Introduce AsyncENS and availability on w3 instance in ENS guide. (`#2585 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1895 +msgid "" +"Fix typo in eth.call docs (`#2613 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1897 +msgid "" +"remove section for deleted `account.recoverHash` method (`#2615 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1899 +msgid "" +"examples docs gave incorrect return type for `eth.get_transaction`, fixed" +" (`#2617 `__)" +msgstr "" + +#: ../../release_notes.rst:1901 +msgid "" +"minor typo fix in contracts overview (`#2628 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1903 +msgid "" +"fix bug in `Deploying new contracts` example (`#2646 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1910 +msgid "" +"Support for ``Account`` class access in ``AsyncEth`` via " +"``async_w3.eth.account`` (`#2580 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1913 +msgid "" +"Expose public abi utility methods: ``get_abi_output_names()`` and " +"``get_abi_input_names()`` (`#2596 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1916 +msgid "" +"update all references to deprecated `eth_abi.encode_abi` to " +"`eth_abi.encode` (`#2621 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1918 +msgid "" +"update all references to deprecated `eth_abi.decode_abi` to " +"`eth_abi.decode` (`#2636 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1920 +msgid "" +"Add Sepolia auto provider (`#2639 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1925 ../../release_notes.rst:1990 +#: ../../release_notes.rst:2064 ../../release_notes.rst:2119 +#: ../../release_notes.rst:2164 ../../release_notes.rst:2252 +#: ../../release_notes.rst:2310 ../../release_notes.rst:2350 +#: ../../release_notes.rst:2401 ../../release_notes.rst:2423 +#: ../../release_notes.rst:2481 ../../release_notes.rst:2532 +#: ../../release_notes.rst:2569 ../../release_notes.rst:2601 +#: ../../release_notes.rst:2644 ../../release_notes.rst:2733 +#: ../../release_notes.rst:2757 ../../release_notes.rst:2778 +#: ../../release_notes.rst:2799 ../../release_notes.rst:2808 +#: ../../release_notes.rst:2825 ../../release_notes.rst:2834 +#: ../../release_notes.rst:2858 ../../release_notes.rst:2971 +#: ../../release_notes.rst:3040 ../../release_notes.rst:3063 +#: ../../release_notes.rst:3099 ../../release_notes.rst:3138 +#: ../../release_notes.rst:3176 ../../release_notes.rst:3206 +#: ../../release_notes.rst:3227 ../../release_notes.rst:3243 +#: ../../release_notes.rst:3298 ../../release_notes.rst:3325 +#: ../../release_notes.rst:3345 ../../release_notes.rst:3384 +#: ../../release_notes.rst:3411 ../../release_notes.rst:3436 +#: ../../release_notes.rst:3469 ../../release_notes.rst:3503 +#: ../../release_notes.rst:3540 ../../release_notes.rst:3567 +#: ../../release_notes.rst:3637 ../../release_notes.rst:3668 +#: ../../release_notes.rst:3708 ../../release_notes.rst:3740 +#: ../../release_notes.rst:3773 ../../release_notes.rst:3811 +#: ../../release_notes.rst:3830 ../../release_notes.rst:3850 +#: ../../release_notes.rst:3928 ../../release_notes.rst:3962 +#: ../../release_notes.rst:3980 ../../release_notes.rst:4005 +#: ../../release_notes.rst:4039 ../../release_notes.rst:4070 +msgid "Misc" +msgstr "" + +#: ../../release_notes.rst:1927 +msgid "" +"`#2603 `__, `#2622 " +"`__, `#2630 " +"`__, `#2638 " +"`__" +msgstr "" + +#: ../../release_notes.rst:1934 +msgid "v6.0.0-beta.4 (2022-07-13)" +msgstr "" + +#: ../../release_notes.rst:1939 +msgid "" +"sha3 and soliditySha3 were previously deprecated and now removed (`#2479 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1941 +msgid "" +"Remove deprecated methods from Geth, Parity and Net modules (`#2480 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1943 +msgid "" +"Provide better messaging to wrong arguments for contract functions, " +"especially for ``tuple`` argument types. (`#2556 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1951 +msgid "" +"Properly format ``block_number`` for ``eth_getTransactionCount`` when " +"using ``EthereumTesterProvider`` (`#1801 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1954 +msgid "" +"removed `Optional` type hints for `passphrase` arguments that aren't " +"actually optional (`#2511 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1956 +msgid "" +"Fix `is_dynamic_fee_transaction` and `TRANSACTION_DEFAULTS` when " +"`gas_price_strategy` returns zero (`#2562 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1964 +msgid "" +"Remove deprecated methods from Geth, Parity, and Net modules (`#2480 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1966 +msgid "" +"replace double- with single-quotes to make f-string valid (`#2504 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1968 +msgid "" +"added geth personal_sign and personal_ec_recover documentation (`#2511 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1975 +msgid "" +"Add transaction result formatters for `type` and `chainId` to convert " +"values to ``int`` if ``hexadecimal`` if the field is not null (`#2491 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1978 +msgid "" +"Add a global flag on the provider for enabling / disabling CCIP Read for " +"calls: ``global_ccip_read_enabled`` (defaults to ``True``). (`#2499 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1981 +msgid "" +"Deprecate Geth Admin StartRPC and StopRPC for StartHTTP and StopHTTP " +"(`#2507 `__)" +msgstr "" + +#: ../../release_notes.rst:1983 +msgid "" +"Added Async support for ENS (`#2547 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1985 +msgid "" +"support multi-dimensional arrays for ABI tuples types (`#2555 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:1992 +msgid "" +"`#2345 `__, `#2483 " +"`__, `#2505 " +"`__, `#2513 " +"`__, `#2514 " +"`__, `#2515 " +"`__, `#2516 " +"`__, `#2518 " +"`__, `#2520 " +"`__, `#2521 " +"`__, `#2522 " +"`__, `#2523 " +"`__, `#2524 " +"`__, `#2525 " +"`__, `#2527 " +"`__, `#2530 " +"`__, `#2531 " +"`__, `#2534 " +"`__, `#2542 " +"`__, `#2544 " +"`__, `#2550 " +"`__, `#2551 " +"`__, `#2559 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2018 +msgid "v6.0.0-beta.3 (2022-06-01)" +msgstr "" + +#: ../../release_notes.rst:2023 +msgid "" +"Removed deprecated methods from eth and geth (`#1416 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2030 +msgid "" +"Fix bug in _is_latest_block_number_request in cache middleware (`#2185 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2032 +msgid "" +"Increase cache size to allow for 20 entries. (`#2477 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2034 +msgid "" +"format receipt.type to int and log.data to HexBytes (`#2482 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2036 +msgid "" +"Only thread lock for methods attempting to access the cache for caching " +"middleware. (`#2496 `__)" +msgstr "" + +#: ../../release_notes.rst:2043 +msgid "" +"Fix typo in simple_cache_middleware example (`#2449 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2045 +msgid "" +"Fix dict type hints in EventScanner example (`#2469 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2047 +msgid "" +"Add clarification around ValueError and Local Signing middleware (`#2474 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2054 +msgid "" +"Add async version of contract functionality (`#2270 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2056 +msgid "" +"ENSIP-10 / wildcard resolution support for ENS module (`#2411 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2058 +msgid "" +"CCIP Read support and finalize implementation of and add tests for ENS " +"offchain resolution support (`#2457 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2066 +msgid "" +"`#2454 `__, `#2450 " +"`__, `#2462 " +"`__, `#2471 " +"`__, `#2478 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2074 +msgid "v6.0.0-beta.2 (2022-04-27)" +msgstr "" + +#: ../../release_notes.rst:2079 +msgid "" +"Audit ``.rst`` and ``.py`` files and convert all Web3 instance variable " +"names to ``w3`` to avoid confusion with the ``web3`` module. (`#1183 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2082 +msgid "" +"Update dependency requirements: - eth-utils - eth-abi - eth-tester - eth-" +"account - eth-typing (`#2342 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2085 +msgid "" +"Add ``attach_methods()`` to ``Module`` class to facilitate attaching " +"methods to modules. (`#2383 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2087 +msgid "" +"Move IOError -> OSError (`#2434 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2094 +msgid "" +"Clarify info about Infura filters over HTTP (`#2322 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2096 +msgid "" +"Document reading private keys from environment variables (`#2380 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2098 +msgid "" +"Add example for the ``construct_sign_and_send_raw_middleware`` when " +"connected to a hosted node (`#2410 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2101 +msgid "" +"Doc fix: Pending transaction filter returns a ``TransactionFilter`` not a" +" ``BlockFilter`` (`#2444 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2108 +msgid "" +"Add 'get_text' method to look up ENS text record values (`#2286 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2110 +msgid "" +"For ``ENS.name()``, validate that the forward resolution returns the same" +" address as provided by the user as per the ENS documentation " +"recommendation for Reverse Resolution. (`#2420 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2114 +msgid "" +"Add sync chain_id to ``simple_middleware_cache`` (`#2425 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2121 +msgid "" +"`#2369 `__, `#2372 " +"`__, `#2418 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2127 +msgid "v6.0.0-beta.1 (2022-02-28)" +msgstr "" + +#: ../../release_notes.rst:2132 +msgid "" +"Update ``websockets`` dependency to v10+ (`#2324 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2134 +msgid "" +"Remove support for the unsupported Python 3.6 Also removes outdated " +"Parity tests (`#2343 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2136 +msgid "" +"Update Sphinx requirement to ``>=4.2.0,<5`` (`#2362 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2143 +msgid "" +"Fix types for ``gas``, and ``gasLimit``: ``Wei -> int``. Also fix types " +"for ``effectiveGasPrice``: (``int -> Wei``) (`#2330 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2151 +msgid "" +"Added session caching to the AsyncHTTPProvider (`#2016 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2153 +msgid "" +"Add support for Python 3.10 (`#2175 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2155 +msgid "" +"Added 'Breaking Changes' and 'Deprecations' categories to our release " +"notes (`#2340 `__)" +msgstr "" + +#: ../../release_notes.rst:2157 +msgid "" +"Add async `eth.get_storage_at` method (`#2350 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2159 +msgid "" +"Upgrade ``jsonschema`` version to ``>=4.0.0<5`` (`#2361 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2166 +msgid "" +"`#2353 `__, `#2365 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2171 +msgid "v5.28.0 (2022-02-09)" +msgstr "" + +#: ../../release_notes.rst:2176 +msgid "" +"Added Async functions for Geth Personal and Admin modules (`#1413 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2178 +msgid "" +"async support for formatting, validation, and geth poa middlewares " +"(`#2098 `__)" +msgstr "" + +#: ../../release_notes.rst:2180 +msgid "" +"Calculate a default ``maxPriorityFeePerGas`` using ``eth_feeHistory`` " +"when ``eth_maxPriorityFeePerGas`` is not available, since the latter is " +"not a part of the Ethereum JSON-RPC specs and only supported by certain " +"clients. (`#2259 `__)" +msgstr "" + +#: ../../release_notes.rst:2184 +msgid "" +"Allow NamedTuples in ABI inputs (`#2312 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2186 +msgid "" +"Add async `eth.syncing` method (`#2331 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2193 +msgid "" +"remove `ens.utils.dict_copy` decorator (`#1423 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2195 +msgid "" +"The exception retry middleware whitelist was missing a comma between " +"``txpool`` and ``testing`` (`#2327 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2198 +msgid "" +"Properly initialize external modules that do not inherit from the " +"``web3.module.Module`` class (`#2328 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2204 +msgid "v5.27.0 (2022-01-31)" +msgstr "" + +#: ../../release_notes.rst:2209 +msgid "" +"Added Async functions for Geth TxPool (`#1413 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2211 +msgid "" +"external modules are no longer required to inherit from the " +"``web3.module.Module`` class (`#2304 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2214 +msgid "" +"Add async `eth.get_logs` method (`#2310 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2216 +msgid "" +"add Async access to `default_account` and `default_block` (`#2315 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2218 +msgid "" +"Update eth-tester and eth-account dependencies to pull in bugfix from " +"eth-keys (`#2320 `__)" +msgstr "" + +#: ../../release_notes.rst:2225 +msgid "" +"Fixed issues with parsing tuples and nested tuples in event logs (`#2211 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2227 +msgid "" +"In ENS the contract function to resolve an ENS address was being called " +"twice in error. One of those calls was removed. (`#2318 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2230 +msgid "" +"``to_hexbytes`` block formatters no longer throw when value is ``None`` " +"(`#2321 `__)" +msgstr "" + +#: ../../release_notes.rst:2237 +msgid "" +"fix typo in `eth.account` docs (`#2111 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2239 +msgid "" +"explicitly add `output_values` to contracts example (`#2293 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2241 +msgid "" +"update imports for `AsyncHTTPProvider` sample code (`#2302 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2243 +msgid "" +"fixed broken link to filter schema (`#2303 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2245 +msgid "" +"add github link to the main docs landing page (`#2313 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2247 +msgid "" +"fix typos and update referenced `geth` version (`#2326 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2254 +msgid "`#2217 `__" +msgstr "" + +#: ../../release_notes.rst:2258 +msgid "v5.26.0 (2022-01-06)" +msgstr "" + +#: ../../release_notes.rst:2263 +msgid "" +"Add ``middlewares`` property to ``NamedElementOnion`` / " +"``web3.middleware_onion``. Returns current middlewares in proper order " +"for importing into a new ``Web3`` instance (`#2239 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2267 +msgid "" +"Add async ``eth.hashrate`` method (`#2243 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2269 +msgid "" +"Add async ``eth.chain_id`` method (`#2251 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2271 +msgid "" +"Add async ``eth.mining`` method (`#2252 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2273 +msgid "" +"Add async ``eth.get_transaction_receipt`` and " +"``eth.wait_for_transaction_receipt`` methods (`#2265 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2276 +msgid "" +"Add async `eth.accounts` method (`#2284 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2278 +msgid "" +"Support for attaching external modules to the ``Web3`` instance when " +"instantiating the ``Web3`` instance, via the ``external_modules`` " +"argument, or via the new ``attach_modules()`` method (`#2288 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2287 +msgid "" +"Fixed doctest that wasn't running in ``docs/contracts.rst`` (`#2213 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2289 +msgid "" +"Key mapping fix to eth-tester middleware for access list storage keys " +"(`#2224 `__)" +msgstr "" + +#: ../../release_notes.rst:2291 +msgid "" +"Inherit ``Web3`` instance middlewares when instantiating ``ENS`` with " +"``ENS.fromWeb3()`` method (`#2239 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2299 +msgid "" +"Fix example docs to show a TransactionNotFound error, instead of None " +"(`#2199 `__)" +msgstr "" + +#: ../../release_notes.rst:2301 +msgid "" +"fix typo in ethpm.rst (`#2277 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2303 +msgid "" +"Clarify provider usage in Quickstart docs (`#2287 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2305 +msgid "" +"Address common BSC usage question (`#2289 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2312 +msgid "" +"`#1729 `__, `#2233 " +"`__, `#2242 " +"`__, `#2260 " +"`__, `#2261 " +"`__, `#2283 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2321 +msgid "v5.25.0 (2021-11-19)" +msgstr "" + +#: ../../release_notes.rst:2326 +msgid "" +"Support for ``w3.eth.get_raw_transaction_by_block``, and async support " +"for ``w3.eth.get_raw_transaction_by_block`` (`#2209 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2334 +msgid "" +"BadResponseFormat error thrown instead of KeyError when a response gets " +"sent back without a ``result`` key. (`#2188 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2342 +msgid "" +"Correct link to Websocket library documentation (`#2173 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2344 +msgid "" +"Doc update to make it clearer that enable_unstable_package_management() " +"method is on the web3 instance (`#2208 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2352 +msgid "" +"`#2102 `__, `#2179 " +"`__, `#2191 " +"`__, `#2201 " +"`__, `#2205 " +"`__, `#2212 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2361 +msgid "v5.24.0 (2021-09-27)" +msgstr "" + +#: ../../release_notes.rst:2366 +msgid "" +"Add async ``eth.send_raw_transaction`` method (`#2135 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2368 +msgid "" +"Updated eth-account version to v0.5.6 - adds support for signing typed " +"transactions without needing to explicitly set the transaction type and " +"now accepts correct JSON-RPC structure for accessList for typed " +"transactions (`#2157 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2377 +msgid "" +"Encode block_count as hex before making eth_feeHistory RPC call (`#2117 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2384 +msgid "" +"Fix typo in AsyncHTTPProvider docs (`#2131 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2386 +msgid "" +"Update AsyncHTTPProvider doc Supported Methods to include " +"``web3.eth.send_raw_transaction()``. (`#2135 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2389 +msgid "" +"Improve messaging around usage and implementation questions, directing " +"users to the appropriate channel (`#2138 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2392 +msgid "" +"Clarify some contract ``ValueError`` error messages. (`#2146 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2394 +msgid "" +"Updated docs for w3.eth.account.sign_transaction to reflect that " +"transaction type is no longer needed to successfully sign typed " +"transactions and to illustrate how to structure an optional accessList " +"parameter in a typed transaction (`#2157 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2403 +msgid "`#2105 `__" +msgstr "" + +#: ../../release_notes.rst:2407 +msgid "v5.23.1 (2021-08-27)" +msgstr "" + +#: ../../release_notes.rst:2412 +msgid "" +"Add constants for the zero address, zero hash, max int, and wei per " +"ether. (`#2109 `__)" +msgstr "" + +#: ../../release_notes.rst:2418 +msgid "" +"Renamed \"1559 transaction\" to \"dynamic fee transaction\" where " +"appropriate to keep consistency among the general code base for 1559 " +"transaction (type=2) naming (`#2118 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2419 +msgid "" +"Update AsyncHTTPProvider doc example to include modules and middlewares " +"keyword arguments (`#2123 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2425 +msgid "" +"`#2110 `__, `#2118 " +"`__, `#2122 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2429 +msgid "v5.23.0 (2021-08-12)" +msgstr "" + +#: ../../release_notes.rst:2434 +msgid "" +"Add support for eth_feeHistory RPC method (`#2038 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2435 +msgid "" +"Add support for eth_maxPriorityFeePerGas RPC method (`#2100 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2441 +msgid "" +"Hot fix for string interpolation issue with contract function call " +"decoding exception to facilitate extracting a meaningful message from the" +" eth_call response (`#2096 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2442 +msgid "" +"Bypass adding a ``gasPrice`` via the gas price strategy, if one is set, " +"when EIP-1559 transaction params are used for ``send_transaction`` " +"(`#2099 `__)" +msgstr "" + +#: ../../release_notes.rst:2448 +msgid "" +"Update feeHistory docs (`#2104 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2452 +msgid "v5.22.0 (2021-08-02)" +msgstr "" + +#: ../../release_notes.rst:2457 +msgid "" +"Add support for eth_getRawTransactionByHash RPC method (`#2039 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2458 +msgid "" +"Add AsyncNet module (`#2044 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2459 +msgid "" +"Add async ``eth.get_balance``, ``eth.get_code``, " +"``eth.get_transaction_count`` methods. (`#2056 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2460 +msgid "" +"eth_signTransaction support for eip-1559 params 'maxFeePerGas' and " +"'maxPriorityFeePerGas' (`#2082 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2461 +msgid "" +"Add support for async ``w3.eth.call``. (`#2083 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2467 +msgid "" +"If a transaction hash was passed as a string rather than a HexByte to " +"``w3.eth.wait_for_transaction_receipt``, and the time was exhausted " +"before the transaction is in the chain, the error being raised was a " +"TypeError instead of the correct TimeExhausted error. This is because the" +" ``to_hex`` method in the TimeExhausted error message expects a primitive" +" as the first argument, and a string doesn't qualify as a primitive. " +"Fixed by converting the transaction_hash to HexBytes instead. (`#2068 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2468 +msgid "" +"Hot fix for a string interpolation issue in message when " +"BadFunctionCallOutput is raised for call_contract_function() (`#2069 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2469 +msgid "" +"``fill_transaction_defaults()`` no longer sets a default ``gasPrice`` if " +"1559 fees are present in the transaction parameters. This fixes sign-and-" +"send middleware issues with 1559 fees. (`#2092 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2475 +msgid "" +"Clarify that ``send_transaction``, ``modify_transaction``, and " +"``replace_transaction`` return HexByte objects instead of strings. " +"(`#2058 `__)" +msgstr "" + +#: ../../release_notes.rst:2476 +msgid "" +"Added troubleshooting section for Microsoft Visual C++ error on Windows " +"machines (`#2077 `__)" +msgstr "" + +#: ../../release_notes.rst:2477 +msgid "" +"Updated the sign-and-send middleware docs to include EIP-1559 as well as " +"legacy transaction examples (`#2092 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2483 +msgid "" +"`#2073 `__, `#2080 " +"`__, `#2085 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2487 +msgid "v5.21.0 (2021-07-12)" +msgstr "" + +#: ../../release_notes.rst:2492 +msgid "" +"Adds support for EIP 1559 transaction keys: `maxFeePerGas` and " +"`maxPriorityFeePerGas` (`#2060 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2498 +msgid "" +"Bugfix where an error response got passed to a function expecting a block" +" identifier." +msgstr "" + +#: ../../release_notes.rst:2500 +msgid "" +"Split out null result formatters from the error formatters and added some" +" tests. (`#2022 `__)" +msgstr "" + +#: ../../release_notes.rst:2501 +msgid "" +"Fix broken tests and use the new 1559 params for most of our test " +"transactions. (`#2053 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2502 +msgid "" +"Set a default maxFeePerGas value consistent with Geth (`#2055 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2503 +msgid "" +"Fix bug in geth PoA middleware where a ``None`` response should throw a " +"``BlockNotFound`` error, but was instead throwing an ``AttributeError`` " +"(`#2064 `__)" +msgstr "" + +#: ../../release_notes.rst:2509 +msgid "" +"Added general documentation on unit and integration testing and how to " +"contribute to our test suite. (`#2053 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2513 +msgid "v5.20.1 (2021-07-01)" +msgstr "" + +#: ../../release_notes.rst:2518 +msgid "" +"Have the geth dev IPC auto connection check for the ``WEB3_PROVIDER_URI``" +" environment variable. (`#2023 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2524 +msgid "" +"Remove reference to allowing multiple providers in docs (`#2018 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2525 +msgid "" +"Update \"Contract Deployment Example\" docs to use ``py-solc-x`` as " +"``solc`` is no longer maintained. (`#2020 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2526 +msgid "" +"Detail using unreleased Geth builds in CI (`#2037 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2527 +msgid "" +"Clarify that a missing trie node error could occur when using " +"``block_identifier`` with ``.call()`` on a node that isn't running in " +"archive mode (`#2048 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2534 +msgid "" +"`#1938 `__, `#2015 " +"`__, `#2021 " +"`__, `#2025 " +"`__, `#2028 " +"`__, `#2029 " +"`__, `#2035 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2538 +msgid "v5.20.0 (2021-06-09)" +msgstr "" + +#: ../../release_notes.rst:2543 +msgid "Add new AsyncHTTPProvider. No middleware or session caching support yet." +msgstr "" + +#: ../../release_notes.rst:2545 +msgid "" +"Also adds async ``w3.eth.gas_price``, and async ``w3.isConnected()`` " +"methods. (`#1978 `__)" +msgstr "" + +#: ../../release_notes.rst:2546 +msgid "Add ability for AsyncHTTPProvider to accept middleware" +msgstr "" + +#: ../../release_notes.rst:2548 +msgid "" +"Also adds async gas_price_strategy middleware, and moves gas estimate to " +"middleware." +msgstr "" + +#: ../../release_notes.rst:2550 +msgid "" +"AsyncEthereumTesterProvider now inherits from AsyncBase (`#1999 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2551 +msgid "" +"Support state_override in contract function call. (`#2005 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2557 +msgid "" +"Test ethpm caching + bump Sphinx version. (`#1977 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2563 +msgid "" +"Clarify solidityKeccak documentation. (`#1971 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2564 +msgid "" +"Improve contributor documentation context and ordering. (`#2008 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2565 +msgid "" +"Add docs for unstable AsyncHTTPProvider (`#2017 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2571 +msgid "" +"`#1979 `__, `#1980 " +"`__, `#1993 " +"`__, `#2002 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2575 +msgid "v5.19.0 (2021-04-28)" +msgstr "" + +#: ../../release_notes.rst:2580 +msgid "" +"Handle optional ``eth_call`` state override param. (`#1921 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2581 +msgid "" +"Add list_storage_keys deprecate listStorageKeys (`#1944 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2582 +msgid "" +"Add net_peers deprecate netPeers (`#1946 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2583 +msgid "" +"Add trace_replay_transaction deprecate traceReplayTransaction (`#1949 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2584 +msgid "" +"Add add_reserved_peer deprecate addReservedPeer (`#1951 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2585 +msgid "" +"Add ``parity.set_mode``, deprecate ``parity.setMode`` (`#1954 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2586 +msgid "" +"Add ``parity.trace_raw_transaction``, deprecate " +"``parity.traceRawTransaction`` (`#1955 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2587 +msgid "" +"Add ``parity.trace_call``, deprecate ``parity.traceCall`` (`#1957 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2588 +msgid "" +"Add trace_filter deprecate traceFilter (`#1960 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2589 +msgid "" +"Add trace_block, deprecate traceBlock (`#1961 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2590 +msgid "" +"Add trace_replay_block_transactions, deprecate " +"traceReplayBlockTransactions (`#1962 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2591 +msgid "" +"Add ``parity.trace_transaction``, deprecate ``parity.traceTransaction`` " +"(`#1963 `__)" +msgstr "" + +#: ../../release_notes.rst:2597 +msgid "" +"Document ``eth_call`` state overrides. (`#1965 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2603 +msgid "" +"`#1774 `__, `#1805 " +"`__, `#1945 " +"`__, `#1964 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2607 +msgid "v5.18.0 (2021-04-08)" +msgstr "" + +#: ../../release_notes.rst:2612 +msgid "" +"Add ``w3.eth.modify_transaction`` deprecate ``w3.eth.modifyTransaction`` " +"(`#1886 `__)" +msgstr "" + +#: ../../release_notes.rst:2613 +msgid "" +"Add ``w3.eth.get_transaction_receipt``, deprecate " +"``w3.eth.getTransactionReceipt`` (`#1893 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2614 +msgid "" +"Add ``w3.eth.wait_for_transaction_receipt`` deprecate " +"``w3.eth.waitForTransactionReceipt`` (`#1896 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2615 +msgid "" +"Add ``w3.eth.set_contract_factory`` deprecate " +"``w3.eth.setContractFactory`` (`#1900 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2616 +msgid "" +"Add ``w3.eth.generate_gas_price`` deprecate ``w3.eth.generateGasPrice`` " +"(`#1905 `__)" +msgstr "" + +#: ../../release_notes.rst:2617 +msgid "" +"Add ``w3.eth.set_gas_price_strategy`` deprecate " +"``w3.eth.setGasPriceStrategy`` (`#1906 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2618 +msgid "" +"Add ``w3.eth.estimate_gas`` deprecate ``w3.eth.estimateGas`` (`#1913 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2619 +msgid "" +"Add ``w3.eth.sign_typed_data`` deprecate ``w3.eth.signTypedData`` (`#1915" +" `__)" +msgstr "" + +#: ../../release_notes.rst:2620 +msgid "" +"Add ``w3.eth.get_filter_changes`` deprecate ``w3.eth.getFilterChanges`` " +"(`#1916 `__)" +msgstr "" + +#: ../../release_notes.rst:2621 +msgid "" +"Add ``eth.get_filter_logs``, deprecate ``eth.getFilterLogs`` (`#1919 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2622 +msgid "" +"Add ``eth.uninstall_filter``, deprecate ``eth.uninstallFilter`` (`#1920 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2623 +msgid "" +"Add ``w3.eth.get_logs`` deprecate ``w3.eth.getLogs`` (`#1925 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2624 +msgid "" +"Add ``w3.eth.submit_hashrate`` deprecate ``w3.eth.submitHashrate`` " +"(`#1926 `__)" +msgstr "" + +#: ../../release_notes.rst:2625 +msgid "" +"Add ``w3.eth.submit_work`` deprecate ``w3.eth.submitWork`` (`#1927 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2626 +msgid "" +"Add ``w3.eth.get_work``, deprecate ``w3.eth.getWork`` (`#1934 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2627 +msgid "" +"Adds public get_block_number method. (`#1937 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2633 +msgid "" +"Add ABI type examples to docs (`#1890 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2634 +msgid "" +"Promote the new Ethereum Python Discord server on the README. (`#1898 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2635 +msgid "" +"Escape reserved characters in install script of Contributing docs. " +"(`#1909 `__)" +msgstr "" + +#: ../../release_notes.rst:2636 +msgid "" +"Add detailed event filtering examples. (`#1910 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2637 +msgid "" +"Add docs example for tuning log levels. (`#1928 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2638 +msgid "" +"Add some performance tips in troubleshooting docs. (`#1929 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2639 +msgid "" +"Add existing contract interaction to docs examples. (`#1933 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2640 +msgid "" +"Replace Gitter links with the Python Discord server. (`#1936 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2646 +msgid "" +"`#1887 `__, `#1907 " +"`__, `#1917 " +"`__, `#1930 " +"`__, `#1935 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2650 +msgid "v5.17.0 (2021-02-24)" +msgstr "" + +#: ../../release_notes.rst:2655 +msgid "" +"Added ``get_transaction_count``, and deprecated ``getTransactionCount`` " +"(`#1844 `__)" +msgstr "" + +#: ../../release_notes.rst:2656 +msgid "" +"Add ``w3.eth.send_transaction``, deprecate ``w3.eth.sendTransaction`` " +"(`#1878 `__)" +msgstr "" + +#: ../../release_notes.rst:2657 +msgid "" +"Add ``web3.eth.sign_transaction``, deprecate ``web3.eth.signTransaction``" +" (`#1879 `__)" +msgstr "" + +#: ../../release_notes.rst:2658 +msgid "" +"Add ``w3.eth.send_raw_transaction``, deprecate " +"``w3.eth.sendRawTransaction`` (`#1880 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2659 +msgid "" +"Add ``w3.eth.replace_transaction`` deprecate " +"``w3.eth.replaceTransaction`` (`#1882 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2665 +msgid "" +"Fix return type of ``send_transaction`` in docs. (`#686 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2669 +msgid "v5.16.0 (2021-02-04)" +msgstr "" + +#: ../../release_notes.rst:2674 +msgid "" +"Added ``get_block_transaction_count``, and deprecated " +"``getBlockTransactionCount`` (`#1841 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2675 +msgid "" +"Move ``defaultAccount`` to ``default_account``. Deprecate " +"``defaultAccount``. (`#1848 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2676 +msgid "" +"Add ``eth.default_block``, deprecate ``eth.defaultBlock``. Also adds " +"``parity.default_block``, and deprecates ``parity.defaultBlock``. (`#1849" +" `__)" +msgstr "" + +#: ../../release_notes.rst:2678 +msgid "" +"Add ``eth.gas_price``, deprecate ``eth.gasPrice`` (`#1850 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2679 +msgid "" +"Added ``eth.block_number`` property. Deprecated ``eth.blockNumber`` " +"(`#1851 `__)" +msgstr "" + +#: ../../release_notes.rst:2680 +msgid "" +"Add ``eth.chain_id``, deprecate ``eth.chainId`` (`#1852 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2681 +msgid "" +"Add ``eth.protocol_version``, deprecate ``eth.protocolVersion`` (`#1853 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2682 +msgid "" +"Add ``eth.get_code``, deprecate ``eth.getCode`` (`#1856 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2683 +msgid "" +"Deprecate ``eth.getProof``, add ``eth.get_proof`` (`#1857 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2684 +msgid "" +"Add ``eth.get_transaction``, deprecate ``eth.getTransaction`` (`#1858 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2685 +msgid "" +"Add ``eth.get_transaction_by_block``, deprecate " +"``eth.getTransactionByBlock`` (`#1859 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2686 +msgid "" +"Add get_uncle_by_block, deprecate getUncleByBlock (`#1862 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2687 +msgid "" +"Add get_uncle_count, deprecate getUncleCount (`#1863 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2693 +msgid "" +"Fix event filter creation if the event ABI contains a ``values`` key. " +"(`#1807 `__)" +msgstr "" + +#: ../../release_notes.rst:2699 +msgid "" +"Remove v5 breaking changes link from the top of the release notes. " +"(`#1837 `__)" +msgstr "" + +#: ../../release_notes.rst:2700 +msgid "" +"Add account creation troubleshooting docs. (`#1855 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2701 +msgid "" +"Document passing a struct into a contract function. (`#1860 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2702 +msgid "" +"Add instance configuration troubleshooting docs. (`#1865 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2703 +msgid "" +"Clarify nonce lookup in sendRawTransaction docs. (`#1866 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2704 +msgid "" +"Updated docs for web3.eth methods: eth.getTransactionReceipt and " +"eth.waitForTransactionReceipt (`#1868 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2708 +msgid "v5.15.0 (2021-01-15)" +msgstr "" + +#: ../../release_notes.rst:2713 +msgid "" +"Add ``get_storage_at`` method and deprecate ``getStorageAt``. (`#1828 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2714 +msgid "" +"Add ``eth.get_block`` method and deprecate ``eth.getBlock``. (`#1829 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2720 +msgid "" +"PR #1585 changed the error that was coming back from eth-tester when the " +"Revert opcode was called, which broke some tests in downstream libraries." +" This PR reverts back to raising the original error. (`#1813 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2722 +msgid "" +"Added a new ``ContractLogicError`` for when a contract reverts a " +"transaction. ``ContractLogicError`` will replace ``SolidityError``, in " +"v6. (`#1814 `__)" +msgstr "" + +#: ../../release_notes.rst:2729 +msgid "" +"Introduce Beacon API documentation (`#1836 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2735 +msgid "" +"`#1602 `__, `#1827 " +"`__, `#1831 " +"`__, `#1833 " +"`__, `#1834 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2739 +msgid "v5.14.0 (2021-01-05)" +msgstr "" + +#: ../../release_notes.rst:2744 +msgid "" +"Remove docs/web3.* from the gitignore to allow for the beacon docs to be " +"added to git, and add ``beacon`` to the default web3 modules that get " +"loaded. (`#1824 `__)" +msgstr "" + +#: ../../release_notes.rst:2746 +msgid "" +"Remove auto-documenting from the Beacon API (`#1825 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2752 +msgid "" +"Introduce experimental Ethereum 2.0 beacon node API (`#1758 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2753 +msgid "" +"Add new get_balance method on Eth class. Deprecated getBalance. (`#1806 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2759 +msgid "" +"`#1815 `__, `#1816 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2763 +msgid "v5.13.1 (2020-12-03)" +msgstr "" + +#: ../../release_notes.rst:2768 +msgid "" +"Handle revert reason parsing for Ganache (`#1794 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2774 +msgid "" +"Document Geth and Parity/OpenEthereum fixture generation (`#1787 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2780 +msgid "" +"`#1778 `__, `#1780 " +"`__, `#1790 " +"`__, `#1791 " +"`__, `#1796 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2784 +msgid "v5.13.0 (2020-10-29)" +msgstr "" + +#: ../../release_notes.rst:2789 +msgid "" +"Raise `SolidityError` exceptions that contain the revert reason when a " +"`call` fails. (`#941 `__)" +msgstr "" + +#: ../../release_notes.rst:2795 +msgid "" +"Update eth-tester dependency to fix tester environment install version " +"conflict. (`#1782 `__)" +msgstr "" + +#: ../../release_notes.rst:2801 +msgid "" +"`#1757 `__, `#1767 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2805 +msgid "v5.12.3 (2020-10-21)" +msgstr "" + +#: ../../release_notes.rst:2810 +msgid "" +"`#1752 `__, `#1759 " +"`__, `#1773 " +"`__, `#1775 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2814 +msgid "v5.12.2 (2020-10-12)" +msgstr "" + +#: ../../release_notes.rst:2819 +msgid "" +"Address the use of multiple providers in the docs (`#1701 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2820 +msgid "" +"Remove stale connection errors from docs (`#1737 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2821 +msgid "" +"Allow ENS name resolution for methods that use the ``Method`` class " +"(`#1749 `__)" +msgstr "" + +#: ../../release_notes.rst:2827 +msgid "" +"`#1727 `__, `#1728 " +"`__, `#1733 " +"`__, `#1735 " +"`__, `#1741 " +"`__, `#1746 " +"`__, `#1748 " +"`__, `#1753 " +"`__, `#1768 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2831 +msgid "v5.12.1 (2020-09-02)" +msgstr "" + +#: ../../release_notes.rst:2836 +msgid "" +"`#1708 `__, `#1709 " +"`__, `#1715 " +"`__, `#1722 " +"`__, `#1724 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2840 +msgid "v5.12.0 (2020-07-16)" +msgstr "" + +#: ../../release_notes.rst:2845 ../../release_notes.rst:2896 +msgid "" +"Update `web3.pm` and `ethpm` module to EthPM v3 specification. (`#1652 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2846 ../../release_notes.rst:2895 +msgid "" +"Allow consumer to initialize `HttpProvider` with their own " +"`requests.Session`. This allows the `HttpAdapter` connection pool to be " +"tuned as desired. (`#1469 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2852 ../../release_notes.rst:2886 +msgid "" +"Use ethpm v3 packages in examples documentation. (`#1683 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2853 ../../release_notes.rst:2885 +msgid "" +"Modernize the deploy contract example. (`#1679 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2854 +msgid "" +"Add contribution guidelines and a code of conduct. (`#1691 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2860 +msgid "`#1687 `__" +msgstr "" + +#: ../../release_notes.rst:2861 +msgid "`#1690 `__" +msgstr "" + +#: ../../release_notes.rst:2865 +msgid "v5.12.0-beta.3 (2020-07-15)" +msgstr "" + +#: ../../release_notes.rst:2870 +msgid "" +"Include ethpm-spec solidity examples in distribution. (`#1686 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2874 +msgid "v5.12.0-beta.2 (2020-07-14)" +msgstr "" + +#: ../../release_notes.rst:2879 +msgid "" +"Support ethpm-spec submodule in distributions. (`#1682 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2890 +msgid "v5.12.0-beta.1 (2020-07-09)" +msgstr "" + +#: ../../release_notes.rst:2902 +msgid "" +"Update outdated reference url in ethpm docs and tests. (`#1680 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2908 +msgid "" +"Add a :meth:`~web3.eth.Eth.getBalance` example and provide more context " +"for using the `fromWei` and `toWei` utility methods. (`#1676 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2909 +msgid "" +"Overhaul the Overview documentation to provide a tour of major features. " +"(`#1681 `__)" +msgstr "" + +#: ../../release_notes.rst:2913 +msgid "v5.11.1 (2020-06-17)" +msgstr "" + +#: ../../release_notes.rst:2918 +msgid "" +"Added formatter rules for eth_tester middleware to allow " +":meth:`~web3.eth.Eth.getBalance` by using integer block numbers (`#1660 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2919 +msgid "" +"Fix type annotations within the ``eth.py`` module. Several arguments that" +" defaulted to ``None`` were not declared ``Optional``. (`#1668 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2920 +msgid "" +"Fix type annotation warning when using string URI to instantiate an HTTP " +"or WebsocketProvider. (`#1669 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2921 +msgid "" +"Fix type annotations within the ``web3`` modules. Several arguments that " +"defaulted to ``None`` were not declared ``Optional``. (`#1670 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2927 +msgid "" +"Breaks up links into three categories (Intro, Guides, and API) and adds " +"content to the index page: a lib introduction and some \"Getting " +"Started\" links. (`#1671 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2928 +msgid "" +"Fills in some gaps in the Quickstart guide and adds provider connection " +"details for local nodes. (`#1673 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2932 +msgid "v5.11.0 (2020-06-03)" +msgstr "" + +#: ../../release_notes.rst:2937 +msgid "" +"Accept a block identifier in the ``Contract.estimateGas`` method. " +"Includes a related upgrade of eth-tester to v0.5.0-beta.1. (`#1639 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2938 +msgid "" +"Introduce a more specific validation error, ``ExtraDataLengthError``. " +"This enables tools to detect when someone may be connected to a POA " +"network, for example, and provide a smoother developer experience. " +"(`#1666 `__)" +msgstr "" + +#: ../../release_notes.rst:2944 +msgid "" +"Correct the type annotations of `FilterParams.address` (`#1664 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2950 +msgid "" +"Corrects the return value of ``getTransactionReceipt``, description of " +"caching middleware, and deprecated method names. (`#1663 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2951 +msgid "" +"Corrects documentation of websocket timeout configuration. (`#1665 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2955 +msgid "v5.10.0 (2020-05-18)" +msgstr "" + +#: ../../release_notes.rst:2960 +msgid "" +"An update of ``eth-tester`` includes a change of the default fork from " +"Constantinople to Muir Glacier. `#1636 " +"`__" +msgstr "" + +#: ../../release_notes.rst:2966 +msgid "" +"``my_contract.events.MyEvent`` was incorrectly annotated so that " +"``MyEvent`` was marked as a ``ContractEvent`` instance. Fixed to be a " +"class type, i.e., ``Type[ContractEvent]``. (`#1646 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2967 +msgid "" +"IPCProvider correctly handled ``pathlib.Path`` input, but warned against " +"its type. Fixed to permit Path objects in addition to strings. (`#1647 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2973 +msgid "`#1636 `__" +msgstr "" + +#: ../../release_notes.rst:2977 +msgid "v5.9.0 (2020-04-30)" +msgstr "" + +#: ../../release_notes.rst:2982 +msgid "" +"Upgrade eth-account to use v0.5.2+. eth-account 0.5.2 adds support for hd" +" accounts" +msgstr "" + +#: ../../release_notes.rst:2984 +msgid "" +"Also had to pin eth-keys to get dependencies to resolve. (`#1622 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2990 +msgid "" +"Fix local_filter_middleware new entries bug (`#1514 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:2991 +msgid "" +"ENS ``name`` and ENS ``address`` can return ``None``. Fixes return types." +" (`#1633 `__)" +msgstr "" + +#: ../../release_notes.rst:2995 +msgid "v5.8.0 (2020-04-23)" +msgstr "" + +#: ../../release_notes.rst:3000 +msgid "" +"Introduced ``list_wallets`` method to the ``GethPersonal`` class. (`#1516" +" `__)" +msgstr "" + +#: ../../release_notes.rst:3001 +msgid "" +"Added block_identifier parameter to `ContractConstructor.estimateGas` " +"method. (`#1588 `__)" +msgstr "" + +#: ../../release_notes.rst:3002 +msgid "Add snake_case methods to Geth and Parity Personal Modules." +msgstr "" + +#: ../../release_notes.rst:3004 +msgid "" +"Deprecate camelCase methods. (`#1589 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3005 +msgid "Added new weighted keyword argument to the time based gas price strategy." +msgstr "" + +#: ../../release_notes.rst:3007 +msgid "" +"If ``True``, it will more give more weight to more recent block times. " +"(`#1614 `__)" +msgstr "" + +#: ../../release_notes.rst:3008 +msgid "Adds support for Solidity's new(ish) receive function." +msgstr "" + +#: ../../release_notes.rst:3010 +msgid "" +"Adds a new contract API that mirrors the existing fallback API: " +"``contract.receive`` (`#1623 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3016 +msgid "" +"Fixed hasattr overloader method in the web3.ContractEvent, " +"web3.ContractFunction, and web3.ContractCaller classes by implementing a " +"try/except handler that returns False if an exception is raised in the " +"__getattr__ overloader method (since __getattr__ HAS to be called in " +"every __hasattr__ call)." +msgstr "" + +#: ../../release_notes.rst:3021 +msgid "" +"Created two new Exception classes, 'ABIEventFunctionNotFound' and " +"'ABIFunctionNotFound', which inherit from both AttributeError and " +"MismatchedABI, and replaced the MismatchedABI raises in ContractEvent, " +"ContractFunction, and ContractCaller with a raise to the created class in" +" the __getattr__ overloader method of the object. (`#1594 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3025 +msgid "" +"Change return type of rpc_gas_price_strategy from int to Wei (`#1612 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3031 +msgid "" +"Fix typo in \"Internals\" docs. Changed asyncronous --> asynchronous " +"(`#1607 `__)" +msgstr "" + +#: ../../release_notes.rst:3032 +msgid "" +"Improve documentation that introduces and troubleshoots Providers. " +"(`#1609 `__)" +msgstr "" + +#: ../../release_notes.rst:3033 +msgid "" +"Add documentation for when to use each transaction method. (`#1610 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3034 +msgid "" +"Remove incorrect web3 for w3 in doc example (`#1615 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3035 +msgid "" +"Add examples for using web3.contract via the ethpm module. (`#1617 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3036 +msgid "" +"Add dark mode to documentation. Also fixes a bunch of formatting issues " +"in docs. (`#1626 `__)" +msgstr "" + +#: ../../release_notes.rst:3042 +msgid "`#1545 `__" +msgstr "" + +#: ../../release_notes.rst:3046 +msgid "v5.7.0 (2020-03-16)" +msgstr "" + +#: ../../release_notes.rst:3051 +msgid "Add snake_case methods for the net module" +msgstr "" + +#: ../../release_notes.rst:3053 +msgid "" +"Also moved net module to use ModuleV2 instead of Module (`#1592 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3059 +msgid "" +"Fix return type of eth_getCode. Changed from Hexstr to HexBytes. (`#1601 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3065 +msgid "`#1590 `__" +msgstr "" + +#: ../../release_notes.rst:3069 +msgid "v5.6.0 (2020-02-26)" +msgstr "" + +#: ../../release_notes.rst:3074 +msgid "" +"Add snake_case methods to Geth Miner class, deprecate camelCase methods " +"(`#1579 `__)" +msgstr "" + +#: ../../release_notes.rst:3075 +msgid "" +"Add snake_case methods for the net module, deprecate camelCase methods " +"(`#1581 `__)" +msgstr "" + +#: ../../release_notes.rst:3076 +msgid "" +"Add PEP561 type marker (`#1583 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3082 +msgid "Increase replacement tx minimum gas price bump" +msgstr "" + +#: ../../release_notes.rst:3084 +#, python-format +msgid "" +"Parity/OpenEthereum requires a replacement transaction's gas to be a " +"minimum of 12.5% higher than the original (vs. Geth's 10%). (`#1570 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3090 +msgid "v5.5.1 (2020-02-10)" +msgstr "" + +#: ../../release_notes.rst:3095 +msgid "" +"Documents the `getUncleCount` method. (`#1534 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3101 +msgid "`#1576 `__" +msgstr "" + +#: ../../release_notes.rst:3105 +msgid "v5.5.0 (2020-02-03)" +msgstr "" + +#: ../../release_notes.rst:3110 +msgid "" +"ENS had to release a new registry to push a bugfix. See `this article " +"`_ for background information. web3.py uses " +"the new registry for all default ENS interactions, now. (`#1573 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3118 +msgid "" +"Minor bugfix in how ContractCaller looks up abi functions. (`#1552 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3119 +msgid "" +"Update modules to use compatible typing-extensions import. (`#1554 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3120 +msgid "" +"Make 'from' and 'to' fields checksum addresses in returned transaction " +"receipts (`#1562 `__)" +msgstr "" + +#: ../../release_notes.rst:3121 +msgid "" +"Use local Trinity's IPC socket if it is available, for newer versions of " +"Trinity. (`#1563 `__)" +msgstr "" + +#: ../../release_notes.rst:3127 +msgid "Add Matomo Tracking to Docs site." +msgstr "" + +#: ../../release_notes.rst:3129 +msgid "" +"Matomo is an Open Source web analytics platform that allows us to get " +"better insights and optimize for our audience without the negative " +"consequences of other compareable platforms." +msgstr "" + +#: ../../release_notes.rst:3133 +msgid "" +"Read more: https://matomo.org/why-matomo/ (`#1541 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3134 +msgid "" +"Fix web3 typo in docs (`#1559 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3140 +msgid "" +"`#1521 `__, `#1546 " +"`__, `#1571 " +"`__" +msgstr "" + +#: ../../release_notes.rst:3144 +msgid "v5.4.0 (2019-12-06)" +msgstr "" + +#: ../../release_notes.rst:3149 +msgid "" +"Add __str__ to IPCProvider (`#1536 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3155 +msgid "" +"Add required typing-extensions library to setup.py (`#1544 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3159 +msgid "v5.3.1 (2019-12-05)" +msgstr "" + +#: ../../release_notes.rst:3164 +msgid "" +"Only apply hexbytes formatting to r and s values in transaction if " +"present (`#1531 `__)" +msgstr "" + +#: ../../release_notes.rst:3165 +msgid "" +"Update eth-utils dependency which contains mypy bugfix. (`#1537 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3171 +msgid "" +"Update Contract Event documentation to show correct example (`#1515 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3172 +msgid "" +"Add documentation to methods that raise an error in v5 instead of " +"returning ``None`` (`#1527 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3178 +msgid "" +"`#1518 `__, `#1532 " +"`__" +msgstr "" + +#: ../../release_notes.rst:3182 +msgid "v5.3.0 (2019-11-14)" +msgstr "" + +#: ../../release_notes.rst:3187 +msgid "" +"Support handling ENS domains in ERC1319 URIs. (`#1489 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3193 +msgid "" +"Make local block filter return empty list when when no blocks mined " +"(`#1255 `__)" +msgstr "" + +#: ../../release_notes.rst:3194 +msgid "" +"Google protobuf dependency was updated to `3.10.0` (`#1493 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3195 +msgid "" +"Infura websocket provider works when no secret key is present (`#1501 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3201 +msgid "" +"Update Quickstart instructions to use the auto Infura module instead of " +"the more complicated web3 auto module (`#1482 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3202 +msgid "" +"Remove outdated py.test command from readme (`#1483 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3208 +msgid "" +"`#1461 `__, `#1471 " +"`__, `#1475 " +"`__, `#1476 " +"`__, `#1479 " +"`__, `#1488 " +"`__, `#1492 " +"`__, `#1498 " +"`__" +msgstr "" + +#: ../../release_notes.rst:3212 +msgid "v5.2.2 (2019-10-21)" +msgstr "" + +#: ../../release_notes.rst:3217 +msgid "" +"Add poll_latency to waitForTransactionReceipt (`#1453 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3223 +msgid "" +"Fix flaky Parity whisper module test (`#1473 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3229 +msgid "" +"`#1472 `__, `#1474 " +"`__" +msgstr "" + +#: ../../release_notes.rst:3233 +msgid "v5.2.1 (2019-10-17)" +msgstr "" + +#: ../../release_notes.rst:3238 +msgid "" +"Update documentation for unlock account duration (`#1464 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3239 +msgid "" +"Clarify module installation command for OSX>=10.15 (`#1467 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3245 +msgid "`#1468 `__" +msgstr "" + +#: ../../release_notes.rst:3249 +msgid "v5.2.0 (2019-09-26)" +msgstr "" + +#: ../../release_notes.rst:3254 +msgid "" +"Add ``enable_strict_bytes_type_checking`` flag to web3 instance (`#1419 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3255 +msgid "" +"Move Geth Whisper methods to snake case and deprecate camel case methods " +"(`#1433 `__)" +msgstr "" + +#: ../../release_notes.rst:3261 +msgid "" +"Add null check to logsbloom formatter (`#1445 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3267 +msgid "" +"Reformat autogenerated towncrier release notes (`#1460 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3271 +msgid "Web3 5.1.0 (2019-09-18)" +msgstr "" + +#: ../../release_notes.rst:3276 +msgid "" +"Add ``contract_types`` property to ``Package`` class. (`#1440 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3282 +msgid "" +"Fix flaky parity integration test in the whisper module (`#1147 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3288 +msgid "" +"Remove whitespace, move ``topics`` key -> ``topic`` in Geth docs (`#1425 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3289 +msgid "" +"Enforce stricter doc checking, turning warnings into errors to fail CI " +"builds to catch issues quickly." +msgstr "" + +#: ../../release_notes.rst:3292 +msgid "" +"Add missing ``web3.tools.rst`` to the table of contents and fix " +"incorrectly formatted JSON example. (`#1437 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3294 +msgid "" +"Add example using Geth POA Middleware with Infura Rinkeby Node (`#1444 " +"`__)" +msgstr "" + +#: ../../release_notes.rst:3300 +msgid "" +"`#1446 `__, `#1451 " +"`__" +msgstr "" + +#: ../../release_notes.rst:3304 +msgid "v5.0.2" +msgstr "" + +#: ../../release_notes.rst:3305 +msgid "Released August 22, 2019" +msgstr "" + +#: ../../release_notes.rst:3309 +msgid "" +"[ethPM] Fix bug in package id and release id fetching strategy - `#1427 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3313 +msgid "v5.0.1" +msgstr "" + +#: ../../release_notes.rst:3314 +msgid "Released August 15, 2019" +msgstr "" + +#: ../../release_notes.rst:3318 +msgid "" +"[ethPM] Add begin/close chars to package name regex - `#1418 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3320 +msgid "" +"[ethPM] Update deployments to work when only abi available - `#1417 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3322 +msgid "" +"Fix tuples handled incorrectly in ``decode_function_input`` - `#1410 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3327 +msgid "" +"Eliminate ``signTransaction`` warning - `#1404 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3331 +msgid "v5.0.0" +msgstr "" + +#: ../../release_notes.rst:3332 +msgid "Released August 1, 2019" +msgstr "" + +#: ../../release_notes.rst:3336 +msgid "" +"``web3.eth.chainId`` now returns an integer instead of hex - `#1394 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3341 +msgid "" +"Deprecation Warnings now show for methods that have a ``@combomethod`` " +"decorator - `#1401 `_" +msgstr "" + +#: ../../release_notes.rst:3347 +msgid "" +"[ethPM] Add ethPM to the docker file - `#1405 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3350 ../../release_notes.rst:3374 +#: ../../release_notes.rst:3405 ../../release_notes.rst:3464 +#: ../../release_notes.rst:3486 ../../release_notes.rst:3498 +#: ../../release_notes.rst:3601 +msgid "Docs" +msgstr "" + +#: ../../release_notes.rst:3352 +msgid "" +"Docs are updated to use checksummed addresses - `#1390 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3354 +msgid "" +"Minor doc formatting fixes - `#1338 " +"`_ & `#1345 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3361 +msgid "v5.0.0-beta.5" +msgstr "" + +#: ../../release_notes.rst:3362 +msgid "Released July 31, 2019" +msgstr "" + +#: ../../release_notes.rst:3364 +msgid "*This is intended to be the final release before the stable v5 release.*" +msgstr "" + +#: ../../release_notes.rst:3368 +msgid "" +"Parity operating mode can be read and set - `#1355 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3370 +msgid "" +"Process a single event log, instead of a whole transaction receipt - " +"`#1354 `_" +msgstr "" + +#: ../../release_notes.rst:3376 +msgid "" +"Remove doctest dependency on ethtoken - `#1395 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3381 +msgid "" +"[ethPM] Bypass IPFS validation for large files - `#1393 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3386 +msgid "" +"[ethPM] Update default Registry solidity contract - `#1400 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3388 +msgid "" +"[ethPM] Update web3.pm to use new simple Registry implementation - `#1398" +" `_" +msgstr "" + +#: ../../release_notes.rst:3390 +msgid "" +"Update dependency requirement formatting for releasing - `#1403 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3395 +msgid "v5.0.0-beta.4" +msgstr "" + +#: ../../release_notes.rst:3396 +msgid "Released July 18,2019" +msgstr "" + +#: ../../release_notes.rst:3402 +msgid "" +"[ethPM] Update registry uri to support basic uris w/o package id - `#1389" +" `_" +msgstr "" + +#: ../../release_notes.rst:3407 +msgid "" +"Clarify in docs the return of ``Eth.sendRawTransaction()`` as a HexBytes " +"object, not a string. - `#1384 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3413 +msgid "" +"[ethPM] Migrate tests over from pytest-ethereum - `#1385 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3417 +msgid "v5.0.0-beta.3" +msgstr "" + +#: ../../release_notes.rst:3418 +msgid "Released July 15, 2019" +msgstr "" + +#: ../../release_notes.rst:3422 +msgid "" +"Add eth_getProof support - `#1185 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3424 +msgid "" +"Implement web3.pm.get_local_package() - `#1372 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3426 +msgid "" +"Update registry URIs to support chain IDs - `#1382 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3428 +msgid "" +"Add error flags to ``event.processReceipt`` - `#1366 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3433 +msgid "" +"Remove full IDNA processing in favor of UTS46 - `#1364 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3438 +msgid "" +"Migrate py-ethpm library to web3/ethpm - `#1379 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3440 +msgid "" +"Relax canonical address requirement in ethPM - `#1380 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3442 +msgid "" +"Replace ethPM's infura strategy with web3's native infura support - " +"`#1383 `_" +msgstr "" + +#: ../../release_notes.rst:3444 +msgid "" +"Change ``combine_argument_formatters`` to " +"``apply_formatters_to_sequence`` - `#1360 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3446 +msgid "" +"Move ``pytest.xfail`` instances to ``@pytest.mark.xfail`` - `#1376 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3448 +msgid "" +"Change ``net.version`` to ``eth.chainId`` in default transaction params -" +" `#1378 `_" +msgstr "" + +#: ../../release_notes.rst:3454 +msgid "v5.0.0-beta.2" +msgstr "" + +#: ../../release_notes.rst:3455 +msgid "Released May 13, 2019" +msgstr "" + +#: ../../release_notes.rst:3459 +msgid "" +"Mark deprecated sha3 method as static - `#1350 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3461 +msgid "" +"Upgrade to eth-account v0.4.0 - `#1348 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3466 +msgid "" +"Add note about web3[tester] in documentation - `#1325 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3471 +msgid "" +"Replace ``web3._utils.toolz`` imports with ``eth_utils.toolz`` - `#1317 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3476 +msgid "v5.0.0-beta.1" +msgstr "" + +#: ../../release_notes.rst:3477 +msgid "Released May 6, 2019" +msgstr "" + +#: ../../release_notes.rst:3481 +msgid "" +"Add support for tilda in provider IPC Path - `#1049 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3483 +msgid "" +"EIP 712 Signing Supported - `#1319 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3488 +msgid "" +"Update contract example to use ``compile_standard`` - `#1263 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3490 +msgid "" +"Fix typo in middleware docs - `#1339 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3495 +msgid "v5.0.0-alpha.11" +msgstr "" + +#: ../../release_notes.rst:3496 +msgid "Released April 24, 2019" +msgstr "" + +#: ../../release_notes.rst:3500 +msgid "" +"Add documentation for web3.py unit tests - `#1324 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3505 +msgid "" +"Update deprecated collections.abc imports - `#1334 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3507 +msgid "" +"Fix documentation typo - `#1335 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3509 +msgid "" +"Upgrade eth-tester version - `#1332 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3514 +msgid "v5.0.0-alpha.10" +msgstr "" + +#: ../../release_notes.rst:3515 +msgid "Released April 15, 2019" +msgstr "" + +#: ../../release_notes.rst:3519 +msgid "" +"Add getLogs by blockHash - `#1269 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3521 +msgid "" +"Implement chainId endpoint - `#1295 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3523 +msgid "" +"Moved non-standard JSON-RPC endpoints to applicable Parity/Geth docs. " +"Deprecated ``web3.version`` for ``web3.api`` - `#1290 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3526 +msgid "" +"Moved Whisper endpoints to applicable Geth or Parity namespace - `#1308 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3528 +msgid "" +"Added support for Goerli provider - `#1286 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3530 +msgid "" +"Added addReservedPeer to Parity module - `#1311 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3535 +msgid "" +"Cast gas price values to integers in gas strategies - `#1297 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3537 +msgid "" +"Missing constructor function no longer ignores constructor args - `#1316 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3542 +msgid "" +"Require eth-utils >= 1.4, downgrade Go version for integration tests - " +"`#1310 `_" +msgstr "" + +#: ../../release_notes.rst:3544 +msgid "" +"Fix doc build warnings - `#1331 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3546 +msgid "" +"Zip Fixture data - `#1307 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3548 +msgid "" +"Update Geth version for integration tests - `#1301 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3550 +msgid "" +"Remove unneeded testrpc - `#1322 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3552 +msgid "" +"Add ContractCaller docs to v5 migration guide - `#1323 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3558 +msgid "v5.0.0-alpha.9" +msgstr "" + +#: ../../release_notes.rst:3559 +msgid "Released March 26, 2019" +msgstr "" + +#: ../../release_notes.rst:3563 +msgid "" +"Raise error if there is no Infura API Key - `#1294 " +"`_ & - `#1299 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3569 +msgid "" +"Upgraded Parity version for integration testing - `#1292 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3573 +msgid "v5.0.0-alpha.8" +msgstr "" + +#: ../../release_notes.rst:3574 +msgid "Released March 20, 2019" +msgstr "" + +#: ../../release_notes.rst:3578 +msgid "" +"Removed ``web3/utils`` directory in favor of ``web3/_utils`` - `#1282 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3580 +msgid "" +"Relocated personal RPC endpoints to Parity and Geth class - `#1211 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3582 +msgid "" +"Deprecated ``web3.net.chainId()``, ``web3.eth.getCompilers()``, and " +"``web3.eth.getTransactionFromBlock()``. Removed " +"``web3.eth.enableUnauditedFeatures()`` - `#1270 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3585 +msgid "" +"Relocated eth_protocolVersion and web3_clientVersion - `#1274 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3587 +msgid "" +"Relocated ``web3.txpool`` to ``web3.geth.txpool`` - `#1275 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3589 +msgid "" +"Relocated admin module to Geth namespace - `#1288 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3591 +msgid "" +"Relocated miner module to Geth namespace - `#1287 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3596 +msgid "" +"Implement ``eth_submitHashrate`` and ``eth_submitWork`` JSONRPC " +"endpoints. - `#1280 `_" +msgstr "" + +#: ../../release_notes.rst:3598 +msgid "" +"Implement ``web3.eth.signTransaction`` - `#1277 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3603 +msgid "" +"Added v5 migration docs - `#1284 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3607 +msgid "v5.0.0-alpha.7" +msgstr "" + +#: ../../release_notes.rst:3608 +msgid "Released March 11, 2019" +msgstr "" + +#: ../../release_notes.rst:3612 +msgid "" +"Updated JSON-RPC calls that lookup txs or blocks to raise an error if " +"lookup fails - `#1218 `_ " +"and `#1268 `_" +msgstr "" + +#: ../../release_notes.rst:3619 +msgid "" +"Tuple ABI support - `#1235 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3624 +msgid "" +"One last ``middleware_stack`` was still hanging on. Changed to " +"``middleware_onion`` - `#1262 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3629 +msgid "v5.0.0-alpha.6" +msgstr "" + +#: ../../release_notes.rst:3630 +msgid "Released February 25th, 2019" +msgstr "" + +#: ../../release_notes.rst:3634 +msgid "" +"New ``NoABIFound`` error for cases where there is no ABI - `#1247 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3639 +msgid "" +"Interact with Infura using an API Key. Key will be required after March " +"27th. - `#1232 `_" +msgstr "" + +#: ../../release_notes.rst:3641 +msgid "" +"Remove ``process_type`` utility function in favor of eth-abi " +"functionality - `#1249 `_" +msgstr "" + +#: ../../release_notes.rst:3647 +msgid "v5.0.0-alpha.5" +msgstr "" + +#: ../../release_notes.rst:3649 +msgid "Released February 13th, 2019" +msgstr "" + +#: ../../release_notes.rst:3653 +msgid "" +"Remove deprecated ``buildTransaction``, ``call``, ``deploy``, " +"``estimateGas``, and ``transact`` methods - `#1232 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3659 +msgid "" +"Adds ``Web3.toJSON`` method - `#1173 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3661 +msgid "" +"Contract Caller API Implemented - `#1227 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3663 +msgid "" +"Add Geth POA middleware to use Rinkeby with Infura Auto - `#1234 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3665 +msgid "" +"Add manifest and input argument validation to ``pm.release_package()`` - " +"`#1237 `_" +msgstr "" + +#: ../../release_notes.rst:3670 +msgid "" +"Clean up intro and block/tx sections in Filter docs - `#1223 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3672 +msgid "" +"Remove unnecessary ``EncodingError`` exception catching - `#1224 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3674 +msgid "" +"Improvements to ``merge_args_and_kwargs`` utility function - `#1228 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3676 +msgid "" +"Update vyper registry assets - `#1242 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3681 +msgid "v5.0.0-alpha.4" +msgstr "" + +#: ../../release_notes.rst:3683 +msgid "Released January 23rd, 2019" +msgstr "" + +#: ../../release_notes.rst:3687 +msgid "" +"Rename ``middleware_stack`` to ``middleware_onion`` - `#1210 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3689 +msgid "" +"Drop already deprecated ``web3.soliditySha3`` - `#1217 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3691 +msgid "" +"ENS: Stop inferring ``.eth`` TLD on domain names - `#1205 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3696 +msgid "" +"Validate ``ethereum_tester`` class in ``EthereumTesterProvider`` - `#1217" +" `_" +msgstr "" + +#: ../../release_notes.rst:3698 +msgid "" +"Support ``getLogs()`` method without creating filters - `#1192 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3703 +msgid "" +"Stablize the ``PM`` module - `#1125 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3705 +msgid "" +"Implement async ``Version`` module - `#1166 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3710 +msgid "" +"Update .gitignore to ignore ``.DS_Store`` and ``.mypy_cache/`` - `#1215 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3712 +msgid "" +"Change CircleCI badge link to CircleCI project - `#1214 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3717 +msgid "v5.0.0-alpha.3" +msgstr "" + +#: ../../release_notes.rst:3719 +msgid "Released January 15th, 2019" +msgstr "" + +#: ../../release_notes.rst:3723 +msgid "" +"Remove ``web3.miner.hashrate`` and ``web3.version.network`` - `#1198 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3725 +msgid "" +"Remove ``web3.providers.tester.EthereumTesterProvider`` and " +"``web3.providers.tester.TestRPCProvider`` - `#1199 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3728 +msgid "" +"Change ``manager.providers`` from list to single ``manager.provider`` - " +"`#1200 `_" +msgstr "" + +#: ../../release_notes.rst:3730 +msgid "" +"Replace deprecated ``web3.sha3`` method with ``web3.keccak`` method - " +"`#1207 `_" +msgstr "" + +#: ../../release_notes.rst:3732 +msgid "" +"Drop auto detect testnets for IPCProvider - `#1206 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3737 +msgid "" +"Add check to make sure blockHash exists - `#1158 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3742 +msgid "" +"Remove some unreachable code in `providers/base.py` - `#1160 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3744 +msgid "" +"Migrate tester provider results from middleware to defaults - `#1188 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3746 +msgid "" +"Fix doc formatting for build_filter method - `#1187 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3748 +msgid "" +"Add ERC20 example in docs - `#1178 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3750 +msgid "" +"Code style improvements - `#1194 " +"`_ & `#1191 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3753 +msgid "" +"Convert Web3 instance variables to w3 - `#1186 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3755 +msgid "" +"Update eth-utils dependencies and clean up other dependencies - `#1195 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3760 +msgid "v5.0.0-alpha.2" +msgstr "" + +#: ../../release_notes.rst:3762 +msgid "Released December 20th, 2018" +msgstr "" + +#: ../../release_notes.rst:3766 +msgid "" +"Remove support for python3.5, drop support for eth-abi v1 - `#1163 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3770 +msgid "" +"Support for custom ReleaseManager was fixed - `#1165 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3775 +msgid "" +"Fix doctest nonsense with unicorn token - `3b2047 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3777 +msgid "" +"Docs for installing web3 in FreeBSD - `#1156 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3779 +msgid "" +"Use latest python in readthedocs - `#1162 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3781 +msgid "" +"Use twine in release script - `#1164 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3783 +msgid "" +"Upgrade eth-tester, for eth-abi v2 support - `#1168 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3787 +msgid "v5.0.0-alpha.1" +msgstr "" + +#: ../../release_notes.rst:3789 +msgid "Released December 13th, 2018" +msgstr "" + +#: ../../release_notes.rst:3793 +msgid "" +"Add Rinkeby and Kovan Infura networks; made mainnet the default - `#1150 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3795 +msgid "" +"Add parity-specific ``listStorageKeys`` RPC - `#1145 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3797 +msgid "" +"Deprecated ``Web3.soliditySha3``; use ``Web3.solidityKeccak`` instead. - " +"`#1139 `_" +msgstr "" + +#: ../../release_notes.rst:3799 +msgid "" +"Add default trinity locations to IPC path guesser - `#1121 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3801 +msgid "" +"Add wss to ``AutoProvider`` - `#1110 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3803 +msgid "" +"Add timeout for ``WebsocketProvider`` - `#1109 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3805 +msgid "" +"Receipt timeout raises ``TimeExhausted`` - `#1070 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3807 +msgid "" +"Allow specification of block number for ``eth_estimateGas`` - `#1046 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3813 +msgid "" +"Removed ``web3._utils.six`` support - `#1116 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3815 +msgid "" +"Upgrade eth-utils to 1.2.0 - `#1104 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3817 +msgid "" +"Require Python version 3.5.3 or greater - `#1095 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3819 +msgid "" +"Bump websockets version to 7.0.0 - `#1146 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3821 +msgid "" +"Bump parity test binary to 1.11.11 - `#1064 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3826 +msgid "v4.8.2" +msgstr "" + +#: ../../release_notes.rst:3828 +msgid "Released November 15, 2018" +msgstr "" + +#: ../../release_notes.rst:3832 +msgid "" +"Reduce unneeded memory usage - `#1138 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3836 +msgid "v4.8.1" +msgstr "" + +#: ../../release_notes.rst:3838 +msgid "Released October 28, 2018" +msgstr "" + +#: ../../release_notes.rst:3842 +msgid "" +"Add timeout for WebsocketProvider - `#1119 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3844 +msgid "" +"Reject transactions that send ether to non-payable contract functions - " +"`#1115 `_" +msgstr "" + +#: ../../release_notes.rst:3846 +msgid "" +"Add Auto Infura Ropsten support: ``from web3.auto.infura.ropsten import " +"w3`` - `#1124 `_" +msgstr "" + +#: ../../release_notes.rst:3848 +msgid "" +"Auto-detect trinity IPC file location - `#1129 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3852 +msgid "" +"Require Python >=3.5.3 - `#1107 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3854 +msgid "" +"Upgrade eth-tester and eth-utils - `#1085 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3856 +msgid "" +"Configure readthedocs dependencies - `#1082 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3858 +msgid "" +"soliditySha3 docs fixup - `#1100 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3860 +msgid "Update ropsten faucet links in troubleshooting docs" +msgstr "" + +#: ../../release_notes.rst:3863 +msgid "v4.7.2" +msgstr "" + +#: ../../release_notes.rst:3865 +msgid "Released September 25th, 2018" +msgstr "" + +#: ../../release_notes.rst:3869 +msgid "" +"IPC paths starting with ``~`` are appropriately resolved to the home " +"directory - `#1072 `_" +msgstr "" + +#: ../../release_notes.rst:3871 +msgid "" +"You can use the local signing middleware with :class:`bytes`-type " +"addresses - `#1069 `_" +msgstr "" + +#: ../../release_notes.rst:3875 +msgid "v4.7.1" +msgstr "" + +#: ../../release_notes.rst:3877 +msgid "Released September 11th, 2018" +msgstr "" + +#: ../../release_notes.rst:3881 +msgid "" +"`old pip bug `_ used during " +"release made it impossible for non-windows users to install 4.7.0." +msgstr "" + +#: ../../release_notes.rst:3885 +msgid "v4.7.0" +msgstr "" + +#: ../../release_notes.rst:3887 +msgid "Released September 10th, 2018" +msgstr "" + +#: ../../release_notes.rst:3891 +msgid "" +"Add traceFilter method to the parity module. - `#1051 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3893 +msgid "" +"Move :mod:`~web3.utils.datastructures` to public namespace " +":mod:`~web3.datastructures` to improve support for type checking. - " +"`#1038 `_" +msgstr "" + +#: ../../release_notes.rst:3896 +msgid "" +"Optimization to contract calls - `#944 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3900 +msgid "" +"ENS name resolution only attempted on mainnet by default. - `#1037 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3902 +msgid "" +"Fix attribute access error when attributedict middleware is not used. - " +"`#1040 `_" +msgstr "" + +#: ../../release_notes.rst:3904 +msgid "" +"Misc - Upgrade eth-tester to 0.1.0-beta.32, and remove integration tests " +"for py-ethereum. - Upgrade eth-hash to 0.2.0 with pycryptodome 3.6.6 " +"which resolves a vulnerability." +msgstr "" + +#: ../../release_notes.rst:3909 +msgid "v4.6.0" +msgstr "" + +#: ../../release_notes.rst:3911 +msgid "Released Aug 24, 2018" +msgstr "" + +#: ../../release_notes.rst:3915 +msgid "" +"Support for Python 3.7, most notably in " +":class:`~web3.providers.websocket.WebsocketProvider` - `#996 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3917 +msgid "" +"You can now decode a transaction's data to its original function call and" +" arguments with: :meth:`contract.decode_function_input() " +"` - `#991 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3920 +msgid "" +"Support for :class:`~web3.providers.ipc.IPCProvider` in FreeBSD (and more" +" readme docs) - `#1008 `_" +msgstr "" + +#: ../../release_notes.rst:3924 +msgid "" +"Fix crash in time-based gas strategies with small number of transactions " +"- `#983 `_" +msgstr "" + +#: ../../release_notes.rst:3926 +msgid "" +"Fx crash when passing multiple addresses to :meth:`w3.eth.getLogs() " +"` - `#1005 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3930 +msgid "" +"Disallow configuring filters with both manual and generated topic lists -" +" `#976 `_" +msgstr "" + +#: ../../release_notes.rst:3932 +msgid "" +"Add support for the upcoming eth-abi v2, which does ABI string decoding " +"differently - `#974 `_" +msgstr "" + +#: ../../release_notes.rst:3934 +msgid "" +"Add a lot more filter tests - `#997 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3936 +msgid "" +"Add more tests for filtering with ``None``. Note that geth & parity " +"differ here. - `#985 `_" +msgstr "" + +#: ../../release_notes.rst:3938 +msgid "" +"Follow-up on Parity bug that we reported upstream (`parity#7816 " +"`_): they " +"resolved in 1.10. We removed xfail on that test. - `#992 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3942 +msgid "" +"Docs: add an example of interacting with an ERC20 contract - `#995 " +"`_" +msgstr "" + +#: ../../release_notes.rst:3944 +msgid "A couple doc typo fixes" +msgstr "" + +#: ../../release_notes.rst:3946 +msgid "`#1006 `_" +msgstr "" + +#: ../../release_notes.rst:3947 +msgid "`#1010 `_" +msgstr "" + +#: ../../release_notes.rst:3950 +msgid "v4.5.0" +msgstr "" + +#: ../../release_notes.rst:3952 +msgid "Released July 30, 2018" +msgstr "" + +#: ../../release_notes.rst:3956 +msgid "" +"Accept addresses supplied in :class:`bytes` format (which does not " +"provide checksum validation)" +msgstr "" + +#: ../../release_notes.rst:3957 +msgid "Improve estimation of gas prices" +msgstr "" + +#: ../../release_notes.rst:3960 +msgid "" +"Can now use a block number with :meth:`~web3.eth.Eth.getCode` when " +"connected to :class:`~web3.providers.eth_tester.EthereumTesterProvider` " +"(without crashing)" +msgstr "" + +#: ../../release_notes.rst:3964 +msgid "Test Parity 1.11.7" +msgstr "" + +#: ../../release_notes.rst:3965 +msgid "Parity integration tests upgrade to use sha256 instead of md5" +msgstr "" + +#: ../../release_notes.rst:3966 +msgid "Fix some filter docs" +msgstr "" + +#: ../../release_notes.rst:3967 +msgid "eth-account upgrade to v0.3.0" +msgstr "" + +#: ../../release_notes.rst:3968 +msgid "eth-tester upgrade to v0.1.0-beta.29" +msgstr "" + +#: ../../release_notes.rst:3971 +msgid "v4.4.1" +msgstr "" + +#: ../../release_notes.rst:3973 +msgid "Released June 29, 2018" +msgstr "" + +#: ../../release_notes.rst:3977 +msgid "" +"eth-pm package was renamed (old one deleted) which broke the web3 " +"release. eth-pm was removed from the web3.py install until it's stable." +msgstr "" + +#: ../../release_notes.rst:3982 +msgid "" +":class:`~web3.providers.ipc.IPCProvider` now accepts a " +":class:`pathlib.Path` argument for the IPC path" +msgstr "" + +#: ../../release_notes.rst:3984 +msgid "Docs explaining the new custom autoproviders in web3" +msgstr "" + +#: ../../release_notes.rst:3987 +msgid "v4.4.0" +msgstr "" + +#: ../../release_notes.rst:3989 +msgid "Released June 21, 2018" +msgstr "" + +#: ../../release_notes.rst:3993 +msgid "Add support for https in WEB3_PROVIDER_URI environment variable" +msgstr "" + +#: ../../release_notes.rst:3994 +msgid "" +"Can send websocket connection parameters in " +":class:`~web3.providers.websocket.WebsocketProvider`" +msgstr "" + +#: ../../release_notes.rst:3995 +msgid "Two new auto-initialization options:" +msgstr "" + +#: ../../release_notes.rst:3997 +msgid "``from web3.auto.gethdev import w3``" +msgstr "" + +#: ../../release_notes.rst:3998 +msgid "" +"``from web3.auto.infura import w3`` (After setting the ``INFURA_API_KEY``" +" environment variable)" +msgstr "" + +#: ../../release_notes.rst:4000 +msgid "Alpha support for a new package management tool based on ethpm-spec" +msgstr "" + +#: ../../release_notes.rst:4003 +msgid "" +"Can now receive large responses in " +":class:`~web3.providers.websocket.WebsocketProvider` by specifying a " +"large ``max_size`` in the websocket connection parameters." +msgstr "" + +#: ../../release_notes.rst:4007 +msgid "Websockets dependency upgraded to v5" +msgstr "" + +#: ../../release_notes.rst:4008 +msgid "Raise deprecation warning on :meth:`~web3.eth.Eth.getTransactionFromBlock`" +msgstr "" + +#: ../../release_notes.rst:4009 +msgid "Fix docs for :meth:`~web3.eth.Eth.waitForTransactionReceipt`" +msgstr "" + +#: ../../release_notes.rst:4010 +msgid "Developer Dockerfile now installs testing dependencies" +msgstr "" + +#: ../../release_notes.rst:4013 +msgid "v4.3.0" +msgstr "" + +#: ../../release_notes.rst:4015 +msgid "Released June 6, 2018" +msgstr "" + +#: ../../release_notes.rst:4019 +msgid "" +"Support for the ABI types like: `fixedMxN " +"`_ which " +"is used by Vyper." +msgstr "" + +#: ../../release_notes.rst:4022 +msgid "" +"In-flight transaction-signing middleware: Use local keys as if they were " +"hosted keys using the new ``sign_and_send_raw_middleware``" +msgstr "" + +#: ../../release_notes.rst:4024 +msgid "New :meth:`~web3.eth.Eth.getUncleByBlock` API" +msgstr "" + +#: ../../release_notes.rst:4025 +msgid "" +"New name :meth:`~web3.eth.Eth.getTransactionByBlock`, which replaces the " +"deprecated :meth:`~web3.eth.Eth.getTransactionFromBlock`" +msgstr "" + +#: ../../release_notes.rst:4027 +msgid "Add several new Parity trace functions" +msgstr "" + +#: ../../release_notes.rst:4028 +msgid "New API to resolve ambiguous function calls, for example:" +msgstr "" + +#: ../../release_notes.rst:4030 +msgid "" +"Two functions with the same name that accept similar argument types, like" +" ``myfunc(uint8)`` and ``myfunc(int8)``, and you want to call " +"``contract.functions.myfunc(1).call()``" +msgstr "" + +#: ../../release_notes.rst:4033 +msgid "See how to use it at: :ref:`ambiguous-contract-functions`" +msgstr "" + +#: ../../release_notes.rst:4036 +msgid "" +"Gas estimation doesn't crash, when 0 blocks are available. (ie~ on the " +"genesis block)" +msgstr "" + +#: ../../release_notes.rst:4037 +msgid "Close out all HTTPProvider sessions, to squash warnings on exit" +msgstr "" + +#: ../../release_notes.rst:4038 +msgid "" +"Stop adding Contract address twice to the filter. It was making some " +"nodes unhappy" +msgstr "" + +#: ../../release_notes.rst:4041 +msgid "Friendlier json encoding/decoding failure error messages" +msgstr "" + +#: ../../release_notes.rst:4042 +msgid "" +"Performance improvements, when the responses from the node are large (by " +"reducing the number of times we evaluate if the response is valid json)" +msgstr "" + +#: ../../release_notes.rst:4044 +msgid "" +"Parity CI test fixes (ugh, environment setup hell, thanks to the " +"community for cleaning this up!)" +msgstr "" + +#: ../../release_notes.rst:4046 +msgid "" +"Don't crash when requesting a transaction that was created with the " +"parity bug (which allowed an unsigned transaction to be included, so " +"``publicKey`` is ``None``)" +msgstr "" + +#: ../../release_notes.rst:4048 +msgid "Doc fixes: addresses must be checksummed (or ENS names on mainnet)" +msgstr "" + +#: ../../release_notes.rst:4049 +msgid "Enable local integration testing of parity on non-Debian OS" +msgstr "" + +#: ../../release_notes.rst:4050 +msgid "README:" +msgstr "" + +#: ../../release_notes.rst:4052 +msgid "Testing setup for devs" +msgstr "" + +#: ../../release_notes.rst:4053 +msgid "Change the build badge from Travis to Circle CI" +msgstr "" + +#: ../../release_notes.rst:4054 +msgid "" +"Cache the parity binary in Circle CI, to reduce the impact of their " +"binary API going down" +msgstr "" + +#: ../../release_notes.rst:4055 +msgid "Dropped the dot: ``py.test`` -> ``pytest``" +msgstr "" + +#: ../../release_notes.rst:4058 +msgid "v4.2.1" +msgstr "" + +#: ../../release_notes.rst:4060 +msgid "Released May 9, 2018" +msgstr "" + +#: ../../release_notes.rst:4064 +msgid "" +"When :meth:`getting a transaction ` with " +"data attached and trying to :meth:`modify it " +"` (say, to increase the gas price), the " +"data was not being reattached in the new transaction." +msgstr "" + +#: ../../release_notes.rst:4068 +msgid "" +":meth:`web3.personal.sendTransaction` was crashing when using a " +"transaction generated with ``buildTransaction()``" +msgstr "" + +#: ../../release_notes.rst:4072 +msgid "Improved error message when connecting to a geth-style PoA network" +msgstr "" + +#: ../../release_notes.rst:4073 +msgid "Improved error message when address is not checksummed" +msgstr "" + +#: ../../release_notes.rst:4074 +msgid "Started in on support for ``fixedMxN`` ABI arguments" +msgstr "" + +#: ../../release_notes.rst:4075 +msgid "Lots of documentation upgrades, including:" +msgstr "" + +#: ../../release_notes.rst:4077 +msgid "Guide for understanding nodes/networks/connections" +msgstr "" + +#: ../../release_notes.rst:4078 +msgid "Simplified Quickstart with notes for common issues" +msgstr "" + +#: ../../release_notes.rst:4079 +msgid "A new Troubleshooting section" +msgstr "" + +#: ../../release_notes.rst:4080 +msgid "Potential pypy performance improvements (use toolz instead of cytoolz)" +msgstr "" + +#: ../../release_notes.rst:4081 +msgid "eth-tester upgraded to beta 24" +msgstr "" + +#: ../../release_notes.rst:4084 +msgid "v4.2.0" +msgstr "" + +#: ../../release_notes.rst:4086 +msgid "Released Apr 25, 2018" +msgstr "" + +#: ../../release_notes.rst:4088 +msgid "" +"Removed audit warning and opt-in requirement for ``w3.eth.account``. See " +"more in: :ref:`eth-account`" +msgstr "" + +#: ../../release_notes.rst:4090 +msgid "" +"Added an API to look up contract functions: ``fn = " +"contract.functions['function_name_here']``" +msgstr "" + +#: ../../release_notes.rst:4091 +msgid "Upgrade Whisper (shh) module to use v6 API" +msgstr "" + +#: ../../release_notes.rst:4092 +msgid "" +"Bugfix: set 'to' field of transaction to empty when using ``transaction =" +" contract.constructor().buildTransaction()``" +msgstr "" + +#: ../../release_notes.rst:4094 +msgid "You can now specify `nonce` in ``buildTransaction()``" +msgstr "" + +#: ../../release_notes.rst:4095 +msgid "" +"Distinguish between chain id and network id -- currently always return " +"`None` for :attr:`~web3.net.Net.chainId`" +msgstr "" + +#: ../../release_notes.rst:4097 +msgid "" +"Better error message when trying to use a contract function that has 0 or" +" >1 matches" +msgstr "" + +#: ../../release_notes.rst:4098 +msgid "Better error message when trying to install on a python version <3.5" +msgstr "" + +#: ../../release_notes.rst:4099 +msgid "Installs pypiwin32 during pip install, for a better Windows experience" +msgstr "" + +#: ../../release_notes.rst:4100 +msgid "" +"Cleaned up a lot of test warnings by upgrading from deprecated APIs, " +"especially from the deprecated ``contract.deploy(txn_dict, " +"args=contract_args)`` to the new " +"``contract.constructor(*contract_args).transact(txn_dict)``" +msgstr "" + +#: ../../release_notes.rst:4103 +msgid "Documentation typo fixes" +msgstr "" + +#: ../../release_notes.rst:4104 +msgid "Better template for Pull Requests" +msgstr "" + +#: ../../release_notes.rst:4107 +msgid "v4.1.0" +msgstr "" + +#: ../../release_notes.rst:4109 +msgid "Released Apr 9, 2018" +msgstr "" + +#: ../../release_notes.rst:4111 +msgid "" +"New :class:`~web3.providers.websocket.WebsocketProvider`. If you're " +"looking for better performance than HTTP, check out websockets." +msgstr "" + +#: ../../release_notes.rst:4113 +msgid "" +"New :meth:`w3.eth.waitForTransactionReceipt() " +"`" +msgstr "" + +#: ../../release_notes.rst:4114 +msgid "Added name collision detection to ConciseContract and ImplicitContract" +msgstr "" + +#: ../../release_notes.rst:4115 +msgid "" +"Bugfix to allow fromBlock set to 0 in createFilter, like " +"``contract.events.MyEvent.createFilter(fromBlock=0, ...)``" +msgstr "" + +#: ../../release_notes.rst:4117 +msgid "Bugfix of ENS automatic connection" +msgstr "" + +#: ../../release_notes.rst:4118 +msgid "eth-tester support for Byzantium" +msgstr "" + +#: ../../release_notes.rst:4119 +msgid "New migration guide for v3 -> v4 upgrade" +msgstr "" + +#: ../../release_notes.rst:4120 +msgid "Various documentation updates" +msgstr "" + +#: ../../release_notes.rst:4121 +msgid "Pinned eth-account to older version" +msgstr "" + +#: ../../release_notes.rst:4124 +msgid "v4.0.0" +msgstr "" + +#: ../../release_notes.rst:4126 +msgid "Released Apr 2, 2018" +msgstr "" + +#: ../../release_notes.rst:4128 +msgid "Marked beta.13 as stable" +msgstr "" + +#: ../../release_notes.rst:4129 +msgid "Documentation tweaks" +msgstr "" + +#: ../../release_notes.rst:4132 +msgid "v4.0.0-beta.13" +msgstr "" + +#: ../../release_notes.rst:4134 +msgid "Released Mar 27, 2018" +msgstr "" + +#: ../../release_notes.rst:4136 +msgid "*This is intended to be the final release before the stable v4 release.*" +msgstr "" + +#: ../../release_notes.rst:4138 +msgid "" +"Add support for geth 1.8 (fixed error on " +":meth:`~web3.eth.Eth.getTransactionReceipt`)" +msgstr "" + +#: ../../release_notes.rst:4139 +msgid "" +"You can now call a contract method at a specific block with the " +"``block_identifier`` keyword argument, see: " +":meth:`~web3.contract.ContractFunction.call`" +msgstr "" + +#: ../../release_notes.rst:4142 +msgid "" +"In preparation for stable release, disable ``w3.eth.account`` by default," +" until a third-party audit is complete & resolved." +msgstr "" + +#: ../../release_notes.rst:4144 +msgid "" +"New API for contract deployment, which enables gas estimation, local " +"signing, etc. See :meth:`~web3.contract.Contract.constructor`." +msgstr "" + +#: ../../release_notes.rst:4146 +msgid "" +"Find contract events with :ref:`contract.events.$my_event.createFilter() " +"`" +msgstr "" + +#: ../../release_notes.rst:4147 +msgid "Support auto-complete for contract methods." +msgstr "" + +#: ../../release_notes.rst:4148 +msgid "Upgrade most dependencies to stable" +msgstr "" + +#: ../../release_notes.rst:4150 +msgid "eth-abi" +msgstr "" + +#: ../../release_notes.rst:4151 +msgid "eth-utils" +msgstr "" + +#: ../../release_notes.rst:4152 +msgid "hexbytes" +msgstr "" + +#: ../../release_notes.rst:4153 +msgid "*not included: eth-tester and eth-account*" +msgstr "" + +#: ../../release_notes.rst:4154 +msgid "" +"Switch the default EthereumTesterProvider backend from eth-testrpc to " +"eth-tester: :class:`web3.providers.eth_tester.EthereumTesterProvider`" +msgstr "" + +#: ../../release_notes.rst:4156 +msgid "A lot of documentation improvements" +msgstr "" + +#: ../../release_notes.rst:4157 +msgid "Test node integrations over a variety of providers" +msgstr "" + +#: ../../release_notes.rst:4158 +msgid "geth 1.8 test suite" +msgstr "" + +#: ../../release_notes.rst:4162 +msgid "v4.0.0-beta.12" +msgstr "" + +#: ../../release_notes.rst:4164 +msgid "A little hiccup on release. Skipped." +msgstr "" + +#: ../../release_notes.rst:4167 +msgid "v4.0.0-beta.11" +msgstr "" + +#: ../../release_notes.rst:4169 +msgid "Released Feb 28, 2018" +msgstr "" + +#: ../../release_notes.rst:4171 +msgid "New methods to modify or replace pending transactions" +msgstr "" + +#: ../../release_notes.rst:4172 +msgid "" +"A compatibility option for connecting to ``geth --dev`` -- see :ref" +":`geth-poa`" +msgstr "" + +#: ../../release_notes.rst:4173 +msgid "A new :attr:`web3.net.chainId`" +msgstr "" + +#: ../../release_notes.rst:4174 +msgid "Create a filter object from an existing filter ID." +msgstr "" + +#: ../../release_notes.rst:4175 +msgid "eth-utils v1.0.1 (stable) compatibility" +msgstr "" + +#: ../../release_notes.rst:4179 +msgid "v4.0.0-beta.10" +msgstr "" + +#: ../../release_notes.rst:4181 +msgid "Released Feb 21, 2018" +msgstr "" + +#: ../../release_notes.rst:4183 +msgid "" +"bugfix: Compatibility with eth-utils v1-beta2 (the incompatibility was " +"causing fresh web3.py installs to fail)" +msgstr "" + +#: ../../release_notes.rst:4185 +msgid "" +"bugfix: crash when sending the output of " +"``contract.functions.myFunction().buildTransaction()`` to " +":meth:`~web3.eth.Eth.sendTransaction`. Now, having a chainID key does not" +" crash sendTransaction." +msgstr "" + +#: ../../release_notes.rst:4188 +msgid "" +"bugfix: a TypeError when estimating gas like: " +"``contract.functions.myFunction().estimateGas()`` is fixed" +msgstr "" + +#: ../../release_notes.rst:4190 +msgid "Added parity integration tests to the continuous integration suite!" +msgstr "" + +#: ../../release_notes.rst:4191 +msgid "Some py3 and docs cleanup" +msgstr "" + +#: ../../release_notes.rst:4194 +msgid "v4.0.0-beta.9" +msgstr "" + +#: ../../release_notes.rst:4196 +msgid "Released Feb 8, 2018" +msgstr "" + +#: ../../release_notes.rst:4198 +msgid "Access event log parameters as attributes" +msgstr "" + +#: ../../release_notes.rst:4199 +msgid "Support for specifying nonce in eth-tester" +msgstr "" + +#: ../../release_notes.rst:4200 +msgid "" +"`Bugfix `_ dependency " +"conflicts between eth-utils, eth-abi, and eth-tester" +msgstr "" + +#: ../../release_notes.rst:4202 +msgid "" +"Clearer error message when invalid keywords provided to contract " +"constructor function" +msgstr "" + +#: ../../release_notes.rst:4203 +msgid "New docs for working with private keys + set up doctests" +msgstr "" + +#: ../../release_notes.rst:4204 +msgid "First parity integration tests" +msgstr "" + +#: ../../release_notes.rst:4205 +msgid "" +"replace internal implementation of w3.eth.account with " +":class:`eth_account.account.Account`" +msgstr "" + +#: ../../release_notes.rst:4209 +msgid "v4.0.0-beta.8" +msgstr "" + +#: ../../release_notes.rst:4211 +msgid "" +"Released Feb 7, 2018, then recalled. It added 32MB of test data to git " +"history, so the tag was deleted, as well as the corresponding release. " +"(Although the release would not have contained that test data)" +msgstr "" + +#: ../../release_notes.rst:4216 +msgid "v4.0.0-beta.7" +msgstr "" + +#: ../../release_notes.rst:4218 +msgid "Released Jan 29, 2018" +msgstr "" + +#: ../../release_notes.rst:4220 +msgid "Support for :meth:`web3.eth.Eth.getLogs` in eth-tester with py-evm" +msgstr "" + +#: ../../release_notes.rst:4221 +msgid "" +"Process transaction receipts with Event ABI, using " +"`Contract.events.myEvent(*args, " +"**kwargs).processReceipt(transaction_receipt)` see :ref:`event-log-" +"object` for the new type." +msgstr "" + +#: ../../release_notes.rst:4224 +msgid "Add timeout parameter to :class:`web3.providers.ipc.IPCProvider`" +msgstr "" + +#: ../../release_notes.rst:4225 +msgid "bugfix: make sure `idna` package is always installed" +msgstr "" + +#: ../../release_notes.rst:4226 +msgid "Replace ethtestrpc with py-evm, in all tests" +msgstr "" + +#: ../../release_notes.rst:4227 +msgid "Dockerfile fixup" +msgstr "" + +#: ../../release_notes.rst:4228 +msgid "Test refactoring & cleanup" +msgstr "" + +#: ../../release_notes.rst:4229 +msgid "Reduced warnings during tests" +msgstr "" + +#: ../../release_notes.rst:4232 +msgid "v4.0.0-beta.6" +msgstr "" + +#: ../../release_notes.rst:4234 +msgid "Released Jan 18, 2018" +msgstr "" + +#: ../../release_notes.rst:4236 +msgid "" +"New contract function call API: `my_contract.functions.my_func().call()` " +"is preferred over the now deprecated `my_contract.call().my_func()` API." +msgstr "" + +#: ../../release_notes.rst:4238 +msgid "" +"A new, sophisticated gas estimation algorithm, based on the " +"https://ethgasstation.info approach. You must opt-in to the new approach," +" because it's quite slow. We recommend using the new caching middleware. " +"See " +":meth:`web3.gas_strategies.time_based.construct_time_based_gas_price_strategy`" +msgstr "" + +#: ../../release_notes.rst:4241 +msgid "" +"New caching middleware that can cache based on time, block, or " +"indefinitely." +msgstr "" + +#: ../../release_notes.rst:4242 +msgid "Automatically retry JSON-RPC requests over HTTP, a few times." +msgstr "" + +#: ../../release_notes.rst:4243 +msgid "ConciseContract now has the address directly" +msgstr "" + +#: ../../release_notes.rst:4244 +msgid "" +"Many eth-tester fixes. " +":class:`web3.providers.eth_tester.main.EthereumTesterProvider` is now a " +"legitimate alternative to " +":class:`web3.providers.tester.EthereumTesterProvider`." +msgstr "" + +#: ../../release_notes.rst:4246 +msgid "" +"ethtest-rpc removed from testing. Tests use eth-tester only, on " +"pyethereum. Soon it will be eth-tester with py-evm." +msgstr "" + +#: ../../release_notes.rst:4248 +msgid "Bumped several dependencies, like eth-tester" +msgstr "" + +#: ../../release_notes.rst:4249 +msgid "Documentation updates" +msgstr "" + +#: ../../release_notes.rst:4252 +msgid "v4.0.0-beta.5" +msgstr "" + +#: ../../release_notes.rst:4254 +msgid "Released Dec 28, 2017" +msgstr "" + +#: ../../release_notes.rst:4256 +msgid "" +"Improvements to working with eth-tester, using " +":class:`~web3.providers.eth_tester.EthereumTesterProvider`:" +msgstr "" + +#: ../../release_notes.rst:4258 +msgid "Bugfix the key names in event logging" +msgstr "" + +#: ../../release_notes.rst:4259 +msgid "Add support for :meth:`~web3.eth.Eth.sendRawTransaction`" +msgstr "" + +#: ../../release_notes.rst:4260 +msgid "" +":class:`~web3.providers.ipc.IPCProvider` now automatically retries on a " +"broken connection, like when you restart your node" +msgstr "" + +#: ../../release_notes.rst:4261 +msgid "" +"New gas price engine API, laying groundwork for more advanced gas pricing" +" strategies" +msgstr "" + +#: ../../release_notes.rst:4264 +msgid "v4.0.0-beta.4" +msgstr "" + +#: ../../release_notes.rst:4266 +msgid "Released Dec 7, 2017" +msgstr "" + +#: ../../release_notes.rst:4268 +msgid "" +"New :meth:`~web3.contract.Contract.buildTransaction` method to prepare " +"contract transactions, offline" +msgstr "" + +#: ../../release_notes.rst:4269 +msgid "New automatic provider detection, for ``w3 = Web3()`` initialization" +msgstr "" + +#: ../../release_notes.rst:4270 +msgid "" +"Set environment variable `WEB3_PROVIDER_URI` to suggest a provider for " +"automatic detection" +msgstr "" + +#: ../../release_notes.rst:4271 +msgid "New API to set providers like: ``w3.providers = [IPCProvider()]``" +msgstr "" + +#: ../../release_notes.rst:4272 +msgid "" +"Crashfix: :meth:`web3.eth.Eth.filter` when retrieving logs with the " +"argument 'latest'" +msgstr "" + +#: ../../release_notes.rst:4273 +msgid "Bump eth-tester to v0.1.0-beta.5, with bugfix for filtering by topic" +msgstr "" + +#: ../../release_notes.rst:4274 +msgid "" +"Removed GPL lib ``pylru``, now believed to be in full MIT license " +"compliance." +msgstr "" + +#: ../../release_notes.rst:4277 +msgid "v4.0.0-beta.3" +msgstr "" + +#: ../../release_notes.rst:4279 +msgid "Released Dec 1, 2017" +msgstr "" + +#: ../../release_notes.rst:4281 +msgid "Fix encoding of ABI types: ``bytes[]`` and ``string[]``" +msgstr "" + +#: ../../release_notes.rst:4282 +msgid "Windows connection error bugfix" +msgstr "" + +#: ../../release_notes.rst:4283 +#, python-format +msgid "" +"Bugfix message signatures that were broken ~1% of the time (zero-pad " +"``r`` and ``s``)" +msgstr "" + +#: ../../release_notes.rst:4284 +msgid "" +"Autoinit web3 now produces None instead of raising an exception on ``from" +" web3.auto import w3``" +msgstr "" + +#: ../../release_notes.rst:4285 +msgid "Clearer errors on formatting failure (includes field name that failed)" +msgstr "" + +#: ../../release_notes.rst:4286 +msgid "Python modernization, removing Py2 compatibility cruft" +msgstr "" + +#: ../../release_notes.rst:4287 +msgid "Update dependencies with changed names, now:" +msgstr "" + +#: ../../release_notes.rst:4289 +msgid "``eth-abi``" +msgstr "" + +#: ../../release_notes.rst:4290 +msgid "``eth-keyfile``" +msgstr "" + +#: ../../release_notes.rst:4291 +msgid "``eth-keys``" +msgstr "" + +#: ../../release_notes.rst:4292 +msgid "``eth-tester``" +msgstr "" + +#: ../../release_notes.rst:4293 +msgid "``eth-utils``" +msgstr "" + +#: ../../release_notes.rst:4294 +msgid "Faster Travis CI builds, with cached geth binary" +msgstr "" + +#: ../../release_notes.rst:4297 +msgid "v4.0.0-beta.2" +msgstr "" + +#: ../../release_notes.rst:4299 +msgid "Released Nov 22, 2017" +msgstr "" + +#: ../../release_notes.rst:4301 +msgid "Bug Fixes:" +msgstr "" + +#: ../../release_notes.rst:4303 +msgid ":meth:`~web3.eth.Eth.sendRawTransaction` accepts raw bytes" +msgstr "" + +#: ../../release_notes.rst:4304 +msgid ":meth:`~web3.eth.Eth.contract` accepts an ENS name as contract address" +msgstr "" + +#: ../../release_notes.rst:4305 +msgid "" +":meth:`~web3.account.Account.signTransaction` returns the expected hash " +"(*after* signing the transaction)" +msgstr "" + +#: ../../release_notes.rst:4306 +msgid "" +":class:`~web3.account.Account` methods can all be called statically, " +"like: ``Account.sign(...)``" +msgstr "" + +#: ../../release_notes.rst:4307 +msgid "" +":meth:`~web3.eth.Eth.getTransactionReceipt` returns the ``status`` field " +"as an ``int``" +msgstr "" + +#: ../../release_notes.rst:4308 +msgid "" +":meth:`Web3.soliditySha3` looks up ENS names if they are supplied with an" +" \"address\" ABI" +msgstr "" + +#: ../../release_notes.rst:4309 +msgid "" +"If running multiple threads with the same w3 instance, ``ValueError: " +"Recursively called ...`` is no longer raised" +msgstr "" + +#: ../../release_notes.rst:4311 +msgid "" +"Plus, various python modernization code cleanups, and testing against " +"geth 1.7.2." +msgstr "" + +#: ../../release_notes.rst:4314 +msgid "v4.0.0-beta.1" +msgstr "" + +#: ../../release_notes.rst:4316 +msgid "Python 3 is now required" +msgstr "" + +#: ../../release_notes.rst:4317 +msgid "ENS names can be used anywhere that a hex address can" +msgstr "" + +#: ../../release_notes.rst:4318 +msgid "Sign transactions and messages with local private keys" +msgstr "" + +#: ../../release_notes.rst:4319 +msgid "" +"New filter mechanism: :meth:`~web3.utils.filters.Filter.get_all_entries` " +"and :meth:`~web3.utils.filters.Filter.get_new_entries`" +msgstr "" + +#: ../../release_notes.rst:4320 +msgid "Quick automatic initialization with ``from web3.auto import w3``" +msgstr "" + +#: ../../release_notes.rst:4321 +msgid "All addresses must be supplied with an EIP-55 checksum" +msgstr "" + +#: ../../release_notes.rst:4322 +msgid "All addresses are returned with a checksum" +msgstr "" + +#: ../../release_notes.rst:4323 +msgid "" +"Renamed ``Web3.toDecimal()`` to ``toInt()``, see: " +":ref:`overview_type_conversions`" +msgstr "" + +#: ../../release_notes.rst:4324 +msgid "All filter calls are synchronous, gevent integration dropped" +msgstr "" + +#: ../../release_notes.rst:4325 +msgid "" +"Contract :meth:`~web3.contract.Contract.eventFilter` has replaced both " +"``Contract.on()`` and ``Contract.pastEvents()``" +msgstr "" + +#: ../../release_notes.rst:4326 +msgid "Contract arguments of ``bytes`` ABI type now accept hex strings." +msgstr "" + +#: ../../release_notes.rst:4327 +msgid "Contract arguments of ``string`` ABI type now accept python ``str``." +msgstr "" + +#: ../../release_notes.rst:4328 +msgid "Contract return values of ``string`` ABI type now return python ``str``." +msgstr "" + +#: ../../release_notes.rst:4329 +msgid "" +"Many methods now return a ``bytes``-like object where they used to return" +" a hex string, like in :meth:`Web3.sha3()`" +msgstr "" + +#: ../../release_notes.rst:4330 +msgid "" +"IPC connection left open and reused, rather than opened and closed on " +"each call" +msgstr "" + +#: ../../release_notes.rst:4331 +msgid "A number of deprecated methods from v3 were removed" +msgstr "" + +#: ../../release_notes.rst:4334 +msgid "3.16.1" +msgstr "" + +#: ../../release_notes.rst:4336 +msgid "Addition of ``ethereum-tester`` as a dependency" +msgstr "" + +#: ../../release_notes.rst:4340 +msgid "3.16.0" +msgstr "" + +#: ../../release_notes.rst:4342 +msgid "" +"Addition of *named* middlewares for easier manipulation of middleware " +"stack." +msgstr "" + +#: ../../release_notes.rst:4343 +msgid "Provider middlewares can no longer be modified during runtime." +msgstr "" + +#: ../../release_notes.rst:4344 +msgid "Experimental custom ABI normalization API for Contract objects." +msgstr "" + +#: ../../release_notes.rst:4348 +msgid "3.15.0" +msgstr "" + +#: ../../release_notes.rst:4350 +msgid "Change docs to use RTD theme" +msgstr "" + +#: ../../release_notes.rst:4351 +msgid "" +"Experimental new ``EthereumTesterProvider`` for the ``ethereum-tester`` " +"library." +msgstr "" + +#: ../../release_notes.rst:4352 +msgid "" +"Bugfix for ``function`` type abi encoding via ``ethereum-abi-utils`` " +"upgrade to ``v0.4.1``" +msgstr "" + +#: ../../release_notes.rst:4353 +msgid "Bugfix for ``Web3.toHex`` to conform to RPC spec." +msgstr "" + +#: ../../release_notes.rst:4357 +msgid "3.14.2" +msgstr "" + +#: ../../release_notes.rst:4359 ../../release_notes.rst:4365 +msgid "Fix PyPi readme text." +msgstr "" + +#: ../../release_notes.rst:4363 +msgid "3.14.1" +msgstr "" + +#: ../../release_notes.rst:4368 +msgid "3.14.0" +msgstr "" + +#: ../../release_notes.rst:4370 +msgid "New ``stalecheck_middleware``" +msgstr "" + +#: ../../release_notes.rst:4371 +msgid "Improvements to ``Web3.toHex`` and ``Web3.toText``." +msgstr "" + +#: ../../release_notes.rst:4372 +msgid "Improvements to ``Web3.sha3`` signature." +msgstr "" + +#: ../../release_notes.rst:4373 +msgid "Bugfixes for ``Web3.eth.sign`` api" +msgstr "" + +#: ../../release_notes.rst:4377 +msgid "3.13.5" +msgstr "" + +#: ../../release_notes.rst:4379 +msgid "Add experimental ``fixture_middleware``" +msgstr "" + +#: ../../release_notes.rst:4380 +msgid "" +"Various bugfixes introduced in middleware API introduction and migration " +"to formatter middleware." +msgstr "" + +#: ../../release_notes.rst:4385 +msgid "3.13.4" +msgstr "" + +#: ../../release_notes.rst:4387 +msgid "Bugfix for formatter handling of contract creation transaction." +msgstr "" + +#: ../../release_notes.rst:4392 +msgid "3.13.3" +msgstr "" + +#: ../../release_notes.rst:4394 +msgid "Improved testing infrastructure." +msgstr "" + +#: ../../release_notes.rst:4398 +msgid "3.13.2" +msgstr "" + +#: ../../release_notes.rst:4400 +msgid "" +"Bugfix for retrieving filter changes for both new block filters and " +"pending transaction filters." +msgstr "" + +#: ../../release_notes.rst:4405 +msgid "3.13.1" +msgstr "" + +#: ../../release_notes.rst:4407 +msgid "" +"Fix mispelled ``attrdict_middleware`` (was spelled " +"``attrdict_middlware``)." +msgstr "" + +#: ../../release_notes.rst:4411 +msgid "3.13.0" +msgstr "" + +#: ../../release_notes.rst:4413 +msgid "New Middleware API" +msgstr "" + +#: ../../release_notes.rst:4414 +msgid "Support for multiple providers" +msgstr "" + +#: ../../release_notes.rst:4415 +msgid "New ``web3.soliditySha3``" +msgstr "" + +#: ../../release_notes.rst:4416 +msgid "" +"Remove multiple functions that were never implemented from the original " +"web3." +msgstr "" + +#: ../../release_notes.rst:4417 +msgid "" +"Deprecated ``web3.currentProvider`` accessor. Use ``web3.provider`` now " +"instead." +msgstr "" + +#: ../../release_notes.rst:4418 +msgid "Deprecated password prompt within ``web3.personal.newAccount``." +msgstr "" + +#: ../../release_notes.rst:4422 +msgid "3.12.0" +msgstr "" + +#: ../../release_notes.rst:4424 +msgid "" +"Bugfix for abi filtering to correctly handle ``constructor`` and " +"``fallback`` type abi entries." +msgstr "" + +#: ../../release_notes.rst:4427 +msgid "3.11.0" +msgstr "" + +#: ../../release_notes.rst:4429 +msgid "" +"All web3 apis which accept ``address`` parameters now enforce checksums " +"if the address *looks* like it is checksummed." +msgstr "" + +#: ../../release_notes.rst:4430 +msgid "" +"Improvements to error messaging with when calling a contract on a node " +"that may not be fully synced" +msgstr "" + +#: ../../release_notes.rst:4431 +msgid "Bugfix for ``web3.eth.syncing`` to correctly handle ``False``" +msgstr "" + +#: ../../release_notes.rst:4434 +msgid "3.10.0" +msgstr "" + +#: ../../release_notes.rst:4436 +msgid "" +"Web3 now returns ``web3.utils.datastructures.AttributeDict`` in places " +"where it previously returned a normal ``dict``." +msgstr "" + +#: ../../release_notes.rst:4437 +msgid "" +"``web3.eth.contract`` now performs validation on the ``address`` " +"parameter." +msgstr "" + +#: ../../release_notes.rst:4438 +msgid "Added ``web3.eth.getWork`` API" +msgstr "" + +#: ../../release_notes.rst:4441 +msgid "3.9.0" +msgstr "" + +#: ../../release_notes.rst:4443 +msgid "Add validation for the ``abi`` parameter of ``eth``" +msgstr "" + +#: ../../release_notes.rst:4444 +msgid "" +"Contract return values of ``bytes``, ``bytesXX`` and ``string`` are no " +"longer converted to text types and will be returned in their raw byte-" +"string format." +msgstr "" + +#: ../../release_notes.rst:4447 +msgid "3.8.1" +msgstr "" + +#: ../../release_notes.rst:4449 +msgid "Bugfix for ``eth_sign`` double hashing input." +msgstr "" + +#: ../../release_notes.rst:4450 +msgid "Removed deprecated ``DelegatedSigningManager``" +msgstr "" + +#: ../../release_notes.rst:4451 +msgid "Removed deprecate ``PrivateKeySigningManager``" +msgstr "" + +#: ../../release_notes.rst:4454 +msgid "3.8.0" +msgstr "" + +#: ../../release_notes.rst:4456 +msgid "Update pyrlp dependency to ``>=0.4.7``" +msgstr "" + +#: ../../release_notes.rst:4457 +msgid "Update eth-testrpc dependency to ``>=1.2.0``" +msgstr "" + +#: ../../release_notes.rst:4458 +msgid "Deprecate ``DelegatedSigningManager``" +msgstr "" + +#: ../../release_notes.rst:4459 +msgid "Deprecate ``PrivateKeySigningManager``" +msgstr "" + +#: ../../release_notes.rst:4462 +msgid "3.7.1" +msgstr "" + +#: ../../release_notes.rst:4464 +msgid "upstream version bump for bugfix in eth-abi-utils" +msgstr "" + +#: ../../release_notes.rst:4467 +msgid "3.7.0" +msgstr "" + +#: ../../release_notes.rst:4469 +msgid "deprecate ``eth.defaultAccount`` defaulting to the coinbase account." +msgstr "" + +#: ../../release_notes.rst:4472 +msgid "3.6.2" +msgstr "" + +#: ../../release_notes.rst:4474 +msgid "Fix error message from contract factory creation." +msgstr "" + +#: ../../release_notes.rst:4475 +msgid "Use ``ethereum-utils`` for utility functions." +msgstr "" + +#: ../../release_notes.rst:4478 +msgid "3.6.1" +msgstr "" + +#: ../../release_notes.rst:4480 +msgid "Upgrade ``ethereum-abi-utils`` dependency for upstream bugfix." +msgstr "" + +#: ../../release_notes.rst:4483 +msgid "3.6.0" +msgstr "" + +#: ../../release_notes.rst:4485 +msgid "Deprecate ``Contract.code``: replaced by ``Contract.bytecode``" +msgstr "" + +#: ../../release_notes.rst:4486 +msgid "" +"Deprecate ``Contract.code_runtime``: replaced by " +"``Contract.bytecode_runtime``" +msgstr "" + +#: ../../release_notes.rst:4487 +msgid "" +"Deprecate ``abi``, ``code``, ``code_runtime`` and ``source`` as arguments" +" for the ``Contract`` object." +msgstr "" + +#: ../../release_notes.rst:4488 +msgid "Deprecate ``source`` as a property of the ``Contract`` object" +msgstr "" + +#: ../../release_notes.rst:4489 +msgid "Add ``Contract.factory()`` API." +msgstr "" + +#: ../../release_notes.rst:4490 +msgid "Deprecate the ``construct_contract_factory`` helper function." +msgstr "" + +#: ../../release_notes.rst:4493 +msgid "3.5.3" +msgstr "" + +#: ../../release_notes.rst:4495 +msgid "Bugfix for how ``requests`` library is used. Now reuses session." +msgstr "" + +#: ../../release_notes.rst:4498 +msgid "3.5.2" +msgstr "" + +#: ../../release_notes.rst:4500 +msgid "Bugfix for construction of ``request_kwargs`` within HTTPProvider" +msgstr "" + +#: ../../release_notes.rst:4503 +msgid "3.5.1" +msgstr "" + +#: ../../release_notes.rst:4505 +msgid "Allow ``HTTPProvider`` to be imported from ``web3`` module." +msgstr "" + +#: ../../release_notes.rst:4506 +msgid "make ``HTTPProvider`` accessible as a property of ``web3`` instances." +msgstr "" + +#: ../../release_notes.rst:4509 +msgid "3.5.0" +msgstr "" + +#: ../../release_notes.rst:4511 +msgid "Deprecate ``web3.providers.rpc.RPCProvider``" +msgstr "" + +#: ../../release_notes.rst:4512 +msgid "Deprecate ``web3.providers.rpc.KeepAliveRPCProvider``" +msgstr "" + +#: ../../release_notes.rst:4513 +msgid "Add new ``web3.providers.rpc.HTTPProvider``" +msgstr "" + +#: ../../release_notes.rst:4514 +msgid "Remove hard dependency on gevent." +msgstr "" + +#: ../../release_notes.rst:4517 +msgid "3.4.4" +msgstr "" + +#: ../../release_notes.rst:4519 +msgid "Bugfix for ``web3.eth.getTransaction`` when the hash is unknown." +msgstr "" + +#: ../../release_notes.rst:4522 +msgid "3.4.3" +msgstr "" + +#: ../../release_notes.rst:4524 +msgid "" +"Bugfix for event log data decoding to properly handle dynamic sized " +"values." +msgstr "" + +#: ../../release_notes.rst:4525 +msgid "" +"New ``web3.tester`` module to access extra RPC functionality from ``eth-" +"testrpc``" +msgstr "" + +#: ../../release_notes.rst:4528 +msgid "3.4.2" +msgstr "" + +#: ../../release_notes.rst:4530 +msgid "Fix package so that ``eth-testrpc`` is not required." +msgstr "" + +#: ../../release_notes.rst:4533 +msgid "3.4.1" +msgstr "" + +#: ../../release_notes.rst:4535 +msgid "" +"Force gevent<1.2.0 until this issue is fixed: " +"https://github.com/gevent/gevent/issues/916" +msgstr "" + +#: ../../release_notes.rst:4538 +msgid "3.4.0" +msgstr "" + +#: ../../release_notes.rst:4540 +msgid "Bugfix for contract instances to respect ``web3.eth.defaultAccount``" +msgstr "" + +#: ../../release_notes.rst:4541 +msgid "" +"Better error reporting when ABI decoding fails for contract method " +"response." +msgstr "" + +#: ../../release_notes.rst:4544 +msgid "3.3.0" +msgstr "" + +#: ../../release_notes.rst:4546 +msgid "" +"New ``EthereumTesterProvider`` now available. Faster test runs than " +"``TestRPCProvider``" +msgstr "" + +#: ../../release_notes.rst:4547 +msgid "Updated underlying eth-testrpc requirement." +msgstr "" + +#: ../../release_notes.rst:4550 +msgid "3.2.0" +msgstr "" + +#: ../../release_notes.rst:4552 +msgid "``web3.shh`` is now implemented." +msgstr "" + +#: ../../release_notes.rst:4553 +msgid "" +"Introduced ``KeepAliveRPCProvider`` to correctly recycle HTTP connections" +" and use HTTP keep alive" +msgstr "" + +#: ../../release_notes.rst:4556 +msgid "3.1.1" +msgstr "" + +#: ../../release_notes.rst:4558 +msgid "" +"Bugfix for contract transaction sending not respecting the " +"``web3.eth.defaultAccount`` configuration." +msgstr "" + +#: ../../release_notes.rst:4562 +msgid "3.1.0" +msgstr "" + +#: ../../release_notes.rst:4564 +msgid "New DelegatedSigningManager and PrivateKeySigningManager classes." +msgstr "" + +#: ../../release_notes.rst:4567 +msgid "3.0.2" +msgstr "" + +#: ../../release_notes.rst:4569 +msgid "Bugfix or IPCProvider not handling large JSON responses well." +msgstr "" + +#: ../../release_notes.rst:4572 +msgid "3.0.1" +msgstr "" + +#: ../../release_notes.rst:4574 +msgid "Better RPC compliance to be compatable with the Parity JSON-RPC server." +msgstr "" + +#: ../../release_notes.rst:4577 +msgid "3.0.0" +msgstr "" + +#: ../../release_notes.rst:4579 +msgid "" +"``Filter`` objects now support controlling the interval through which " +"they poll using the ``poll_interval`` property" +msgstr "" + +#: ../../release_notes.rst:4583 +msgid "2.9.0" +msgstr "" + +#: ../../release_notes.rst:4585 +msgid "Bugfix generation of event topics." +msgstr "" + +#: ../../release_notes.rst:4586 +msgid "Web3.Iban now allows access to Iban address tools." +msgstr "" + +#: ../../release_notes.rst:4589 +msgid "2.8.1" +msgstr "" + +#: ../../release_notes.rst:4591 +msgid "Bugfix for ``geth.ipc`` path on linux systems." +msgstr "" + +#: ../../release_notes.rst:4594 +msgid "2.8.0" +msgstr "" + +#: ../../release_notes.rst:4596 +msgid "Changes to the ``Contract`` API:" +msgstr "" + +#: ../../release_notes.rst:4597 +msgid "``Contract.deploy()`` parameter arguments renamed to args" +msgstr "" + +#: ../../release_notes.rst:4598 +msgid "" +"``Contract.deploy()`` now takes args and kwargs parameters to allow " +"constructing with keyword arguments or positional arguments." +msgstr "" + +#: ../../release_notes.rst:4600 +msgid "" +"``Contract.pastEvents`` now allows you to specify a ``fromBlock or " +"``toBlock.`` Previously these were forced to be ``'earliest'`` and " +"``web3.eth.blockNumber`` respectively." +msgstr "" + +#: ../../release_notes.rst:4603 +msgid "" +"``Contract.call``, ``Contract.transact`` and ``Contract.estimateGas`` are" +" now callable as class methods as well as instance methods. When called " +"this way, an address must be provided with the transaction parameter." +msgstr "" + +#: ../../release_notes.rst:4606 +msgid "" +"``Contract.call``, ``Contract.transact`` and ``Contract.estimateGas`` now" +" allow specifying an alternate address for the transaction." +msgstr "" + +#: ../../release_notes.rst:4608 +msgid "``RPCProvider`` now supports the following constructor arguments." +msgstr "" + +#: ../../release_notes.rst:4609 +msgid "``ssl`` for enabling SSL" +msgstr "" + +#: ../../release_notes.rst:4610 +msgid "" +"``connection_timeout`` and ``network_timeout`` for controlling the " +"timeouts for requests." +msgstr "" + +#: ../../release_notes.rst:4614 +msgid "2.7.1" +msgstr "" + +#: ../../release_notes.rst:4616 +msgid "Bugfix: Fix KeyError in merge_args_and_kwargs helper fn." +msgstr "" + +#: ../../release_notes.rst:4619 +msgid "2.7.0" +msgstr "" + +#: ../../release_notes.rst:4621 +msgid "Bugfix for usage of block identifiers 'latest', 'earliest', 'pending'" +msgstr "" + +#: ../../release_notes.rst:4622 +msgid "Sphinx documentation" +msgstr "" + +#: ../../release_notes.rst:4623 +msgid "Non-data transactions now default to 90000 gas." +msgstr "" + +#: ../../release_notes.rst:4624 +msgid "" +"Web3 object now has helpers set as static methods rather than being set " +"at initialization." +msgstr "" + +#: ../../release_notes.rst:4626 +msgid "" +"RPCProvider now takes a ``path`` parameter to allow configuration for " +"requests to go to paths other than ``/``." +msgstr "" + +#: ../../release_notes.rst:4630 +msgid "2.6.0" +msgstr "" + +#: ../../release_notes.rst:4632 +msgid "TestRPCProvider no longer dumps logging output to stdout and stderr." +msgstr "" + +#: ../../release_notes.rst:4633 +msgid "Bugfix for return types of ``address[]``" +msgstr "" + +#: ../../release_notes.rst:4634 +msgid "Bugfix for event data types of ``address``" +msgstr "" + +#: ../../release_notes.rst:4637 +msgid "2.5.0" +msgstr "" + +#: ../../release_notes.rst:4639 +msgid "" +"All transactions which contain a ``data`` element will now have their gas" +" automatically estimated with 100k additional buffer. This was " +"previously only true with transactions initiated from a ``Contract`` " +"object." +msgstr "" + +#: ../../release_notes.rst:4644 +msgid "2.4.0" +msgstr "" + +#: ../../release_notes.rst:4646 +msgid "Contract functions can now be called using keyword arguments." +msgstr "" + +#: ../../release_notes.rst:4649 +msgid "2.3.0" +msgstr "" + +#: ../../release_notes.rst:4651 +msgid "Upstream fixes for filters" +msgstr "" + +#: ../../release_notes.rst:4652 +msgid "" +"Filter APIs ``on`` and ``pastEvents`` now callable as both instance and " +"class methods." +msgstr "" + +#: ../../release_notes.rst:4655 +msgid "2.2.0" +msgstr "" + +#: ../../release_notes.rst:4657 +msgid "" +"The filters that come back from the contract ``on`` and ``pastEvents`` " +"methods now call their callbacks with the same data format as " +"``web3.js``." +msgstr "" + +#: ../../release_notes.rst:4661 +msgid "2.1.1" +msgstr "" + +#: ../../release_notes.rst:4663 +msgid "Cast RPCProvider port to an integer." +msgstr "" + +#: ../../release_notes.rst:4666 +msgid "2.1.0" +msgstr "" + +#: ../../release_notes.rst:4668 +msgid "Remove all monkeypatching" +msgstr "" + +#: ../../release_notes.rst:4671 +msgid "2.0.0" +msgstr "" + +#: ../../release_notes.rst:4673 +msgid "Pull in downstream updates to proper gevent usage." +msgstr "" + +#: ../../release_notes.rst:4674 +msgid "Fix ``eth_sign``" +msgstr "" + +#: ../../release_notes.rst:4675 +msgid "" +"Bugfix with contract operations mutating the transaction object that is " +"passed in." +msgstr "" + +#: ../../release_notes.rst:4676 +msgid "More explicit linting ignore statements." +msgstr "" + +#: ../../release_notes.rst:4679 +msgid "1.9.0" +msgstr "" + +#: ../../release_notes.rst:4681 +msgid "BugFix: fix for python3 only ``json.JSONDecodeError`` handling." +msgstr "" + +#: ../../release_notes.rst:4684 +msgid "1.8.0" +msgstr "" + +#: ../../release_notes.rst:4686 +msgid "BugFix: ``RPCProvider`` not sending a content-type header" +msgstr "" + +#: ../../release_notes.rst:4687 +msgid "Bugfix: ``web3.toWei`` now returns an integer instead of a decimal.Decimal" +msgstr "" + +#: ../../release_notes.rst:4690 +msgid "1.7.1" +msgstr "" + +#: ../../release_notes.rst:4692 +msgid "``TestRPCProvider`` can now be imported directly from ``web3``" +msgstr "" + +#: ../../release_notes.rst:4695 +msgid "1.7.0" +msgstr "" + +#: ../../release_notes.rst:4697 +msgid "Add ``eth.admin`` interface." +msgstr "" + +#: ../../release_notes.rst:4698 +msgid "Bugfix: Format the return value of ``web3.eth.syncing``" +msgstr "" + +#: ../../release_notes.rst:4699 +msgid "Bugfix: IPCProvider socket interactions are now more robust." +msgstr "" + +#: ../../release_notes.rst:4702 +msgid "1.6.0" +msgstr "" + +#: ../../release_notes.rst:4704 +msgid "" +"Downstream package upgrades for ``eth-testrpc`` and ``ethereum-tester-" +"client`` to handle configuration of the Homestead and DAO fork block " +"numbers." +msgstr "" + +#: ../../release_notes.rst:4708 +msgid "1.5.0" +msgstr "" + +#: ../../release_notes.rst:4710 +msgid "" +"Rename ``web3.contract._Contract`` to ``web3.contract.Contract`` to " +"expose it for static analysis and auto completion tools" +msgstr "" + +#: ../../release_notes.rst:4712 +msgid "Allow passing string parameters to functions" +msgstr "" + +#: ../../release_notes.rst:4713 +msgid "Automatically compute gas requirements for contract deployment and" +msgstr "" + +#: ../../release_notes.rst:4714 +msgid "transactions." +msgstr "" + +#: ../../release_notes.rst:4715 +msgid "Contract Filters" +msgstr "" + +#: ../../release_notes.rst:4716 +msgid "Block, Transaction, and Log filters" +msgstr "" + +#: ../../release_notes.rst:4717 +msgid "``web3.eth.txpool`` interface" +msgstr "" + +#: ../../release_notes.rst:4718 +msgid "``web3.eth.mining`` interface" +msgstr "" + +#: ../../release_notes.rst:4719 +msgid "Fixes for encoding." +msgstr "" + +#: ../../release_notes.rst:4722 +msgid "1.4.0" +msgstr "" + +#: ../../release_notes.rst:4724 +msgid "Bugfix to allow address types in constructor arguments." +msgstr "" + +#: ../../release_notes.rst:4727 +msgid "1.3.0" +msgstr "" + +#: ../../release_notes.rst:4729 +msgid "Partial implementation of the ``web3.eth.contract`` interface." +msgstr "" + +#: ../../release_notes.rst:4732 +msgid "1.2.0" +msgstr "" + +#: ../../release_notes.rst:4734 +msgid "Restructure project modules to be more *flat*" +msgstr "" + +#: ../../release_notes.rst:4735 +msgid "Add ability to run test suite without the *slow* tests." +msgstr "" + +#: ../../release_notes.rst:4736 +msgid "Breakup ``encoding`` utils into smaller modules." +msgstr "" + +#: ../../release_notes.rst:4737 +msgid "Basic pep8 formatting." +msgstr "" + +#: ../../release_notes.rst:4738 +msgid "Apply python naming conventions to internal APIs" +msgstr "" + +#: ../../release_notes.rst:4739 +msgid "Lots of minor bugfixes." +msgstr "" + +#: ../../release_notes.rst:4740 +msgid "Removal of dead code left behind from ``1.0.0`` refactor." +msgstr "" + +#: ../../release_notes.rst:4741 +msgid "Removal of ``web3/solidity`` module." +msgstr "" + +#: ../../release_notes.rst:4744 +msgid "1.1.0" +msgstr "" + +#: ../../release_notes.rst:4746 +msgid "Add missing ``isConnected()`` method." +msgstr "" + +#: ../../release_notes.rst:4747 +msgid "Add test coverage for ``setProvider()``" +msgstr "" + +#: ../../release_notes.rst:4750 +msgid "1.0.1" +msgstr "" + +#: ../../release_notes.rst:4752 +msgid "Specify missing ``pyrlp`` and ``gevent`` dependencies" +msgstr "" + +#: ../../release_notes.rst:4755 +msgid "1.0.0" +msgstr "" + +#: ../../release_notes.rst:4757 +msgid "Massive refactor to the majority of the app." +msgstr "" + +#: ../../release_notes.rst:4760 +msgid "0.1.0" +msgstr "" + +#: ../../release_notes.rst:4762 +msgid "Initial release" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/resources.po b/docs/locales/zh_CN/LC_MESSAGES/resources.po new file mode 100644 index 0000000000..ceeabd1997 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/resources.po @@ -0,0 +1,312 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../resources.rst:5 +msgid "Resources and Learning Material" +msgstr "资源和学习材料" + +#: ../../resources.rst:7 +msgid "" +"web3.py and the Ethereum Python ecosystem have an active community of " +"developers and educators. Here you'll find libraries, tutorials, " +"examples, courses and other learning material." +msgstr "" + +#: ../../resources.rst:12 +msgid "" +"Links on this page are community submissions and are not vetted by the " +"team that maintains web3.py. As always, DYOR (Do Your Own Research)." +msgstr "" + +#: ../../resources.rst:17 +msgid "First Steps" +msgstr "" + +#: ../../resources.rst:19 +msgid "Resources for those brand new to Ethereum:" +msgstr "" + +#: ../../resources.rst:21 +msgid "" +"`A Developer's Guide to Ethereum, Pt. 1 " +"`__" +msgstr "" + +#: ../../resources.rst:22 +msgid "" +"`Ethereum Python Ecosystem Tour `__" +msgstr "" + +#: ../../resources.rst:26 +msgid "Courses" +msgstr "" + +#: ../../resources.rst:28 +msgid "" +"`freeCodeCamp Solidity and Python Course (2022) " +"`__" +msgstr "" + +#: ../../resources.rst:29 +msgid "" +"`Blockchain Python Programming Tutorial (2019) " +"`__" +msgstr "" + +#: ../../resources.rst:33 +msgid "Tutorials" +msgstr "" + +#: ../../resources.rst:35 +msgid "" +"Intro to `Ape development framework `__" +msgstr "" + +#: ../../resources.rst:36 +msgid "" +"Intro to `websockets " +"`__ and web3.py" +msgstr "" + +#: ../../resources.rst:37 +msgid "" +"Intro to `asynchronous web3.py `__" +msgstr "" + +#: ../../resources.rst:38 +msgid "" +"Intro to `threaded web3.py `__" +msgstr "" + +#: ../../resources.rst:39 +msgid "" +"Sign `typed data messages `__ (EIP 712)" +msgstr "" + +#: ../../resources.rst:40 +msgid "" +"Look up offchain data via `CCIP Read " +"`__" +msgstr "" + +#: ../../resources.rst:41 +msgid "" +"Configure and `customize web3.py `__" +msgstr "" + +#: ../../resources.rst:42 +msgid "" +"`Decode a signed transaction `__" +msgstr "" + +#: ../../resources.rst:43 +msgid "" +"Find a historical contract `revert reason " +"`__" +msgstr "" + +#: ../../resources.rst:44 +msgid "" +"Generate a `vanity address `__" +msgstr "" + +#: ../../resources.rst:45 +msgid "" +"Simulate transactions with `call state overrides " +"`__" +msgstr "" + +#: ../../resources.rst:46 +msgid "" +"Configure web3 for `JSON-RPC fallback and MEV blocker providers " +"`__" +msgstr "" + +#: ../../resources.rst:50 +msgid "Conference Presentations and Videos" +msgstr "" + +#: ../../resources.rst:52 +msgid "" +"`Web3.Py - Now And Near Future by Marc Garreau (2022, 15 mins) " +"`__" +msgstr "" + +#: ../../resources.rst:53 +msgid "" +"`Python and DeFi by Curve Finance (2022, 15 mins) " +"`__" +msgstr "" + +#: ../../resources.rst:54 +msgid "" +"`Working with MetaMask in Python by Rishab Kattimani (2022, 15 mins) " +"`__" +msgstr "" + +#: ../../resources.rst:58 +msgid "Smart Contract Programming Languages" +msgstr "" + +#: ../../resources.rst:60 +msgid "" +"`Vyper `__ - Contract-oriented, " +"pythonic programming language that targets EVM" +msgstr "" + +#: ../../resources.rst:64 +msgid "Frameworks and Tooling" +msgstr "" + +#: ../../resources.rst:66 +msgid "" +"`Ape `__ - The Ethereum development framework " +"for Python Developers, Data Scientists, and Security Professionals" +msgstr "" + +#: ../../resources.rst:67 +msgid "" +"`Titanoboa `__ - A Vyper " +"interpreter and testing framework" +msgstr "" + +#: ../../resources.rst:68 +msgid "" +"`Wake `__ - A Python-based " +"development and testing framework for Solidity" +msgstr "" + +#: ../../resources.rst:69 +msgid "" +"`Brownie `__ - [No longer " +"actively maintained] A Python-based development and testing framework for" +" smart contracts targeting EVM" +msgstr "" + +#: ../../resources.rst:73 +msgid "Libraries" +msgstr "" + +#: ../../resources.rst:75 +msgid "" +"`Web3 Ethereum DeFi `__ - Library for DeFi trading and protocols (Uniswap, PancakeSwap, " +"Sushi, Aave, Chainlink)" +msgstr "" + +#: ../../resources.rst:76 +msgid "" +"`lighter-v1-python `__ -" +" Lighter.xyz DEX client for Python" +msgstr "" + +#: ../../resources.rst:77 +msgid "" +"`uniswap-python `__ - Library lets you " +"easily retrieve prices and make trades on all Uniswap versions." +msgstr "" + +#: ../../resources.rst:78 +msgid "" +"`pyWalletConnect `__ - " +"WalletConnect implementation for wallets in Python" +msgstr "" + +#: ../../resources.rst:79 +msgid "" +"`dydx-v3-python `__ - " +"Python client for dYdX v3" +msgstr "" + +#: ../../resources.rst:80 +msgid "" +"`Lido Python SDK `__ - " +"Library with which you can get all Lido validator's signatures and check " +"their validity" +msgstr "" + +#: ../../resources.rst:84 +msgid "Applications" +msgstr "" + +#: ../../resources.rst:86 +msgid "" +"`Curve Finance " +"`__" +msgstr "" + +#: ../../resources.rst:87 +msgid "" +"`Yearn Finance " +"`__" +msgstr "" + +#: ../../resources.rst:88 +msgid "`StakeWise Oracle `__" +msgstr "" + +#: ../../resources.rst:92 +msgid "Hackathon Helpers" +msgstr "" + +#: ../../resources.rst:94 +msgid "" +"`ape-hackathon-kit `__ - " +"Ape project template with a web front-end (Next.js, Tailwind, RainbowKit," +" wagmi)" +msgstr "" + +#: ../../resources.rst:95 +msgid "" +"`eth-flogger `__ - Sample web app" +" utilizing async web3.py, Flask, SQLite, Sourcify" +msgstr "" + +#: ../../resources.rst:96 +msgid "" +"`Temo `__ - Sample terminal app " +"utilizing async web3py, Textual, Anvil" +msgstr "" + +#: ../../resources.rst:97 +msgid "" +"`web3py-discord-bot `__ - " +"Sample Discord bot utilizing websockets, ``eth_subscribe``, and " +"discord.py" +msgstr "" + +#: ../../resources.rst:98 +msgid "" +"`py-signer `__ - Demo of typed data" +" message signing (EIP-712) with eth-account and Ape" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/sphinx.po b/docs/locales/zh_CN/LC_MESSAGES/sphinx.po new file mode 100644 index 0000000000..7bbb84bf70 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/sphinx.po @@ -0,0 +1,44 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../_templates/searchbox.html:9 +msgid "Search docs" +msgstr "搜索文档" + +#: ../../_templates/versions.html:16 +msgid "Versions" +msgstr "" + +#: ../../_templates/versions.html:21 +msgid "Downloads" +msgstr "" + +#: ../../_templates/versions.html:27 +msgid "On Read the Docs" +msgstr "" + +#: ../../_templates/versions.html:29 +msgid "Project Home" +msgstr "" + +#: ../../_templates/versions.html:32 +msgid "Builds" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/subscriptions.po b/docs/locales/zh_CN/LC_MESSAGES/subscriptions.po new file mode 100644 index 0000000000..299fea0ea3 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/subscriptions.po @@ -0,0 +1,217 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../subscriptions.rst:4 +msgid "Event Subscriptions" +msgstr "事件订阅" + +#: ../../subscriptions.rst:6 +msgid "" +"Most Ethereum clients include ``eth_subscribe`` support, allowing you to " +"listen for specific events as they occur. This applies to a limited set " +"of events: new block headers, the syncing status of a node, new pending " +"transactions, and emitted logs from smart contracts." +msgstr "" + +#: ../../subscriptions.rst:10 +msgid "" +"Subscriptions require a persistent socket connection between you and the " +"Ethereum client. For that reason, you must use web3.py's " +":class:`~web3.providers.persistent.WebSocketProvider` or " +":class:`~web3.providers.persistent.AsyncIPCProvider` to utilize " +"subscriptions. As it is the more common of the two, examples in this " +"guide will leverage the ``WebSocketProvider``." +msgstr "" + +#: ../../subscriptions.rst:13 +msgid "An introduction to subscriptions" +msgstr "" + +#: ../../subscriptions.rst:15 +msgid "" +"When you subscribe to an event – new block headers, for example – you'll " +"receive a subscription ID. The Ethereum client will then maintain a " +"connection to your application and send along any related event until you" +" unsubscribe with that ID. That example in code:" +msgstr "" + +#: ../../subscriptions.rst:44 +msgid "web3.py's ``subscription_manager``" +msgstr "" + +#: ../../subscriptions.rst:46 +msgid "" +"The example above is the \"manual\" approach to managing subscriptions. " +"It's not so complicated in the case of listening for new block headers, " +"but things get considerably more complex once you start listening for " +"smart contract event logs or managing multiple subscriptions. As of " +"v7.7.0, web3.py includes some additional convenient subscription " +"management features. We'll step through them now." +msgstr "" + +#: ../../subscriptions.rst:50 +msgid "1.) The subscription_manager" +msgstr "" + +#: ../../subscriptions.rst:52 +msgid "" +"The ``w3`` (``AsyncWeb3``) instance has a ``subscription_manager`` " +"module. While you may still use the ``w3.eth.subscribe`` method from the " +"previous example, the ``subscription_manager`` offers an additional way " +"to start one or more subscriptions and provides better management of " +"those subscriptions. We're going to pass in a list of events we want to " +"subscribe to within the ``w3.subscription_manager.subscribe`` method." +msgstr "" + +#: ../../subscriptions.rst:64 +msgid "2.) Subscription types" +msgstr "" + +#: ../../subscriptions.rst:66 +msgid "" +"To aid in defining those subscriptions, subscription type classes have " +"been introduced: ``NewHeadsSubscription``, ``PendingTxSubscription``, " +"``LogsSubscription``, and ``SyncingSubscription``. Each class is context " +"aware, meaning it will throw an error if you provide an unexpected data " +"type." +msgstr "" + +#: ../../subscriptions.rst:100 +msgid "3.) Handlers" +msgstr "" + +#: ../../subscriptions.rst:102 +msgid "" +"In the example above, there is a handler specified for each subscription." +" These are context-aware functions that you can declare separate from the" +" subscription logic. Within each handler, parse and perform whatever " +"logic you require. Note that in addition to the result being processed, " +"the ``handler_context`` in each handler provides access to your " +"``AsyncWeb3`` instance, the subscription instance, and any custom values " +"declared within the ``handler_context`` of the subscription: ``from " +"web3.utils.subscriptions import LogsSubscriptionContext``" +msgstr "" + +#: ../../subscriptions.rst:121 +msgid "4.) handle_subscriptions" +msgstr "" + +#: ../../subscriptions.rst:123 +msgid "" +"Finally, when all your subscriptions are configured, utilize the " +"handle_subscriptions method to begin processing them. If you need to " +"listen for events on multiple chains, create one w3 instance per chain." +msgstr "" + +#: ../../subscriptions.rst:143 +msgid "5.) Unsubscribing" +msgstr "" + +#: ../../subscriptions.rst:145 +msgid "" +"If you don't want to subscribe indefinitely to an event, you can " +"unsubscribe at any point. The first example in this post demonstrated the" +" manual approach: ``await w3.eth.unsubscribe(subscription_id)``" +msgstr "" + +#: ../../subscriptions.rst:148 +msgid "" +"The new handler pattern will keep track of the subscription ID for you " +"however, so the same can be accomplished via the ``handler_context`` " +"without an ID:" +msgstr "" + +#: ../../subscriptions.rst:158 +msgid "" +"Lastly, if you're wrapping up the whole show, you can reach for " +"``unsubscribe_all`` on the subscription_manager:" +msgstr "" + +#: ../../subscriptions.rst:167 +msgid "An example" +msgstr "" + +#: ../../subscriptions.rst:169 +msgid "" +"Let's put all the pieces together. This example will subscribe to new " +"block headers and transfer events from the WETH contract. It should work " +"as written if you provide a WebSocket RPC URL." +msgstr "" + +#: ../../subscriptions.rst:225 +msgid "Parallelizing subscriptions" +msgstr "" + +#: ../../subscriptions.rst:229 +msgid "" +"Parallelizing subscriptions does not guarantee that events will be " +"processed in the order they are received. Most events should still be " +"processed in the order they are received, but if a particular handler " +"takes a long time to execute, newer events may be processed first. It is " +"recommended to set the ``parallelize`` flag to ``False`` (default " +"behavior) for subscriptions that depend on the order of events." +msgstr "" + +#: ../../subscriptions.rst:236 +msgid "" +"If you have multiple subscriptions that can be processed in parallel, you" +" can set the ``parallelize`` flag to ``True`` - either globally on the " +"subscription manager, or individually on each subscription. This control " +"allows the subscription manager to handle subscription processing " +"concurrently. This flag can be set on the manager, as a global setting, " +"or on individual subscriptions. This can help with performance if " +"subscriptions are independent of each other, or do not rely on some " +"external shared state (no race conditions are present)." +msgstr "" + +#: ../../subscriptions.rst:244 +msgid "" +"Global parallelization is off by default, meaning all subscriptions will " +"be processed sequentially unless you set the ``parallelize`` flag to " +"``True`` on the subscription manager or individual subscriptions." +msgstr "" + +#: ../../subscriptions.rst:274 +msgid "" +"Global parallelization can also be set on the subscription manager, which" +" will apply to all subscriptions unless overridden by an individual " +"subscription's ``parallelize`` flag:" +msgstr "" + +#: ../../subscriptions.rst:311 +msgid "FAQ" +msgstr "" + +#: ../../subscriptions.rst:315 +msgid "How can I subscribe to additional events once my application is running?" +msgstr "" + +#: ../../subscriptions.rst:317 +msgid "" +"Wherever you have a ``w3`` instance of the ``AsyncWeb3`` object, you can " +"use the ``subscription_manager`` to subscribe to new events." +msgstr "" + +#: ../../subscriptions.rst:319 +msgid "" +"For example, the handler of one subscription could initialize a new " +"subscription:" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/toc.po b/docs/locales/zh_CN/LC_MESSAGES/toc.po new file mode 100644 index 0000000000..5d1c60668d --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/toc.po @@ -0,0 +1,56 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: 2025-08-06 12:09+0800\n" +"Last-Translator: shevloader \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../toc.rst:4 +msgid "Intro" +msgstr "介绍" + +#: ../../toc.rst:12 +msgid "Guides" +msgstr "指南" + +#: ../../toc.rst:28 +msgid "API" +msgstr "API" + +#: ../../toc.rst:43 +msgid "Community" +msgstr "社区" + +#: ../../toc.rst:2 +msgid "Table of Contents" +msgstr "目录" + +#: ../../toc.rst:52 +msgid "Indices and tables" +msgstr "索引和表格" + +#: ../../toc.rst:54 +msgid ":ref:`genindex`" +msgstr ":ref:`genindex`" + +#: ../../toc.rst:55 +msgid ":ref:`modindex`" +msgstr ":ref:`modindex`" + +#: ../../toc.rst:56 +msgid ":ref:`search`" +msgstr ":ref:`search`" diff --git a/docs/locales/zh_CN/LC_MESSAGES/transactions.po b/docs/locales/zh_CN/LC_MESSAGES/transactions.po new file mode 100644 index 0000000000..1606f44af9 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/transactions.po @@ -0,0 +1,184 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../transactions.rst:2 +msgid "Transactions" +msgstr "交易" + +#: ../../transactions.rst:4 +msgid "" +"There are a handful of ways to interact with transactions in web3.py. See" +" the :ref:`Web3.eth module ` for a full list of " +"transaction-related methods. Note that you may also :ref:`batch requests " +"` that read transaction data, but not send new " +"transactions in a batch request." +msgstr "" + +#: ../../transactions.rst:7 +msgid "" +"The rest of this guide covers the decision tree for how to send a " +"transaction." +msgstr "" + +#: ../../transactions.rst:11 +msgid "" +"Prefer to view this code in a Jupyter Notebook? View the repo `here " +"`_." +msgstr "" + +#: ../../transactions.rst:13 +msgid "" +"There are two methods for sending transactions using web3.py: " +":meth:`~web3.eth.Eth.send_transaction` and " +":meth:`~web3.eth.Eth.send_raw_transaction`. A brief guide:" +msgstr "" + +#: ../../transactions.rst:15 +msgid "Want to sign a transaction offline or send pre-signed transactions?" +msgstr "" + +#: ../../transactions.rst:17 +msgid "" +"use :meth:`sign_transaction " +"` + " +":meth:`~web3.eth.Eth.send_raw_transaction`" +msgstr "" + +#: ../../transactions.rst:19 +msgid "" +"Are you primarily using the same account for all transactions and would " +"you prefer to save a few lines of code?" +msgstr "" + +#: ../../transactions.rst:21 +msgid "" +"configure the ``build`` method for " +":class:`~web3.middleware.SignAndSendRawMiddlewareBuilder`, then" +msgstr "" + +#: ../../transactions.rst:22 ../../transactions.rst:27 +msgid "use :meth:`~web3.eth.Eth.send_transaction`" +msgstr "" + +#: ../../transactions.rst:24 +msgid "Otherwise:" +msgstr "" + +#: ../../transactions.rst:26 +msgid "" +"load account via eth-account (:meth:`w3.eth.account.from_key(pk) " +"`), then" +msgstr "" + +#: ../../transactions.rst:29 +msgid "Interacting with or deploying a contract?" +msgstr "" + +#: ../../transactions.rst:31 +msgid "" +"Option 1: :meth:`~web3.contract.ContractFunction.transact` uses " +":meth:`~web3.eth.Eth.send_transaction` under the hood" +msgstr "" + +#: ../../transactions.rst:32 +msgid "" +"Option 2: :meth:`~web3.contract.ContractFunction.build_transaction` + " +":meth:`sign_transaction ` +" +" :meth:`~web3.eth.Eth.send_raw_transaction`" +msgstr "" + +#: ../../transactions.rst:34 +msgid "An example for each can be found below." +msgstr "" + +#: ../../transactions.rst:38 +msgid "Chapter 0: ``w3.eth.send_transaction`` with ``eth-tester``" +msgstr "" + +#: ../../transactions.rst:40 +msgid "" +"Many tutorials use ``eth-tester`` (via EthereumTesterProvider) for " +"convenience and speed of conveying ideas/building a proof of concept. " +"Transactions sent by test accounts are auto-signed." +msgstr "" + +#: ../../transactions.rst:68 +msgid "Chapter 1: ``w3.eth.send_transaction`` + signer middleware" +msgstr "" + +#: ../../transactions.rst:70 +msgid "" +"The :meth:`~web3.eth.Eth.send_transaction` method is convenient and to-" +"the-point. If you want to continue using the pattern after graduating " +"from ``eth-tester``, you can utilize web3.py middleware to sign " +"transactions from a particular account:" +msgstr "" + +#: ../../transactions.rst:112 +msgid "Chapter 2: ``w3.eth.send_raw_transaction``" +msgstr "" + +#: ../../transactions.rst:114 +msgid "if you don't opt for the middleware, you'll need to:" +msgstr "" + +#: ../../transactions.rst:116 +msgid "build each transaction," +msgstr "" + +#: ../../transactions.rst:117 +msgid "" +":meth:`sign_transaction `, " +"and" +msgstr "" + +#: ../../transactions.rst:118 +msgid "then use :meth:`~web3.eth.Eth.send_raw_transaction`." +msgstr "" + +#: ../../transactions.rst:143 +msgid "Chapter 3: Contract transactions" +msgstr "" + +#: ../../transactions.rst:145 +msgid "" +"The same concepts apply for contract interactions, at least under the " +"hood." +msgstr "" + +#: ../../transactions.rst:147 +msgid "" +"Executing a function on a smart contract requires sending a transaction, " +"which is typically done in one of two ways:" +msgstr "" + +#: ../../transactions.rst:149 +msgid "" +"executing the :meth:`~web3.contract.ContractFunction.transact` function, " +"or" +msgstr "" + +#: ../../transactions.rst:150 +msgid "" +":meth:`~web3.contract.ContractFunction.build_transaction`, then signing " +"and sending the raw transaction." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/troubleshooting.po b/docs/locales/zh_CN/LC_MESSAGES/troubleshooting.po new file mode 100644 index 0000000000..e4d6a49b61 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/troubleshooting.po @@ -0,0 +1,591 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../troubleshooting.rst:2 +msgid "Troubleshooting" +msgstr "故障排除" + +#: ../../troubleshooting.rst:7 +msgid "Set up a clean environment" +msgstr "" + +#: ../../troubleshooting.rst:9 +msgid "" +"Many things can cause a broken environment. You might be on an " +"unsupported version of Python. Another package might be installed that " +"has a name or version conflict. Often, the best way to guarantee a " +"correct environment is with ``virtualenv``, like:" +msgstr "" + +#: ../../troubleshooting.rst:36 +msgid "" +"Remember that each new terminal session requires you to reactivate your " +"virtualenv, like: ``$ source ~/.venv-py3/bin/activate``" +msgstr "" + +#: ../../troubleshooting.rst:43 +msgid "Why can't I use a particular function?" +msgstr "" + +#: ../../troubleshooting.rst:45 +msgid "" +"Note that a web3.py instance must be configured before you can use most " +"of its capabilities. One symptom of not configuring the instance first is" +" an error that looks something like this: ``AttributeError: type object " +"'Web3' has no attribute 'eth'``." +msgstr "" + +#: ../../troubleshooting.rst:49 +msgid "" +"To properly configure your web3.py instance, specify which provider " +"you're using to connect to the Ethereum network. An example " +"configuration, if you're connecting to a locally run node, might be:" +msgstr "" + +#: ../../troubleshooting.rst:62 +msgid "" +"Refer to the :ref:`providers` documentation for further help with " +"configuration." +msgstr "" + +#: ../../troubleshooting.rst:68 +msgid "Why isn't my web3 instance connecting to the network?" +msgstr "" + +#: ../../troubleshooting.rst:69 +msgid "" +"You can check that your instance is connected via the ``is_connected`` " +"method:" +msgstr "" + +#: ../../troubleshooting.rst:76 +msgid "" +"There are a variety of explanations for why you may see ``False`` here. " +"To help you diagnose the problem, ``is_connected`` has an optional " +"``show_traceback`` argument:" +msgstr "" + +#: ../../troubleshooting.rst:87 +msgid "" +"If you're running a local node, such as Geth, double-check that you've " +"indeed started the binary and that you've started it from the intended " +"directory - particularly if you've specified a relative path to its ipc " +"file." +msgstr "" + +#: ../../troubleshooting.rst:91 +msgid "" +"If that does not address your issue, it's probable that you still have a " +"Provider configuration issue. There are several options for configuring a" +" Provider, detailed :ref:`here`." +msgstr "" + +#: ../../troubleshooting.rst:98 +msgid "How do I get ether for my test network?" +msgstr "" + +#: ../../troubleshooting.rst:100 +msgid "" +"Test networks usually have something called a \"faucet\" to help get test" +" ether to people who want to use it. The faucet simply sends you test " +"ether when you visit a web page, or ping a chat bot, etc." +msgstr "" + +#: ../../troubleshooting.rst:104 +msgid "" +"Each test network has its own version of test ether, so each one must " +"maintain its own faucet. Faucet mechanisms tend to come and go, so a web " +"search for \"ethereum testnet faucet\" should give you the most up-to-" +"date options." +msgstr "" + +#: ../../troubleshooting.rst:109 +msgid "How do I use my MetaMask accounts from web3.py?" +msgstr "" + +#: ../../troubleshooting.rst:111 +msgid "" +"Export your private key from MetaMask, and use the local private key " +"tools in web3.py to sign and send transactions." +msgstr "" + +#: ../../troubleshooting.rst:114 +msgid "" +"See `how to export your private key " +"`_ and :ref" +":`eth-account`." +msgstr "" + +#: ../../troubleshooting.rst:121 +msgid "How do I create an account?" +msgstr "" + +#: ../../troubleshooting.rst:123 +msgid "In general, your options for accounts are:" +msgstr "" + +#: ../../troubleshooting.rst:125 +msgid "" +"Import a keystore file for an account and :ref:`extract the private " +"key`." +msgstr "" + +#: ../../troubleshooting.rst:126 +msgid "" +"Create an account via the :ref:`eth-account ` API, e.g., " +"``new_acct = w3.eth.account.create()``." +msgstr "" + +#: ../../troubleshooting.rst:127 +msgid "" +"Use an external service (e.g. Metamask) to generate a new account, then " +"securely import its private key." +msgstr "" + +#: ../../troubleshooting.rst:129 +msgid "" +"Don't store real value in an account until you are familiar with security" +" best practices. If you lose your private key, you lose your account!" +msgstr "" + +#: ../../troubleshooting.rst:133 +msgid "Why doesn't my transaction work on another network?" +msgstr "" + +#: ../../troubleshooting.rst:135 +msgid "" +"web3.py is an Ethereum-specific library, which defaults to `\"type 2\" " +"EIP-1559 transactions " +"`_ as of the London network upgrade. Some chains (including " +"Ethereum L2s) do not support the same transaction types." +msgstr "" + +#: ../../troubleshooting.rst:140 +msgid "" +"If your chain doesn't support this transaction type, you likely need to " +"create a \"legacy\" transaction, i.e., include ``gasPrice``, but not " +"``type``, ``maxFeePerGas``, or ``maxPriorityFeePerGas`` in your " +"transaction body." +msgstr "" + +#: ../../troubleshooting.rst:144 +msgid "" +"If that doesn't resolve your issue, open a GitHub issue or reach out for " +"help in the community `Discord`_ server if you're having trouble with an " +"Ethereum-ecosystem chain. If you're debugging in an alternative " +"ecosystem, please find another appropriate forum to raise your question." +msgstr "" + +#: ../../troubleshooting.rst:153 +msgid "How do I conform to ABI types?" +msgstr "" + +#: ../../troubleshooting.rst:155 +msgid "The web3 library follows the following conventions:" +msgstr "" + +#: ../../troubleshooting.rst:158 +msgid "Bytes vs Text" +msgstr "" + +#: ../../troubleshooting.rst:160 +msgid "" +"The term *bytes* is used to refer to the binary representation of a " +"string." +msgstr "" + +#: ../../troubleshooting.rst:161 +msgid "The term *text* is used to refer to unicode representations of strings." +msgstr "" + +#: ../../troubleshooting.rst:164 +msgid "Hexadecimal Representations" +msgstr "" + +#: ../../troubleshooting.rst:166 +msgid "All hexadecimal values will be returned as text." +msgstr "" + +#: ../../troubleshooting.rst:167 +msgid "All hexadecimal values will be ``0x`` prefixed." +msgstr "" + +#: ../../troubleshooting.rst:170 +msgid "Ethereum Addresses" +msgstr "" + +#: ../../troubleshooting.rst:172 +msgid "All addresses must be supplied in one of three ways:" +msgstr "" + +#: ../../troubleshooting.rst:174 +msgid "" +"A 20-byte hexadecimal that is checksummed using the `EIP-55 " +"`_ spec." +msgstr "" + +#: ../../troubleshooting.rst:176 +msgid "A 20-byte binary address (python bytes type)." +msgstr "" + +#: ../../troubleshooting.rst:177 +msgid "" +"While connected to an Ethereum Name Service (ENS) supported chain, an ENS" +" name (often in the form ``myname.eth``)." +msgstr "" + +#: ../../troubleshooting.rst:181 +msgid "Disabling Strict Bytes Type Checking" +msgstr "" + +#: ../../troubleshooting.rst:183 +msgid "" +"There is a boolean flag on the ``Web3`` class and the ``ENS`` class that " +"will disable strict bytes type checking. This allows bytes values of " +"Python strings and allows byte strings less than the specified byte size," +" appropriately padding values that need padding. To disable stricter " +"checks, set the ``w3.strict_bytes_type_checking`` (or " +"``ns.strict_bytes_type_checking``) flag to ``False``. This will no longer" +" cause the ``Web3`` / ``ENS`` instance to raise an error if a Python " +"string is passed in without a \"0x\" prefix. It will also render valid " +"byte strings or hex strings that are below the exact number of bytes " +"specified by the ABI type by padding the value appropriately, according " +"to the ABI type. See the :ref:`disable-strict-byte-check` section for an " +"example on using the flag and more details." +msgstr "" + +#: ../../troubleshooting.rst:195 +msgid "" +"If a standalone ``ENS`` instance is instantiated from a ``Web3`` " +"instance, i.e. ``ns = ENS.from_web3(w3)``, it will inherit the value of " +"the ``w3.strict_bytes_type_checking`` flag from the ``Web3`` instance at " +"the time of instantiation." +msgstr "" + +#: ../../troubleshooting.rst:200 +msgid "" +"Also of note, all modules on the ``Web3`` class will inherit the value of" +" this flag, since all modules use the parent ``w3`` object reference " +"under the hood. This means that ``w3.eth.w3.strict_bytes_type_checking`` " +"will always have the same value as ``w3.strict_bytes_type_checking``." +msgstr "" + +#: ../../troubleshooting.rst:206 +msgid "" +"For more details on the ABI specification, refer to the `Solidity ABI " +"Spec `_." +msgstr "" + +#: ../../troubleshooting.rst:212 +msgid "Types by Example" +msgstr "" + +#: ../../troubleshooting.rst:214 +msgid "Let's use a contrived contract to demonstrate input types in web3.py:" +msgstr "" + +#: ../../troubleshooting.rst:255 +msgid "Booleans" +msgstr "" + +#: ../../troubleshooting.rst:262 +msgid "Unsigned Integers" +msgstr "" + +#: ../../troubleshooting.rst:271 +msgid "Signed Integers" +msgstr "" + +#: ../../troubleshooting.rst:278 +msgid "Addresses" +msgstr "" + +#: ../../troubleshooting.rst:285 +msgid "Bytes" +msgstr "" + +#: ../../troubleshooting.rst:292 +msgid "Structs" +msgstr "" + +#: ../../troubleshooting.rst:300 +msgid "How can I optimize Ethereum JSON-RPC API access?" +msgstr "" + +#: ../../troubleshooting.rst:302 +msgid "" +"Your Ethereum node JSON-RPC API might be slow when fetching multiple and " +"large requests, especially when running batch jobs. Here are some tips " +"for how to speed up your web3.py application." +msgstr "" + +#: ../../troubleshooting.rst:304 +msgid "" +"Run your client locally, e.g., `Go Ethereum `_ or `TurboGeth `_. The network latency and speed are the major limiting factors for" +" fast API access." +msgstr "" + +#: ../../troubleshooting.rst:306 +msgid "" +"Use IPC communication instead of HTTP/WebSockets. See " +":ref:`choosing_provider`." +msgstr "" + +#: ../../troubleshooting.rst:308 +msgid "" +"Use an optimised JSON decoder. A future iteration of web3.py may change " +"the default decoder or provide an API to configure one, but for now, you " +"may patch the provider class to use `ujson " +"`_." +msgstr "" + +#: ../../troubleshooting.rst:338 +msgid "Why am I getting Visual C++ or Cython not installed error?" +msgstr "" + +#: ../../troubleshooting.rst:340 +msgid "" +"Some Windows users that do not have Microsoft Visual C++ version 14.0 or " +"greater installed may see an error message when installing web3.py as " +"shown below:" +msgstr "" + +#: ../../troubleshooting.rst:348 +msgid "To fix this error, download and install Microsoft Visual C++ from here :" +msgstr "" + +#: ../../troubleshooting.rst:350 +msgid "" +"`Microsoft Visual C++ Redistributable for Visual Studio " +"`_" +msgstr "" + +#: ../../troubleshooting.rst:352 +msgid "`x64 Visual C++ `_" +msgstr "" + +#: ../../troubleshooting.rst:354 +msgid "`x86 Visual C++ `_" +msgstr "" + +#: ../../troubleshooting.rst:356 +msgid "`ARM64 Visual C++ `_" +msgstr "" + +#: ../../troubleshooting.rst:360 +msgid "How do I convert currency denominations?" +msgstr "" + +#: ../../troubleshooting.rst:362 +msgid "The following denominations are supported:" +msgstr "" + +#: ../../troubleshooting.rst:365 +msgid "denomination" +msgstr "" + +#: ../../troubleshooting.rst:365 +msgid "amount in wei" +msgstr "" + +#: ../../troubleshooting.rst:367 +msgid "wei" +msgstr "" + +#: ../../troubleshooting.rst:367 +msgid "1" +msgstr "" + +#: ../../troubleshooting.rst:369 +msgid "kwei" +msgstr "" + +#: ../../troubleshooting.rst:369 ../../troubleshooting.rst:371 +#: ../../troubleshooting.rst:373 +msgid "1000" +msgstr "" + +#: ../../troubleshooting.rst:371 +msgid "babbage" +msgstr "" + +#: ../../troubleshooting.rst:373 +msgid "femtoether" +msgstr "" + +#: ../../troubleshooting.rst:375 +msgid "mwei" +msgstr "" + +#: ../../troubleshooting.rst:375 ../../troubleshooting.rst:377 +#: ../../troubleshooting.rst:379 +msgid "1000000" +msgstr "" + +#: ../../troubleshooting.rst:377 +msgid "lovelace" +msgstr "" + +#: ../../troubleshooting.rst:379 +msgid "picoether" +msgstr "" + +#: ../../troubleshooting.rst:381 +msgid "gwei" +msgstr "" + +#: ../../troubleshooting.rst:381 ../../troubleshooting.rst:383 +#: ../../troubleshooting.rst:385 ../../troubleshooting.rst:387 +msgid "1000000000" +msgstr "" + +#: ../../troubleshooting.rst:383 +msgid "shannon" +msgstr "" + +#: ../../troubleshooting.rst:385 +msgid "nanoether" +msgstr "" + +#: ../../troubleshooting.rst:387 +msgid "nano" +msgstr "" + +#: ../../troubleshooting.rst:389 +msgid "szabo" +msgstr "" + +#: ../../troubleshooting.rst:389 ../../troubleshooting.rst:391 +#: ../../troubleshooting.rst:393 +msgid "1000000000000" +msgstr "" + +#: ../../troubleshooting.rst:391 +msgid "microether" +msgstr "" + +#: ../../troubleshooting.rst:393 +msgid "micro" +msgstr "" + +#: ../../troubleshooting.rst:395 +msgid "finney" +msgstr "" + +#: ../../troubleshooting.rst:395 ../../troubleshooting.rst:397 +#: ../../troubleshooting.rst:399 +msgid "1000000000000000" +msgstr "" + +#: ../../troubleshooting.rst:397 +msgid "milliether" +msgstr "" + +#: ../../troubleshooting.rst:399 +msgid "milli" +msgstr "" + +#: ../../troubleshooting.rst:401 +msgid "ether" +msgstr "" + +#: ../../troubleshooting.rst:401 +msgid "1000000000000000000" +msgstr "" + +#: ../../troubleshooting.rst:403 +msgid "kether" +msgstr "" + +#: ../../troubleshooting.rst:403 ../../troubleshooting.rst:405 +msgid "1000000000000000000000" +msgstr "" + +#: ../../troubleshooting.rst:405 +msgid "grand" +msgstr "" + +#: ../../troubleshooting.rst:407 +msgid "mether" +msgstr "" + +#: ../../troubleshooting.rst:407 +msgid "1000000000000000000000000" +msgstr "" + +#: ../../troubleshooting.rst:409 +msgid "gether" +msgstr "" + +#: ../../troubleshooting.rst:409 +msgid "1000000000000000000000000000" +msgstr "" + +#: ../../troubleshooting.rst:411 +msgid "tether" +msgstr "" + +#: ../../troubleshooting.rst:411 +msgid "1000000000000000000000000000000" +msgstr "" + +#: ../../troubleshooting.rst:414 +msgid "" +"You can use the :meth:`~web3.from_wei` method to convert a balance to " +"ether (or another denomination)." +msgstr "" + +#: ../../troubleshooting.rst:422 +msgid "" +"To convert back to wei, you can use the inverse function, " +":meth:`~web3.to_wei`. Note that Python's default floating point precision" +" is insufficient for this use case, so it's necessary to cast the value " +"to a `Decimal `_ if it " +"isn't already." +msgstr "" + +#: ../../troubleshooting.rst:433 +msgid "" +"Best practice: If you need to work with multiple currency denominations, " +"default to wei. A typical workflow may require a conversion from some " +"denomination to wei, then from wei to whatever you need." +msgstr "" + +#: ../../troubleshooting.rst:446 +msgid "How do I adjust the log levels?" +msgstr "" + +#: ../../troubleshooting.rst:448 +msgid "" +"web3.py internally uses `Python logging subsystem " +"`_." +msgstr "" + +#: ../../troubleshooting.rst:450 +msgid "" +"If you want to run your application logging in debug mode, below is an " +"example of how to make some JSON-RPC traffic quieter." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.beacon.po b/docs/locales/zh_CN/LC_MESSAGES/web3.beacon.po new file mode 100644 index 0000000000..5579e1254f --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.beacon.po @@ -0,0 +1,46 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.beacon.rst:2 +msgid "Beacon API" +msgstr "" + +#: ../../web3.beacon.rst:4 +msgid "" +"This API Is experimental. Client support is incomplete and the API itself" +" is still evolving." +msgstr "" + +#: ../../web3.beacon.rst:6 +msgid "" +"To use this API, you'll need a beacon node running locally or remotely. " +"To set that up, refer to the documentation of your specific client." +msgstr "" + +#: ../../web3.beacon.rst:8 +msgid "" +"Once you have a running beacon node, import and configure your beacon " +"instance:" +msgstr "" + +#: ../../web3.beacon.rst:16 +msgid "Methods" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.contract.po b/docs/locales/zh_CN/LC_MESSAGES/web3.contract.po new file mode 100644 index 0000000000..cf0bdfec9d --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.contract.po @@ -0,0 +1,1368 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.contract.rst:4 +msgid "Contracts" +msgstr "合约" + +#: ../../web3.contract.rst:8 +msgid "" +"Smart contracts are programs deployed to the Ethereum network. See the " +"`ethereum.org docs `_ for a proper introduction." +msgstr "" + +#: ../../web3.contract.rst:13 +msgid "Interacting with deployed contracts" +msgstr "" + +#: ../../web3.contract.rst:15 +msgid "" +"In order to use an existing contract, you'll need its deployed address " +"and its ABI. Both can be found using block explorers, like Etherscan. " +"Once you instantiate a contract instance, you can read data and execute " +"transactions." +msgstr "" + +#: ../../web3.contract.rst:36 +msgid "Contract Deployment Example" +msgstr "" + +#: ../../web3.contract.rst:38 +msgid "To run this example, you will need to install a few extra features:" +msgstr "" + +#: ../../web3.contract.rst:40 +msgid "The sandbox node provided by eth-tester. You can install it with:" +msgstr "" + +#: ../../web3.contract.rst:46 +msgid "" +"``py-solc-x``. This is the supported route to installing the solidity " +"compiler ``solc``. You can install it with:" +msgstr "" + +#: ../../web3.contract.rst:52 +msgid "" +"After ``py-solc-x`` is installed, you will need to install a version of " +"``solc``. You can install the latest version via a new REPL with:" +msgstr "" + +#: ../../web3.contract.rst:59 +msgid "You should now be set up to compile and deploy a contract." +msgstr "" + +#: ../../web3.contract.rst:61 +msgid "The following example runs through these steps:" +msgstr "" + +#: ../../web3.contract.rst:63 +msgid "Compile Solidity contract into bytecode and an ABI" +msgstr "" + +#: ../../web3.contract.rst:64 +msgid "Initialize a Contract instance" +msgstr "" + +#: ../../web3.contract.rst:65 +msgid "Deploy the contract using the Contract instance to initiate a transaction" +msgstr "" + +#: ../../web3.contract.rst:66 +msgid "Interact with the contract functions using the Contract instance" +msgstr "" + +#: ../../web3.contract.rst:135 +msgid "Contract Factories" +msgstr "" + +#: ../../web3.contract.rst:137 +msgid "" +"These factories are not intended to be initialized directly. Instead, " +"create contract objects using the :meth:`w3.eth.contract() " +"` method. By default, the contract factory is " +":class:`Contract`." +msgstr "" + +#: ../../web3.contract.rst:143 +msgid "" +"Contract provides a default interface for deploying and interacting with " +"Ethereum smart contracts." +msgstr "" + +#: ../../web3.contract.rst:146 +msgid "" +"The address parameter can be a hex address or an ENS name, like " +"``mycontract.eth``." +msgstr "" + +#: ../../web3.contract.rst:150 +msgid "Properties" +msgstr "" + +#: ../../web3.contract.rst:152 +msgid "Each Contract Factory exposes the following properties." +msgstr "" + +#: ../../web3.contract.rst:157 +msgid "" +"The hexadecimal encoded 20-byte address of the contract, or an ENS name. " +"May be ``None`` if not provided during factory creation." +msgstr "" + +#: ../../web3.contract.rst:163 +msgid "" +"The contract ``abi``, or Application Binary Interface, specifies how a " +"contract can be interacted with. Without an ``abi``, the contract cannot " +"be decoded. The ``abi`` enables the Contract instance to expose functions" +" and events as object properties." +msgstr "" + +#: ../../web3.contract.rst:167 +msgid "" +"For further details, see the `Solidity ABI specification " +"`_." +msgstr "" + +#: ../../web3.contract.rst:172 +msgid "" +"The contract bytecode string. May be ``None`` if not provided during " +"factory creation." +msgstr "" + +#: ../../web3.contract.rst:178 +msgid "" +"The runtime part of the contract bytecode string. May be ``None`` if not" +" provided during factory creation." +msgstr "" + +#: ../../web3.contract.rst:184 +msgid "" +"If a Tuple/Struct is returned by a contract function, this flag defines " +"whether to apply the field names from the ABI to the returned data. If " +"False, the returned value will be a normal Python ``Tuple``. If True, the" +" returned value will be a Python ``NamedTuple`` of the class " +"``ABIDecodedNamedTuple``." +msgstr "" + +#: ../../web3.contract.rst:189 +msgid "" +"NamedTuples have some restrictions regarding field names. web3.py sets " +"``NamedTuple``'s ``rename=True``, so disallowed field names may be " +"different than expected. See the `Python docs " +"`_" +" for more information." +msgstr "" + +#: ../../web3.contract.rst:194 +msgid "Defaults to ``False`` if not provided during factory creation." +msgstr "" + +#: ../../web3.contract.rst:199 +msgid "" +"This provides access to contract functions as attributes. For example: " +"``myContract.functions.MyMethod()``. The exposed contract functions are " +"classes of the type :py:class:`ContractFunction`." +msgstr "" + +#: ../../web3.contract.rst:206 +msgid "" +"This provides access to contract events as attributes. For example: " +"``myContract.events.MyEvent()``. The exposed contract events are classes" +" of the type :py:class:`ContractEvent`." +msgstr "" + +#: ../../web3.contract.rst:211 ../../web3.contract.rst:870 +#: ../../web3.contract.rst:1153 +msgid "Methods" +msgstr "" + +#: ../../web3.contract.rst:213 +msgid "Method doctests use the following ABI and bytecode." +msgstr "" + +#: ../../web3.contract.rst:221 +msgid "Each Contract Factory exposes the following methods." +msgstr "" + +#: ../../web3.contract.rst:233 +msgid "Construct and deploy a contract by sending a new public transaction." +msgstr "" + +#: ../../web3.contract.rst:235 +msgid "" +"If provided ``transaction`` should be a dictionary conforming to the " +"``web3.eth.send_transaction(transaction)`` method. This value may not " +"contain the keys ``data`` or ``to``." +msgstr "" + +#: ../../web3.contract.rst:239 ../../web3.contract.rst:287 +msgid "" +"If the contract takes constructor parameters they should be provided as " +"positional arguments or keyword arguments." +msgstr "" + +#: ../../web3.contract.rst:242 +msgid "" +"If any of the arguments specified in the ABI are an ``address`` type, " +"they will accept ENS names." +msgstr "" + +#: ../../web3.contract.rst:245 +msgid "" +"If a ``gas`` value is not provided, then the ``gas`` value for the " +"deployment transaction will be created using the " +"``web3.eth.estimate_gas()`` method." +msgstr "" + +#: ../../web3.contract.rst:249 +msgid "Returns the transaction hash for the deploy transaction." +msgstr "" + +#: ../../web3.contract.rst:262 +msgid "Estimate gas for constructing and deploying the contract." +msgstr "" + +#: ../../web3.contract.rst:264 +msgid "" +"This method behaves the same as the :py:meth:`Contract.constructor(*args," +" **kwargs).transact` method, with transaction details being passed into " +"the end portion of the function call, and function arguments being passed" +" into the first portion." +msgstr "" + +#: ../../web3.contract.rst:269 +msgid "" +"The ``block_identifier`` parameter is passed directly to the call at the " +"end portion of the function call." +msgstr "" + +#: ../../web3.contract.rst:272 ../../web3.contract.rst:1012 +msgid "" +"Returns the amount of gas consumed which can be used as a gas estimate " +"for executing this transaction publicly." +msgstr "" + +#: ../../web3.contract.rst:275 +msgid "Returns the gas needed to deploy the contract." +msgstr "" + +#: ../../web3.contract.rst:285 +msgid "Construct the contract deploy transaction bytecode data." +msgstr "" + +#: ../../web3.contract.rst:290 +msgid "" +"If any of the ``args`` specified in the ABI are an ``address`` type, they" +" will accept ENS names." +msgstr "" + +#: ../../web3.contract.rst:293 +msgid "" +"Returns the transaction dictionary that you can pass to send_transaction " +"method." +msgstr "" + +#: ../../web3.contract.rst:309 +msgid "" +"Creates a new event filter, an instance of " +":py:class:`web3.utils.filters.LogFilter`." +msgstr "" + +#: ../../web3.contract.rst:311 +msgid "" +"``from_block`` is a mandatory field. Defines the starting block " +"(exclusive) filter block range. It can be either the starting block " +"number, or 'latest' for the last mined block, or 'pending' for unmined " +"transactions. In the case of ``from_block``, 'latest' and 'pending' set " +"the 'latest' or 'pending' block as a static value for the starting filter" +" block." +msgstr "" + +#: ../../web3.contract.rst:312 +msgid "" +"``to_block`` optional. Defaults to 'latest'. Defines the ending block " +"(inclusive) in the filter block range. Special values 'latest' and " +"'pending' set a dynamic range that always includes the 'latest' or " +"'pending' blocks for the filter's upper block range." +msgstr "" + +#: ../../web3.contract.rst:313 +msgid "" +"``address`` optional. Defaults to the contract address. The filter " +"matches the event logs emanating from ``address``." +msgstr "" + +#: ../../web3.contract.rst:314 +msgid "" +"``argument_filters``, optional. Expects a dictionary of argument names " +"and values. When provided event logs are filtered for the event argument " +"values. Event arguments can be both indexed or unindexed. Indexed values " +"will be translated to their corresponding topic arguments. Unindexed " +"arguments will be filtered using a regular expression." +msgstr "" + +#: ../../web3.contract.rst:315 +msgid "" +"``topics`` optional, accepts the standard JSON-RPC topics argument. See " +"the JSON-RPC documentation for `eth_newFilter " +"`_ more " +"information on the ``topics`` parameters." +msgstr "" + +#: ../../web3.contract.rst:323 +msgid "" +"Creates a EventFilterBuilder instance with the event abi, and the " +"contract address if called from a deployed contract instance. The " +"EventFilterBuilder provides a convenient way to construct the filter " +"parameters with value checking against the event abi. It allows for " +"defining multiple match values or of single values through the match_any " +"and match_single methods." +msgstr "" + +#: ../../web3.contract.rst:334 +msgid "" +"The ``deploy`` method returns a :py:class:`web3.utils.filters.LogFilter` " +"instance from the filter parameters generated by the filter builder. " +"Defining multiple match values for array arguments can be accomplished " +"easily with the filter builder:" +msgstr "" + +#: ../../web3.contract.rst:341 +msgid "" +"The filter builder blocks already defined filter parameters from being " +"changed." +msgstr "" + +#: ../../web3.contract.rst:353 +msgid "" +"Encodes the arguments using the Ethereum ABI for the contract function " +"that matches the given ``abi_element_identifier`` and arguments ``args``." +" The ``data`` parameter defaults to the function selector." +msgstr "" + +#: ../../web3.contract.rst:364 +msgid "" +"Returns a list of all the events present in a Contract where every event " +"is an instance of :py:class:`ContractEvent`." +msgstr "" + +#: ../../web3.contract.rst:375 +msgid "" +"Searches for a distinct event with matching signature. Returns an " +"instance of :py:class:`ContractEvent` upon finding a match. Raises " +"``Web3ValueError`` if no match is found." +msgstr "" + +#: ../../web3.contract.rst:387 +msgid "" +"Searches for all events matching the provided name. Returns a list of " +"matching events where every event is an instance of " +":py:class:`ContractEvent`. Returns an empty list when no match is found." +msgstr "" + +#: ../../web3.contract.rst:399 +msgid "" +"Searches for a distinct event matching the name. Returns an instance of " +":py:class:`ContractEvent` upon finding a match. Raises ``Web3ValueError``" +" if no match is found or if multiple matches are found." +msgstr "" + +#: ../../web3.contract.rst:410 +msgid "" +"Searches for all events matching the provided selector. Returns a list of" +" matching events where every event is an instance of " +":py:class:`ContractEvent`. Returns an empty list when no match is found." +msgstr "" + +#: ../../web3.contract.rst:421 +msgid "" +"Searches for a distinct event with matching selector. The selector can be" +" a hexadecimal string, bytes or int. Returns an instance of " +":py:class:`ContractEvent` upon finding a match. Raises ``Web3ValueError``" +" if no match is found." +msgstr "" + +#: ../../web3.contract.rst:437 +msgid "" +"Searches for all events matching the provided topic. Returns a list of " +"matching events where every event is an instance of " +":py:class:`ContractEvent`. Returns an empty list when no match is found." +msgstr "" + +#: ../../web3.contract.rst:448 +msgid "" +"Searches for a distinct event with matching topic. The topic is a " +"hexadecimal string. Returns an instance of :py:class:`ContractEvent` upon" +" finding a match. Raises ``Web3ValueError`` if no match is found." +msgstr "" + +#: ../../web3.contract.rst:460 +msgid "" +"Returns a list of all the functions present in a Contract where every " +"function is an instance of :py:class:`ContractFunction`." +msgstr "" + +#: ../../web3.contract.rst:471 +msgid "" +"Searches for a distinct function with matching signature. Returns an " +"instance of :py:class:`ContractFunction` upon finding a match. Raises " +"``Web3ValueError`` if no match is found." +msgstr "" + +#: ../../web3.contract.rst:483 +msgid "" +"Searches for all functions matching the name. Returns a list of matching " +"functions where every function is an instance of " +":py:class:`ContractFunction`. Returns an empty list when no match is " +"found." +msgstr "" + +#: ../../web3.contract.rst:495 +msgid "" +"Searches for a distinct function with matching name. Returns an instance " +"of :py:class:`ContractFunction` upon finding a match. Raises " +"``Web3ValueError`` if no match is found or if multiple matches are found." +msgstr "" + +#: ../../web3.contract.rst:507 +msgid "" +"Searches for a distinct function with matching selector. The selector can" +" be a hexadecimal string, bytes or int. Returns an instance of " +":py:class:`ContractFunction` upon finding a match. Raises " +"``Web3ValueError`` if no match is found." +msgstr "" + +#: ../../web3.contract.rst:524 +msgid "" +"Searches for all function with matching args. Returns a list of matching " +"functions where every function is an instance of " +":py:class:`ContractFunction`. Returns an empty list when no match is " +"found." +msgstr "" + +#: ../../web3.contract.rst:536 +msgid "" +"Searches for a distinct function with matching args. Returns an instance " +"of :py:class:`ContractFunction` upon finding a match. Raises " +"``ValueError`` if no match is found or if multiple matches are found." +msgstr "" + +#: ../../web3.contract.rst:547 +msgid "" +"``Contract`` methods ``all_functions``, ``get_function_by_signature``, " +"``find_functions_by_name``, ``get_function_by_name``, " +"``get_function_by_selector``, ``find_functions_by_args`` and " +"``get_function_by_args`` can only be used when abi is provided to the " +"contract." +msgstr "" + +#: ../../web3.contract.rst:553 +msgid "" +"web3.py rejects the initialization of contracts that have more than one " +"function with the same selector or signature. eg. " +"``blockHashAddendsInexpansible(uint256)`` and " +"``blockHashAskewLimitary(uint256)`` have the same selector value equal to" +" ``0x00000000``. A contract containing both of these functions will be " +"rejected." +msgstr "" + +#: ../../web3.contract.rst:563 +msgid "Disabling Strict Checks for Bytes Types" +msgstr "" + +#: ../../web3.contract.rst:565 +msgid "" +"By default, web3 is strict when it comes to hex and bytes values, as of " +"``v6``. If an abi specifies a byte size, but the value that gets passed " +"in is not the specified size, web3 will invalidate the value. For " +"example, if an abi specifies a type of ``bytes4``, web3 will invalidate " +"the following values:" +msgstr "" + +#: ../../web3.contract.rst:570 +msgid "Invalid byte and hex strings with strict (default) bytes4 type checking" +msgstr "" + +#: ../../web3.contract.rst:574 ../../web3.contract.rst:610 +msgid "Input" +msgstr "" + +#: ../../web3.contract.rst:575 +msgid "Reason" +msgstr "" + +#: ../../web3.contract.rst:576 ../../web3.contract.rst:612 +msgid "``''``" +msgstr "" + +#: ../../web3.contract.rst:577 +msgid "" +"Needs to be prefixed with a \"0x\" to be interpreted as an empty hex " +"string" +msgstr "" + +#: ../../web3.contract.rst:578 +msgid "``2``" +msgstr "" + +#: ../../web3.contract.rst:579 +msgid "Wrong type" +msgstr "" + +#: ../../web3.contract.rst:580 +msgid "``'ah'``" +msgstr "" + +#: ../../web3.contract.rst:581 +msgid "String is not valid hex" +msgstr "" + +#: ../../web3.contract.rst:582 ../../web3.contract.rst:622 +#: ../../web3.contract.rst:626 +msgid "``'1234'``" +msgstr "" + +#: ../../web3.contract.rst:583 +msgid "" +"Needs to either be a bytestring (b'1234') or be a hex value of the right " +"size, prefixed with 0x (in this case: '0x31323334')" +msgstr "" + +#: ../../web3.contract.rst:584 ../../web3.contract.rst:616 +msgid "``b''``" +msgstr "" + +#: ../../web3.contract.rst:585 ../../web3.contract.rst:587 +#: ../../web3.contract.rst:589 ../../web3.contract.rst:591 +msgid "Needs to have exactly 4 bytes" +msgstr "" + +#: ../../web3.contract.rst:586 ../../web3.contract.rst:618 +msgid "``b'ab'``" +msgstr "" + +#: ../../web3.contract.rst:588 ../../web3.contract.rst:620 +msgid "``'0xab'``" +msgstr "" + +#: ../../web3.contract.rst:590 +msgid "``'0x6162636464'``" +msgstr "" + +#: ../../web3.contract.rst:593 +msgid "" +"However, you may want to be less strict with acceptable values for bytes " +"types. This may prove useful if you trust that values coming through are " +"what they are meant to be with respect to the ABI. In this case, the " +"automatic padding might be convenient for inferred types. For this, you " +"can set the :meth:`w3.strict_bytes_type_checking` flag to ``False``, " +"which is available on the Web3 instance. A Web3 instance which has this " +"flag set to ``False`` will have a less strict set of rules on which " +"values are accepted. A ``bytes`` type will allow values as a hex string, " +"a bytestring, or a regular Python string that can be decoded as a hex. " +"0x-prefixed hex strings are also not required." +msgstr "" + +#: ../../web3.contract.rst:603 +msgid "A Python string that is not prefixed with ``0x`` is valid." +msgstr "" + +#: ../../web3.contract.rst:604 +msgid "A bytestring whose length is less than the specified byte size is valid." +msgstr "" + +#: ../../web3.contract.rst:606 +msgid "Valid byte and hex strings for a non-strict bytes4 type" +msgstr "" + +#: ../../web3.contract.rst:611 +msgid "Normalizes to" +msgstr "" + +#: ../../web3.contract.rst:613 ../../web3.contract.rst:615 +#: ../../web3.contract.rst:617 +msgid "``b'\\x00\\x00\\x00\\x00'``" +msgstr "" + +#: ../../web3.contract.rst:614 +msgid "``'0x'``" +msgstr "" + +#: ../../web3.contract.rst:619 +msgid "``b'ab\\x00\\x00'``" +msgstr "" + +#: ../../web3.contract.rst:621 +msgid "``b'\\xab\\x00\\x00\\x00'``" +msgstr "" + +#: ../../web3.contract.rst:623 +msgid "``b'\\x124\\x00\\x00'``" +msgstr "" + +#: ../../web3.contract.rst:624 +msgid "``'0x61626364'``" +msgstr "" + +#: ../../web3.contract.rst:625 +msgid "``b'abcd'``" +msgstr "" + +#: ../../web3.contract.rst:627 +msgid "``b'1234'``" +msgstr "" + +#: ../../web3.contract.rst:630 +msgid "Taking the following contract code as an example:" +msgstr "" + +#: ../../web3.contract.rst:778 +msgid "Contract Functions" +msgstr "" + +#: ../../web3.contract.rst:780 +msgid "" +"The named functions exposed through the :py:attr:`Contract.functions` " +"property are of the ContractFunction type. This class is not to be used " +"directly, but instead through :py:attr:`Contract.functions`." +msgstr "" + +#: ../../web3.contract.rst:784 ../../web3.contract.rst:1104 +#: ../../web3.contract.rst:1408 +msgid "For example:" +msgstr "" + +#: ../../web3.contract.rst:791 +msgid "" +"If you have the function name in a variable, you might prefer this " +"alternative:" +msgstr "" + +#: ../../web3.contract.rst:799 +msgid "" +"You can also interact with contract functions without parentheses if the " +"function doesn't take any arguments. For example:" +msgstr "" + +#: ../../web3.contract.rst:809 +msgid "" +"In cases where functions are overloaded and use arguments of similar " +"types, a function may resolve to an undesired function when using the " +"method syntax. For example, given two functions with the same name that " +"take a single argument of differing types of ``bytes`` and ``bytes32``. " +"When a reference to :meth:`contract.functions.setBytes(b'1')` is used, " +"the function will resolve as the one that takes ``bytes``. If a value is " +"passed that was meant to be 32 bytes but the given argument was off by " +"one, the function reference will still use the one that takes ``bytes``." +msgstr "" + +#: ../../web3.contract.rst:817 +msgid "" +"When in doubt, use explicit function references to the signature. Use " +"bracket notation (:meth:`contract.functions[\"setBytes(bytes32)\"](b'')`)" +" or the contract API " +"`contract.get_function_by_signature(\"setBytes(bytes32)\")` to retrieve " +"the desired function. This will ensure an exception is raised if the " +"argument is not strictly 32 bytes in length." +msgstr "" + +#: ../../web3.contract.rst:826 ../../web3.contract.rst:1116 +msgid "Attributes" +msgstr "" + +#: ../../web3.contract.rst:828 +msgid "" +"The :py:class:`ContractFunction` class provides attributes for each " +"function. Access the function attributes through " +"`Contract.functions.myMethod`." +msgstr "" + +#: ../../web3.contract.rst:832 +msgid "" +"The signature of the function assigned to the class ``__name__`` during " +"initialization. Fallback and Receive functions will be assigned as " +"classes :py:class:`FallbackFn` or :py:class:`ReceiveFn` respectively." +msgstr "" + +#: ../../web3.contract.rst:838 +msgid "A string representing the function, receive or fallback name." +msgstr "" + +#: ../../web3.contract.rst:840 +msgid "" +"Use :py:attr:`ContractFunction.signature` when the function arguments are" +" needed." +msgstr "" + +#: ../../web3.contract.rst:842 +msgid "This is an alias of :py:attr:`ContractFunction.fn_name`." +msgstr "" + +#: ../../web3.contract.rst:846 +msgid "A string representing the function, receive or fallback signature." +msgstr "" + +#: ../../web3.contract.rst:850 +msgid "A HexStr encoded from the first four bytes of the function signature." +msgstr "" + +#: ../../web3.contract.rst:854 +msgid "The function ABI with the type, name, inputs and outputs." +msgstr "" + +#: ../../web3.contract.rst:858 +msgid "" +"A tuple of all function inputs, normalized so that `kwargs` themselves " +"are flattened into a tuple as returned by " +":py:meth:`eth_utils.abi.get_normalized_abi_inputs`." +msgstr "" + +#: ../../web3.contract.rst:863 +msgid "The function input names." +msgstr "" + +#: ../../web3.contract.rst:867 +msgid "The function input types." +msgstr "" + +#: ../../web3.contract.rst:872 +msgid "" +":py:class:`ContractFunction` provides methods to interact with contract " +"functions. Positional and keyword arguments supplied to the contract " +"function subclass will be used to find the contract function by " +"signature, and forwarded to the contract function when applicable." +msgstr "" + +#: ../../web3.contract.rst:877 +msgid "" +"`EIP-3668 `_ introduced support " +"for the ``OffchainLookup`` revert / CCIP Read support. CCIP Read is set " +"to ``True`` for calls by default, as recommended in EIP-3668. This is " +"done via a global ``global_ccip_read_enabled`` flag on the provider. If " +"raising the ``OffchainLookup`` revert is preferred for a specific call, " +"the ``ccip_read_enabled`` flag on the call may be set to ``False``." +msgstr "" + +#: ../../web3.contract.rst:888 +msgid "" +"Disabling CCIP Read support can be useful if a transaction needs to be " +"sent to the callback function. In such cases, \"preflighting\" with an " +"``eth_call``, handling the ``OffchainLookup``, and sending the data via a" +" transaction may be necessary. See :ref:`ccip-read-example` in the " +"examples section for how to preflight a transaction with a contract call." +msgstr "" + +#: ../../web3.contract.rst:892 +msgid "" +"Similarly, if CCIP Read is globally set to ``False`` via the " +"``global_ccip_read_enabled`` flag on the provider, it may be enabled on a" +" per-call basis - overriding the global flag. This ensures only " +"explicitly enabled calls will handle the ``OffchainLookup`` revert " +"appropriately." +msgstr "" + +#: ../../web3.contract.rst:904 +msgid "" +"If the function called results in a ``revert`` error, a " +"``ContractLogicError`` will be raised. If there is an error message with " +"the error, web3.py attempts to parse the message that comes back and " +"return it to the user as the error string. As of v6.3.0, the raw data is " +"also returned and can be accessed via the ``data`` attribute on " +"``ContractLogicError``." +msgstr "" + +#: ../../web3.contract.rst:912 +msgid "Execute the specified function by sending a new public transaction." +msgstr "" + +#: ../../web3.contract.rst:914 ../../web3.contract.rst:950 +#: ../../web3.contract.rst:1002 ../../web3.contract.rst:1029 +msgid "Refer to the following invocation:" +msgstr "" + +#: ../../web3.contract.rst:920 +msgid "" +"The first portion of the function call ``myMethod(*args, **kwargs)`` " +"selects the appropriate contract function based on the name and provided " +"argument. Arguments can be provided as positional arguments, keyword " +"arguments, or a mix of the two." +msgstr "" + +#: ../../web3.contract.rst:925 +msgid "" +"The end portion of this function call ``transact(transaction)`` takes a " +"single parameter which should be a python dictionary conforming to the " +"same format as the ``web3.eth.send_transaction(transaction)`` method. " +"This dictionary may not contain the keys ``data``." +msgstr "" + +#: ../../web3.contract.rst:930 +msgid "" +"If any of the ``args`` or ``kwargs`` specified in the ABI are an " +"``address`` type, they will accept ENS names." +msgstr "" + +#: ../../web3.contract.rst:933 +msgid "" +"If a ``gas`` value is not provided, then the ``gas`` value for the method" +" transaction will be created using the ``web3.eth.estimate_gas()`` " +"method." +msgstr "" + +#: ../../web3.contract.rst:937 +msgid "Returns the transaction hash." +msgstr "" + +#: ../../web3.contract.rst:947 ../../web3.contract.rst:999 +msgid "" +"Call a contract function, executing the transaction locally using the " +"``eth_call`` API. This will not create a new public transaction." +msgstr "" + +#: ../../web3.contract.rst:956 ../../web3.contract.rst:1008 +msgid "" +"This method behaves the same as the :py:meth:`ContractFunction.transact` " +"method, with transaction details being passed into the end portion of the" +" function call, and function arguments being passed into the first " +"portion." +msgstr "" + +#: ../../web3.contract.rst:960 +msgid "Returns the return value of the executed function." +msgstr "" + +#: ../../web3.contract.rst:971 +msgid "" +"You can call the method at a historical block using ``block_identifier``." +" Some examples:" +msgstr "" + +#: ../../web3.contract.rst:992 +msgid "" +"Passing the ``block_identifier`` parameter for past block numbers " +"requires that your Ethereum API node is running in the more expensive " +"archive node mode. Normally synced Ethereum nodes will fail with a " +"\"missing trie node\" error, because Ethereum node may have purged the " +"past state from its database. `More information about archival nodes here" +" `_." +msgstr "" + +#: ../../web3.contract.rst:1021 +#, python-brace-format +msgid "" +"The parameter ``block_identifier`` is not enabled in geth nodes, hence " +"passing a value of ``block_identifier`` when connected to a geth nodes " +"would result in an error like: ``ValueError: {'code': -32602, 'message':" +" 'too many arguments, want at most 1'}``" +msgstr "" + +#: ../../web3.contract.rst:1027 +msgid "" +"Builds a transaction dictionary based on the contract function call " +"specified." +msgstr "" + +#: ../../web3.contract.rst:1035 +msgid "" +"This method behaves the same as the :py:meth:`Contract.transact` method, " +"with transaction details being passed into the end portion of the " +"function call, and function arguments being passed into the first " +"portion." +msgstr "" + +#: ../../web3.contract.rst:1040 +msgid "" +"`nonce` is not returned as part of the transaction dictionary unless it " +"is specified in the first portion of the function call:" +msgstr "" + +#: ../../web3.contract.rst:1047 +msgid "" +"You may use :meth:`~web3.eth.Eth.getTransactionCount` to get the current " +"nonce for an account. Therefore a shortcut for producing a transaction " +"dictionary with nonce included looks like:" +msgstr "" + +#: ../../web3.contract.rst:1055 +msgid "" +"Returns a transaction dictionary. This transaction dictionary can then be" +" sent using :meth:`~web3.eth.Eth.send_transaction`." +msgstr "" + +#: ../../web3.contract.rst:1058 +msgid "" +"Additionally, the dictionary may be used for offline transaction signing " +"using :meth:`~web3.eth.account.Account.sign_transaction`." +msgstr "" + +#: ../../web3.contract.rst:1077 +msgid "Fallback Function" +msgstr "" + +#: ../../web3.contract.rst:1079 +msgid "" +"The Contract Factory also offers an API to interact with the fallback " +"function, which supports four methods like normal functions:" +msgstr "" + +#: ../../web3.contract.rst:1084 +msgid "" +"Call fallback function, executing the transaction locally using the " +"``eth_call`` API. This will not create a new public transaction." +msgstr "" + +#: ../../web3.contract.rst:1089 +msgid "Call fallback function and return the gas estimation." +msgstr "" + +#: ../../web3.contract.rst:1093 +msgid "Execute fallback function by sending a new public transaction." +msgstr "" + +#: ../../web3.contract.rst:1097 +msgid "" +"Builds a transaction dictionary based on the contract fallback function " +"call." +msgstr "" + +#: ../../web3.contract.rst:1100 +msgid "Contract Events" +msgstr "" + +#: ../../web3.contract.rst:1102 +msgid "" +"The named events exposed through the :py:attr:`Contract.events` property " +"are of the ContractEvent type. This class is not to be used directly, but" +" instead through :py:attr:`Contract.events`." +msgstr "" + +#: ../../web3.contract.rst:1118 +msgid "" +"The :py:class:`ContractEvent` class provides attributes for each event. " +"Access the event attributes through `Contract.events.MyEvent`." +msgstr "" + +#: ../../web3.contract.rst:1122 +msgid "" +"The signature of the event assigned to the class ``__name__`` during " +"initialization." +msgstr "" + +#: ../../web3.contract.rst:1126 +msgid "A string representing the event, receive or fallback name." +msgstr "" + +#: ../../web3.contract.rst:1128 +msgid "" +"Use :py:attr:`ContractEvent.MyEvent(*args, **kwargs).signature` when the " +"event arguments are needed." +msgstr "" + +#: ../../web3.contract.rst:1130 +msgid "" +"This is an alias of :py:attr:`ContractEvent.MyEvent(*args, " +"**kwargs).event_name`." +msgstr "" + +#: ../../web3.contract.rst:1134 +msgid "A string representing the event signature." +msgstr "" + +#: ../../web3.contract.rst:1138 +msgid "The event ABI with the type, name, inputs." +msgstr "" + +#: ../../web3.contract.rst:1142 +msgid "The event input names." +msgstr "" + +#: ../../web3.contract.rst:1146 +msgid "The event input types." +msgstr "" + +#: ../../web3.contract.rst:1150 +msgid "" +"The event topic represented by a hex encoded string from the keccak " +"signature." +msgstr "" + +#: ../../web3.contract.rst:1155 +msgid "" +":py:class:`ContractEvent` provides methods to interact with contract " +"events. Positional and keyword arguments supplied to the contract event " +"subclass will be used to find the contract event by signature." +msgstr "" + +#: ../../web3.contract.rst:1162 +msgid "" +"Fetches all logs for a given event within the specified block range or " +"block hash." +msgstr "" + +#: ../../web3.contract.rst:1164 +msgid "Returns a list of decoded event logs sorted by ``logIndex``." +msgstr "" + +#: ../../web3.contract.rst:1166 +msgid "" +"``argument_filters`` is an optional dictionary argument that can be used " +"to filter for logs where the event's argument values match the values " +"provided in the dictionary. The keys must match the event argument names " +"as they exist in the ABI. The values can either be a single value or a " +"list of values to match against. If a list is provided, the logs will be " +"filtered for any logs that match any of the values in the list. Indexed " +"arguments are filtered pre-call by building specific ``topics`` to filter" +" for. Non-indexed arguments are filtered by the library after the logs " +"are fetched from the node." +msgstr "" + +#: ../../web3.contract.rst:1192 +msgid "Extracts the pertinent logs from a transaction receipt." +msgstr "" + +#: ../../web3.contract.rst:1194 +msgid "" +"If there are no errors, ``process_receipt`` returns a tuple of " +":ref:`Event Log Objects `, emitted from the event (e.g." +" ``MyEvent``), with decoded output." +msgstr "" + +#: ../../web3.contract.rst:1205 +msgid "" +"If there are errors, the logs will be handled differently depending on " +"the flag that is passed in:" +msgstr "" + +#: ../../web3.contract.rst:1207 +msgid "" +"``WARN`` (default) - logs a warning to the console for the log that has " +"an error, and discards the log. Returns any logs that are able to be " +"processed." +msgstr "" + +#: ../../web3.contract.rst:1208 +msgid "``STRICT`` - stops all processing and raises the error encountered." +msgstr "" + +#: ../../web3.contract.rst:1209 +msgid "" +"``IGNORE`` - returns any raw logs that raised an error with an added " +"\"errors\" field, along with any other logs were able to be processed." +msgstr "" + +#: ../../web3.contract.rst:1210 +msgid "" +"``DISCARD`` - silently discards any logs that have errors, and returns " +"processed logs that don't have errors." +msgstr "" + +#: ../../web3.contract.rst:1212 +msgid "An event log error flag needs to be imported from ``web3/logs.py``." +msgstr "" + +#: ../../web3.contract.rst:1260 +msgid "" +"Similar to process_receipt_, but only processes one log at a time, " +"instead of a whole transaction receipt. Will return a single :ref:`Event " +"Log Object ` if there are no errors encountered during " +"processing. If an error is encountered during processing, it will be " +"raised." +msgstr "" + +#: ../../web3.contract.rst:1285 +msgid "Event Log Object" +msgstr "" + +#: ../../web3.contract.rst:1287 +msgid "The Event Log Object is a python dictionary with the following keys:" +msgstr "" + +#: ../../web3.contract.rst:1289 +msgid "``args``: Dictionary - The arguments coming from the event." +msgstr "" + +#: ../../web3.contract.rst:1290 +msgid "``event``: String - The event name." +msgstr "" + +#: ../../web3.contract.rst:1291 +msgid "``logIndex``: Number - integer of the log index position in the block." +msgstr "" + +#: ../../web3.contract.rst:1292 +msgid "" +"``transactionIndex``: Number - integer of the transactions index position" +" log was created from." +msgstr "" + +#: ../../web3.contract.rst:1294 +msgid "" +"``transactionHash``: String, 32 Bytes - hash of the transactions this log" +" was created from." +msgstr "" + +#: ../../web3.contract.rst:1296 +msgid "``address``: String, 32 Bytes - address from which this log originated." +msgstr "" + +#: ../../web3.contract.rst:1297 +msgid "" +"``blockHash``: String, 32 Bytes - hash of the block where this log was " +"in. null when it's pending." +msgstr "" + +#: ../../web3.contract.rst:1299 +msgid "" +"``blockNumber``: Number - the block number where this log was in. null " +"when it's pending." +msgstr "" + +#: ../../web3.contract.rst:1377 +msgid "Utils" +msgstr "" + +#: ../../web3.contract.rst:1381 +msgid "" +"Decodes the transaction data used to invoke a smart contract function, " +"and returns :py:class:`ContractFunction` and decoded parameters as " +":py:class:`dict`." +msgstr "" + +#: ../../web3.contract.rst:1399 +msgid "ContractCaller" +msgstr "" + +#: ../../web3.contract.rst:1403 +msgid "" +"The ``ContractCaller`` class provides an API to call functions in a " +"contract. This class is not to be used directly, but instead through " +"``Contract.caller``." +msgstr "" + +#: ../../web3.contract.rst:1406 +msgid "There are a number of different ways to invoke the ``ContractCaller``." +msgstr "" + +#: ../../web3.contract.rst:1429 +msgid "It can also be invoked using parentheses:" +msgstr "" + +#: ../../web3.contract.rst:1437 +msgid "" +"And a transaction dictionary, with or without the ``transaction`` " +"keyword. You can also optionally include a block identifier. For example:" +msgstr "" + +#: ../../web3.contract.rst:1453 +msgid "" +"Like :py:class:`ContractFunction`, :py:class:`ContractCaller` provides " +"methods to interact with contract functions. Positional and keyword " +"arguments supplied to the contract caller subclass will be used to find " +"the contract function by signature, and forwarded to the contract " +"function when applicable." +msgstr "" + +#: ../../web3.contract.rst:1461 +msgid "Examples" +msgstr "" + +#: ../../web3.contract.rst:1464 +msgid "Working with an ERC-20 Token Contract" +msgstr "" + +#: ../../web3.contract.rst:1466 +msgid "" +"Most fungible tokens on the Ethereum blockchain conform to the `ERC-20`_ " +"standard. This section of the guide covers interacting with an existing " +"token contract which conforms to this standard." +msgstr "" + +#: ../../web3.contract.rst:1492 +msgid "" +"In this guide we will interact with an existing token contract that we " +"have already deployed to a local testing chain. This guide assumes:" +msgstr "" + +#: ../../web3.contract.rst:1495 +msgid "An existing token contract at a known address." +msgstr "" + +#: ../../web3.contract.rst:1496 +msgid "Access to the proper ``ABI`` for the given contract." +msgstr "" + +#: ../../web3.contract.rst:1497 +msgid "" +"A ``web3.main.Web3`` instance connected to a provider with an unlocked " +"account which can send transactions." +msgstr "" + +#: ../../web3.contract.rst:1501 +msgid "Creating the contract factory" +msgstr "" + +#: ../../web3.contract.rst:1503 +msgid "" +"First we need to create a contract instance with the address of our token" +" contract and the ``ERC-20`` ABI." +msgstr "" + +#: ../../web3.contract.rst:1514 +msgid "Querying token metadata" +msgstr "" + +#: ../../web3.contract.rst:1516 +msgid "" +"Each token will have a total supply which represents the total number of " +"tokens in circulation. In this example we've initialized the token " +"contract to have 1 million tokens. Since this token contract is setup to" +" have 18 decimal places, the raw total supply returned by the contract is" +" going to have 18 additional decimal places." +msgstr "" + +#: ../../web3.contract.rst:1537 +msgid "Query account balances" +msgstr "" + +#: ../../web3.contract.rst:1539 +msgid "" +"Next we can query some account balances using the contract's " +"``balanceOf`` function. The token contract we are using starts with a " +"single account which we'll refer to as ``alice`` holding all of the " +"tokens." +msgstr "" + +#: ../../web3.contract.rst:1557 +msgid "Sending tokens" +msgstr "" + +#: ../../web3.contract.rst:1559 +msgid "" +"Next we can transfer some tokens from ``alice`` to ``bob`` using the " +"contract's ``transfer`` function." +msgstr "" + +#: ../../web3.contract.rst:1574 +msgid "Creating an approval for external transfers" +msgstr "" + +#: ../../web3.contract.rst:1576 +msgid "" +"Alice could also *approve* someone else to spend tokens from her account " +"using the ``approve`` function. We can also query how many tokens we're " +"approved to spend using the ``allowance`` function." +msgstr "" + +#: ../../web3.contract.rst:1591 +msgid "Performing an external transfer" +msgstr "" + +#: ../../web3.contract.rst:1593 +msgid "" +"When someone has an allowance they can transfer those tokens using the " +"``transferFrom`` function." +msgstr "" + +#: ../../web3.contract.rst:1614 +msgid "Using a struct as a function argument" +msgstr "" + +#: ../../web3.contract.rst:1616 +msgid "" +"web3.py accepts struct arguments as dictionaries. This format also " +"supports nested structs. Let's take a look at a quick example. Given the " +"following Solidity contract:" +msgstr "" + +#: ../../web3.contract.rst:1649 +msgid "You can interact with the web3.py contract API as follows:" +msgstr "" + +#: ../../web3.contract.rst:1667 +msgid "Invoke Ambiguous Contract Functions" +msgstr "" + +#: ../../web3.contract.rst:1669 +msgid "" +"Calling overloaded functions can be done as you would expect. Passing " +"arguments will disambiguate which function you want to call." +msgstr "" + +#: ../../web3.contract.rst:1672 +msgid "" +"For example, if you have a contract with two functions with the name " +"``identity`` that accept different types of arguments, you can call them " +"like this:" +msgstr "" + +#: ../../web3.contract.rst:1683 +msgid "" +"If there is a need to first retrieve the function, you can use the " +"contract instance's ``get_function_by_signature`` method to get the " +"function you want to call." +msgstr "" + +#: ../../web3.contract.rst:1686 +msgid "" +"Below is an example of a contract that has multiple functions of the same" +" name, and the arguments are ambiguous. You can use the " +":meth:`Contract.get_function_by_signature` method to reference the " +"intended function and call it with the correct arguments." +msgstr "" + +#: ../../web3.contract.rst:1715 +msgid "CCIP Read support for offchain lookup" +msgstr "" + +#: ../../web3.contract.rst:1717 +msgid "" +"Contract calls support CCIP Read by default, via a ``ccip_read_enabled`` " +"flag on the call and, more globally, a ``global_ccip_read_enabled`` flag " +"on the provider. The following should work by default without raising an " +"``OffchainLookup`` and instead handling it appropriately as per the " +"specification outlined in `EIP-3668 " +"`_." +msgstr "" + +#: ../../web3.contract.rst:1726 +msgid "" +"If the offchain lookup requires the user to send a transaction rather " +"than make a call, this may be handled appropriately in the following way:" +msgstr "" + +#: ../../web3.contract.rst:1751 +msgid "Contract Unit Tests in Python" +msgstr "" + +#: ../../web3.contract.rst:1753 +msgid "" +"Here is an example of how one can use the `pytest`_ framework in python, " +"web3.py, eth-tester, and PyEVM to perform unit tests entirely in python " +"without any additional need for a full featured ethereum node/client. To " +"install needed dependencies you can use the pinned extra for testing:" +msgstr "" + +#: ../../web3.contract.rst:1764 +msgid "" +"Once you have an environment set up for testing, you can then write your " +"tests like so:" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.eth.account.po b/docs/locales/zh_CN/LC_MESSAGES/web3.eth.account.po new file mode 100644 index 0000000000..175b887151 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.eth.account.po @@ -0,0 +1,391 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.eth.account.rst:4 +msgid "Accounts" +msgstr "账户" + +#: ../../web3.eth.account.rst:9 +msgid "Local vs Hosted Nodes" +msgstr "" + +#: ../../web3.eth.account.rst:11 +msgid "Hosted Node" +msgstr "" + +#: ../../web3.eth.account.rst:12 +msgid "" +"A **hosted** node is controlled by someone else. You may also see these " +"referred to as **remote** nodes. View a list of commercial `node " +"providers `_." +msgstr "" + +#: ../../web3.eth.account.rst:15 +msgid "Local Node" +msgstr "" + +#: ../../web3.eth.account.rst:16 +msgid "" +"A **local** node is started and controlled by you on your computer. For " +"several reasons (e.g., privacy, security), this is the recommended path, " +"but it requires more resources and work to set up and maintain. See " +"`ethereum.org `_ for a guided tour." +msgstr "" + +#: ../../web3.eth.account.rst:21 +msgid "Local vs Hosted Keys" +msgstr "" + +#: ../../web3.eth.account.rst:23 +msgid "" +"An Ethereum private key is a 256-bit (32 bytes) random integer. For each " +"private key, you get one Ethereum address, also known as an Externally " +"Owned Account (EOA)." +msgstr "" + +#: ../../web3.eth.account.rst:27 +msgid "" +"In Python, the private key is expressed as a 32-byte long Python " +"``bytes`` object. When a private key is presented to users in a " +"hexadecimal format, it may or may not contain a starting ``0x`` " +"hexadecimal prefix." +msgstr "" + +#: ../../web3.eth.account.rst:31 +msgid "Local Private Key" +msgstr "" + +#: ../../web3.eth.account.rst:32 +msgid "" +"A local private key is a locally stored secret you import to your Python " +"application. Please read below how you can create and import a local " +"private key and use it to sign transactions." +msgstr "" + +#: ../../web3.eth.account.rst:36 +msgid "Hosted Private Key" +msgstr "" + +#: ../../web3.eth.account.rst:37 +msgid "" +"This is a legacy way to use accounts when working with unit test backends" +" like ``EthereumTesterProvider`` or `Anvil " +"`_. Calling " +"``web3.eth.accounts`` gives you a predefined list of accounts that have " +"been funded with test ETH. You can use " +":meth:`~web3.eth.Eth.send_transaction` on any of these accounts without " +"further configuration." +msgstr "" + +#: ../../web3.eth.account.rst:44 +msgid "" +"In the past, around 2015, this was also a way to use private keys in a " +"locally hosted node, but this practice is now discouraged." +msgstr "" + +#: ../../web3.eth.account.rst:49 +msgid "" +"``web3.eth.send_transaction`` does not work with modern node providers, " +"because they relied on a node state and all modern nodes are stateless. " +"You must always use local private keys when working with nodes hosted by " +"someone else." +msgstr "" + +#: ../../web3.eth.account.rst:56 +msgid "Some Common Uses for Local Private Keys" +msgstr "" + +#: ../../web3.eth.account.rst:58 +msgid "" +"A very common reason to work with local private keys is to interact with " +"a hosted node." +msgstr "" + +#: ../../web3.eth.account.rst:61 +msgid "Some common things you might want to do with a `Local Private Key` are:" +msgstr "" + +#: ../../web3.eth.account.rst:63 +msgid "`Sign a Transaction`_" +msgstr "" + +#: ../../web3.eth.account.rst:64 +msgid "`Sign a Contract Transaction`_" +msgstr "" + +#: ../../web3.eth.account.rst:65 +msgid "`Sign a Message`_" +msgstr "" + +#: ../../web3.eth.account.rst:66 +msgid "`Verify a Message`_" +msgstr "" + +#: ../../web3.eth.account.rst:68 +msgid "" +"Using private keys usually involves ``w3.eth.account`` in one way or " +"another. Read on for more, or see a full list of things you can do in the" +" docs for :class:`eth_account.Account `." +msgstr "" + +#: ../../web3.eth.account.rst:74 +msgid "Creating a Private Key" +msgstr "" + +#: ../../web3.eth.account.rst:76 +msgid "" +"Each Ethereum address has a matching private key. To create a new " +"Ethereum account you can just generate a random number that acts as a " +"private key." +msgstr "" + +#: ../../web3.eth.account.rst:79 +msgid "" +"A private key is just a random unguessable, or cryptographically safe, " +"256-bit integer number" +msgstr "" + +#: ../../web3.eth.account.rst:81 +msgid "" +"A valid private key is > 0 and < max private key value (a number above " +"the elliptic curve order FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 " +"AF48A03B BFD25E8C D0364141)" +msgstr "" + +#: ../../web3.eth.account.rst:83 +msgid "Private keys do not have checksums." +msgstr "" + +#: ../../web3.eth.account.rst:85 +msgid "To create a private key using web3.py and command line you can do:" +msgstr "" + +#: ../../web3.eth.account.rst:91 +msgid "Which outputs a new private key and an account pair::" +msgstr "" + +#: ../../web3.eth.account.rst:95 +msgid "" +"*Never store private key with your source*. Use environment variables to " +"store the key. Read more below." +msgstr "" + +#: ../../web3.eth.account.rst:98 +msgid "" +"You can also import the raw hex private key to MetaMask and any other " +"wallet - the private key can be shared between your Python code and any " +"number of wallets." +msgstr "" + +#: ../../web3.eth.account.rst:104 +msgid "Funding a New Account" +msgstr "" + +#: ../../web3.eth.account.rst:106 +msgid "" +"If you create a private key, it comes with its own Ethereum address. By " +"default, the balance of this address is zero. Before you can send any " +"transactions with your account, you need to top up." +msgstr "" + +#: ../../web3.eth.account.rst:111 +msgid "" +"For a local test environment (e.g., ``EthereumTesterProvider``), any " +"environment is bootstrapped with accounts that have test ETH in them. " +"Move ETH from default accounts to your newly created account." +msgstr "" + +#: ../../web3.eth.account.rst:115 +msgid "" +"For public mainnet, you need to buy ETH in a cryptocurrency exchange and " +"send it to your privately controlled account." +msgstr "" + +#: ../../web3.eth.account.rst:118 +msgid "For a testnet, find a relevant testnet :ref:`faucet `." +msgstr "" + +#: ../../web3.eth.account.rst:122 +msgid "Reading a Private Key from an Environment Variable" +msgstr "" + +#: ../../web3.eth.account.rst:124 +msgid "" +"In this example we pass the private key to our Python application in an " +"`environment variable " +"`_. This private key " +"is then added to the transaction signing keychain with ``Signing`` " +"middleware." +msgstr "" + +#: ../../web3.eth.account.rst:129 +msgid "" +"If unfamiliar, note that you can `export your private keys from Metamask " +"and other wallets `_." +msgstr "" + +#: ../../web3.eth.account.rst:133 +msgid "**Never** share your private keys." +msgstr "" + +#: ../../web3.eth.account.rst:134 +msgid "**Never** put your private keys in source code." +msgstr "" + +#: ../../web3.eth.account.rst:135 +msgid "**Never** commit private keys to a Git repository." +msgstr "" + +#: ../../web3.eth.account.rst:137 +msgid "Example ``account_test_script.py``" +msgstr "" + +#: ../../web3.eth.account.rst:162 +msgid "Example how to run this in UNIX shell:" +msgstr "" + +#: ../../web3.eth.account.rst:176 +msgid "This will print::" +msgstr "" + +#: ../../web3.eth.account.rst:184 +msgid "Extract private key from geth keyfile" +msgstr "" + +#: ../../web3.eth.account.rst:187 +msgid "The amount of available ram should be greater than 1GB." +msgstr "" + +#: ../../web3.eth.account.rst:198 +msgid "Sign a Message" +msgstr "" + +#: ../../web3.eth.account.rst:200 +msgid "" +"There is no single message format that is broadly adopted with community " +"consensus. Keep an eye on several options, like `EIP-683 " +"`_, `EIP-712 " +"`_, and `EIP-719 " +"`_. Consider the " +":meth:`w3.eth.sign() ` approach be deprecated." +msgstr "" + +#: ../../web3.eth.account.rst:207 +msgid "" +"For this example, we will use the same message hashing mechanism that is " +"provided by :meth:`w3.eth.sign() `." +msgstr "" + +#: ../../web3.eth.account.rst:229 +msgid "Verify a Message" +msgstr "" + +#: ../../web3.eth.account.rst:231 +msgid "With the original message text and a signature:" +msgstr "" + +#: ../../web3.eth.account.rst:241 +msgid "Prepare message for ecrecover in Solidity" +msgstr "" + +#: ../../web3.eth.account.rst:243 +msgid "" +"Let's say you want a contract to validate a signed message, like if " +"you're making payment channels, and you want to validate the value in " +"Remix or web3.js." +msgstr "" + +#: ../../web3.eth.account.rst:247 +msgid "" +"You might have produced the signed_message locally, as in `Sign a " +"Message`_. If so, this will prepare it for Solidity:" +msgstr "" + +#: ../../web3.eth.account.rst:272 +msgid "" +"Instead, you might have received a message and a signature encoded to " +"hex. Then this will prepare it for Solidity:" +msgstr "" + +#: ../../web3.eth.account.rst:310 +msgid "Verify a message with ecrecover in Solidity" +msgstr "" + +#: ../../web3.eth.account.rst:312 +msgid "" +"Create a simple ecrecover contract in `Remix " +"`_:" +msgstr "" + +#: ../../web3.eth.account.rst:325 +msgid "" +"Then call ecr with these arguments from `Prepare message for ecrecover in" +" Solidity`_ in Remix, " +"``\"0x1476abb745d423bf09273f1afd887d951181d25adc66c4834a70491911b7f750\"," +" 28, " +"\"0xe6ca9bba58c88611fad66a6ce8f996908195593807c4b38bd528d2cff09d4eb3\", " +"\"0x3e5bfbbf4d3e39b1a2fd816a7680c19ebebaf3a141b239934ad43cb33fcec8ce\"``" +msgstr "" + +#: ../../web3.eth.account.rst:328 +msgid "" +"The message is verified, because we get the correct sender of the message" +" back in response: ``0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12e``." +msgstr "" + +#: ../../web3.eth.account.rst:335 +msgid "Sign a Transaction" +msgstr "" + +#: ../../web3.eth.account.rst:337 +msgid "" +"Create a transaction, sign it locally, and then send it to your node for " +"broadcasting, with :meth:`~web3.eth.Eth.send_raw_transaction`." +msgstr "" + +#: ../../web3.eth.account.rst:384 +msgid "Sign a Contract Transaction" +msgstr "" + +#: ../../web3.eth.account.rst:386 +msgid "To sign a transaction locally that will invoke a smart contract:" +msgstr "" + +#: ../../web3.eth.account.rst:388 +msgid "Initialize your :meth:`Contract ` object" +msgstr "" + +#: ../../web3.eth.account.rst:389 +msgid "Build the transaction" +msgstr "" + +#: ../../web3.eth.account.rst:390 +msgid "" +"Sign the transaction, with :meth:`w3.eth.account.sign_transaction() " +"`" +msgstr "" + +#: ../../web3.eth.account.rst:392 +msgid "Broadcast the transaction with :meth:`~web3.eth.Eth.send_raw_transaction`" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.eth.po b/docs/locales/zh_CN/LC_MESSAGES/web3.eth.po new file mode 100644 index 0000000000..233497e669 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.eth.po @@ -0,0 +1,1139 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.eth.rst:4 +msgid "web3.eth API" +msgstr "" + +#: ../../web3.eth.rst:10 +msgid "" +"The ``web3.eth`` object exposes the following properties and methods to " +"interact with the RPC APIs under the ``eth_`` namespace." +msgstr "" + +#: ../../web3.eth.rst:13 +msgid "" +"By default, when a property or method returns a mapping of keys to " +"values, it will return an ``AttributeDict`` which acts like a ``dict`` " +"but you can access the keys as attributes and cannot modify its fields. " +"For example, you can find the latest block number in these two ways:" +msgstr "" + +#: ../../web3.eth.rst:36 +msgid "" +"This feature is available via the ``AttributeDictMiddleware`` which is a " +"default middleware." +msgstr "" + +#: ../../web3.eth.rst:40 +msgid "" +"Accessing an ``AttributeDict`` property via attribute will break type " +"hinting. If typing is crucial for your application, accessing via key / " +"value, as well as removing the ``AttributeDictMiddleware`` altogether, " +"may be desired." +msgstr "" + +#: ../../web3.eth.rst:46 +msgid "Properties" +msgstr "" + +#: ../../web3.eth.rst:48 +msgid "The following properties are available on the ``web3.eth`` namespace." +msgstr "" + +#: ../../web3.eth.rst:53 +msgid "" +"The ethereum address that will be used as the default ``from`` address " +"for all transactions. Defaults to empty." +msgstr "" + +#: ../../web3.eth.rst:59 +msgid "" +"The default block number that will be used for any RPC methods that " +"accept a block identifier. Defaults to ``'latest'``." +msgstr "" + +#: ../../web3.eth.rst:65 +msgid "Delegates to ``eth_syncing`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:67 +msgid "" +"Returns either ``False`` if the node is not syncing or a dictionary " +"showing sync status." +msgstr "" + +#: ../../web3.eth.rst:84 +msgid "Delegates to ``eth_maxPriorityFeePerGas`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:86 +msgid "" +"Returns a suggestion for a max priority fee for dynamic fee transactions " +"in Wei." +msgstr "" + +#: ../../web3.eth.rst:96 +msgid "Delegates to ``eth_gasPrice`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:98 +msgid "Returns the current gas price in Wei." +msgstr "" + +#: ../../web3.eth.rst:108 +msgid "Delegates to ``eth_accounts`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:110 +msgid "Returns the list of known accounts." +msgstr "" + +#: ../../web3.eth.rst:120 ../../web3.eth.rst:179 +msgid "Delegates to ``eth_blockNumber`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:122 +msgid "Returns the number of the most recent block" +msgstr "" + +#: ../../web3.eth.rst:124 +msgid "Alias for :meth:`~web3.eth.Eth.get_block_number`" +msgstr "" + +#: ../../web3.eth.rst:134 +msgid "Delegates to ``eth_chainId`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:136 +msgid "" +"Returns an integer value for the currently configured \"Chain Id\" value " +"introduced in `EIP-155 " +"`_. Returns" +" ``None`` if no Chain Id is available." +msgstr "" + +#: ../../web3.eth.rst:145 +msgid "" +"This property gets called frequently in validation middleware, but " +"`eth_chainId` is an allowed method for caching by default. Simply turn on" +" request caching to avoid repeated calls to this method." +msgstr "" + +#: ../../web3.eth.rst:157 +msgid "Methods" +msgstr "" + +#: ../../web3.eth.rst:159 +msgid "The following methods are available on the ``web3.eth`` namespace." +msgstr "" + +#: ../../web3.eth.rst:164 +msgid "Delegates to ``eth_getBalance`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:166 +msgid "" +"Returns the balance of the given ``account`` at the block specified by " +"``block_identifier``." +msgstr "" + +#: ../../web3.eth.rst:169 ../../web3.eth.rst:196 ../../web3.eth.rst:224 +#: ../../web3.eth.rst:326 ../../web3.eth.rst:652 ../../web3.eth.rst:871 +#: ../../web3.eth.rst:905 +msgid "``account`` may be a checksum address or an ENS name" +msgstr "" + +#: ../../web3.eth.rst:181 +msgid "Returns the number of the most recent block." +msgstr "" + +#: ../../web3.eth.rst:191 +msgid "Delegates to ``eth_getStorageAt`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:193 +msgid "" +"Returns the value from a storage position for the given ``account`` at " +"the block specified by ``block_identifier``." +msgstr "" + +#: ../../web3.eth.rst:205 +msgid "Fetches the expected base fee for blobs in the next block." +msgstr "" + +#: ../../web3.eth.rst:207 +msgid "Delegates to ``eth_blobBaseFee`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:209 +msgid "Returns the expected base fee in Wei." +msgstr "" + +#: ../../web3.eth.rst:219 +msgid "Delegates to ``eth_getProof`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:221 +msgid "" +"Returns the values from an array of storage positions for the given " +"``account`` at the block specified by ``block_identifier``." +msgstr "" + +#: ../../web3.eth.rst:251 +msgid "Merkle proof verification using py-trie." +msgstr "" + +#: ../../web3.eth.rst:253 +msgid "" +"The following example verifies that the values returned in the " +"``AttributeDict`` are included in the state of given trie ``root``." +msgstr "" + +#: ../../web3.eth.rst:321 +msgid "Delegates to ``eth_getCode`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:323 +msgid "" +"Returns the bytecode for the given ``account`` at the block specified by " +"``block_identifier``." +msgstr "" + +#: ../../web3.eth.rst:340 +msgid "" +"Delegates to ``eth_getBlockByNumber`` or ``eth_getBlockByHash`` RPC " +"Methods" +msgstr "" + +#: ../../web3.eth.rst:342 +msgid "" +"Returns the block specified by ``block_identifier``. Delegates to " +"``eth_getBlockByNumber`` if ``block_identifier`` is an integer or one of " +"the predefined block parameters ``'latest', 'earliest', 'pending', " +"'safe', 'finalized'`` - otherwise delegates to ``eth_getBlockByHash``. " +"Throws ``BlockNotFound`` error if the block is not found." +msgstr "" + +#: ../../web3.eth.rst:348 +msgid "" +"If ``full_transactions`` is ``True`` then the ``'transactions'`` key will" +" contain full transactions objects. Otherwise it will be an array of " +"transaction hashes." +msgstr "" + +#: ../../web3.eth.rst:380 +msgid "" +"Delegates to ``eth_getBlockTransactionCountByNumber`` or " +"``eth_getBlockTransactionCountByHash`` RPC Methods" +msgstr "" + +#: ../../web3.eth.rst:383 +msgid "" +"Returns the number of transactions in the block specified by " +"``block_identifier``. Delegates to " +"``eth_getBlockTransactionCountByNumber`` if ``block_identifier`` is an " +"integer or one of the predefined block parameters ``'latest', 'earliest'," +" 'pending', 'safe', 'finalized'``, otherwise delegates to " +"``eth_getBlockTransactionCountByHash``. Throws ``BlockNotFoundError`` if " +"transactions are not found." +msgstr "" + +#: ../../web3.eth.rst:401 ../../web3.eth.rst:449 +msgid "Deprecated. Will be removed in v8." +msgstr "" + +#: ../../web3.eth.rst:403 +msgid "" +"Delegates to ``eth_getUncleByBlockHashAndIndex`` or " +"``eth_getUncleByBlockNumberAndIndex`` RPC methods" +msgstr "" + +#: ../../web3.eth.rst:406 +msgid "" +"Returns the uncle at the index specified by ``uncle_index`` from the " +"block specified by ``block_identifier``. Delegates to " +"``eth_getUncleByBlockNumberAndIndex`` if ``block_identifier`` is an " +"integer or one of the predefined block parameters ``'latest', 'earliest'," +" 'pending'``, otherwise delegates to ``eth_getUncleByBlockHashAndIndex``." +" Throws ``BlockNotFound`` if the block is not found." +msgstr "" + +#: ../../web3.eth.rst:451 +msgid "" +"Delegates to ``eth_getUncleCountByBlockHash`` or " +"``eth_getUncleCountByBlockNumber`` RPC methods" +msgstr "" + +#: ../../web3.eth.rst:454 +msgid "" +"Returns the (integer) number of uncles associated with the block " +"specified by ``block_identifier``. Delegates to " +"``eth_getUncleCountByBlockNumber`` if ``block_identifier`` is an integer " +"or one of the predefined block parameters ``'latest', 'earliest', " +"'pending'``, otherwise delegates to ``eth_getUncleCountByBlockHash``. " +"Throws ``BlockNotFound`` if the block is not found." +msgstr "" + +#: ../../web3.eth.rst:472 +msgid "Delegates to ``eth_getTransactionByHash`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:474 +msgid "" +"Returns the transaction specified by ``transaction_hash``. If the " +"transaction cannot be found throws " +":class:`web3.exceptions.TransactionNotFound`." +msgstr "" + +#: ../../web3.eth.rst:499 +msgid "Delegates to ``eth_getRawTransactionByHash`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:501 +msgid "Returns the raw form of transaction specified by ``transaction_hash``." +msgstr "" + +#: ../../web3.eth.rst:503 +msgid "If no transaction is found, ``TransactionNotFound`` is raised." +msgstr "" + +#: ../../web3.eth.rst:513 +msgid "" +"Delegates to ``eth_getTransactionByBlockNumberAndIndex`` or " +"``eth_getTransactionByBlockHashAndIndex`` RPC Methods" +msgstr "" + +#: ../../web3.eth.rst:516 +msgid "" +"Returns the transaction at the index specified by ``transaction_index`` " +"from the block specified by ``block_identifier``. Delegates to " +"``eth_getTransactionByBlockNumberAndIndex`` if ``block_identifier`` is an" +" integer or one of the predefined block parameters ``'latest', " +"'earliest', 'pending', 'safe', 'finalized'``, otherwise delegates to " +"``eth_getTransactionByBlockHashAndIndex``. If a transaction is not found " +"at specified arguments, throws " +":class:`web3.exceptions.TransactionNotFound`." +msgstr "" + +#: ../../web3.eth.rst:562 +msgid "" +"Delegates to ``eth_getRawTransactionByBlockNumberAndIndex`` or " +"``eth_getRawTransactionByBlockHashAndIndex`` RPC Methods" +msgstr "" + +#: ../../web3.eth.rst:565 +msgid "" +"Returns the raw transaction at the index specified by " +"``transaction_index`` from the block specified by ``block_identifier``. " +"Delegates to ``eth_getRawTransactionByBlockNumberAndIndex`` if " +"``block_identifier`` is an integer or one of the predefined block " +"parameters ``'latest', 'earliest', 'pending', 'safe', 'finalized'``, " +"otherwise delegates to ``eth_getRawTransactionByBlockHashAndIndex``. If a" +" transaction is not found at specified arguments, throws " +":class:`web3.exceptions.TransactionNotFound`." +msgstr "" + +#: ../../web3.eth.rst:584 +msgid "" +"Waits for the transaction specified by ``transaction_hash`` to be " +"included in a block, then returns its transaction receipt." +msgstr "" + +#: ../../web3.eth.rst:587 +msgid "" +"Optionally, specify a ``timeout`` in seconds. If timeout elapses before " +"the transaction is added to a block, then " +":meth:`~Eth.wait_for_transaction_receipt` raises a " +":class:`web3.exceptions.TimeExhausted` exception." +msgstr "" + +#: ../../web3.eth.rst:615 +msgid "Delegates to ``eth_getTransactionReceipt`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:617 +msgid "" +"Returns the transaction receipt specified by ``transaction_hash``. If " +"the transaction cannot be found throws " +":class:`web3.exceptions.TransactionNotFound`." +msgstr "" + +#: ../../web3.eth.rst:619 +msgid "" +"If ``status`` in response equals 1 the transaction was successful. If it " +"is equals 0 the transaction was reverted by EVM." +msgstr "" + +#: ../../web3.eth.rst:647 +msgid "Delegates to ``eth_getTransactionCount`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:649 +msgid "" +"Returns the number of transactions that have been sent from ``account`` " +"as of the block specified by ``block_identifier``." +msgstr "" + +#: ../../web3.eth.rst:662 ../../web3.eth.rst:781 ../../web3.eth.rst:837 +msgid "Delegates to ``eth_sendTransaction`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:664 +msgid "Signs and sends the given ``transaction``" +msgstr "" + +#: ../../web3.eth.rst:666 +msgid "" +"The ``transaction`` parameter should be a dictionary with the following " +"fields." +msgstr "" + +#: ../../web3.eth.rst:668 +msgid "" +"``from``: ``bytes or text``, checksum address or ENS name - (optional, " +"default: ``web3.eth.defaultAccount``) The address the transaction is sent" +" from." +msgstr "" + +#: ../../web3.eth.rst:670 +msgid "" +"``to``: ``bytes or text``, checksum address or ENS name - (optional when " +"creating new contract) The address the transaction is directed to." +msgstr "" + +#: ../../web3.eth.rst:672 +msgid "" +"``gas``: ``integer`` - (optional) Integer of the gas provided for the " +"transaction execution. It will return unused gas." +msgstr "" + +#: ../../web3.eth.rst:674 +msgid "" +"``maxFeePerGas``: ``integer or hex`` - (optional) maximum amount you're " +"willing to pay, inclusive of ``baseFeePerGas`` and " +"``maxPriorityFeePerGas``. The difference between ``maxFeePerGas`` and " +"``baseFeePerGas + maxPriorityFeePerGas`` is refunded to the user." +msgstr "" + +#: ../../web3.eth.rst:678 +msgid "" +"``maxPriorityFeePerGas``: ``integer or hex`` - (optional) the part of the" +" fee that goes to the miner" +msgstr "" + +#: ../../web3.eth.rst:680 +msgid "" +"``gasPrice``: ``integer`` - Integer of the gasPrice used for each paid " +"gas **LEGACY** - unless you have a good reason to use ``gasPrice``, use " +"``maxFeePerGas`` and ``maxPriorityFeePerGas`` instead." +msgstr "" + +#: ../../web3.eth.rst:683 +msgid "" +"``value``: ``integer`` - (optional) Integer of the value send with this " +"transaction" +msgstr "" + +#: ../../web3.eth.rst:685 +msgid "" +"``data``: ``bytes or text`` - The compiled code of a contract OR the hash" +" of the invoked method signature and encoded parameters. For details see " +"`Ethereum Contract ABI `_." +msgstr "" + +#: ../../web3.eth.rst:688 +msgid "" +"``nonce``: ``integer`` - (optional) Integer of a nonce. This allows to " +"overwrite your own pending transactions that use the same nonce." +msgstr "" + +#: ../../web3.eth.rst:691 +msgid "" +"If the ``transaction`` specifies a ``data`` value but does not specify " +"``gas`` then the ``gas`` value will be populated using the " +":meth:`~web3.eth.Eth.estimate_gas()` function with an additional buffer " +"of ``100000`` gas up to the ``gasLimit`` of the latest block. In the " +"event that the value returned by :meth:`~web3.eth.Eth.estimate_gas()` " +"method is greater than the ``gasLimit`` a ``ValueError`` will be raised." +msgstr "" + +#: ../../web3.eth.rst:734 +msgid "Delegates to ``eth_signTransaction`` RPC Method." +msgstr "" + +#: ../../web3.eth.rst:736 +msgid "" +"Returns a transaction that's been signed by the node's private key, but " +"not yet submitted. The signed tx can be submitted with " +"``Eth.send_raw_transaction``" +msgstr "" + +#: ../../web3.eth.rst:756 +msgid "Delegates to ``eth_sendRawTransaction`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:758 +msgid "" +"Sends a signed and serialized transaction. Returns the transaction hash " +"as a HexBytes object." +msgstr "" + +#: ../../web3.eth.rst:783 +msgid "" +"Sends a transaction that replaces the transaction with " +"``transaction_hash``." +msgstr "" + +#: ../../web3.eth.rst:785 +msgid "The ``transaction_hash`` must be the hash of a pending transaction." +msgstr "" + +#: ../../web3.eth.rst:787 +msgid "" +"The ``new_transaction`` parameter should be a dictionary with transaction" +" fields as required by :meth:`~web3.eth.Eth.send_transaction`. It will be" +" used to entirely replace the transaction of ``transaction_hash`` without" +" using any of the pending transaction's values." +msgstr "" + +#: ../../web3.eth.rst:792 +msgid "" +"If the ``new_transaction`` specifies a ``nonce`` value, it must match the" +" pending transaction's nonce." +msgstr "" + +#: ../../web3.eth.rst:795 +msgid "" +"If the ``new_transaction`` specifies ``maxFeePerGas`` and " +"``maxPriorityFeePerGas`` values, they must be greater than the pending " +"transaction's values for each field, respectively." +msgstr "" + +#: ../../web3.eth.rst:799 +msgid "Legacy Transaction Support (Less Efficient - Not Recommended)" +msgstr "" + +#: ../../web3.eth.rst:801 +msgid "" +"If the pending transaction specified a ``gasPrice`` value (legacy " +"transaction), the ``gasPrice`` value for the ``new_transaction`` must be " +"greater than the pending transaction's ``gasPrice``." +msgstr "" + +#: ../../web3.eth.rst:805 +msgid "" +"If the ``new_transaction`` does not specify any of ``gasPrice``, " +"``maxFeePerGas``, or ``maxPriorityFeePerGas`` values, one of the " +"following will happen:" +msgstr "" + +#: ../../web3.eth.rst:808 +msgid "" +"If the pending transaction has a ``gasPrice`` value, this value will be " +"used with a multiplier of 1.125 - This is typically the minimum " +"``gasPrice`` increase a node requires before it accepts a replacement " +"transaction." +msgstr "" + +#: ../../web3.eth.rst:811 +msgid "" +"If a gas price strategy is set, the ``gasPrice`` value from the gas price" +" strategy(See :ref:`Gas_Price`) will be used." +msgstr "" + +#: ../../web3.eth.rst:813 +msgid "" +"If none of the above, the client will ultimately decide appropriate " +"values for ``maxFeePerGas`` and ``maxPriorityFeePerGas``. These will " +"likely be default values and may result in an unsuccessful replacement of" +" the pending transaction." +msgstr "" + +#: ../../web3.eth.rst:817 +msgid "" +"This method returns the transaction hash of the replacement transaction " +"as a HexBytes object." +msgstr "" + +#: ../../web3.eth.rst:839 +msgid "" +"Sends a transaction that modifies the transaction with " +"``transaction_hash``." +msgstr "" + +#: ../../web3.eth.rst:841 +msgid "" +"``transaction_params`` are keyword arguments that correspond to valid " +"transaction parameters as required by " +":meth:`~web3.eth.Eth.send_transaction`. The parameter values will " +"override the pending transaction's values to create the replacement " +"transaction to send." +msgstr "" + +#: ../../web3.eth.rst:846 +msgid "" +"The same validation and defaulting rules of " +":meth:`~web3.eth.Eth.replace_transaction` apply." +msgstr "" + +#: ../../web3.eth.rst:848 +msgid "" +"This method returns the transaction hash of the newly modified " +"transaction as a HexBytes object." +msgstr "" + +#: ../../web3.eth.rst:864 +msgid "Delegates to ``eth_sign`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:866 +msgid "Caller must specify exactly one of: ``data``, ``hexstr``, or ``text``." +msgstr "" + +#: ../../web3.eth.rst:868 +msgid "" +"Signs the given data with the private key of the given ``account``. The " +"account must be unlocked." +msgstr "" + +#: ../../web3.eth.rst:893 +msgid "Delegates to ``eth_signTypedData`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:897 +msgid "" +"``eth_signTypedData`` is not currently supported by any major client " +"(Besu, Erigon, Geth, or Nethermind)" +msgstr "" + +#: ../../web3.eth.rst:899 +msgid "" +"Please note that the ``jsonMessage`` argument is the loaded JSON Object " +"and **NOT** the JSON String itself." +msgstr "" + +#: ../../web3.eth.rst:902 +msgid "" +"Signs the ``Structured Data`` (or ``Typed Data``) with the private key of" +" the given ``account``. The account must be unlocked." +msgstr "" + +#: ../../web3.eth.rst:910 +msgid "Delegates to ``eth_call`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:912 +msgid "" +"Executes the given transaction locally without creating a new transaction" +" on the blockchain. Returns the return value of the executed contract." +msgstr "" + +#: ../../web3.eth.rst:915 +msgid "" +"The ``transaction`` parameter is handled in the same manner as the " +":meth:`~web3.eth.Eth.send_transaction()` method." +msgstr "" + +#: ../../web3.eth.rst:928 +msgid "" +"In most cases it is better to make contract function call through the " +":py:class:`web3.contract.Contract` interface." +msgstr "" + +#: ../../web3.eth.rst:930 +msgid "" +"Overriding state is a debugging feature available in Geth clients. View " +"their `usage documentation `_ for a list of possible parameters." +msgstr "" + +#: ../../web3.eth.rst:934 +msgid "" +"`EIP-3668 `_ introduced support " +"for the ``OffchainLookup`` revert / CCIP Read support. In order to " +"properly handle a call to a contract function that reverts with an " +"``OffchainLookup`` error for offchain data retrieval, the " +"``ccip_read_enabled`` flag has been added to the ``eth_call`` method. " +"``ccip_read_enabled`` is optional, yielding the default value for CCIP " +"Read on calls to a global ``global_ccip_read_enabled`` flag on the " +"provider which is set to ``True`` by default. This means CCIP Read is " +"enabled by default for calls, as is recommended in EIP-3668. Therefore, " +"calls to contract functions that revert with an ``OffchainLookup`` will " +"be handled appropriately by default." +msgstr "" + +#: ../../web3.eth.rst:942 +msgid "" +"The ``ccip_read_enabled`` flag on the call will always override the value" +" of the global flag on the provider for explicit control over specific " +"calls. If the flag on the call is set to ``False``, the call will raise " +"the ``OffchainLookup`` instead of properly handling the exception " +"according to EIP-3668. This may be useful for \"preflighting\" a " +"transaction with a call (see :ref:`ccip-read-example` within the examples" +" section)." +msgstr "" + +#: ../../web3.eth.rst:947 +msgid "" +"If the function called results in a ``revert`` error, a " +"``ContractLogicError`` will be raised. If there is an error message with " +"the error, web3.py attempts to parse the message that comes back and " +"return it to the user as the error string. As of v6.3.0, the raw data is " +"also returned and can be accessed via the ``data`` attribute on " +"``ContractLogicError``." +msgstr "" + +#: ../../web3.eth.rst:956 +msgid "Delegates to ``eth_simulateV1`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:958 +msgid "" +"Executes a simulation for the given payload at the given block. Returns " +"the simulation results." +msgstr "" + +#: ../../web3.eth.rst:1026 +msgid "Delegates to ``eth_createAccessList`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:1028 +msgid "" +"This method creates an `EIP-2930 " +"`_ type ``accessList`` based on " +"a given ``transaction``. The ``accessList`` contains all storage slots " +"and addresses read and written by the transaction, except for the sender " +"account and the precompiles. This method uses the same ``transaction`` " +"call object and ``block_identifier`` object as " +":meth:`~web3.eth.Eth.call()`. An ``accessList`` can be used to access " +"contracts that became inaccessible due to gas cost increases." +msgstr "" + +#: ../../web3.eth.rst:1034 +msgid "" +"The ``transaction`` parameter is handled in the same manner as the " +":meth:`~web3.eth.Eth.send_transaction()` method. The optional " +"``block_identifier`` parameter is a block_number or ``latest`` or " +"``pending``. Default is ``latest``." +msgstr "" + +#: ../../web3.eth.rst:1066 +msgid "" +"The method ``eth_createAccessList`` returns a list of addresses and " +"storage keys used by the transaction, plus the gas consumed when the " +"``accessList`` is included. Like ``eth_estimateGas``, this is an " +"estimation; the list could change when the transaction is actually " +"finalized. Adding an ``accessList`` to your transaction does not " +"necessarily result in lower gas usage compared to a transaction without " +"an ``accessList``." +msgstr "" + +#: ../../web3.eth.rst:1073 +msgid "Delegates to ``eth_feeHistory`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:1075 +msgid "Returns transaction fee data for up to 1,024 blocks." +msgstr "" + +#: ../../web3.eth.rst +msgid "Parameters" +msgstr "" + +#: ../../web3.eth.rst:1077 +msgid "" +"The number of blocks in the requested range. Depending on the client, " +"this value should be either a :py:class:`int` between 1 and 1024 or a " +"hexstring. Less than requested may be returned if not all blocks are " +"available." +msgstr "" + +#: ../../web3.eth.rst:1081 +msgid "" +"The newest, highest-numbered, block in the requested range. This value " +"may be an :py:class:`int` or one of the predefined block parameters " +"``'latest'``, ``'earliest'``, or ``'pending'``." +msgstr "" + +#: ../../web3.eth.rst:1084 +msgid "" +"*(optional)* A monotonically increasing list of percentile " +":py:class:`float` values to sample from each block's effective priority " +"fees per gas in ascending order, weighted by gas used." +msgstr "" + +#: ../../web3.eth.rst +msgid "Returns" +msgstr "" + +#: ../../web3.eth.rst:1087 +msgid "An ``AttributeDict`` containing the following keys:" +msgstr "" + +#: ../../web3.eth.rst:1089 +msgid "" +"**oldestBlock** *(int)* -- The oldest, lowest-numbered, block in the " +"range requested as a ``BlockNumber`` type with :py:class:`int` value." +msgstr "" + +#: ../../web3.eth.rst:1091 +msgid "" +"**baseFeePerGas** *(List[Wei])* -- An array of block base fees per gas. " +"This includes the next block after the newest of the returned range, " +"because this value can be derived from the newest block. Zeroes are " +"returned for pre-EIP-1559 blocks." +msgstr "" + +#: ../../web3.eth.rst:1094 +msgid "" +"**gasUsedRatio** *(List[float])* -- An array of ``gasUsed``/``gasLimit`` " +"float values for the requested blocks." +msgstr "" + +#: ../../web3.eth.rst:1095 +msgid "" +"**reward** *(List[List[Wei]])* -- *(optional)* A two-dimensional array of" +" effective priority fees per gas at the requested block percentiles." +msgstr "" + +#: ../../web3.eth.rst:1111 +msgid "Delegates to ``eth_estimateGas`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:1113 +msgid "" +"Executes the given transaction locally without creating a new transaction" +" on the blockchain. Returns amount of gas consumed by execution which " +"can be used as a gas estimate." +msgstr "" + +#: ../../web3.eth.rst:1117 +msgid "" +"The ``transaction`` and ``block_identifier`` parameters are handled in " +"the same manner as the :meth:`~web3.eth.Eth.send_transaction()` method." +msgstr "" + +#: ../../web3.eth.rst:1120 +msgid "" +"The ``state_override`` is useful when there is a chain of transaction " +"calls. It overrides state so that the gas estimate of a transaction is " +"accurate in cases where prior calls produce side effects." +msgstr "" + +#: ../../web3.eth.rst:1132 +msgid "" +"Uses the selected gas price strategy to calculate a gas price. This " +"method returns the gas price denominated in wei." +msgstr "" + +#: ../../web3.eth.rst:1135 +msgid "" +"The ``transaction_params`` argument is optional however some gas price " +"strategies may require it to be able to produce a gas price." +msgstr "" + +#: ../../web3.eth.rst:1144 +msgid "" +"For information about how gas price can be customized in web3 see " +":ref:`Gas_Price`." +msgstr "" + +#: ../../web3.eth.rst:1150 +msgid "" +"Set the selected gas price strategy. It must be a method of the signature" +" ``(web3, transaction_params)`` and return a gas price denominated in " +"wei." +msgstr "" + +#: ../../web3.eth.rst:1156 +msgid "Delegates to ``eth_subscribe`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:1158 ../../web3.eth.rst:1176 +msgid "" +"Only available on persistent connection providers: " +":class:`~web3.providers.persistent.WebSocketProvider` and " +":class:`~web3.providers.persistent.AsyncIPCProvider`." +msgstr "" + +#: ../../web3.eth.rst:1162 +msgid "" +"Returns a subscription ID that can be used to track a particular " +"subscription to, or unsubscribe from, an event. For usage examples see " +"the docs on :ref:`subscription-examples`." +msgstr "" + +#: ../../web3.eth.rst:1174 +msgid "Delegates to ``eth_unsubscribe`` RPC Method" +msgstr "" + +#: ../../web3.eth.rst:1180 +msgid "" +"Returns ``True`` if successfully unsubscribed. For usage examples see the" +" docs on :ref:`subscription-examples`." +msgstr "" + +#: ../../web3.eth.rst:1191 +msgid "Filters" +msgstr "" + +#: ../../web3.eth.rst:1193 +msgid "" +"The following methods are available on the ``web3.eth`` object for " +"interacting with the filtering API." +msgstr "" + +#: ../../web3.eth.rst:1199 +msgid "" +"Delegates to ``eth_newFilter``, ``eth_newBlockFilter``, and " +"``eth_newPendingTransactionFilter`` RPC Methods." +msgstr "" + +#: ../../web3.eth.rst:1202 +msgid "" +"This method delegates to one of three RPC methods depending on the value " +"of ``filter_params``." +msgstr "" + +#: ../../web3.eth.rst:1205 +msgid "" +"If ``filter_params`` is the string ``'pending'`` then a new filter is " +"registered using the ``eth_newPendingTransactionFilter`` RPC method. This" +" will create a new filter that will be called for each new unmined " +"transaction that the node receives." +msgstr "" + +#: ../../web3.eth.rst:1209 +msgid "" +"If ``filter_params`` is the string ``'latest'`` then a new filter is " +"registered using the ``eth_newBlockFilter`` RPC method. This will create" +" a new filter that will be called each time the node receives a new " +"block." +msgstr "" + +#: ../../web3.eth.rst:1212 +msgid "" +"If ``filter_params`` is a dictionary then a new filter is registered " +"using the ``eth_newFilter`` RPC method. This will create a new filter " +"that will be called for all log entries that match the provided " +"``filter_params``." +msgstr "" + +#: ../../web3.eth.rst:1217 +msgid "" +"This method returns a ``web3.utils.filters.Filter`` object which can then" +" be used to either directly fetch the results of the filter or to " +"register callbacks which will be called with each result of the filter." +msgstr "" + +#: ../../web3.eth.rst:1221 +msgid "" +"When creating a new log filter, the ``filter_params`` should be a " +"dictionary with the following keys. Note that the keys are camel-cased " +"strings, as is expected in a JSON-RPC request." +msgstr "" + +#: ../../web3.eth.rst:1225 +msgid "" +"``fromBlock``: ``integer/tag`` - (optional, default: \"latest\") Integer " +"block number, or one of predefined block identifiers \"latest\", " +"\"pending\", \"earliest\", \"safe\", or \"finalized\"." +msgstr "" + +#: ../../web3.eth.rst:1228 +msgid "" +"``toBlock``: ``integer/tag`` - (optional, default: \"latest\") Integer " +"block number, or one of predefined block identifiers \"latest\", " +"\"pending\", \"earliest\", \"safe\", or \"finalized\"." +msgstr "" + +#: ../../web3.eth.rst:1231 +msgid "" +"``address``: ``string`` or list of ``strings``, each 20 Bytes - " +"(optional) Contract address or a list of addresses from which logs should" +" originate." +msgstr "" + +#: ../../web3.eth.rst:1234 +msgid "" +"``topics``: list of 32 byte ``strings`` or ``null`` - (optional) Array of" +" topics that should be used for filtering. Topics are order-dependent. " +"This parameter can also be a list of topic lists in which case filtering " +"will match any of the provided topic arrays." +msgstr "" + +#: ../../web3.eth.rst:1241 +msgid "" +"Though ``\"latest\"`` and ``\"safe\"`` block identifiers are not yet part" +" of the specifications for ``eth_newFilter``, they are supported by " +"web3.py and may or may not yield expected results depending on the node " +"being accessed." +msgstr "" + +#: ../../web3.eth.rst:1245 +msgid "See :doc:`./filters` for more information about filtering." +msgstr "" + +#: ../../web3.eth.rst:1258 +msgid "Delegates to ``eth_getFilterChanges`` RPC Method." +msgstr "" + +#: ../../web3.eth.rst:1260 +msgid "" +"Returns all new entries which occurred since the last call to this method" +" for the given ``filter_id``" +msgstr "" + +#: ../../web3.eth.rst:1286 +msgid "Delegates to ``eth_getFilterLogs`` RPC Method." +msgstr "" + +#: ../../web3.eth.rst:1288 +msgid "Returns all entries for the given ``filter_id``" +msgstr "" + +#: ../../web3.eth.rst:1313 +msgid "Delegates to ``eth_uninstallFilter`` RPC Method." +msgstr "" + +#: ../../web3.eth.rst:1315 +msgid "" +"Uninstalls the filter specified by the given ``filter_id``. Returns " +"boolean as to whether the filter was successfully uninstalled." +msgstr "" + +#: ../../web3.eth.rst:1329 +msgid "" +"This is the equivalent of: creating a new filter, running " +":meth:`~Eth.get_filter_logs`, and then uninstalling the filter. See " +":meth:`~Eth.filter` for details on allowed filter parameters." +msgstr "" + +#: ../../web3.eth.rst:1335 +msgid "Contracts" +msgstr "" + +#: ../../web3.eth.rst:1339 +msgid "" +"If ``address`` is provided, then this method will return an instance of " +"the contract defined by ``abi``. The address may be a checksum string, or" +" an ENS name like ``'mycontract.eth'``." +msgstr "" + +#: ../../web3.eth.rst:1356 +msgid "" +"If you use an ENS name to initialize a contract, the contract will be " +"looked up by name on each use. If the name could ever change maliciously," +" first :ref:`ens_get_address`, and then create the contract with the " +"checksum address." +msgstr "" + +#: ../../web3.eth.rst:1361 +msgid "" +"If ``address`` is *not* provided, the newly created contract class will " +"be returned. That class will then be initialized by supplying the " +"address." +msgstr "" + +#: ../../web3.eth.rst:1376 +msgid "" +"``contract_name`` will be used as the name of the contract class. If it " +"is ``None`` then the name of the ``ContractFactoryClass`` will be used." +msgstr "" + +#: ../../web3.eth.rst:1379 +msgid "``ContractFactoryClass`` will be used as the base Contract class." +msgstr "" + +#: ../../web3.eth.rst:1381 +msgid "The following arguments are accepted for contract class creation." +msgstr "" + +#: ../../web3.eth.rst:1383 +msgid "" +"Application Binary Interface. Usually provided since an ``abi`` is " +"required to interact with any contract." +msgstr "" + +#: ../../web3.eth.rst:1385 +msgid "Assembly code generated by the compiler" +msgstr "" + +#: ../../web3.eth.rst:1386 +msgid "Abstract Syntax Tree of the contract generated by the compiler" +msgstr "" + +#: ../../web3.eth.rst:1387 +msgid "Bytecode of the contract generated by the compiler" +msgstr "" + +#: ../../web3.eth.rst:1388 +msgid "" +"Bytecode stored at the contract address, excludes the constructor and " +"initialization code" +msgstr "" + +#: ../../web3.eth.rst:1391 +msgid "Optionally convert tuples/structs to named tuples" +msgstr "" + +#: ../../web3.eth.rst:1393 +msgid "Contract Metadata generated by the compiler" +msgstr "" + +#: ../../web3.eth.rst:1394 +msgid "Opcodes for the contract generated by the compiler" +msgstr "" + +#: ../../web3.eth.rst:1398 +msgid "Instance of the contract" +msgstr "" + +#: ../../web3.eth.rst +msgid "Return type" +msgstr "" + +#: ../../web3.eth.rst +msgid "Raises" +msgstr "" + +#: ../../web3.eth.rst:1400 +msgid "If the address is not provided" +msgstr "" + +#: ../../web3.eth.rst:1401 +msgid "If the contract class is not initialized" +msgstr "" + +#: ../../web3.eth.rst:1403 +msgid "" +"See the :doc:`web3.contract` documentation for more information about " +"Contracts." +msgstr "" + +#: ../../web3.eth.rst:1408 +msgid "" +"Modify the default contract factory from ``Contract`` to " +"``contractFactoryClass``. Future calls to ``Eth.contract()`` will then " +"default to ``contractFactoryClass``." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.geth.po b/docs/locales/zh_CN/LC_MESSAGES/web3.geth.po new file mode 100644 index 0000000000..d6d17e84c4 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.geth.po @@ -0,0 +1,181 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.geth.rst:2 +msgid "Geth API" +msgstr "" + +#: ../../web3.geth.rst:6 +msgid "" +"The ``web3.geth`` object exposes modules that enable you to interact with" +" the JSON-RPC endpoints supported by `Geth `_ that are not defined in the standard" +" set of Ethereum JSONRPC endpoints according to `EIP 1474 " +"`_." +msgstr "" + +#: ../../web3.geth.rst:9 +msgid "GethAdmin API" +msgstr "" + +#: ../../web3.geth.rst:11 +msgid "The following methods are available on the ``web3.geth.admin`` namespace." +msgstr "" + +#: ../../web3.geth.rst:15 +msgid "" +"The ``web3.geth.admin`` object exposes methods to interact with the RPC " +"APIs under the ``admin_`` namespace that are supported by the Geth " +"client." +msgstr "" + +#: ../../web3.geth.rst:20 +msgid "Delegates to ``admin_datadir`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:22 +msgid "Returns the system path of the node's data directory." +msgstr "" + +#: ../../web3.geth.rst:32 +msgid "Delegates to ``admin_nodeInfo`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:34 +msgid "Returns information about the currently running node." +msgstr "" + +#: ../../web3.geth.rst:59 +msgid "Delegates to ``admin_peers`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:61 +msgid "Returns the current peers the node is connected to." +msgstr "" + +#: ../../web3.geth.rst:105 +msgid "Delegates to ``admin_addPeer`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:107 +msgid "Requests adding a new remote node to the list of tracked static nodes." +msgstr "" + +#: ../../web3.geth.rst:117 +msgid "Delegates to ``admin_startHTTP`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:119 +msgid "" +"Starts the HTTP based JSON RPC API webserver on the specified ``host`` " +"and ``port``, with the ``rpccorsdomain`` set to the provided ``cors`` " +"value and with the APIs specified by ``apis`` enabled. Returns boolean " +"as to whether the server was successfully started." +msgstr "" + +#: ../../web3.geth.rst:132 +msgid "Delegates to ``admin_startWS`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:134 +msgid "" +"Starts the WebSocket based JSON RPC API webserver on the specified " +"``host`` and ``port``, with the ``rpccorsdomain`` set to the provided " +"``cors`` value and with the APIs specified by ``apis`` enabled. Returns " +"boolean as to whether the server was successfully started." +msgstr "" + +#: ../../web3.geth.rst:147 +msgid "Delegates to ``admin_stopHTTP`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:149 +msgid "Stops the HTTP based JSON RPC server." +msgstr "" + +#: ../../web3.geth.rst:159 +msgid "Delegates to ``admin_stopWS`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:161 +msgid "Stops the WebSocket based JSON RPC server." +msgstr "" + +#: ../../web3.geth.rst:172 +msgid "GethTxPool API" +msgstr "" + +#: ../../web3.geth.rst:174 +msgid "" +"The ``web3.geth.txpool`` object exposes methods to interact with the RPC " +"APIs under the ``txpool_`` namespace. These methods are only exposed " +"under the ``geth`` namespace since they are not standard." +msgstr "" + +#: ../../web3.geth.rst:178 +msgid "The following methods are available on the ``web3.geth.txpool`` namespace." +msgstr "" + +#: ../../web3.geth.rst:182 +msgid "Delegates to ``txpool_inspect`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:184 ../../web3.geth.rst:246 +msgid "" +"Returns a textual summary of all transactions currently pending for " +"inclusion in the next block(s) as well as ones that are scheduled for " +"future execution." +msgstr "" + +#: ../../web3.geth.rst:244 +msgid "Delegates to ``txpool_status`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:260 +msgid "Delegates to ``txpool_content`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:262 +msgid "Returns the exact details of all transactions that are pending or queued." +msgstr "" + +#: ../../web3.geth.rst:374 +msgid "GethDebug API" +msgstr "" + +#: ../../web3.geth.rst:376 +msgid "" +"The ``web3.geth.debug`` object exposes methods to interact with the RPC " +"APIs under the ``debug_`` namespace. These methods are only exposed under" +" the ``geth`` namespace. Full documentation around options can be found " +"in the `Geth docs `_." +msgstr "" + +#: ../../web3.geth.rst:383 +msgid "Delegates to ``debug_traceTransaction`` RPC Method" +msgstr "" + +#: ../../web3.geth.rst:385 +msgid "" +"Returns the trace of the transaction with the given ``transaction_hash`` " +"and ``trace_config``." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.main.po b/docs/locales/zh_CN/LC_MESSAGES/web3.main.po new file mode 100644 index 0000000000..39f69d8ac5 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.main.po @@ -0,0 +1,355 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.main.rst:4 +msgid "Web3 API" +msgstr "" + +#: ../../web3.main.rst:14 +msgid "Each ``Web3`` instance exposes the following APIs." +msgstr "" + +#: ../../web3.main.rst:17 +msgid "Providers" +msgstr "" + +#: ../../web3.main.rst:21 +msgid "Convenience API to access :py:class:`web3.providers.rpc.HTTPProvider`" +msgstr "" + +#: ../../web3.main.rst:25 +msgid "Convenience API to access :py:class:`web3.providers.ipc.IPCProvider`" +msgstr "" + +#: ../../web3.main.rst:29 +msgid "Attributes" +msgstr "" + +#: ../../web3.main.rst:33 +msgid "Returns the current Web3 version." +msgstr "" + +#: ../../web3.main.rst:42 +msgid "Delegates to ``web3_clientVersion`` RPC Method" +msgstr "" + +#: ../../web3.main.rst:44 +msgid "Returns the current client version." +msgstr "" + +#: ../../web3.main.rst:55 +msgid "Batch Requests" +msgstr "" + +#: ../../web3.main.rst:59 +msgid "" +"The JSON-RPC API allows for batch requests, meaning you can send a single" +" request that contains an array of request objects. Generally, this may " +"be useful when you want to limit the number of requests you send to a " +"node." +msgstr "" + +#: ../../web3.main.rst:63 +msgid "" +"You can choose to build a batch of requests within or outside of a " +"context manager:" +msgstr "" + +#: ../../web3.main.rst:77 +msgid "" +"Within the batching context above, calls are suspended until " +"``batch.execute()`` is called. Calling a method without passing it to " +"``batch.add`` might result in unexpected behavior." +msgstr "" + +#: ../../web3.main.rst:81 +msgid "Using the batch object directly:" +msgstr "" + +#: ../../web3.main.rst:91 +msgid "" +"Contract interactions can be included in batch requests by omitting the " +"``call()`` method:" +msgstr "" + +#: ../../web3.main.rst:97 +msgid "" +"Additionally, if you need to make multiple calls of the same function, " +"you can add a mapping of the function to its arguments:" +msgstr "" + +#: ../../web3.main.rst:112 +msgid "" +"The ``execute`` method returns a list of responses in the order they were" +" included in the batch." +msgstr "" + +#: ../../web3.main.rst:115 +msgid "" +"If you need to abandon or rebuild a batch request, utilize the ``clear`` " +"method:" +msgstr "" + +#: ../../web3.main.rst:129 +msgid "" +"Only read-only operations that exist within modules on the ``Web3`` class" +" (e.g. ``w3.eth``, ``w3.net``) are supported by ``batch_requests``. " +"Unsupported methods include:" +msgstr "" + +#: ../../web3.main.rst:133 +msgid ":meth:`subscribe `" +msgstr "" + +#: ../../web3.main.rst:134 +msgid ":meth:`unsubscribe `" +msgstr "" + +#: ../../web3.main.rst:135 +msgid ":meth:`send_raw_transaction `" +msgstr "" + +#: ../../web3.main.rst:136 +msgid ":meth:`send_transaction `" +msgstr "" + +#: ../../web3.main.rst:137 +msgid ":meth:`sign_transaction `" +msgstr "" + +#: ../../web3.main.rst:138 +msgid ":meth:`sign `" +msgstr "" + +#: ../../web3.main.rst:139 +msgid ":meth:`sign_typed_data `" +msgstr "" + +#: ../../web3.main.rst:140 +msgid "``w3.provider.make_request()``." +msgstr "" + +#: ../../web3.main.rst:143 +msgid "Async Batch Requests" +msgstr "" + +#: ../../web3.main.rst:145 +msgid "" +"If using one of the asynchronous providers, you'll need to make use of " +"the ``async_execute`` method and the ``async`` and ``await`` keywords as " +"appropriate." +msgstr "" + +#: ../../web3.main.rst:150 +msgid "" +"If performance is a concern, consider using ``asyncio.gather()`` with " +"single concurrent requests instead of an asynchronous batch request. It " +"will generally be the faster option due to the overhead of batching." +msgstr "" + +#: ../../web3.main.rst:176 +msgid "Encoding and Decoding Helpers" +msgstr "" + +#: ../../web3.main.rst:180 +msgid "" +"Takes a variety of inputs and returns it in its hexadecimal " +"representation. It follows the rules for converting to hex in the `JSON-" +"RPC spec`_" +msgstr "" + +#: ../../web3.main.rst:215 +msgid "" +"Takes a variety of inputs and returns its string equivalent. Text gets " +"decoded as UTF-8." +msgstr "" + +#: ../../web3.main.rst:235 +msgid "" +"Takes a variety of inputs and returns its bytes equivalent. Text gets " +"encoded as UTF-8." +msgstr "" + +#: ../../web3.main.rst:265 +msgid "Takes a variety of inputs and returns its integer equivalent." +msgstr "" + +#: ../../web3.main.rst:287 +msgid "Takes a variety of inputs and returns its JSON equivalent." +msgstr "" + +#: ../../web3.main.rst:301 +msgid "Currency Conversions" +msgstr "" + +#: ../../web3.main.rst:305 +msgid "" +"Returns the value in the denomination specified by the ``currency`` " +"argument converted to wei." +msgstr "" + +#: ../../web3.main.rst:317 +msgid "" +"Returns the value in wei converted to the given currency. The value is " +"returned as a ``Decimal`` to ensure precision down to the wei." +msgstr "" + +#: ../../web3.main.rst:330 +msgid "Addresses" +msgstr "" + +#: ../../web3.main.rst:334 +msgid "Returns ``True`` if the value is one of the recognized address formats." +msgstr "" + +#: ../../web3.main.rst:336 +msgid "Allows for both ``0x`` prefixed and non-prefixed values." +msgstr "" + +#: ../../web3.main.rst:337 +msgid "" +"If the address contains mixed upper and lower cased characters this " +"function also checks if the address checksum is valid according to " +"`EIP55`_" +msgstr "" + +#: ../../web3.main.rst:348 +msgid "Returns ``True`` if the value is a valid `EIP55`_ checksummed address" +msgstr "" + +#: ../../web3.main.rst:361 +msgid "Returns the given address with an `EIP55`_ checksum." +msgstr "" + +#: ../../web3.main.rst:375 +msgid "Cryptographic Hashing" +msgstr "" + +#: ../../web3.main.rst:379 +msgid "" +"Returns the Keccak-256 of the given value. Text is encoded to UTF-8 " +"before computing the hash, just like Solidity. Any of the following are " +"valid and equivalent:" +msgstr "" + +#: ../../web3.main.rst:394 +msgid "" +"Returns the Keccak-256 as it would be computed by the solidity ``keccak``" +" function on a *packed* ABI encoding of the ``value`` list contents. The" +" ``abi_types`` argument should be a list of solidity type strings which " +"correspond to each of the provided values." +msgstr "" + +#: ../../web3.main.rst:418 +msgid "Comparable solidity usage:" +msgstr "" + +#: ../../web3.main.rst:429 +msgid "Check Encodability" +msgstr "" + +#: ../../web3.main.rst:433 +msgid "" +"Returns ``True`` if a value can be encoded as the given type. Otherwise " +"returns ``False``." +msgstr "" + +#: ../../web3.main.rst:451 +msgid "" +"Disable the stricter bytes type checking that is loaded by default. For " +"more examples, see :ref:`disable-strict-byte-check`" +msgstr "" + +#: ../../web3.main.rst:478 +msgid "RPC API Modules" +msgstr "" + +#: ../../web3.main.rst:480 +msgid "Each ``Web3`` instance also exposes these namespaced API modules." +msgstr "" + +#: ../../web3.main.rst:485 +msgid "See :doc:`./web3.eth`" +msgstr "" + +#: ../../web3.main.rst:489 +msgid "See :doc:`./web3.geth`" +msgstr "" + +#: ../../web3.main.rst:492 +msgid "" +"These internal modules inherit from the ``web3.module.Module`` class " +"which give them some configurations internal to the web3.py library." +msgstr "" + +#: ../../web3.main.rst:497 +msgid "Custom Methods" +msgstr "" + +#: ../../web3.main.rst:499 +msgid "" +"You may add or overwrite methods within any module using the " +"``attach_methods`` function. To create a property instead, set " +"``is_property`` to ``True``." +msgstr "" + +#: ../../web3.main.rst:517 +msgid "External Modules" +msgstr "" + +#: ../../web3.main.rst:519 +msgid "" +"External modules can be used to introduce custom or third-party APIs to " +"your ``Web3`` instance. External modules are simply classes whose methods" +" and properties can be made available within the ``Web3`` instance. " +"Optionally, the external module may make use of the parent ``Web3`` " +"instance by accepting it as the first argument within the ``__init__`` " +"function:" +msgstr "" + +#: ../../web3.main.rst:533 +msgid "" +"Given the flexibility of external modules, use caution and only import " +"modules from trusted third parties and open source code you've vetted!" +msgstr "" + +#: ../../web3.main.rst:536 +msgid "" +"Configuring external modules can occur either at instantiation of the " +"``Web3`` instance or by making use of the ``attach_modules()`` method. To" +" instantiate the ``Web3`` instance with external modules use the " +"``external_modules`` keyword argument:" +msgstr "" + +#: ../../web3.main.rst:574 +msgid "" +"The ``attach_modules()`` method can be used to attach external modules " +"after the ``Web3`` instance has been instantiated." +msgstr "" + +#: ../../web3.main.rst:577 +msgid "" +"Modules are attached via a `dict` with module names as the keys. The " +"values can either be the module classes themselves, if there are no " +"submodules, or two-item tuples with the module class as the 0th index and" +" a similarly built `dict` containing the submodule information as the 1st" +" index. This pattern may be repeated as necessary." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.net.po b/docs/locales/zh_CN/LC_MESSAGES/web3.net.po new file mode 100644 index 0000000000..8a32478b8e --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.net.po @@ -0,0 +1,62 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.net.rst:2 +msgid "Net API" +msgstr "" + +#: ../../web3.net.rst:6 +msgid "" +"The ``web3.net`` object exposes methods to interact with the RPC APIs " +"under the ``net_`` namespace." +msgstr "" + +#: ../../web3.net.rst:11 +msgid "Properties" +msgstr "" + +#: ../../web3.net.rst:13 +msgid "The following properties are available on the ``web3.net`` namespace." +msgstr "" + +#: ../../web3.net.rst:18 +msgid "Delegates to ``net_listening`` RPC method" +msgstr "" + +#: ../../web3.net.rst:20 +msgid "Returns true if client is actively listening for network connections." +msgstr "" + +#: ../../web3.net.rst:30 +msgid "Delegates to ``net_peerCount`` RPC method" +msgstr "" + +#: ../../web3.net.rst:32 +msgid "Returns number of peers currently connected to the client." +msgstr "" + +#: ../../web3.net.rst:42 +msgid "Delegates to ``net_version`` RPC Method" +msgstr "" + +#: ../../web3.net.rst:44 +msgid "Returns the current network id." +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.tracing.po b/docs/locales/zh_CN/LC_MESSAGES/web3.tracing.po new file mode 100644 index 0000000000..1da15abac7 --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.tracing.po @@ -0,0 +1,35 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.tracing.rst:2 +msgid "Tracing API" +msgstr "" + +#: ../../web3.tracing.rst:6 +msgid "" +"The ``web3.tracing`` object exposes modules that enable you to interact " +"with the JSON-RPC ``trace_`` endpoints supported by Erigon and " +"Nethermind." +msgstr "" + +#: ../../web3.tracing.rst:8 +msgid "The following methods are available on the ``web3.tracing`` namespace:" +msgstr "" diff --git a/docs/locales/zh_CN/LC_MESSAGES/web3.utils.po b/docs/locales/zh_CN/LC_MESSAGES/web3.utils.po new file mode 100644 index 0000000000..5796c540fd --- /dev/null +++ b/docs/locales/zh_CN/LC_MESSAGES/web3.utils.po @@ -0,0 +1,76 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2016-2025, The Ethereum Foundation +# This file is distributed under the same license as the web3.py package. +# FIRST AUTHOR , 2025. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: web3.py 7.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-08-06 10:49+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language: zh_CN\n" +"Language-Team: zh_CN \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: ../../web3.utils.rst:2 +msgid "Utils" +msgstr "" + +#: ../../web3.utils.rst:6 +msgid "The ``utils`` module houses public utility functions and classes." +msgstr "" + +#: ../../web3.utils.rst:9 +msgid "ABI" +msgstr "" + +#: ../../web3.utils.rst:17 +msgid "Address" +msgstr "" + +#: ../../web3.utils.rst:21 +msgid "" +"Return the checksummed contract address generated by using the ``CREATE``" +" opcode by a sender address with a given nonce." +msgstr "" + +#: ../../web3.utils.rst:27 +msgid "" +"Return the checksummed contract address generated by using the " +"``CREATE2`` opcode by a sender address with a given salt and contract " +"bytecode. See `EIP-1014 `_." +msgstr "" + +#: ../../web3.utils.rst:33 +msgid "Caching" +msgstr "" + +#: ../../web3.utils.rst:37 +msgid "" +"The main cache class being used internally by web3.py. In some cases, it " +"may prove useful to set your own cache size and pass in your own instance" +" of this class where supported." +msgstr "" + +#: ../../web3.utils.rst:43 +msgid "Exception Handling" +msgstr "" + +#: ../../web3.utils.rst:47 +msgid "" +"Handle ``OffchainLookup`` reverts on contract function calls manually. " +"For an example, see :ref:`ccip-read-example` within the examples section." +msgstr "" + +#: ../../web3.utils.rst:53 +msgid "" +"The async version of the ``handle_offchain_lookup()`` utility method " +"described above." +msgstr ""