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

Wyświetl plik

@ -66,6 +66,12 @@ from moonstreamdb.models import (
ZkSyncEraTestnetLabel,
ZkSyncEraTestnetTransaction,
ZkSyncEraTransaction,
Game7Block,
Game7Label,
Game7Transaction,
Game7TestnetBlock,
Game7TestnetLabel,
Game7TestnetTransaction,
)
from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3
from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3
@ -272,6 +278,16 @@ MODELS: Dict[Network, Dict[str, Base]] = {
"labels": MantleSepoliaLabel,
"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]] = {

Wyświetl plik

@ -41,6 +41,7 @@ class SubscriptionTypes(Enum):
RONIN_BLOCKCHAIN = "ronin_smartcontract"
RONIN_SAIGON_BLOCKCHAIN = "ronin_saigon_smartcontract"
def blockchain_type_to_subscription_type(
blockchain_type: AvailableBlockchainType,
) -> 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"]},
zip_safe=False,
install_requires=[
"moonstreamdb>=0.4.5",
"moonstreamdb>=0.4.7",
"moonstreamdb-v3>=0.1.4",
],
extras_require={