kopia lustrzana https://github.com/bugout-dev/moonstream
zkSync in crawlers.
rodzic
5fcffd7d5e
commit
f49b7c4a78
|
@ -30,7 +30,6 @@ from .actions import (
|
|||
from .middleware import MoonstreamHTTPException
|
||||
from .settings import (
|
||||
BUGOUT_RESOURCE_TYPE_ENTITY_SUBSCRIPTION,
|
||||
BUGOUT_RESOURCE_TYPE_SUBSCRIPTION,
|
||||
DOCS_TARGET_PATH,
|
||||
LINKS_EXPIRATION_TIME,
|
||||
MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
|
@ -173,7 +172,7 @@ async def status_handler(
|
|||
dashboard_subscription_filters["subscription_id"]
|
||||
]
|
||||
|
||||
for reqired_field in subscription.required_fields:
|
||||
for reqired_field in subscription.required_fields: # type: ignore
|
||||
if "subscription_type_id" in reqired_field:
|
||||
subscriprions_type = reqired_field["subscription_type_id"]
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ from .settings import (
|
|||
MOONSTREAM_WYRM_WEB3_PROVIDER_URI,
|
||||
MOONSTREAM_XDAI_WEB3_PROVIDER_URI,
|
||||
MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI,
|
||||
MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI,
|
||||
NB_ACCESS_ID_HEADER,
|
||||
NB_DATA_SOURCE_HEADER,
|
||||
WEB3_CLIENT_REQUEST_TIMEOUT_SECONDS,
|
||||
|
@ -73,6 +74,8 @@ def connect(
|
|||
web3_uri = MOONSTREAM_WYRM_WEB3_PROVIDER_URI
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
|
||||
web3_uri = MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
web3_uri = MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI
|
||||
else:
|
||||
raise Exception("Wrong blockchain type provided for web3 URI")
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import argparse
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from typing import cast, List
|
||||
import uuid
|
||||
|
||||
|
@ -12,7 +11,6 @@ from .utils import get_results_for_moonstream_query
|
|||
from ..settings import (
|
||||
MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
MOONSTREAM_LEADERBOARD_GENERATOR_JOURNAL_ID,
|
||||
BUGOUT_REQUEST_TIMEOUT_SECONDS,
|
||||
MOONSTREAM_API_URL,
|
||||
MOONSTREAM_ENGINE_URL,
|
||||
)
|
||||
|
|
|
@ -3,19 +3,16 @@ import json
|
|||
import logging
|
||||
import random
|
||||
import urllib.request
|
||||
from contextlib import contextmanager
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import Any, Dict, List, Optional
|
||||
from urllib.error import HTTPError
|
||||
|
||||
from moonstreamdb.blockchain import AvailableBlockchainType
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from ..db import (
|
||||
yield_db_preping_session_ctx,
|
||||
yield_db_read_only_preping_session_ctx,
|
||||
)
|
||||
from ..settings import MOONSTREAM_CRAWLERS_DB_STATEMENT_TIMEOUT_MILLIS
|
||||
from .db import (
|
||||
clean_labels_from_db,
|
||||
get_current_metadata_for_address,
|
||||
|
|
|
@ -132,6 +132,8 @@ def continuous_crawler(
|
|||
network = Network.wyrm
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
|
||||
network = Network.zksync_era_testnet
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
network = Network.zksync_era
|
||||
else:
|
||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ class SubscriptionTypes(Enum):
|
|||
XDAI_BLOCKCHAIN = "xdai_smartcontract"
|
||||
WYRM_BLOCKCHAIN = "wyrm_smartcontract"
|
||||
ZKSYNC_ERA_TESTNET_BLOCKCHAIN = "zksync_era_testnet_smartcontract"
|
||||
ZKSYNC_ERA_BLOCKCHAIN = "zksync_era_smartcontract"
|
||||
|
||||
|
||||
def abi_input_signature(input_abi: Dict[str, Any]) -> str:
|
||||
|
@ -142,6 +143,8 @@ def blockchain_type_to_subscription_type(
|
|||
return SubscriptionTypes.WYRM_BLOCKCHAIN
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
|
||||
return SubscriptionTypes.ZKSYNC_ERA_TESTNET_BLOCKCHAIN
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
return SubscriptionTypes.ZKSYNC_ERA_BLOCKCHAIN
|
||||
else:
|
||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ def function_call_crawler(
|
|||
network = Network.wyrm
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA_TESTNET:
|
||||
network = Network.zksync_era_testnet
|
||||
elif blockchain_type == AvailableBlockchainType.ZKSYNC_ERA:
|
||||
network = Network.zksync_era
|
||||
else:
|
||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||
|
||||
|
|
|
@ -116,6 +116,12 @@ if MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI == "":
|
|||
"MOONSTREAM_ZKSYNC_ERA_TESTNET_WEB3_PROVIDER_URI env variable is not set"
|
||||
)
|
||||
|
||||
MOONSTREAM_ZKSYNC_ERA_WEB3_PROVIDER_URI = os.environ.get(
|
||||
"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")
|
||||
|
||||
MOONSTREAM_CRAWL_WORKERS = 4
|
||||
MOONSTREAM_CRAWL_WORKERS_RAW = os.environ.get("MOONSTREAM_CRAWL_WORKERS")
|
||||
try:
|
||||
|
|
|
@ -12,7 +12,6 @@ from uuid import UUID
|
|||
|
||||
from moonstreamdb.blockchain import AvailableBlockchainType
|
||||
from moonstream.client import Moonstream # type: ignore
|
||||
from web3._utils.request import cache_session
|
||||
from web3.middleware import geth_poa_middleware
|
||||
|
||||
from mooncrawl.moonworm_crawler.crawler import _retry_connect_web3
|
||||
|
@ -21,7 +20,6 @@ from ..actions import recive_S3_data_from_query
|
|||
from ..db import PrePing_SessionLocal
|
||||
from ..settings import (
|
||||
INFURA_PROJECT_ID,
|
||||
MOONSTREAM_ADMIN_ACCESS_TOKEN,
|
||||
NB_CONTROLLER_ACCESS_ID,
|
||||
infura_networks,
|
||||
multicall_contracts,
|
||||
|
|
|
@ -53,6 +53,7 @@ subscription_id_by_blockchain = {
|
|||
"xdai": "xdai_smartcontract",
|
||||
"wyrm": "wyrm_smartcontract",
|
||||
"zksync_era_testnet": "zksync_era_testnet_smartcontract",
|
||||
"zksync_era": "zksync_era_smartcontract",
|
||||
}
|
||||
|
||||
blockchain_by_subscription_id = {
|
||||
|
@ -68,6 +69,7 @@ blockchain_by_subscription_id = {
|
|||
"xdai_smartcontract": "xdai",
|
||||
"wyrm_smartcontract": "wyrm",
|
||||
"zksync_era_testnet_smartcontract": "zksync_era_testnet",
|
||||
"zksync_era_smartcontract": "zksync_era",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
Moonstream crawlers version.
|
||||
"""
|
||||
|
||||
MOONCRAWL_VERSION = "0.3.4"
|
||||
MOONCRAWL_VERSION = "0.3.5"
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
Moonstream library and API version.
|
||||
"""
|
||||
|
||||
MOONSTREAMAPI_VERSION = "0.2.9"
|
||||
MOONSTREAMAPI_VERSION = "0.3.0"
|
||||
|
|
Ładowanie…
Reference in New Issue