Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Aug 3, 2023
1 parent edd9002 commit d93ad84
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 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.2

- Add: `eth_defi.provider.multi_provider.create_multi_provider_web3`: An easy way to configure a Web3 instance with multiple providers

# 0.22.1

- Add logging to `swap_with_slippage_protection()` on Uniswap v3
Expand Down
12 changes: 12 additions & 0 deletions eth_defi/provider/multi_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class MultiProviderWeb3(Web3):
for making transactions to prevent frontrunning
- There might be several providers for reading on-chain data
See :py:func:`create_multi_provider_web3`
"""

def get_active_transact_provider(self) -> NamedProvider:
Expand Down Expand Up @@ -99,6 +101,16 @@ def create_multi_provider_web3(
- If any of the protocols have `mev+` prefix like `mev+https` then this
endpoint is used for the execution.
Example:
.. code-block:: python
config = "mev+https://rpc.mevblocker.io https://polygon-rpc.com https://bsc-dataseed2.bnbchain.org"
web3 = create_multi_provider_web3(config)
assert get_provider_name(web3.get_fallback_provider()) == "polygon-rpc.com"
assert len(web3.get_fallback_provider().providers) == 2
assert get_provider_name(web3.get_active_transact_provider()) == "rpc.mevblocker.io"
:param configuration_line:
Configuration line from an environment variable, config file or similar.
Expand Down

0 comments on commit d93ad84

Please sign in to comment.