Skip to content

Commit

Permalink
More on RPC configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Aug 3, 2023
1 parent cb10973 commit 6d3d816
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.22.3

- Fix: `eth_defi.chain.has_graphql_support` to support `MultiProviderWeb3`

# 0.22.2

- Add: `eth_defi.provider.multi_provider.create_multi_provider_web3`: An easy way to configure a Web3 instance with multiple providers
Expand Down
8 changes: 7 additions & 1 deletion docs/source/tutorials/multi-rpc-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ Instead of giving a single RPC endpoint URL, you give a list URLs.

Example:

.. code-block::
.. code-block:: python
# Uses MEVblocker.io to broadcast transactions
# and two separate nodes for reading blockchain data
config = "mev+https://rpc.mevblocker.io https://myethereumnode1.example.com https://fallback.example.com"
web3 = create_multi_provider_web3(config)
If you want to keep using a single RPC endpoint, you do not need to do any changes:

.. code-block:: python
# Pasing a single RPC endpoint URL is ok
web3 = create_multi_provider_web3("https://polygon-rpc.com")
2 changes: 2 additions & 0 deletions eth_defi/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ def has_graphql_support(provider: BaseProvider) -> bool:
{"data":{"block":{"number":16328259}}}
"""

# See BaseNamedProvider
if hasattr(provider, "call_endpoint_uri"):
base_url = provider.call_endpoint_uri
elif hasattr(provider, "endpoint_uri"):
# HTTPProvider
base_url = provider.endpoint_uri
else:
raise AssertionError(f"Do not know how to extract endpoint URI: {provider}")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "web3-ethereum-defi"
version = "0.22.2"
version = "0.22.3"
description = "Python library for Uniswap, Aave, ChainLink, Enzyme and other protocols on BNB Chain, Polygon, Ethereum and other blockchains"
authors = ["Mikko Ohtamaa <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 6d3d816

Please sign in to comment.