Update moonstream types.

pull/1149/head
Andrey 2024-12-18 16:10:33 +02:00
rodzic 1de7b7fa96
commit 7b901b0680
5 zmienionych plików z 50 dodań i 4 usunięć

Wyświetl plik

@ -81,6 +81,7 @@ from moonstreamdbv3.models import EthereumLabel as EthereumLabelV3
from moonstreamdbv3.models import (
Game7OrbitArbitrumSepoliaLabel as Game7OrbitArbitrumSepoliaLabelV3,
)
from moonstreamdbv3.models import Game7Label as Game7LabelV3
from moonstreamdbv3.models import Game7TestnetLabel as Game7TestnetLabelV3
from moonstreamdbv3.models import ImxZkevmLabel as ImxZkevmLabelV3
from moonstreamdbv3.models import ImxZkevmSepoliaLabel as ImxZkevmSepoliaLabelV3
@ -99,7 +100,8 @@ from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
from moonstreamdbv3.models import B3Label as B3LabelV3
from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
from moonstreamdbv3.models import RoninLabel as RoninLabelV3
from moonstreamdbv3.models import RoninSaigonLabel as RoninSaigonLabelV3
class AvailableBlockchainType(Enum):
ETHEREUM = "ethereum"
@ -118,6 +120,7 @@ class AvailableBlockchainType(Enum):
ARBITRUM_SEPOLIA = "arbitrum_sepolia"
GAME7_ORBIT_ARBITRUM_SEPOLIA = "game7_orbit_arbitrum_sepolia"
GAME7_TESTNET = "game7_testnet"
GAME7 = "game7"
XAI = "xai"
XAI_SEPOLIA = "xai_sepolia"
AVALANCHE = "avalanche"
@ -133,6 +136,8 @@ class AvailableBlockchainType(Enum):
IMX_ZKEVM_SEPOLIA = "imx_zkevm_sepolia"
B3 = "b3"
B3_SEPOLIA = "b3_sepolia"
RONIN = "ronin"
RONIN_SAIGON = "ronin_saigon"
def get_block_model(
@ -438,6 +443,8 @@ def get_label_model(
label_model = Game7OrbitArbitrumSepoliaLabelV3
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
label_model = Game7TestnetLabelV3
elif blockchain_type == AvailableBlockchainType.GAME7:
label_model = Game7LabelV3
elif blockchain_type == AvailableBlockchainType.XAI:
label_model = XaiLabelV3
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
@ -468,6 +475,10 @@ def get_label_model(
label_model = B3LabelV3
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
label_model = B3SepoliaLabelV3
elif blockchain_type == AvailableBlockchainType.RONIN:
label_model = RoninLabelV3
elif blockchain_type == AvailableBlockchainType.RONIN_SAIGON:
label_model = RoninSaigonLabelV3
else:
raise Exception("Unsupported blockchain type provided")
else:

Wyświetl plik

@ -81,6 +81,7 @@ from moonstreamdbv3.models import (
Game7OrbitArbitrumSepoliaLabel as Game7OrbitArbitrumSepoliaLabelV3,
)
from moonstreamdbv3.models import Game7TestnetLabel as Game7TestnetLabelV3
from moonstreamdbv3.models import Game7Label as Game7LabelV3
from moonstreamdbv3.models import ImxZkevmLabel as ImxZkevmLabelV3
from moonstreamdbv3.models import ImxZkevmSepoliaLabel as ImxZkevmSepoliaLabelV3
from moonstreamdbv3.models import MantleLabel as MantleLabelV3
@ -98,6 +99,8 @@ from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
from moonstreamdbv3.models import B3Label as B3LabelV3
from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
from moonstreamdbv3.models import RoninLabel as RoninLabelV3
from moonstreamdbv3.models import RoninSaigonLabel as RoninSaigonLabelV3
from .blockchain import AvailableBlockchainType
@ -119,6 +122,7 @@ class Network(Enum):
arbitrum_sepolia = "arbitrum_sepolia"
game7_orbit_arbitrum_sepolia = "game7_orbit_arbitrum_sepolia"
game7_testnet = "game7_testnet"
game7 = "game7"
xai = "xai"
xai_sepolia = "xai_sepolia"
avalanche = "avalanche"
@ -134,6 +138,8 @@ class Network(Enum):
imx_zkevm_sepolia = "imx_zkevm_sepolia"
b3 = "b3"
b3_sepolia = "b3_sepolia"
ronin = "ronin"
ronin_saigon = "ronin_saigon"
tx_raw_types = Union[
@ -311,6 +317,9 @@ MODELS_V3: Dict[Network, Dict[str, Base]] = {
Network.game7_testnet: {
"labels": Game7TestnetLabelV3,
},
Network.game7: {
"labels": Game7LabelV3,
},
Network.xai: {
"labels": XaiLabelV3,
},
@ -356,6 +365,12 @@ MODELS_V3: Dict[Network, Dict[str, Base]] = {
Network.b3_sepolia: {
"labels": B3SepoliaLabelV3,
},
Network.ronin: {
"labels": RoninLabelV3,
},
Network.ronin_saigon: {
"labels": RoninSaigonLabelV3,
},
}
@ -395,6 +410,8 @@ def blockchain_type_to_network_type(
return Network.game7_orbit_arbitrum_sepolia
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
return Network.game7_testnet
elif blockchain_type == AvailableBlockchainType.GAME7:
return Network.game7
elif blockchain_type == AvailableBlockchainType.XAI:
return Network.xai
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
@ -425,5 +442,9 @@ def blockchain_type_to_network_type(
return Network.b3
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
return Network.b3_sepolia
elif blockchain_type == AvailableBlockchainType.RONIN:
return Network.ronin
elif blockchain_type == AvailableBlockchainType.RONIN_SAIGON:
return Network.ronin_saigon
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")

Wyświetl plik

@ -22,6 +22,7 @@ class SubscriptionTypes(Enum):
"game7_orbit_arbitrum_sepolia_smartcontract"
)
GAME7_TESTNET_BLOCKCHAIN = "game7_testnet_smartcontract"
GAME7_BLOCKCHAIN = "game7_smartcontract"
XAI_BLOCKCHAIN = "xai_smartcontract"
XAI_SEPOLIA_BLOCKCHAIN = "xai_sepolia_smartcontract"
AVALANCHE_BLOCKCHAIN = "avalanche_smartcontract"
@ -37,7 +38,8 @@ class SubscriptionTypes(Enum):
IMX_ZKEVM_SEPOLIA_BLOCKCHAIN = "imx_zkevm_sepolia_smartcontract"
B3_BLOCKCHAIN = "b3_smartcontract"
B3_SEPOLIA_BLOCKCHAIN = "b3_sepolia_smartcontract"
RONIN_BLOCKCHAIN = "ronin_smartcontract"
RONIN_SAIGON_BLOCKCHAIN = "ronin_saigon_smartcontract"
def blockchain_type_to_subscription_type(
blockchain_type: AvailableBlockchainType,
@ -74,6 +76,8 @@ def blockchain_type_to_subscription_type(
return SubscriptionTypes.GAME7_ORBIT_ARBITRUM_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
return SubscriptionTypes.GAME7_TESTNET_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.GAME7:
return SubscriptionTypes.GAME7_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XAI:
return SubscriptionTypes.XAI_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.XAI_SEPOLIA:
@ -104,6 +108,10 @@ def blockchain_type_to_subscription_type(
return SubscriptionTypes.B3_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
return SubscriptionTypes.B3_SEPOLIA_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.RONIN:
return SubscriptionTypes.RONIN_BLOCKCHAIN
elif blockchain_type == AvailableBlockchainType.RONIN_SAIGON:
return SubscriptionTypes.RONIN_SAIGON_BLOCKCHAIN
else:
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
@ -125,6 +133,7 @@ subscription_id_by_blockchain = {
"arbitrum_sepolia": "arbitrum_sepolia_smartcontract",
"game7_orbit_arbitrum_sepolia": "game7_orbit_arbitrum_sepolia_smartcontract",
"game7_testnet": "game7_testnet_smartcontract",
"game7": "game7_smartcontract",
"xai": "xai_smartcontract",
"xai_sepolia": "xai_sepolia_smartcontract",
"avalanche": "avalanche_smartcontract",
@ -140,6 +149,8 @@ subscription_id_by_blockchain = {
"imx_zkevm_sepolia": "imx_zkevm_sepolia_smartcontract",
"b3": "b3_smartcontract",
"b3_sepolia": "b3_sepolia_smartcontract",
"ronin": "ronin_smartcontract",
"ronin_saigon": "ronin_saigon_smartcontract",
}
blockchain_by_subscription_id = {
@ -159,6 +170,7 @@ blockchain_by_subscription_id = {
"arbitrum_sepolia_blockchain": "arbitrum_sepolia",
"game7_orbit_arbitrum_sepolia_blockchain": "game7_orbit_arbitrum_sepolia",
"game7_testnet_blockchain": "game7_testnet",
"game7_blockchain": "game7",
"xai_blockchain": "xai",
"xai_sepolia_blockchain": "xai_sepolia",
"avalanche_blockchain": "avalanche",
@ -202,4 +214,6 @@ blockchain_by_subscription_id = {
"imx_zkevm_sepolia_smartcontract": "imx_zkevm_sepolia",
"b3_smartcontract": "b3",
"b3_sepolia_smartcontract": "b3_sepolia",
"ronin_smartcontract": "ronin",
"ronin_saigon_smartcontract": "ronin_saigon",
}

Wyświetl plik

@ -1 +1 @@
0.0.7
0.0.8

Wyświetl plik

@ -34,7 +34,7 @@ setup(
zip_safe=False,
install_requires=[
"moonstreamdb>=0.4.5",
"moonstreamdb-v3>=0.0.18",
"moonstreamdb-v3>=0.1.2",
],
extras_require={
"dev": ["black", "isort", "mypy"],