-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: improve network handling and type safety
- 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
- Loading branch information
Showing
4 changed files
with
255 additions
and
235 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
from typing import Dict, Tuple | ||
from typing import Dict | ||
|
||
from eth_typing import URI | ||
|
||
from .types import Network, NetworkConfig | ||
|
||
FLASHBOTS_NETWORKS: Dict[Network, NetworkConfig] = { | ||
"sepolia": { | ||
"chain_id": 11155111, | ||
"provider_url": URI("https://rpc-sepolia.flashbots.net"), | ||
"relay_url": URI("https://relay-sepolia.flashbots.net"), | ||
}, | ||
"holesky": { | ||
"chain_id": 17000, | ||
"provider_url": URI("https://rpc-holesky.flashbots.net"), | ||
"relay_url": URI("https://relay-holesky.flashbots.net"), | ||
}, | ||
"mainnet": { | ||
"chain_id": 1, | ||
"provider_url": URI("https://rpc.flashbots.net"), | ||
"relay_url": URI("https://relay.flashbots.net"), | ||
}, | ||
Network.SEPOLIA: NetworkConfig( | ||
chain_id=11155111, | ||
provider_url=URI("https://rpc-sepolia.flashbots.net"), | ||
relay_url=URI("https://relay-sepolia.flashbots.net"), | ||
), | ||
Network.HOLESKY: NetworkConfig( | ||
chain_id=17000, | ||
provider_url=URI("https://rpc-holesky.flashbots.net"), | ||
relay_url=URI("https://relay-holesky.flashbots.net"), | ||
), | ||
Network.MAINNET: NetworkConfig( | ||
chain_id=1, | ||
provider_url=URI("https://rpc.flashbots.net"), | ||
relay_url=URI("https://relay.flashbots.net"), | ||
), | ||
} | ||
|
||
|
||
def get_networks() -> Tuple[Network, ...]: | ||
return tuple(FLASHBOTS_NETWORKS.keys()) |
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
Oops, something went wrong.