diff --git a/PKG-INFO b/PKG-INFO index 6026fe4..8c9162c 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,9 +1,9 @@ Metadata-Version: 2.1 Name: flashbots -Version: 1.1.1 +Version: 2.0.0 Summary: flashbots client Author: Georgios Konstantopoulos -Author-email: me@gakonst.com +Author-email: Requires-Python: >=3.9,<4.0 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.9 diff --git a/README.md b/README.md index 538ccda..330edf3 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,14 @@ poetry install Tips: PyCharm has a poetry plugin -## Simple Goerli Example +## Simple Testnet Example See [examples/simple.py](./examples/simple.py) for environment variable definitions. ```sh poetry shell ETH_SENDER_KEY= \ -PROVIDER_URL=https://eth-goerli.alchemyapi.io/v2/ \ +PROVIDER_URL=https://eth-holesky.g.alchemy.com/v2/ \ ETH_SIGNER_KEY= \ python examples/simple.py ``` diff --git a/flashbots/__init__.py b/flashbots/__init__.py index e352c0e..2cc12e9 100644 --- a/flashbots/__init__.py +++ b/flashbots/__init__.py @@ -48,7 +48,6 @@ def flashbot( """ flashbots_provider = FlashbotProvider(signature_account, endpoint_uri) - flash_middleware = construct_flashbots_middleware(flashbots_provider) w3.middleware_onion.add(flash_middleware) diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..636d9e1 --- /dev/null +++ b/release.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# make sure this is running in a poetry shell +if [ -z "$VIRTUAL_ENV" ]; then + echo "This script should be run from a poetry shell. Run 'poetry shell' and try again." + echo " +Alternatively, if you don't want to use poetry and know that you have python and dependencies configured correctly, +set VIRTUAL_ENV in your shell to override this check." + exit 1 +fi + +# ensure twine and wheel are installed +echo "Checking build requirements..." +pip install twine wheel 1>/dev/null + +# build the package +python setup.py sdist bdist_wheel +if [ $? -ne 0 ]; then + echo "Failed to build package" + exit 1 +fi +echo "*********************************************************************" +echo "Build successful." + +# pick last two files in dist/ in case there are previous builds present +files=(dist/*) +files=("${files[@]: -2}") +echo "Prepared files for upload:" +for file in "${files[@]}"; do + echo -e " - $file" +done + +# parse the version number from the first element of files +libname="flashbots" +version=$(echo "$files" | grep -oP "$libname-\d+\.\d+\.\d+") +version=${version#"$libname-"} + +# draw some lines to alert the user to their one last chance to exit +for i in $(seq 1 69); do + printf '*' + sleep 0.013 +done; echo + +echo "This is the point of no return." +echo -e " package:\t$libname" +echo -e " version:\t$version" +echo "Press Enter to upload the package to PyPI." +read -rs dummy + +# upload the package +twine upload "${files[@]}" diff --git a/setup.py b/setup.py index e44bc2d..c9e0ad0 100644 --- a/setup.py +++ b/setup.py @@ -5,13 +5,13 @@ package_data = {"": ["*"]} -install_requires = ["web3>=6,7"] +install_requires = ["web3>=6,<7"] setup_kwargs = { "name": "flashbots", "version": "2.0.0", "description": "web3-flashbots.py", - "long_description": 'This library works by injecting flashbots as a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is done by also creating a middleware which captures calls to `eth_sendBundle` and `eth_callBundle`, and sends them to an RPC endpoint which you have specified, which corresponds to `mev-geth`.\n\nTo apply correct headers we use the `flashbot` method which injects the correct header on POST.\n\n## Quickstart\n\n```python\nfrom eth_account.signers.local import LocalAccount\nfrom web3 import Web3, HTTPProvider\nfrom flashbots import flashbot\nfrom eth_account.account import Account\nimport os\n\nETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNATURE_KEY"))\n\n\nw3 = Web3(HTTPProvider("http://localhost:8545"))\nflashbot(w3, ETH_ACCOUNT_SIGNATURE)\n```\n\nNow the `w3.flashbots.sendBundle` method should be available to you. Look in [examples/simple.py](./examples/simple.py) for usage examples.\n\n### Goerli\n\nTo use goerli, add the goerli relay RPC to the `flashbot` function arguments.\n\n```python\nflashbot(w3, ETH_ACCOUNT_SIGNATURE, "https://relay-goerli.flashbots.net")\n```\n\n## Development and testing\n\nInstall [poetry](https://python-poetry.org/)\n\nPoetry will automatically fix your venv and all packages needed.\n\n```sh\npoetry install\n```\n\nTips: PyCharm has a poetry plugin\n\n## Simple Goerli Example\n\nSee [examples/simple.py](./examples/simple.py) for environment variable definitions.\n\n```sh\npoetry shell\nETH_SENDER_KEY= \\nPROVIDER_URL=https://eth-goerli.alchemyapi.io/v2/ \\nETH_SIGNER_KEY= \\npython examples/simple.py\n```\n\n## Linting\n\nIt\'s advisable to run black with default rules for linting\n\n```sh\nsudo pip install black # Black should be installed with a global entrypoint\nblack .\n```', + "long_description": 'This library works by injecting flashbots as a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is done by also creating a middleware which captures calls to `eth_sendBundle` and `eth_callBundle`, and sends them to an RPC endpoint which you have specified, which corresponds to `mev-geth`.\n\nTo apply correct headers we use the `flashbot` method which injects the correct header on POST.\n\n## Quickstart\n\n```python\nfrom eth_account.signers.local import LocalAccount\nfrom web3 import Web3, HTTPProvider\nfrom flashbots import flashbot\nfrom eth_account.account import Account\nimport os\n\nETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNATURE_KEY"))\n\n\nw3 = Web3(HTTPProvider("http://localhost:8545"))\nflashbot(w3, ETH_ACCOUNT_SIGNATURE)\n```\n\nNow the `w3.flashbots.sendBundle` method should be available to you. Look in [examples/simple.py](./examples/simple.py) for usage examples.\n\n### Testnet\n\nTo use an ethereum testnet, add the appropriate testnet relay RPC to the `flashbot` function arguments.\n\n```python\nflashbot(w3, ETH_ACCOUNT_SIGNATURE, "https://relay-holesky.flashbots.net")\n```\nCheck [flashbots docs](https://docs.flashbots.net/flashbots-auction/advanced/testnets#bundle-relay-urls) for up-to-date URLs.\n\n## Development and testing\n\nInstall [poetry](https://python-poetry.org/)\n\nPoetry will automatically fix your venv and all packages needed.\n\n```sh\npoetry install\n```\n\nTips: PyCharm has a poetry plugin\n\n## Simple Testnet Example\n\nSee [examples/simple.py](./examples/simple.py) for environment variable definitions.\n\n```sh\npoetry shell\nETH_SENDER_KEY= \\nPROVIDER_URL=https://eth-holesky.alchemyapi.io/v2/ \\nETH_SIGNER_KEY= \\npython examples/simple.py\n```\n\n## Linting\n\nIt\'s advisable to run black with default rules for linting\n\n```sh\nsudo pip install black # Black should be installed with a global entrypoint\nblack .\n```', "long_description_content_type": "text/markdown", "author": "Georgios Konstantopoulos", "author_email": "me@gakonst.com",