kopia lustrzana https://github.com/bugout-dev/moonstream
Add B3 moonstream types.
rodzic
47329fdc01
commit
a1916cfcdc
|
@ -20,6 +20,8 @@ from moonstreamdb.models import (
|
||||||
AvalancheFujiTransaction,
|
AvalancheFujiTransaction,
|
||||||
AvalancheLabel,
|
AvalancheLabel,
|
||||||
AvalancheTransaction,
|
AvalancheTransaction,
|
||||||
|
B3Block,
|
||||||
|
B3SepoliaBlock,
|
||||||
BlastBlock,
|
BlastBlock,
|
||||||
BlastLabel,
|
BlastLabel,
|
||||||
BlastSepoliaBlock,
|
BlastSepoliaBlock,
|
||||||
|
@ -95,6 +97,8 @@ from moonstreamdbv3.models import XaiSepoliaLabel as XaiSepoliaLabelV3
|
||||||
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
|
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
|
||||||
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
|
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
|
||||||
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
|
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
|
||||||
|
from moonstreamdbv3.models import B3Label as B3LabelV3
|
||||||
|
from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
|
||||||
|
|
||||||
|
|
||||||
class AvailableBlockchainType(Enum):
|
class AvailableBlockchainType(Enum):
|
||||||
|
@ -127,6 +131,8 @@ class AvailableBlockchainType(Enum):
|
||||||
MANTLE_SEPOLIA = "mantle_sepolia"
|
MANTLE_SEPOLIA = "mantle_sepolia"
|
||||||
IMX_ZKEVM = "imx_zkevm"
|
IMX_ZKEVM = "imx_zkevm"
|
||||||
IMX_ZKEVM_SEPOLIA = "imx_zkevm_sepolia"
|
IMX_ZKEVM_SEPOLIA = "imx_zkevm_sepolia"
|
||||||
|
B3 = "b3"
|
||||||
|
B3_SEPOLIA = "b3_sepolia"
|
||||||
|
|
||||||
|
|
||||||
def get_block_model(
|
def get_block_model(
|
||||||
|
@ -154,6 +160,8 @@ def get_block_model(
|
||||||
ProofOfPlayApexBlock,
|
ProofOfPlayApexBlock,
|
||||||
MantleBlock,
|
MantleBlock,
|
||||||
MantleSepoliaBlock,
|
MantleSepoliaBlock,
|
||||||
|
B3Block,
|
||||||
|
B3SepoliaBlock,
|
||||||
]
|
]
|
||||||
]:
|
]:
|
||||||
"""
|
"""
|
||||||
|
@ -182,6 +190,8 @@ def get_block_model(
|
||||||
ProofOfPlayApexBlock,
|
ProofOfPlayApexBlock,
|
||||||
MantleBlock,
|
MantleBlock,
|
||||||
MantleSepoliaBlock,
|
MantleSepoliaBlock,
|
||||||
|
B3Block,
|
||||||
|
B3SepoliaBlock,
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
if blockchain_type == AvailableBlockchainType.ETHEREUM:
|
if blockchain_type == AvailableBlockchainType.ETHEREUM:
|
||||||
|
@ -226,6 +236,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.B3:
|
||||||
|
block_model = B3Block
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
|
||||||
|
block_model = B3SepoliaBlock
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported blockchain type provided")
|
raise Exception("Unsupported blockchain type provided")
|
||||||
|
|
||||||
|
@ -285,6 +299,8 @@ def get_label_model(
|
||||||
MantleSepoliaLabelV3,
|
MantleSepoliaLabelV3,
|
||||||
ImxZkevmLabelV3,
|
ImxZkevmLabelV3,
|
||||||
ImxZkevmSepoliaLabelV3,
|
ImxZkevmSepoliaLabelV3,
|
||||||
|
B3LabelV3,
|
||||||
|
B3SepoliaLabelV3,
|
||||||
]
|
]
|
||||||
]:
|
]:
|
||||||
"""
|
"""
|
||||||
|
@ -344,6 +360,8 @@ def get_label_model(
|
||||||
MantleSepoliaLabelV3,
|
MantleSepoliaLabelV3,
|
||||||
ImxZkevmLabelV3,
|
ImxZkevmLabelV3,
|
||||||
ImxZkevmSepoliaLabelV3,
|
ImxZkevmSepoliaLabelV3,
|
||||||
|
B3LabelV3,
|
||||||
|
B3SepoliaLabelV3,
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
if version == 2:
|
if version == 2:
|
||||||
|
@ -446,6 +464,10 @@ def get_label_model(
|
||||||
label_model = ImxZkevmLabelV3
|
label_model = ImxZkevmLabelV3
|
||||||
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
|
||||||
label_model = ImxZkevmSepoliaLabelV3
|
label_model = ImxZkevmSepoliaLabelV3
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3:
|
||||||
|
label_model = B3LabelV3
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
|
||||||
|
label_model = B3SepoliaLabelV3
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported blockchain type provided")
|
raise Exception("Unsupported blockchain type provided")
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -96,6 +96,8 @@ from moonstreamdbv3.models import XaiSepoliaLabel as XaiSepoliaLabelV3
|
||||||
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
|
from moonstreamdbv3.models import XDaiLabel as XDaiLabelV3
|
||||||
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
|
from moonstreamdbv3.models import ZkSyncEraLabel as ZkSyncEraLabelV3
|
||||||
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
|
from moonstreamdbv3.models import ZkSyncEraSepoliaLabel as ZkSyncEraSepoliaLabelV3
|
||||||
|
from moonstreamdbv3.models import B3Label as B3LabelV3
|
||||||
|
from moonstreamdbv3.models import B3SepoliaLabel as B3SepoliaLabelV3
|
||||||
|
|
||||||
from .blockchain import AvailableBlockchainType
|
from .blockchain import AvailableBlockchainType
|
||||||
|
|
||||||
|
@ -130,6 +132,8 @@ class Network(Enum):
|
||||||
mantle_sepolia = "mantle_sepolia"
|
mantle_sepolia = "mantle_sepolia"
|
||||||
imx_zkevm = "imx_zkevm"
|
imx_zkevm = "imx_zkevm"
|
||||||
imx_zkevm_sepolia = "imx_zkevm_sepolia"
|
imx_zkevm_sepolia = "imx_zkevm_sepolia"
|
||||||
|
b3 = "b3"
|
||||||
|
b3_sepolia = "b3_sepolia"
|
||||||
|
|
||||||
|
|
||||||
tx_raw_types = Union[
|
tx_raw_types = Union[
|
||||||
|
@ -346,6 +350,12 @@ MODELS_V3: Dict[Network, Dict[str, Base]] = {
|
||||||
Network.imx_zkevm_sepolia: {
|
Network.imx_zkevm_sepolia: {
|
||||||
"labels": ImxZkevmSepoliaLabelV3,
|
"labels": ImxZkevmSepoliaLabelV3,
|
||||||
},
|
},
|
||||||
|
Network.b3: {
|
||||||
|
"labels": B3LabelV3,
|
||||||
|
},
|
||||||
|
Network.b3_sepolia: {
|
||||||
|
"labels": B3SepoliaLabelV3,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -411,5 +421,9 @@ def blockchain_type_to_network_type(
|
||||||
return Network.imx_zkevm
|
return Network.imx_zkevm
|
||||||
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
|
||||||
return Network.imx_zkevm_sepolia
|
return Network.imx_zkevm_sepolia
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3:
|
||||||
|
return Network.b3
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
|
||||||
|
return Network.b3_sepolia
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||||
|
|
|
@ -35,6 +35,8 @@ class SubscriptionTypes(Enum):
|
||||||
MANTLE_SEPOLIA_BLOCKCHAIN = "mantle_sepolia_smartcontract"
|
MANTLE_SEPOLIA_BLOCKCHAIN = "mantle_sepolia_smartcontract"
|
||||||
IMX_ZKEVM_BLOCKCHAIN = "imx_zkevm_smartcontract"
|
IMX_ZKEVM_BLOCKCHAIN = "imx_zkevm_smartcontract"
|
||||||
IMX_ZKEVM_SEPOLIA_BLOCKCHAIN = "imx_zkevm_sepolia_smartcontract"
|
IMX_ZKEVM_SEPOLIA_BLOCKCHAIN = "imx_zkevm_sepolia_smartcontract"
|
||||||
|
B3_BLOCKCHAIN = "b3_smartcontract"
|
||||||
|
B3_SEPOLIA_BLOCKCHAIN = "b3_sepolia_smartcontract"
|
||||||
|
|
||||||
|
|
||||||
def blockchain_type_to_subscription_type(
|
def blockchain_type_to_subscription_type(
|
||||||
|
@ -98,6 +100,10 @@ def blockchain_type_to_subscription_type(
|
||||||
return SubscriptionTypes.IMX_ZKEVM_BLOCKCHAIN
|
return SubscriptionTypes.IMX_ZKEVM_BLOCKCHAIN
|
||||||
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
|
elif blockchain_type == AvailableBlockchainType.IMX_ZKEVM_SEPOLIA:
|
||||||
return SubscriptionTypes.IMX_ZKEVM_SEPOLIA_BLOCKCHAIN
|
return SubscriptionTypes.IMX_ZKEVM_SEPOLIA_BLOCKCHAIN
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3:
|
||||||
|
return SubscriptionTypes.B3_BLOCKCHAIN
|
||||||
|
elif blockchain_type == AvailableBlockchainType.B3_SEPOLIA:
|
||||||
|
return SubscriptionTypes.B3_SEPOLIA_BLOCKCHAIN
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||||
|
|
||||||
|
@ -132,6 +138,8 @@ subscription_id_by_blockchain = {
|
||||||
"mantle_sepolia": "mantle_sepolia_smartcontract",
|
"mantle_sepolia": "mantle_sepolia_smartcontract",
|
||||||
"imx_zkevm": "imx_zkevm_smartcontract",
|
"imx_zkevm": "imx_zkevm_smartcontract",
|
||||||
"imx_zkevm_sepolia": "imx_zkevm_sepolia_smartcontract",
|
"imx_zkevm_sepolia": "imx_zkevm_sepolia_smartcontract",
|
||||||
|
"b3": "b3_smartcontract",
|
||||||
|
"b3_sepolia": "b3_sepolia_smartcontract",
|
||||||
}
|
}
|
||||||
|
|
||||||
blockchain_by_subscription_id = {
|
blockchain_by_subscription_id = {
|
||||||
|
@ -192,4 +200,6 @@ blockchain_by_subscription_id = {
|
||||||
"mantle_sepolia_smartcontract": "mantle_sepolia",
|
"mantle_sepolia_smartcontract": "mantle_sepolia",
|
||||||
"imx_zkevm_smartcontract": "imx_zkevm",
|
"imx_zkevm_smartcontract": "imx_zkevm",
|
||||||
"imx_zkevm_sepolia_smartcontract": "imx_zkevm_sepolia",
|
"imx_zkevm_sepolia_smartcontract": "imx_zkevm_sepolia",
|
||||||
|
"b3_smartcontract": "b3",
|
||||||
|
"b3_sepolia_smartcontract": "b3_sepolia",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.0.6
|
0.0.7
|
||||||
|
|
|
@ -34,7 +34,7 @@ setup(
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"moonstreamdb>=0.4.5",
|
"moonstreamdb>=0.4.5",
|
||||||
"moonstreamdb-v3>=0.0.16",
|
"moonstreamdb-v3>=0.0.18",
|
||||||
],
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
"dev": ["black", "isort", "mypy"],
|
"dev": ["black", "isort", "mypy"],
|
||||||
|
|
Ładowanie…
Reference in New Issue