kopia lustrzana https://github.com/bugout-dev/moonstream
Merge pull request #1020 from moonstream-to/api-add-chains
Add Arbitrum Nova, Arbitrum Sepolia, Xai api support.pull/1021/head
commit
4bf8df636c
|
@ -58,6 +58,9 @@ blockchain_by_subscription_id = {
|
||||||
"mumbai_blockchain": "mumbai",
|
"mumbai_blockchain": "mumbai",
|
||||||
"xdai_blockchain": "xdai",
|
"xdai_blockchain": "xdai",
|
||||||
"wyrm_blockchain": "wyrm",
|
"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_testnet_blockchain": "zksync_era_testnet",
|
||||||
"zksync_era_blockchain": "zksync_era",
|
"zksync_era_blockchain": "zksync_era",
|
||||||
"ethereum_smartcontract": "ethereum",
|
"ethereum_smartcontract": "ethereum",
|
||||||
|
@ -67,6 +70,9 @@ blockchain_by_subscription_id = {
|
||||||
"wyrm_smartcontract": "wyrm",
|
"wyrm_smartcontract": "wyrm",
|
||||||
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
|
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
|
||||||
"zksync_era_smartcontract": "zksync_era",
|
"zksync_era_smartcontract": "zksync_era",
|
||||||
|
"arbitrum_nova_smartcontract": "arbitrum_nova",
|
||||||
|
"arbitrum_sepolia_smartcontract": "arbitrum_sepolia",
|
||||||
|
"xai_smartcontract": "xai",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Utilities for managing subscription type resources for a Moonstream application.
|
Utilities for managing subscription type resources for a Moonstream application.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
@ -94,6 +95,39 @@ CANONICAL_SUBSCRIPTION_TYPES = {
|
||||||
stripe_price_id=None,
|
stripe_price_id=None,
|
||||||
active=True,
|
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/ethereum/eth-diamond-purple.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/ethereum/eth-diamond-purple.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/ethereum/eth-diamond-purple.png",
|
||||||
|
stripe_product_id=None,
|
||||||
|
stripe_price_id=None,
|
||||||
|
active=True,
|
||||||
|
),
|
||||||
"ethereum_blockchain": SubscriptionTypeResourceData(
|
"ethereum_blockchain": SubscriptionTypeResourceData(
|
||||||
id="ethereum_blockchain",
|
id="ethereum_blockchain",
|
||||||
name="Ethereum transactions",
|
name="Ethereum transactions",
|
||||||
|
|
|
@ -53,12 +53,18 @@ event_providers: Dict[str, Any] = {
|
||||||
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
|
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
|
||||||
moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider,
|
moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider,
|
||||||
moonworm_provider.ZkSyncEraMoonwormProvider.event_type: moonworm_provider.ZkSyncEraMoonwormProvider,
|
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.EthereumTransactions.event_type: transactions.EthereumTransactions,
|
||||||
transactions.PolygonTransactions.event_type: transactions.PolygonTransactions,
|
transactions.PolygonTransactions.event_type: transactions.PolygonTransactions,
|
||||||
transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions,
|
transactions.MumbaiTransactions.event_type: transactions.MumbaiTransactions,
|
||||||
transactions.XDaiTransactions.event_type: transactions.XDaiTransactions,
|
transactions.XDaiTransactions.event_type: transactions.XDaiTransactions,
|
||||||
transactions.ZkSyncEraTestnetTransactions.event_type: transactions.ZkSyncEraTestnetTransactions,
|
transactions.ZkSyncEraTestnetTransactions.event_type: transactions.ZkSyncEraTestnetTransactions,
|
||||||
transactions.ZkSyncEraTransactions.event_type: transactions.ZkSyncEraTransactions,
|
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.polygon_whalewatch_provider.event_type: bugout.polygon_whalewatch_provider,
|
||||||
bugout.ethereum_txpool_provider.event_type: bugout.ethereum_txpool_provider,
|
bugout.ethereum_txpool_provider.event_type: bugout.ethereum_txpool_provider,
|
||||||
bugout.ethereum_whalewatch_provider.event_type: bugout.ethereum_whalewatch_provider,
|
bugout.ethereum_whalewatch_provider.event_type: bugout.ethereum_whalewatch_provider,
|
||||||
|
|
|
@ -23,6 +23,9 @@ mumbai_event_type = "mumbai_blockchain"
|
||||||
xdai_event_type = "xdai_blockchain"
|
xdai_event_type = "xdai_blockchain"
|
||||||
zksync_era_testnet_event_type = "zksync_era_testnet_blockchain"
|
zksync_era_testnet_event_type = "zksync_era_testnet_blockchain"
|
||||||
zksync_era_event_type = "zksync_era_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"]
|
allowed_tags = ["tag:erc721"]
|
||||||
|
|
||||||
description = f"""Event provider for transactions from the Ethereum blockchain.
|
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.",
|
description="Provider for reviving transactions from zkSync Era tables.",
|
||||||
streamboaundary_range_limit=2 * 60 * 60,
|
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,
|
||||||
|
)
|
||||||
|
|
|
@ -489,3 +489,25 @@ ZkSyncEraTransactions = TransactionsProvider(
|
||||||
description="Provider for resiving transactions from ZkSync Era tables.",
|
description="Provider for resiving transactions from ZkSync Era tables.",
|
||||||
streamboaundary_range_limit=2 * 60 * 60,
|
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,
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
The Moonstream subscriptions HTTP API
|
The Moonstream subscriptions HTTP API
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@ -374,9 +375,11 @@ async def get_subscriptions_handler(
|
||||||
address=subscription.address,
|
address=subscription.address,
|
||||||
color=color,
|
color=color,
|
||||||
label=label,
|
label=label,
|
||||||
abi="True"
|
abi=(
|
||||||
if subscription.secondary_fields.get("abi", None)
|
"True"
|
||||||
else "False", ### TODO(ANDREY): remove this hack when frontend is updated
|
if subscription.secondary_fields.get("abi", None)
|
||||||
|
else "False"
|
||||||
|
), ### TODO(ANDREY): remove this hack when frontend is updated
|
||||||
description=subscription.secondary_fields.get("description"),
|
description=subscription.secondary_fields.get("description"),
|
||||||
tags=normalized_entity_tags,
|
tags=normalized_entity_tags,
|
||||||
subscription_type_id=subscription_type_id,
|
subscription_type_id=subscription_type_id,
|
||||||
|
@ -520,13 +523,17 @@ async def update_subscriptions_handler(
|
||||||
token=token,
|
token=token,
|
||||||
journal_id=journal_id,
|
journal_id=journal_id,
|
||||||
entity_id=subscription_id,
|
entity_id=subscription_id,
|
||||||
title=subscription_entity.title
|
title=(
|
||||||
if subscription_entity.title is not None
|
subscription_entity.title
|
||||||
else "",
|
if subscription_entity.title is not None
|
||||||
|
else ""
|
||||||
|
),
|
||||||
address=address,
|
address=address,
|
||||||
blockchain=subscription_entity.blockchain
|
blockchain=(
|
||||||
if subscription_entity.blockchain is not None
|
subscription_entity.blockchain
|
||||||
else "",
|
if subscription_entity.blockchain is not None
|
||||||
|
else ""
|
||||||
|
),
|
||||||
required_fields=update_required_fields,
|
required_fields=update_required_fields,
|
||||||
secondary_fields=update_secondary_fields,
|
secondary_fields=update_secondary_fields,
|
||||||
)
|
)
|
||||||
|
@ -707,7 +714,7 @@ async def address_info(request: Request, address: str = Query(...)):
|
||||||
user_token = request.state.token
|
user_token = request.state.token
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Web3.toChecksumAddress(address)
|
address = Web3.toChecksumAddress(address)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise MoonstreamHTTPException(
|
raise MoonstreamHTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
|
|
|
@ -144,6 +144,30 @@ MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI = os.environ.get(
|
||||||
if MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI == "":
|
if MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI == "":
|
||||||
raise Exception("MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI env variable is not set")
|
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", "")
|
MOONSTREAM_S3_QUERIES_BUCKET = os.environ.get("MOONSTREAM_S3_QUERIES_BUCKET", "")
|
||||||
if MOONSTREAM_S3_QUERIES_BUCKET == "":
|
if MOONSTREAM_S3_QUERIES_BUCKET == "":
|
||||||
raise ValueError("MOONSTREAM_S3_QUERIES_BUCKET environment variable must be set")
|
raise ValueError("MOONSTREAM_S3_QUERIES_BUCKET environment variable must be set")
|
||||||
|
@ -193,6 +217,12 @@ multicall_contracts: Dict[AvailableBlockchainType, str] = {
|
||||||
AvailableBlockchainType.POLYGON: "0xc8E51042792d7405184DfCa245F2d27B94D013b6",
|
AvailableBlockchainType.POLYGON: "0xc8E51042792d7405184DfCa245F2d27B94D013b6",
|
||||||
AvailableBlockchainType.MUMBAI: "0xe9939e7Ea7D7fb619Ac57f648Da7B1D425832631",
|
AvailableBlockchainType.MUMBAI: "0xe9939e7Ea7D7fb619Ac57f648Da7B1D425832631",
|
||||||
AvailableBlockchainType.ETHEREUM: "0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696",
|
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",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
Moonstream library and API version.
|
Moonstream library and API version.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
MOONSTREAMAPI_VERSION = "0.3.2"
|
MOONSTREAMAPI_VERSION = "0.3.3"
|
||||||
|
|
|
@ -36,7 +36,7 @@ jsonschema==4.17.0
|
||||||
lru-dict==1.1.8
|
lru-dict==1.1.8
|
||||||
Mako==1.2.3
|
Mako==1.2.3
|
||||||
MarkupSafe==2.1.1
|
MarkupSafe==2.1.1
|
||||||
moonstreamdb==0.3.5
|
moonstreamdb==0.3.8
|
||||||
multiaddr==0.0.9
|
multiaddr==0.0.9
|
||||||
multidict==6.0.2
|
multidict==6.0.2
|
||||||
netaddr==0.8.0
|
netaddr==0.8.0
|
||||||
|
|
|
@ -15,7 +15,7 @@ setup(
|
||||||
"boto3",
|
"boto3",
|
||||||
"bugout>=0.2.15",
|
"bugout>=0.2.15",
|
||||||
"fastapi",
|
"fastapi",
|
||||||
"moonstreamdb>=0.3.5",
|
"moonstreamdb>=0.3.8",
|
||||||
"humbug",
|
"humbug",
|
||||||
"pydantic==1.10.2",
|
"pydantic==1.10.2",
|
||||||
"pyevmasm",
|
"pyevmasm",
|
||||||
|
|
Ładowanie…
Reference in New Issue