staking-deposit-cli/staking_deposit/settings.py
2022-07-30 14:02:38 +08:00

40 lines
1.1 KiB
Python

from typing import Dict, NamedTuple
DEPOSIT_CLI_VERSION = '2.2.0'
class BaseChainSetting(NamedTuple):
NETWORK_NAME: str
GENESIS_FORK_VERSION: bytes
MAINNET = 'mainnet'
ROPSTEN = 'ropsten'
GOERLI = 'goerli'
PRATER = 'prater'
KILN = 'kiln'
# Mainnet setting
MainnetSetting = BaseChainSetting(NETWORK_NAME=MAINNET, GENESIS_FORK_VERSION=bytes.fromhex('00000000'))
# Ropsten setting
RopstenSetting = BaseChainSetting(NETWORK_NAME=ROPSTEN, GENESIS_FORK_VERSION=bytes.fromhex('80000069'))
# Goreli setting
GoerliSetting = BaseChainSetting(NETWORK_NAME=GOERLI, GENESIS_FORK_VERSION=bytes.fromhex('00001020'))
# Merge Testnet (spec v1.1.9)
KilnSetting = BaseChainSetting(NETWORK_NAME=KILN, GENESIS_FORK_VERSION=bytes.fromhex('70000069'))
ALL_CHAINS: Dict[str, BaseChainSetting] = {
MAINNET: MainnetSetting,
ROPSTEN: RopstenSetting,
GOERLI: GoerliSetting,
PRATER: GoerliSetting, # Prater is the old name of the Prater/Goerli testnet
KILN: KilnSetting,
}
def get_chain_setting(chain_name: str = MAINNET) -> BaseChainSetting:
return ALL_CHAINS[chain_name]