Game7 and Game7 Testnet V2 types

g7-types-v2
kompotkot 2025-02-26 17:49:48 +00:00
rodzic 1e97318b97
commit e33faebbfc
5 zmienionych plików z 52 dodań i 4 usunięć

Wyświetl plik

@ -65,6 +65,12 @@ from moonstreamdb.models import (
ZkSyncEraTestnetLabel, ZkSyncEraTestnetLabel,
ZkSyncEraTestnetTransaction, ZkSyncEraTestnetTransaction,
ZkSyncEraTransaction, ZkSyncEraTransaction,
Game7Block,
Game7Label,
Game7Transaction,
Game7TestnetBlock,
Game7TestnetLabel,
Game7TestnetTransaction,
) )
from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3 from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3
from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3 from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3
@ -101,6 +107,7 @@ from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
from moonstreamdbv3.models import RoninLabel as RoninLabelV3 from moonstreamdbv3.models import RoninLabel as RoninLabelV3
from moonstreamdbv3.models import RoninSaigonLabel as RoninSaigonLabelV3 from moonstreamdbv3.models import RoninSaigonLabel as RoninSaigonLabelV3
class AvailableBlockchainType(Enum): class AvailableBlockchainType(Enum):
ETHEREUM = "ethereum" ETHEREUM = "ethereum"
SEPOLIA = "sepolia" SEPOLIA = "sepolia"
@ -162,7 +169,9 @@ def get_block_model(
BlastSepoliaBlock, BlastSepoliaBlock,
ProofOfPlayApexBlock, ProofOfPlayApexBlock,
MantleBlock, MantleBlock,
MantleSepoliaBlock MantleSepoliaBlock,
Game7Block,
Game7TestnetBlock,
] ]
]: ]:
""" """
@ -190,7 +199,9 @@ def get_block_model(
BlastSepoliaBlock, BlastSepoliaBlock,
ProofOfPlayApexBlock, ProofOfPlayApexBlock,
MantleBlock, MantleBlock,
MantleSepoliaBlock MantleSepoliaBlock,
Game7Block,
Game7TestnetBlock,
] ]
] ]
if blockchain_type == AvailableBlockchainType.ETHEREUM: if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -235,6 +246,10 @@ def get_block_model(
block_model = MantleBlock block_model = MantleBlock
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA: elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
block_model = MantleSepoliaBlock block_model = MantleSepoliaBlock
elif blockchain_type == AvailableBlockchainType.GAME7:
block_model = Game7Block
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
block_model = Game7TestnetBlock
else: else:
raise Exception("Unsupported blockchain type provided") raise Exception("Unsupported blockchain type provided")
@ -267,6 +282,8 @@ def get_label_model(
ProofOfPlayApexLabel, ProofOfPlayApexLabel,
MantleLabel, MantleLabel,
MantleSepoliaLabel, MantleSepoliaLabel,
Game7Label,
Game7TestnetLabel,
EthereumLabelV3, EthereumLabelV3,
SepoliaLabelV3, SepoliaLabelV3,
PolygonLabelV3, PolygonLabelV3,
@ -328,6 +345,8 @@ def get_label_model(
ProofOfPlayApexLabel, ProofOfPlayApexLabel,
MantleLabel, MantleLabel,
MantleSepoliaLabel, MantleSepoliaLabel,
Game7Label,
Game7TestnetLabel,
EthereumLabelV3, EthereumLabelV3,
SepoliaLabelV3, SepoliaLabelV3,
PolygonLabelV3, PolygonLabelV3,
@ -402,6 +421,10 @@ def get_label_model(
label_model = MantleLabel label_model = MantleLabel
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA: elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
label_model = MantleSepoliaLabel label_model = MantleSepoliaLabel
elif blockchain_type == AvailableBlockchainType.GAME7:
label_model = Game7Label
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
label_model = Game7TestnetLabel
else: else:
raise Exception("Unsupported blockchain type provided") raise Exception("Unsupported blockchain type provided")
elif version == 3: elif version == 3:
@ -501,6 +524,8 @@ def get_transaction_model(
ProofOfPlayApexTransaction, ProofOfPlayApexTransaction,
MantleTransaction, MantleTransaction,
MantleSepoliaTransaction, MantleSepoliaTransaction,
Game7Transaction,
Game7TestnetTransaction,
] ]
]: ]:
""" """
@ -529,6 +554,8 @@ def get_transaction_model(
ProofOfPlayApexTransaction, ProofOfPlayApexTransaction,
MantleTransaction, MantleTransaction,
MantleSepoliaTransaction, MantleSepoliaTransaction,
Game7Transaction,
Game7TestnetTransaction,
] ]
] ]
if blockchain_type == AvailableBlockchainType.ETHEREUM: if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -573,6 +600,10 @@ def get_transaction_model(
transaction_model = MantleTransaction transaction_model = MantleTransaction
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA: elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
transaction_model = MantleSepoliaTransaction transaction_model = MantleSepoliaTransaction
elif blockchain_type == AvailableBlockchainType.GAME7:
transaction_model = Game7Transaction
elif blockchain_type == AvailableBlockchainType.GAME7_TESTNET:
transaction_model = Game7TestnetTransaction
else: else:
raise Exception("Unsupported blockchain type provided") raise Exception("Unsupported blockchain type provided")

Wyświetl plik

@ -66,6 +66,12 @@ from moonstreamdb.models import (
ZkSyncEraTestnetLabel, ZkSyncEraTestnetLabel,
ZkSyncEraTestnetTransaction, ZkSyncEraTestnetTransaction,
ZkSyncEraTransaction, ZkSyncEraTransaction,
Game7Block,
Game7Label,
Game7Transaction,
Game7TestnetBlock,
Game7TestnetLabel,
Game7TestnetTransaction,
) )
from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3 from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3
from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3 from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3
@ -272,6 +278,16 @@ MODELS: Dict[Network, Dict[str, Base]] = {
"labels": MantleSepoliaLabel, "labels": MantleSepoliaLabel,
"transactions": MantleSepoliaTransaction, "transactions": MantleSepoliaTransaction,
}, },
Network.game7: {
"blocks": Game7Block,
"labels": Game7Label,
"transactions": Game7Transaction,
},
Network.game7_testnet: {
"blocks": Game7TestnetBlock,
"labels": Game7TestnetLabel,
"transactions": Game7TestnetTransaction,
},
} }
MODELS_V3: Dict[Network, Dict[str, Base]] = { MODELS_V3: Dict[Network, Dict[str, Base]] = {

Wyświetl plik

@ -41,6 +41,7 @@ class SubscriptionTypes(Enum):
RONIN_BLOCKCHAIN = "ronin_smartcontract" RONIN_BLOCKCHAIN = "ronin_smartcontract"
RONIN_SAIGON_BLOCKCHAIN = "ronin_saigon_smartcontract" RONIN_SAIGON_BLOCKCHAIN = "ronin_saigon_smartcontract"
def blockchain_type_to_subscription_type( def blockchain_type_to_subscription_type(
blockchain_type: AvailableBlockchainType, blockchain_type: AvailableBlockchainType,
) -> SubscriptionTypes: ) -> SubscriptionTypes:

Wyświetl plik

@ -1 +1 @@
0.0.11 0.0.12

Wyświetl plik

@ -33,7 +33,7 @@ setup(
package_data={"moonstreamtypes": ["py.typed"]}, package_data={"moonstreamtypes": ["py.typed"]},
zip_safe=False, zip_safe=False,
install_requires=[ install_requires=[
"moonstreamdb>=0.4.5", "moonstreamdb>=0.4.7",
"moonstreamdb-v3>=0.1.4", "moonstreamdb-v3>=0.1.4",
], ],
extras_require={ extras_require={