From d36f28e0107eaeeaafea05e74669af489c1a65ad Mon Sep 17 00:00:00 2001 From: kompotkot Date: Wed, 10 Aug 2022 17:06:47 +0000 Subject: [PATCH 1/3] Mumbai support by api --- backend/moonstreamapi/actions.py | 4 +++- .../moonstreamapi/admin/subscription_types.py | 20 +++++++++++++++++++ backend/moonstreamapi/providers/__init__.py | 2 ++ .../providers/moonworm_provider.py | 14 ++++++++++--- .../moonstreamapi/providers/transactions.py | 7 +++++++ 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/backend/moonstreamapi/actions.py b/backend/moonstreamapi/actions.py index c4a9d403..a946e078 100644 --- a/backend/moonstreamapi/actions.py +++ b/backend/moonstreamapi/actions.py @@ -46,9 +46,11 @@ logger = logging.getLogger(__name__) blockchain_by_subscription_id = { "ethereum_blockchain": "ethereum", "polygon_blockchain": "polygon", + "mumbai_blockchain": "mumbai", + "xdai_blockchain": "xdai", "ethereum_smartcontract": "ethereum", "polygon_smartcontract": "polygon", - "xdai_blockchain": "xdai", + "mumbai_smartcontract": "mumbai", "xdai_smartcontract": "xdai", } diff --git a/backend/moonstreamapi/admin/subscription_types.py b/backend/moonstreamapi/admin/subscription_types.py index 79dc320d..8661f4ef 100644 --- a/backend/moonstreamapi/admin/subscription_types.py +++ b/backend/moonstreamapi/admin/subscription_types.py @@ -37,6 +37,16 @@ CANONICAL_SUBSCRIPTION_TYPES = { stripe_price_id=None, active=True, ), + "mumbai_smartcontract": SubscriptionTypeResourceData( + id="mumbai_smartcontract", + name="Mumbai smartcontracts", + choices=["input:address", "tag:erc721"], + description="Contracts events and tx_calls of contract of Mumbai blockchain", + icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png", + stripe_product_id=None, + stripe_price_id=None, + active=True, + ), "xdai_smartcontract": SubscriptionTypeResourceData( id="xdai_smartcontract", name="XDai smartcontract", @@ -67,6 +77,16 @@ CANONICAL_SUBSCRIPTION_TYPES = { stripe_price_id=None, active=True, ), + "mumbai_blockchain": SubscriptionTypeResourceData( + id="mumbai_blockchain", + name="Mumbai transactions", + choices=["input:address", "tag:erc721"], + description="Transactions that have been mined into the Mumbai blockchain", + icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/matic-token-inverted-icon.png", + stripe_product_id=None, + stripe_price_id=None, + active=True, + ), "xdai_blockchain": SubscriptionTypeResourceData( id="xdai_blockchain", name="XDai transactions", diff --git a/backend/moonstreamapi/providers/__init__.py b/backend/moonstreamapi/providers/__init__.py index 53c99a8f..00511966 100644 --- a/backend/moonstreamapi/providers/__init__.py +++ b/backend/moonstreamapi/providers/__init__.py @@ -49,9 +49,11 @@ class ReceivingEventsException(Exception): event_providers: Dict[str, Any] = { moonworm_provider.EthereumMoonwormProvider.event_type: moonworm_provider.EthereumMoonwormProvider, moonworm_provider.PolygonMoonwormProvider.event_type: moonworm_provider.PolygonMoonwormProvider, + moonworm_provider.MumbaiMoonwormProvider.event_type: moonworm_provider.MumbaiMoonwormProvider, moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider, transactions.EthereumTransactions.event_type: transactions.EthereumTransactions, transactions.PolygonTransactions.event_type: transactions.PolygonTransactions, + transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions, transactions.XDaiTransactions.event_type: transactions.XDaiTransactions, bugout.polygon_whalewatch_provider.event_type: bugout.polygon_whalewatch_provider, bugout.ethereum_txpool_provider.event_type: bugout.ethereum_txpool_provider, diff --git a/backend/moonstreamapi/providers/moonworm_provider.py b/backend/moonstreamapi/providers/moonworm_provider.py index c9fc6869..b0e5b9f4 100644 --- a/backend/moonstreamapi/providers/moonworm_provider.py +++ b/backend/moonstreamapi/providers/moonworm_provider.py @@ -19,6 +19,7 @@ logger.setLevel(logging.WARN) ethereum_event_type = "ethereum_blockchain" polygon_event_type = "polygon_blockchain" +mumbai_event_type = "mumbai_blockchain" xdai_event_type = "xdai_blockchain" allowed_tags = ["tag:erc721"] @@ -393,20 +394,27 @@ class MoonwormProvider: EthereumMoonwormProvider = MoonwormProvider( event_type="ethereum_smartcontract", blockchain=AvailableBlockchainType("ethereum"), - description="Provider for resiving transactions from Ethereum tables.", + description="Provider for reviving transactions from Ethereum tables.", streamboaundary_range_limit=2 * 60 * 60, ) PolygonMoonwormProvider = MoonwormProvider( event_type="polygon_smartcontract", blockchain=AvailableBlockchainType("polygon"), - description="Provider for resiving transactions from Polygon tables.", + description="Provider for reviving transactions from Polygon tables.", + streamboaundary_range_limit=2 * 60 * 60, +) + +MumbaiMoonwormProvider = MoonwormProvider( + event_type="mumbai_smartcontract", + blockchain=AvailableBlockchainType("mumbai"), + description="Provider for reviving transactions from Mumbai tables.", streamboaundary_range_limit=2 * 60 * 60, ) XDaiMoonwormProvider = MoonwormProvider( event_type="xdai_smartcontract", blockchain=AvailableBlockchainType("xdai"), - description="Provider for resiving transactions from XDai tables.", + description="Provider for reviving transactions from XDai tables.", streamboaundary_range_limit=2 * 60 * 60, ) diff --git a/backend/moonstreamapi/providers/transactions.py b/backend/moonstreamapi/providers/transactions.py index cb43e730..a031fa85 100644 --- a/backend/moonstreamapi/providers/transactions.py +++ b/backend/moonstreamapi/providers/transactions.py @@ -462,6 +462,13 @@ PolygonTransactions = TransactionsProvider( streamboaundary_range_limit=2 * 60 * 60, ) +MumbaiTransactions = TransactionsProvider( + event_type="mumbai_blockchain", + blockchain=AvailableBlockchainType("mumbai"), + description="Provider for resiving transactions from Mumbai tables.", + streamboaundary_range_limit=2 * 60 * 60, +) + XDaiTransactions = TransactionsProvider( event_type="xdai_blockchain", blockchain=AvailableBlockchainType("xdai"), From 19b586760b3e356917f2fceaeea24e94a3ba91e3 Mon Sep 17 00:00:00 2001 From: kompotkot Date: Thu, 11 Aug 2022 14:16:32 +0000 Subject: [PATCH 2/3] Bumped version in setup.py --- backend/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/setup.py b/backend/setup.py index de4e491c..e1b74051 100644 --- a/backend/setup.py +++ b/backend/setup.py @@ -15,7 +15,7 @@ setup( "boto3", "bugout>=0.1.19", "fastapi", - "moonstreamdb>=0.2.5", + "moonstreamdb>=0.3.1", "humbug", "pydantic", "pyevmasm", From 4cee8eacfcad52671dca29ecd7e23c80dae18ca5 Mon Sep 17 00:00:00 2001 From: kompotkot Date: Thu, 11 Aug 2022 14:30:42 +0000 Subject: [PATCH 3/3] Bumped version of moonstreamapi --- backend/moonstreamapi/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/moonstreamapi/version.py b/backend/moonstreamapi/version.py index d43f30a0..ab09a0ef 100644 --- a/backend/moonstreamapi/version.py +++ b/backend/moonstreamapi/version.py @@ -2,4 +2,4 @@ Moonstream library and API version. """ -MOONSTREAMAPI_VERSION = "0.1.4" +MOONSTREAMAPI_VERSION = "0.2.1"