kopia lustrzana https://github.com/bugout-dev/moonstream
Revert "Zksync support for moonstreamapi"
rodzic
b1f3d24145
commit
e11bad0bb3
|
@ -59,13 +59,11 @@ blockchain_by_subscription_id = {
|
|||
"mumbai_blockchain": "mumbai",
|
||||
"xdai_blockchain": "xdai",
|
||||
"wyrm_blockchain": "wyrm",
|
||||
"zksync_era_testnet_blockchain": "zksync_era_testnet",
|
||||
"ethereum_smartcontract": "ethereum",
|
||||
"polygon_smartcontract": "polygon",
|
||||
"mumbai_smartcontract": "mumbai",
|
||||
"xdai_smartcontract": "xdai",
|
||||
"wyrm_smartcontract": "wyrm",
|
||||
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -478,12 +478,18 @@ This CLI is configured to work with the following API URLs:
|
|||
|
||||
parser_moonworm_tasks_add.set_defaults(func=moonworm_tasks_add_subscription_handler)
|
||||
|
||||
|
||||
|
||||
queries_parser = subcommands.add_parser(
|
||||
"queries", description="Manage Moonstream queries"
|
||||
)
|
||||
queries_parser.set_defaults(func=lambda _: queries_parser.print_help())
|
||||
|
||||
queries_subcommands = queries_parser.add_subparsers(description="Query commands")
|
||||
|
||||
|
||||
queries_subcommands = queries_parser.add_subparsers(
|
||||
description="Query commands"
|
||||
)
|
||||
|
||||
create_query_parser = queries_subcommands.add_parser(
|
||||
"create-template", description="Create query template"
|
||||
|
|
|
@ -24,11 +24,12 @@ from ..actions import get_all_entries_from_search, name_normalization
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
def create_query_template(args: argparse.Namespace) -> None:
|
||||
"""
|
||||
Create query template for all queries resources.
|
||||
"""
|
||||
|
||||
|
||||
query = ""
|
||||
with args.query_file:
|
||||
query = textwrap.indent(args.query_file.read(), " ")
|
||||
|
@ -38,6 +39,7 @@ def create_query_template(args: argparse.Namespace) -> None:
|
|||
name = f"template_{name_normalization(args.name)}"
|
||||
|
||||
try:
|
||||
|
||||
entry = bc.create_entry(
|
||||
journal_id=MOONSTREAM_QUERIES_JOURNAL_ID,
|
||||
title=args.name,
|
||||
|
@ -49,17 +51,18 @@ def create_query_template(args: argparse.Namespace) -> None:
|
|||
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
timeout=BUGOUT_REQUEST_TIMEOUT_SECONDS,
|
||||
)
|
||||
|
||||
|
||||
except BugoutResponseException as err:
|
||||
logger.error(f"Failed to create query template: {err}")
|
||||
return
|
||||
except Exception as err:
|
||||
logger.error(f"Failed to create query template: {err}")
|
||||
return
|
||||
|
||||
|
||||
logger.info(f"Query template created: {entry.id}")
|
||||
logger.info(f"Query template created url name: {name}")
|
||||
|
||||
|
||||
### Add query id
|
||||
|
||||
try:
|
||||
|
@ -78,4 +81,4 @@ def create_query_template(args: argparse.Namespace) -> None:
|
|||
logger.error(f"Failed to add query id: {err}")
|
||||
return
|
||||
|
||||
logger.info(f"Query created: {json.dumps(entry.dict(), indent=4)}")
|
||||
logger.info(f"Query created: {json.dumps(entry.dict(), indent=4)}")
|
|
@ -72,17 +72,6 @@ CANONICAL_SUBSCRIPTION_TYPES = {
|
|||
stripe_price_id=None,
|
||||
active=True,
|
||||
),
|
||||
"zksync_era_testnet_smartcontract": SubscriptionTypeResourceData(
|
||||
id="zksync_era_testnet_smartcontract",
|
||||
name="zkSync Era testnet smartcontract",
|
||||
blockchain="zksync_era_testnet",
|
||||
choices=["input:address", "tag:erc721"],
|
||||
description="Contracts events and tx_calls of contract of zkSync Era testnet blockchain.",
|
||||
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
|
||||
stripe_product_id=None,
|
||||
stripe_price_id=None,
|
||||
active=True,
|
||||
),
|
||||
"ethereum_blockchain": SubscriptionTypeResourceData(
|
||||
id="ethereum_blockchain",
|
||||
name="Ethereum transactions",
|
||||
|
@ -138,17 +127,6 @@ CANONICAL_SUBSCRIPTION_TYPES = {
|
|||
stripe_price_id=None,
|
||||
active=False,
|
||||
),
|
||||
"zksync_era_testnet_blockchain": SubscriptionTypeResourceData(
|
||||
id="zksync_era_testnet_blockchain",
|
||||
name="zkSync Era testnet transactions",
|
||||
blockchain="zksync_era_testnet",
|
||||
choices=["input:address", "tag:erc721"],
|
||||
description="ZkSync Era testnet chain transactions subscription.",
|
||||
icon_url="https://s3.amazonaws.com/static.simiotics.com/moonstream/assets/zksync-era-testnet-token-logo.png",
|
||||
stripe_product_id=None,
|
||||
stripe_price_id=None,
|
||||
active=False,
|
||||
),
|
||||
"ethereum_whalewatch": SubscriptionTypeResourceData(
|
||||
id="ethereum_whalewatch",
|
||||
name="Ethereum whale watch",
|
||||
|
|
|
@ -51,12 +51,10 @@ event_providers: Dict[str, Any] = {
|
|||
moonworm_provider.PolygonMoonwormProvider.event_type: moonworm_provider.PolygonMoonwormProvider,
|
||||
moonworm_provider.MumbaiMoonwormProvider.event_type: moonworm_provider.MumbaiMoonwormProvider,
|
||||
moonworm_provider.XDaiMoonwormProvider.event_type: moonworm_provider.XDaiMoonwormProvider,
|
||||
moonworm_provider.ZkSyncEraTestnetMoonwormProvider.event_type: moonworm_provider.ZkSyncEraTestnetMoonwormProvider,
|
||||
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,
|
||||
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,
|
||||
|
|
|
@ -21,7 +21,6 @@ ethereum_event_type = "ethereum_blockchain"
|
|||
polygon_event_type = "polygon_blockchain"
|
||||
mumbai_event_type = "mumbai_blockchain"
|
||||
xdai_event_type = "xdai_blockchain"
|
||||
zksync_era_testnet_event_type = "zksync_era_testnet_blockchain"
|
||||
allowed_tags = ["tag:erc721"]
|
||||
|
||||
description = f"""Event provider for transactions from the Ethereum blockchain.
|
||||
|
@ -414,10 +413,3 @@ XDaiMoonwormProvider = MoonwormProvider(
|
|||
description="Provider for reviving transactions from XDai tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
||||
ZkSyncEraTestnetMoonwormProvider = MoonwormProvider(
|
||||
event_type="zksync_era_testnet_smartcontract",
|
||||
blockchain=AvailableBlockchainType("zksync_era_testnet"),
|
||||
description="Provider for reviving transactions from zkSync Era testnet tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
|
|
@ -475,10 +475,3 @@ XDaiTransactions = TransactionsProvider(
|
|||
description="Provider for resiving transactions from XDai tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
||||
ZkSyncEraTestnetTransactions = TransactionsProvider(
|
||||
event_type="zksync_era_testnet_blockchain",
|
||||
blockchain=AvailableBlockchainType("zksync_era_testnet"),
|
||||
description="Provider for resiving transactions from ZkSync Era testnet tables.",
|
||||
streamboaundary_range_limit=2 * 60 * 60,
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@ from typing import Any, Dict, List, Optional, Tuple, Union
|
|||
from uuid import UUID
|
||||
|
||||
|
||||
|
||||
from bugout.data import BugoutResources, BugoutJournalEntryContent, BugoutJournalEntry
|
||||
from bugout.exceptions import BugoutResponseException
|
||||
from fastapi import APIRouter, Body, Request
|
||||
|
@ -156,6 +157,7 @@ async def create_query_handler(
|
|||
return entry
|
||||
|
||||
|
||||
|
||||
@router.get("/templates", tags=["queries"])
|
||||
def get_suggested_queries(
|
||||
supported_interfaces: Optional[List[str]] = None,
|
||||
|
@ -221,6 +223,7 @@ async def get_query_handler(
|
|||
) -> data.QueryInfoResponse:
|
||||
token = request.state.token
|
||||
|
||||
|
||||
# normalize query name
|
||||
|
||||
try:
|
||||
|
@ -231,6 +234,7 @@ async def get_query_handler(
|
|||
detail=f"Provided query name can't be normalize please select different.",
|
||||
)
|
||||
|
||||
|
||||
# check in templates
|
||||
|
||||
try:
|
||||
|
@ -279,6 +283,7 @@ async def get_query_handler(
|
|||
else:
|
||||
query_id = entries.results[0].entry_url.split("/")[-1]
|
||||
|
||||
|
||||
entry = entries.results[0]
|
||||
|
||||
try:
|
||||
|
@ -307,6 +312,7 @@ async def get_query_handler(
|
|||
else:
|
||||
query_parameters[param] = None
|
||||
|
||||
|
||||
print(type(entry.created_at))
|
||||
|
||||
return data.QueryInfoResponse(
|
||||
|
@ -389,6 +395,7 @@ async def update_query_data_handler(
|
|||
detail=f"Provided query name can't be normalize please select different.",
|
||||
)
|
||||
|
||||
|
||||
# check in templates
|
||||
|
||||
try:
|
||||
|
@ -503,7 +510,9 @@ async def get_access_link_handler(
|
|||
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
journal_id=MOONSTREAM_QUERIES_JOURNAL_ID,
|
||||
query=f"tag:query_template tag:query_url:{query_name_normalized}",
|
||||
filters=[f"context_type:{MOONSTREAM_QUERY_TEMPLATE_CONTEXT_TYPE}"],
|
||||
filters=[
|
||||
f"context_type:{MOONSTREAM_QUERY_TEMPLATE_CONTEXT_TYPE}"
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
except BugoutResponseException as e:
|
||||
|
@ -513,6 +522,7 @@ async def get_access_link_handler(
|
|||
raise MoonstreamHTTPException(status_code=500, internal_error=e)
|
||||
|
||||
if len(entries.results) == 0:
|
||||
|
||||
try:
|
||||
query_id = get_query_by_name(query_name, token)
|
||||
except NameNormalizationException:
|
||||
|
@ -522,6 +532,7 @@ async def get_access_link_handler(
|
|||
)
|
||||
|
||||
try:
|
||||
|
||||
entries = bc.search(
|
||||
token=MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
journal_id=MOONSTREAM_QUERIES_JOURNAL_ID,
|
||||
|
@ -541,6 +552,7 @@ async def get_access_link_handler(
|
|||
)
|
||||
|
||||
try:
|
||||
|
||||
s3_response = None
|
||||
|
||||
if entries.results[0].content:
|
||||
|
@ -619,4 +631,4 @@ async def remove_query_handler(
|
|||
except Exception as e:
|
||||
raise MoonstreamHTTPException(status_code=500, internal_error=e)
|
||||
|
||||
return entry
|
||||
return entry
|
File diff suppressed because one or more lines are too long
|
@ -137,13 +137,6 @@ MOONSTREAM_WYRM_WEB3_PROVIDER_URI = os.environ.get(
|
|||
if MOONSTREAM_WYRM_WEB3_PROVIDER_URI == "":
|
||||
raise Exception("MOONSTREAM_WYRM_WEB3_PROVIDER_URI env variable is not set")
|
||||
|
||||
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI = os.environ.get(
|
||||
"MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI", ""
|
||||
)
|
||||
if MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI == "":
|
||||
raise Exception(
|
||||
"MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI env variable is not set"
|
||||
)
|
||||
|
||||
MOONSTREAM_S3_QUERIES_BUCKET = os.environ.get("MOONSTREAM_S3_QUERIES_BUCKET", "")
|
||||
if MOONSTREAM_S3_QUERIES_BUCKET == "":
|
||||
|
|
|
@ -19,7 +19,6 @@ from .settings import (
|
|||
MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI,
|
||||
MOONSTREAM_XDAI_WEB3_PROVIDER_URI,
|
||||
MOONSTREAM_WYRM_WEB3_PROVIDER_URI,
|
||||
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI,
|
||||
multicall_contracts,
|
||||
multicall_contract_abi,
|
||||
)
|
||||
|
@ -70,8 +69,6 @@ def connect(
|
|||
web3_uri = MOONSTREAM_XDAI_WEB3_PROVIDER_URI
|
||||
elif blockchain_type == AvailableBlockchainType.WYRM:
|
||||
web3_uri = MOONSTREAM_WYRM_WEB3_PROVIDER_URI
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
|
||||
web3_uri = MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI
|
||||
else:
|
||||
raise Exception("Wrong blockchain type provided for web3 URI")
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ setup(
|
|||
"bugout>=0.2.9",
|
||||
"moonstream-entity>=0.0.5",
|
||||
"fastapi",
|
||||
"moonstreamdb>=0.3.4",
|
||||
"moonstreamdb>=0.3.3",
|
||||
"humbug",
|
||||
"pydantic",
|
||||
"pyevmasm",
|
||||
|
|
Ładowanie…
Reference in New Issue