-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web3.py V6 upgrade #96
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add logger to Flashbots class - Include log messages for key operations: - Sending bundle - Simulating bundle - Sending private transaction - Cancelling private transaction - Use proper logging instead of print in example.py
- Streamline header combination in make_request method - Update docstring to accurately reflect provider's purpose - Improve overall code readability
- Remove Black configuration and dependencies - Add Ruff configuration and dependencies - Update VSCode settings for Python to use Ruff - Add pre-commit config for Ruff - Replace GitHub Actions workflow for Black with Ruff - Update pyproject.toml to configure Ruff
- Reorder and optimize imports across multiple files - Remove unused imports - Standardize import order and grouping - Minor code formatting adjustments - Remove trailing whitespace This commit improves code consistency and readability by applying ruff's linting and formatting rules to the project.
- Introduce FlashbotsWeb3 class to enhance type checking - Remove Goerli-specific PoA middleware injection - Update flashbot function to return FlashbotsWeb3 instance - Improve error handling for environment variables in examples - Enhance address handling with Web3.to_checksum_address - Update transaction nonce type to use web3.types.Nonce - Minor code style improvements and type annotations
- Add flashbots/constants.py with FLASHBOTS_NETWORKS - Update flashbots/types.py to include new network types - Modify setup_web3 function to use the new network configuration - Remove NETWORK_CONFIG and related functions from examples/simple.py
- Update create_transaction function to dynamically calculate gas prices - Modify transaction creation in main function
- Add command-line arguments for network selection and log level - Implement dynamic logging configuration - Update docstrings with usage instructions and examples - Refactor network type to 'Network' for consistency - Add get_networks() function to retrieve available networks - Improve flashbot() function documentation - Minor code cleanup and formatting improvements
- Convert Network type to Enum for better type safety - Update FLASHBOTS_NETWORKS to use Network enum as keys - Remove get_networks() function, use Network enum values directly - Add EnumAction class for argparse to handle Network enum - Update parse_arguments() and related functions to use Network enum - Adjust type hints throughout the code to reflect these changes
zeroXbrock
approved these changes
Jul 31, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super clean, thx @odysseus0!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for Web3.py v6 and enhance Flashbots module
This pull request introduces support for Web3.py v6 and includes several improvements to the Flashbots module, enhancing type safety and refactoring code for better maintainability.
Key Changes
Web3.py v6 Support
Network Handling Refactor
Improved Transaction Handling
Type Safety Enhancements
Code Quality Improvements
Enhanced Logging
Additional Notes
These changes primarily focus on ensuring compatibility with Web3.py v6 while also enhancing the overall quality, maintainability, and usability of the Flashbots module.