Add Arbitrum Nova, Arbitrum Sepolia, Xai api support.

pull/1020/head
Andrey 2024-02-21 22:47:42 +02:00
rodzic 5a1e1e155e
commit 168fecfa29
10 zmienionych plików z 142 dodań i 13 usunięć

Wyświetl plik

@ -58,6 +58,9 @@ blockchain_by_subscription_id = {
"mumbai_blockchain": "mumbai",
"xdai_blockchain": "xdai",
"wyrm_blockchain": "wyrm",
"arbitrum_nova_blockchain": "arbitrum_nova",
"arbitrum_sepolia_blockchain": "arbitrum_sepolia",
"xai_blockchain": "xai",
"zksync_era_testnet_blockchain": "zksync_era_testnet",
"zksync_era_blockchain": "zksync_era",
"ethereum_smartcontract": "ethereum",
@ -67,6 +70,9 @@ blockchain_by_subscription_id = {
"wyrm_smartcontract": "wyrm",
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
"zksync_era_smartcontract": "zksync_era",
"arbitrum_nova_smartcontract": "arbitrum_nova",
"arbitrum_sepolia_smartcontract": "arbitrum_sepolia",
"xai_smartcontract": "xai",
}

Wyświetl plik

@ -1,6 +1,7 @@
"""
Utilities for managing subscription type resources for a Moonstream application.
"""
import argparse
import json
from typing import Dict, List, Optional
@ -94,6 +95,39 @@ CANONICAL_SUBSCRIPTION_TYPES = {
stripe_price_id=None,
active=True,
),
"arbitrum_nova_smartcontract": SubscriptionTypeResourceData(
id="arbitrum_nova_smartcontract",
name="Arbitrum Nova smartcontract",
blockchain="arbitrum_nova",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Arbitrum Nova blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/arbitrum-nova-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"arbitrum_sepolia_smartcontract": SubscriptionTypeResourceData(
id="arbitrum_sepolia_smartcontract",
name="Arbitrum Sepolia smartcontract",
blockchain="arbitrum_sepolia",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Arbitrum Sepolia blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/arbitrum-sepolia-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"xai_smartcontract": SubscriptionTypeResourceData(
id="xai_smartcontract",
name="Xai smartcontract",
blockchain="xai",
choices=["input:address", "tag:erc721"],
description="Contracts events and tx_calls of contract of Xai blockchain.",
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/xai-token-logo.png",
stripe_product_id=None,
stripe_price_id=None,
active=True,
),
"ethereum_blockchain": SubscriptionTypeResourceData(
id="ethereum_blockchain",
name="Ethereum transactions",

Wyświetl plik

@ -53,12 +53,18 @@ event_providers: Dict[str, Any] = {
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider,
moonworm_provider.ZkSyncEraMoonwormProvider.event_type: moonworm_provider.ZkSyncEraMoonwormProvider,
moonworm_provider.ArbitrumNovaMoonwormProvider.event_type: moonworm_provider.ArbitrumNovaMoonwormProvider,
moonworm_provider.ArbitrumSepoliaMoonwormProvider.event_type: moonworm_provider.ArbitrumSepoliaMoonwormProvider,
moonworm_provider.XaiMoonwormProvider.event_type: moonworm_provider.XaiMoonwormProvider,
transactions.EthereumTransactions.event_type: transactions.EthereumTransactions,
transactions.PolygonTransactions.event_type: transactions.PolygonTransactions,
transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions,
transactions.XDaiTransactions.event_type: transactions.XDaiTransactions,
transactions.ZkSyncEraTestnetTransactions.event_type: transactions.ZkSyncEraTestnetTransactions,
transactions.ZkSyncEraTransactions.event_type: transactions.ZkSyncEraTransactions,
transactions.ArbitrumNovaTransactions.event_type: transactions.ArbitrumNovaTransactions,
transactions.ArbitrumSepoliaTransactions.event_type: transactions.ArbitrumSepoliaTransactions,
transactions.XaiTransactions.event_type: transactions.XaiTransactions,
bugout.polygon_whalewatch_provider.event_type: bugout.polygon_whalewatch_provider,
bugout.ethereum_txpool_provider.event_type: bugout.ethereum_txpool_provider,
bugout.ethereum_whalewatch_provider.event_type: bugout.ethereum_whalewatch_provider,

Wyświetl plik

@ -23,6 +23,9 @@ mumbai_event_type = "mumbai_blockchain"
xdai_event_type = "xdai_blockchain"
zksync_era_testnet_event_type = "zksync_era_testnet_blockchain"
zksync_era_event_type = "zksync_era_blockchain"
arbitrum_nova_event_type = "arbitrum_nova_blockchain"
arbitrum_sepolia_event_type = "arbitrum_sepolia_blockchain"
xai_event_type = "xai_blockchain"
allowed_tags = ["tag:erc721"]
description = f"""Event provider for transactions from the Ethereum blockchain.
@ -429,3 +432,24 @@ ZkSyncEraMoonwormProvider = MoonwormProvider(
description="Provider for reviving transactions from zkSync Era tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
ArbitrumNovaMoonwormProvider = MoonwormProvider(
event_type="arbitrum_nova_smartcontract",
blockchain=AvailableBlockchainType("arbitrum_nova"),
description="Provider for reviving transactions from Arbitrum Nova tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
ArbitrumSepoliaMoonwormProvider = MoonwormProvider(
event_type="arbitrum_sepolia_smartcontract",
blockchain=AvailableBlockchainType("arbitrum_sepolia"),
description="Provider for reviving transactions from Arbitrum Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
XaiMoonwormProvider = MoonwormProvider(
event_type="xai_smartcontract",
blockchain=AvailableBlockchainType("xai"),
description="Provider for reviving transactions from Xai tables.",
streamboaundary_range_limit=2 * 60 * 60,
)

Wyświetl plik

@ -489,3 +489,25 @@ ZkSyncEraTransactions = TransactionsProvider(
description="Provider for resiving transactions from ZkSync Era tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
ArbitrumNovaTransactions = TransactionsProvider(
event_type="arbitrum_nova_blockchain",
blockchain=AvailableBlockchainType("arbitrum_nova"),
description="Provider for resiving transactions from Arbitrum Nova tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
ArbitrumSepoliaTransactions = TransactionsProvider(
event_type="arbitrum_sepolia_blockchain",
blockchain=AvailableBlockchainType("arbitrum_sepolia"),
description="Provider for resiving transactions from Arbitrum Sepolia tables.",
streamboaundary_range_limit=2 * 60 * 60,
)
XaiTransactions = TransactionsProvider(
event_type="xai_blockchain",
blockchain=AvailableBlockchainType("xai"),
description="Provider for resiving transactions from Xai tables.",
streamboaundary_range_limit=2 * 60 * 60,
)

Wyświetl plik

@ -1,6 +1,7 @@
"""
The Moonstream subscriptions HTTP API
"""
import hashlib
import json
import logging
@ -374,9 +375,11 @@ async def get_subscriptions_handler(
address=subscription.address,
color=color,
label=label,
abi="True"
if subscription.secondary_fields.get("abi", None)
else "False", ### TODO(ANDREY): remove this hack when frontend is updated
abi=(
"True"
if subscription.secondary_fields.get("abi", None)
else "False"
), ### TODO(ANDREY): remove this hack when frontend is updated
description=subscription.secondary_fields.get("description"),
tags=normalized_entity_tags,
subscription_type_id=subscription_type_id,
@ -520,13 +523,17 @@ async def update_subscriptions_handler(
token=token,
journal_id=journal_id,
entity_id=subscription_id,
title=subscription_entity.title
if subscription_entity.title is not None
else "",
title=(
subscription_entity.title
if subscription_entity.title is not None
else ""
),
address=address,
blockchain=subscription_entity.blockchain
if subscription_entity.blockchain is not None
else "",
blockchain=(
subscription_entity.blockchain
if subscription_entity.blockchain is not None
else ""
),
required_fields=update_required_fields,
secondary_fields=update_secondary_fields,
)
@ -707,7 +714,7 @@ async def address_info(request: Request, address: str = Query(...)):
user_token = request.state.token
try:
Web3.toChecksumAddress(address)
address = Web3.toChecksumAddress(address)
except ValueError as e:
raise MoonstreamHTTPException(
status_code=400,

Wyświetl plik

@ -144,6 +144,30 @@ MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI = os.environ.get(
if MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI env variable is not set")
MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI == "":
raise Exception(
"MOONSTREAM_ARBITRUM_NOVA_WEB3_PROVIDER_URI env variable is not set"
)
MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI == "":
raise Exception(
"MOONSTREAM_ARBITRUM_SEPOLIA_WEB3_PROVIDER_URI env variable is not set"
)
MOONSTREAM_XAI_WEB3_PROVIDER_URI = os.environ.get(
"MOONSTREAM_XAI_WEB3_PROVIDER_URI", ""
)
if MOONSTREAM_XAI_WEB3_PROVIDER_URI == "":
raise Exception("MOONSTREAM_XAI_WEB3_PROVIDER_URI env variable is not set")
## QueryAPI
MOONSTREAM_S3_QUERIES_BUCKET = os.environ.get("MOONSTREAM_S3_QUERIES_BUCKET", "")
if MOONSTREAM_S3_QUERIES_BUCKET == "":
raise ValueError("MOONSTREAM_S3_QUERIES_BUCKET environment variable must be set")
@ -193,6 +217,12 @@ multicall_contracts: Dict[AvailableBlockchainType, str] = {
AvailableBlockchainType.POLYGON: "0xc8E51042792d7405184DfCa245F2d27B94D013b6",
AvailableBlockchainType.MUMBAI: "0xe9939e7Ea7D7fb619Ac57f648Da7B1D425832631",
AvailableBlockchainType.ETHEREUM: "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",
AvailableBlockchainType.ARBITRUM_NOVA: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.ARBITRUM_SEPOLIA: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.XAI: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.XDAI: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.ZKSYNC_ERA: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
AvailableBlockchainType.ZKSYNC_ERA_TESTNET: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
}

Wyświetl plik

@ -2,4 +2,4 @@
Moonstream library and API version.
"""
MOONSTREAMAPI_VERSION = "0.3.2"
MOONSTREAMAPI_VERSION = "0.3.3"

Wyświetl plik

@ -36,7 +36,7 @@ jsonschema==4.17.0
lru-dict==1.1.8
Mako==1.2.3
MarkupSafe==2.1.1
moonstreamdb==0.3.5
moonstreamdb==0.3.8
multiaddr==0.0.9
multidict==6.0.2
netaddr==0.8.0

Wyświetl plik

@ -15,7 +15,7 @@ setup(
"boto3",
"bugout>=0.2.15",
"fastapi",
"moonstreamdb>=0.3.5",
"moonstreamdb>=0.3.8",
"humbug",
"pydantic==1.10.2",
"pyevmasm",