diff --git a/db/moonstreamdb/blockchain.py b/db/moonstreamdb/blockchain.py index 250cfba5..0a78f9c9 100644 --- a/db/moonstreamdb/blockchain.py +++ b/db/moonstreamdb/blockchain.py @@ -6,6 +6,9 @@ from .models import ( PolygonBlock, PolygonLabel, PolygonTransaction, + XDaiBlock, + XDaiLabel, + XDaiTransaction, ) from enum import Enum @@ -16,20 +19,23 @@ from typing import Type, Union class AvailableBlockchainType(Enum): ETHEREUM = "ethereum" POLYGON = "polygon" + XDAI = "xdai" def get_block_model( blockchain_type: AvailableBlockchainType, -) -> Type[Union[EthereumBlock, PolygonBlock]]: +) -> Type[Union[EthereumBlock, PolygonBlock, XDaiBlock]]: """ - Depends on provided blockchain type: Ethereum or Polygon, - set proper blocks model: EthereumBlock or PolygonBlock. + Depends on provided blockchain type: Ethereum, Polygon or XDai, + set proper blocks model: EthereumBlock, PolygonBlock or XdaiBlock. """ - block_model: Type[Union[EthereumBlock, PolygonBlock]] + block_model: Type[Union[EthereumBlock, PolygonBlock, XDaiBlock]] if blockchain_type == AvailableBlockchainType.ETHEREUM: block_model = EthereumBlock elif blockchain_type == AvailableBlockchainType.POLYGON: block_model = PolygonBlock + elif blockchain_type == AvailableBlockchainType.XDAI: + block_model = XDaiBlock else: raise Exception("Unsupported blockchain type provided") @@ -38,16 +44,18 @@ def get_block_model( def get_label_model( blockchain_type: AvailableBlockchainType, -) -> Type[Union[EthereumLabel, PolygonLabel]]: +) -> Type[Union[EthereumLabel, PolygonLabel, XDaiLabel]]: """ - Depends on provided blockchain type: Ethereum or Polygon, - set proper block label model: EthereumLabel or PolygonLabel. + Depends on provided blockchain type: Ethereum, Polygon or XDai, + set proper block label model: EthereumLabel, PolygonLabel or XdaiLabel. """ - label_model: Type[Union[EthereumLabel, PolygonLabel]] + label_model: Type[Union[EthereumLabel, PolygonLabel, XDaiLabel]] if blockchain_type == AvailableBlockchainType.ETHEREUM: label_model = EthereumLabel elif blockchain_type == AvailableBlockchainType.POLYGON: label_model = PolygonLabel + elif blockchain_type == AvailableBlockchainType.XDAI: + label_model = XDaiLabel else: raise Exception("Unsupported blockchain type provided") @@ -56,16 +64,20 @@ def get_label_model( def get_transaction_model( blockchain_type: AvailableBlockchainType, -) -> Type[Union[EthereumTransaction, PolygonTransaction]]: +) -> Type[Union[EthereumTransaction, PolygonTransaction, XDaiTransaction]]: """ Depends on provided blockchain type: Ethereum or Polygon, set proper block transactions model: EthereumTransaction or PolygonTransaction. """ - transaction_model: Type[Union[EthereumTransaction, PolygonTransaction]] + transaction_model: Type[ + Union[EthereumTransaction, PolygonTransaction, XDaiTransaction] + ] if blockchain_type == AvailableBlockchainType.ETHEREUM: transaction_model = EthereumTransaction elif blockchain_type == AvailableBlockchainType.POLYGON: transaction_model = PolygonTransaction + elif blockchain_type == AvailableBlockchainType.XDAI: + transaction_model = XDaiTransaction else: raise Exception("Unsupported blockchain type provided") diff --git a/db/moonstreamdb/version.py b/db/moonstreamdb/version.py index 9ddfc008..72fa3d89 100644 --- a/db/moonstreamdb/version.py +++ b/db/moonstreamdb/version.py @@ -2,4 +2,4 @@ Moonstream database version. """ -MOONSTREAMDB_VERSION = "0.2.4" +MOONSTREAMDB_VERSION = "0.2.5"