Mantle and Mantle Sepolia types for V2

pull/1100/head
kompotkot 2024-06-25 09:52:07 +00:00
rodzic 317f5fe1af
commit 39b8f53e97
5 zmienionych plików z 102 dodań i 55 usunięć

Wyświetl plik

@ -5,12 +5,12 @@ from moonstreamdb.models import (
AmoyBlock, AmoyBlock,
AmoyLabel, AmoyLabel,
AmoyTransaction, AmoyTransaction,
ArbitrumOneBlock,
ArbitrumOneLabel,
ArbitrumOneTransaction,
ArbitrumNovaBlock, ArbitrumNovaBlock,
ArbitrumNovaLabel, ArbitrumNovaLabel,
ArbitrumNovaTransaction, ArbitrumNovaTransaction,
ArbitrumOneBlock,
ArbitrumOneLabel,
ArbitrumOneTransaction,
ArbitrumSepoliaBlock, ArbitrumSepoliaBlock,
ArbitrumSepoliaLabel, ArbitrumSepoliaLabel,
ArbitrumSepoliaTransaction, ArbitrumSepoliaTransaction,
@ -29,6 +29,12 @@ from moonstreamdb.models import (
EthereumBlock, EthereumBlock,
EthereumLabel, EthereumLabel,
EthereumTransaction, EthereumTransaction,
MantleBlock,
MantleLabel,
MantleSepoliaBlock,
MantleSepoliaLabel,
MantleSepoliaTransaction,
MantleTransaction,
MumbaiBlock, MumbaiBlock,
MumbaiLabel, MumbaiLabel,
MumbaiTransaction, MumbaiTransaction,
@ -60,32 +66,32 @@ from moonstreamdb.models import (
ZkSyncEraTestnetTransaction, ZkSyncEraTestnetTransaction,
ZkSyncEraTransaction, ZkSyncEraTransaction,
) )
from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3
from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3
from moonstreamdbv3.models import ArbitrumOneLabel as ArbitrumOneLabelV3
from moonstreamdbv3.models import ArbitrumSepoliaLabel as ArbitrumSepoliaLabelV3
from moonstreamdbv3.models import AvalancheFujiLabel as AvalancheFujiLabelV3
from moonstreamdbv3.models import AvalancheLabel as AvalancheLabelV3
from moonstreamdbv3.models import BaseLabel as BaseLabelV3
from moonstreamdbv3.models import BlastLabel as BlastLabelV3
from moonstreamdbv3.models import BlastSepoliaLabel as BlastSepoliaLabelV3
from moonstreamdbv3.models import EthereumLabel as EthereumLabelV3
from moonstreamdbv3.models import ( from moonstreamdbv3.models import (
EthereumLabel as EthereumLabelV3,
SepoliaLabel as SepoliaLabelV3,
PolygonLabel as PolygonLabelV3,
MumbaiLabel as MumbaiLabelV3,
AmoyLabel as AmoyLabelV3,
XDaiLabel as XDaiLabelV3,
ZkSyncEraLabel as ZkSyncEraLabelV3,
ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3,
BaseLabel as BaseLabelV3,
ArbitrumNovaLabel as ArbitrumNovaLabelV3,
ArbitrumOneLabel as ArbitrumOneLabelV3,
ArbitrumSepoliaLabel as ArbitrumSepoliaLabelV3,
Game7OrbitArbitrumSepoliaLabel as Game7OrbitArbitrumSepoliaLabelV3, Game7OrbitArbitrumSepoliaLabel as Game7OrbitArbitrumSepoliaLabelV3,
XaiLabel as XaiLabelV3,
XaiSepoliaLabel as XaiSepoliaLabelV3,
AvalancheLabel as AvalancheLabelV3,
AvalancheFujiLabel as AvalancheFujiLabelV3,
BlastLabel as BlastLabelV3,
BlastSepoliaLabel as BlastSepoliaLabelV3,
ProofOfPlayApexLabel as ProofOfPlayApexLabelV3,
StarknetLabel as StarknetLabelV3,
StarknetSepoliaLabel as StarknetSepoliaLabelV3,
MantleLabel as MantleLabelV3,
MantleSepoliaLabel as MantleSepoliaLabelV3,
) )
from moonstreamdbv3.models import MantleLabel as MantleLabelV3
from moonstreamdbv3.models import MantleSepoliaLabel as MantleSepoliaLabelV3
from moonstreamdbv3.models import MumbaiLabel as MumbaiLabelV3
from moonstreamdbv3.models import PolygonLabel as PolygonLabelV3
from moonstreamdbv3.models import ProofOfPlayApexLabel as ProofOfPlayApexLabelV3
from moonstreamdbv3.models import SepoliaLabel as SepoliaLabelV3
from moonstreamdbv3.models import StarknetLabel as StarknetLabelV3
from moonstreamdbv3.models import StarknetSepoliaLabel as StarknetSepoliaLabelV3
from moonstreamdbv3.models import XaiLabel as XaiLabelV3
from moonstreamdbv3.models import XaiSepoliaLabel as XaiSepoliaLabelV3
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
class AvailableBlockchainType(Enum): class AvailableBlockchainType(Enum):
@ -140,6 +146,8 @@ def get_block_model(
BlastBlock, BlastBlock,
BlastSepoliaBlock, BlastSepoliaBlock,
ProofOfPlayApexBlock, ProofOfPlayApexBlock,
MantleBlock,
MantleSepoliaBlock,
] ]
]: ]:
""" """
@ -166,6 +174,8 @@ def get_block_model(
BlastBlock, BlastBlock,
BlastSepoliaBlock, BlastSepoliaBlock,
ProofOfPlayApexBlock, ProofOfPlayApexBlock,
MantleBlock,
MantleSepoliaBlock,
] ]
] ]
if blockchain_type == AvailableBlockchainType.ETHEREUM: if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -206,6 +216,10 @@ def get_block_model(
block_model = BlastSepoliaBlock block_model = BlastSepoliaBlock
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
block_model = ProofOfPlayApexBlock block_model = ProofOfPlayApexBlock
elif blockchain_type == AvailableBlockchainType.MANTLE:
block_model = MantleBlock
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
block_model = MantleSepoliaBlock
else: else:
raise Exception("Unsupported blockchain type provided") raise Exception("Unsupported blockchain type provided")
@ -236,6 +250,8 @@ def get_label_model(
BlastLabel, BlastLabel,
BlastSepoliaLabel, BlastSepoliaLabel,
ProofOfPlayApexLabel, ProofOfPlayApexLabel,
MantleLabel,
MantleSepoliaLabel,
EthereumLabelV3, EthereumLabelV3,
SepoliaLabelV3, SepoliaLabelV3,
PolygonLabelV3, PolygonLabelV3,
@ -290,6 +306,8 @@ def get_label_model(
BlastLabel, BlastLabel,
BlastSepoliaLabel, BlastSepoliaLabel,
ProofOfPlayApexLabel, ProofOfPlayApexLabel,
MantleLabel,
MantleSepoliaLabel,
EthereumLabelV3, EthereumLabelV3,
SepoliaLabelV3, SepoliaLabelV3,
PolygonLabelV3, PolygonLabelV3,
@ -355,6 +373,10 @@ def get_label_model(
label_model = BlastSepoliaLabel label_model = BlastSepoliaLabel
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
label_model = ProofOfPlayApexLabel label_model = ProofOfPlayApexLabel
elif blockchain_type == AvailableBlockchainType.MANTLE:
label_model = MantleLabel
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
label_model = MantleSepoliaLabel
else: else:
raise Exception("Unsupported blockchain type provided") raise Exception("Unsupported blockchain type provided")
elif version == 3: elif version == 3:
@ -436,6 +458,8 @@ def get_transaction_model(
BlastTransaction, BlastTransaction,
BlastSepoliaTransaction, BlastSepoliaTransaction,
ProofOfPlayApexTransaction, ProofOfPlayApexTransaction,
MantleTransaction,
MantleSepoliaTransaction,
] ]
]: ]:
""" """
@ -462,6 +486,8 @@ def get_transaction_model(
BlastTransaction, BlastTransaction,
BlastSepoliaTransaction, BlastSepoliaTransaction,
ProofOfPlayApexTransaction, ProofOfPlayApexTransaction,
MantleTransaction,
MantleSepoliaTransaction,
] ]
] ]
if blockchain_type == AvailableBlockchainType.ETHEREUM: if blockchain_type == AvailableBlockchainType.ETHEREUM:
@ -502,6 +528,10 @@ def get_transaction_model(
transaction_model = BlastSepoliaTransaction transaction_model = BlastSepoliaTransaction
elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX: elif blockchain_type == AvailableBlockchainType.PROOFOFPLAY_APEX:
transaction_model = ProofOfPlayApexTransaction transaction_model = ProofOfPlayApexTransaction
elif blockchain_type == AvailableBlockchainType.MANTLE:
transaction_model = MantleTransaction
elif blockchain_type == AvailableBlockchainType.MANTLE_SEPOLIA:
transaction_model = MantleSepoliaTransaction
else: else:
raise Exception("Unsupported blockchain type provided") raise Exception("Unsupported blockchain type provided")

Wyświetl plik

@ -5,12 +5,12 @@ from moonstreamdb.models import (
AmoyBlock, AmoyBlock,
AmoyLabel, AmoyLabel,
AmoyTransaction, AmoyTransaction,
ArbitrumOneBlock,
ArbitrumOneLabel,
ArbitrumOneTransaction,
ArbitrumNovaBlock, ArbitrumNovaBlock,
ArbitrumNovaLabel, ArbitrumNovaLabel,
ArbitrumNovaTransaction, ArbitrumNovaTransaction,
ArbitrumOneBlock,
ArbitrumOneLabel,
ArbitrumOneTransaction,
ArbitrumSepoliaBlock, ArbitrumSepoliaBlock,
ArbitrumSepoliaLabel, ArbitrumSepoliaLabel,
ArbitrumSepoliaTransaction, ArbitrumSepoliaTransaction,
@ -30,6 +30,12 @@ from moonstreamdb.models import (
EthereumBlock, EthereumBlock,
EthereumLabel, EthereumLabel,
EthereumTransaction, EthereumTransaction,
MantleBlock,
MantleLabel,
MantleSepoliaBlock,
MantleSepoliaLabel,
MantleSepoliaTransaction,
MantleTransaction,
MumbaiBlock, MumbaiBlock,
MumbaiLabel, MumbaiLabel,
MumbaiTransaction, MumbaiTransaction,
@ -61,32 +67,32 @@ from moonstreamdb.models import (
ZkSyncEraTestnetTransaction, ZkSyncEraTestnetTransaction,
ZkSyncEraTransaction, ZkSyncEraTransaction,
) )
from moonstreamdbv3.models import AmoyLabel as AmoyLabelV3
from moonstreamdbv3.models import ArbitrumNovaLabel as ArbitrumNovaLabelV3
from moonstreamdbv3.models import ArbitrumOneLabel as ArbitrumOneLabelV3
from moonstreamdbv3.models import ArbitrumSepoliaLabel as ArbitrumSepoliaLabelV3
from moonstreamdbv3.models import AvalancheFujiLabel as AvalancheFujiLabelV3
from moonstreamdbv3.models import AvalancheLabel as AvalancheLabelV3
from moonstreamdbv3.models import BaseLabel as BaseLabelV3
from moonstreamdbv3.models import BlastLabel as BlastLabelV3
from moonstreamdbv3.models import BlastSepoliaLabel as BlastSepoliaLabelV3
from moonstreamdbv3.models import EthereumLabel as EthereumLabelV3
from moonstreamdbv3.models import ( from moonstreamdbv3.models import (
EthereumLabel as EthereumLabelV3,
SepoliaLabel as SepoliaLabelV3,
PolygonLabel as PolygonLabelV3,
MumbaiLabel as MumbaiLabelV3,
AmoyLabel as AmoyLabelV3,
XDaiLabel as XDaiLabelV3,
ZkSyncEraLabel as ZkSyncEraLabelV3,
ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3,
BaseLabel as BaseLabelV3,
ArbitrumNovaLabel as ArbitrumNovaLabelV3,
ArbitrumOneLabel as ArbitrumOneLabelV3,
ArbitrumSepoliaLabel as ArbitrumSepoliaLabelV3,
Game7OrbitArbitrumSepoliaLabel as Game7OrbitArbitrumSepoliaLabelV3, Game7OrbitArbitrumSepoliaLabel as Game7OrbitArbitrumSepoliaLabelV3,
XaiLabel as XaiLabelV3,
XaiSepoliaLabel as XaiSepoliaLabelV3,
AvalancheLabel as AvalancheLabelV3,
AvalancheFujiLabel as AvalancheFujiLabelV3,
BlastLabel as BlastLabelV3,
BlastSepoliaLabel as BlastSepoliaLabelV3,
ProofOfPlayApexLabel as ProofOfPlayApexLabelV3,
StarknetLabel as StarknetLabelV3,
StarknetSepoliaLabel as StarknetSepoliaLabelV3,
MantleLabel as MantleLabelV3,
MantleSepoliaLabel as MantleSepoliaLabelV3,
) )
from moonstreamdbv3.models import MantleLabel as MantleLabelV3
from moonstreamdbv3.models import MantleSepoliaLabel as MantleSepoliaLabelV3
from moonstreamdbv3.models import MumbaiLabel as MumbaiLabelV3
from moonstreamdbv3.models import PolygonLabel as PolygonLabelV3
from moonstreamdbv3.models import ProofOfPlayApexLabel as ProofOfPlayApexLabelV3
from moonstreamdbv3.models import SepoliaLabel as SepoliaLabelV3
from moonstreamdbv3.models import StarknetLabel as StarknetLabelV3
from moonstreamdbv3.models import StarknetSepoliaLabel as StarknetSepoliaLabelV3
from moonstreamdbv3.models import XaiLabel as XaiLabelV3
from moonstreamdbv3.models import XaiSepoliaLabel as XaiSepoliaLabelV3
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
from .blockchain import AvailableBlockchainType from .blockchain import AvailableBlockchainType
@ -140,6 +146,8 @@ tx_raw_types = Union[
BlastTransaction, BlastTransaction,
BlastSepoliaTransaction, BlastSepoliaTransaction,
ProofOfPlayApexTransaction, ProofOfPlayApexTransaction,
MantleTransaction,
MantleSepoliaTransaction,
] ]
MODELS: Dict[Network, Dict[str, Base]] = { MODELS: Dict[Network, Dict[str, Base]] = {
@ -238,6 +246,16 @@ MODELS: Dict[Network, Dict[str, Base]] = {
"labels": ProofOfPlayApexLabel, "labels": ProofOfPlayApexLabel,
"transactions": ProofOfPlayApexTransaction, "transactions": ProofOfPlayApexTransaction,
}, },
Network.mantle: {
"blocks": MantleBlock,
"labels": MantleLabel,
"transactions": MantleTransaction,
},
Network.mantle_sepolia: {
"blocks": MantleSepoliaBlock,
"labels": MantleSepoliaLabel,
"transactions": MantleSepoliaTransaction,
},
} }
MODELS_V3: Dict[Network, Dict[str, Base]] = { MODELS_V3: Dict[Network, Dict[str, Base]] = {

Wyświetl plik

@ -145,7 +145,6 @@ blockchain_by_subscription_id = {
"starknet_sepolia_blockchain": "starknet_sepolia", "starknet_sepolia_blockchain": "starknet_sepolia",
"mantle_blockchain": "mantle", "mantle_blockchain": "mantle",
"mantle_sepolia_blockchain": "mantle_sepolia", "mantle_sepolia_blockchain": "mantle_sepolia",
"ethereum_smartcontract": "ethereum", "ethereum_smartcontract": "ethereum",
"polygon_smartcontract": "polygon", "polygon_smartcontract": "polygon",
"mumbai_smartcontract": "mumbai", "mumbai_smartcontract": "mumbai",

Wyświetl plik

@ -1 +1 @@
0.0.3 0.0.4

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.4", "moonstreamdb>=0.4.5",
"moonstreamdb-v3>=0.0.9", "moonstreamdb-v3>=0.0.9",
], ],
extras_require={ extras_require={