staking-deposit-cli/eth2deposit/settings.py

44 lines
1.3 KiB
Python
Raw Normal View History

from typing import Dict, NamedTuple
import pkg_resources
DEPOSIT_CLI_VERSION = pkg_resources.require("eth2deposit")[0].version
class BaseChainSetting(NamedTuple):
GENESIS_FORK_VERSION: bytes
2020-06-25 03:42:03 +00:00
# Eth2 Mainnet setting
2020-06-25 03:23:00 +00:00
MainnetSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000000'))
2020-05-26 08:13:12 +00:00
# Eth2 spec v0.11.3 testnet
2020-06-25 03:23:00 +00:00
WittiSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000113'))
# Eth2 spec v0.12.1 testnet
AltonaSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000121'))
2020-07-23 08:01:15 +00:00
# Eth2 "official" public testnet (spec v0.12.2)
MedallaSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000001'))
2020-09-30 02:00:59 +00:00
# Eth2 "dress rehearsal" testnet (spec v0.12.3)
SpadinaSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000002'))
2020-09-30 02:00:59 +00:00
# Eth2 "dress rehearsal" testnet (spec v0.12.3)
ZinkenSetting = BaseChainSetting(GENESIS_FORK_VERSION=bytes.fromhex('00000003'))
2020-05-26 08:13:12 +00:00
MAINNET = 'mainnet'
2020-05-26 08:13:12 +00:00
WITTI = 'witti'
2020-06-25 03:23:00 +00:00
ALTONA = 'altona'
2020-07-23 08:01:15 +00:00
MEDALLA = 'medalla'
SPADINA = 'spadina'
2020-09-30 02:00:59 +00:00
ZINKEN = 'zinken'
ALL_CHAINS: Dict[str, BaseChainSetting] = {
MAINNET: MainnetSetting,
2020-05-26 08:13:12 +00:00
WITTI: WittiSetting,
2020-06-25 03:23:00 +00:00
ALTONA: AltonaSetting,
2020-07-23 08:01:15 +00:00
MEDALLA: MedallaSetting,
SPADINA: SpadinaSetting,
2020-09-30 02:00:59 +00:00
ZINKEN: ZinkenSetting,
}
def get_setting(chain_name: str = MAINNET) -> BaseChainSetting:
return ALL_CHAINS[chain_name]