kopia lustrzana https://github.com/bugout-dev/moonstream
Merge branch 'moonworm-prod-xdai-support' into xdai-subscription
commit
60e3c078fb
|
@ -12,6 +12,7 @@ from ..settings import MOONSTREAM_MOONWORM_TASKS_JOURNAL, NB_CONTROLLER_ACCESS_I
|
|||
from .continuous_crawler import _retry_connect_web3, continuous_crawler
|
||||
from .crawler import (
|
||||
SubscriptionTypes,
|
||||
blockchain_type_to_subscription_type,
|
||||
get_crawl_job_entries,
|
||||
make_event_crawl_jobs,
|
||||
make_function_call_crawl_jobs,
|
||||
|
@ -24,9 +25,12 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
def handle_crawl(args: argparse.Namespace) -> None:
|
||||
|
||||
blockchain_type = AvailableBlockchainType(args.blockchain_type)
|
||||
subscription_type = blockchain_type_to_subscription_type(blockchain_type)
|
||||
|
||||
initial_event_jobs = make_event_crawl_jobs(
|
||||
get_crawl_job_entries(
|
||||
SubscriptionTypes.POLYGON_BLOCKCHAIN,
|
||||
subscription_type,
|
||||
"event",
|
||||
MOONSTREAM_MOONWORM_TASKS_JOURNAL,
|
||||
)
|
||||
|
@ -35,7 +39,7 @@ def handle_crawl(args: argparse.Namespace) -> None:
|
|||
|
||||
initial_function_call_jobs = make_function_call_crawl_jobs(
|
||||
get_crawl_job_entries(
|
||||
SubscriptionTypes.POLYGON_BLOCKCHAIN,
|
||||
subscription_type,
|
||||
"function",
|
||||
MOONSTREAM_MOONWORM_TASKS_JOURNAL,
|
||||
)
|
||||
|
@ -44,8 +48,6 @@ def handle_crawl(args: argparse.Namespace) -> None:
|
|||
f"Initial function call crawl jobs count: {len(initial_function_call_jobs)}"
|
||||
)
|
||||
|
||||
blockchain_type = AvailableBlockchainType(args.blockchain_type)
|
||||
|
||||
logger.info(f"Blockchain type: {blockchain_type.value}")
|
||||
with yield_db_session_ctx() as db_session:
|
||||
web3: Optional[Web3] = None
|
||||
|
|
|
@ -250,7 +250,6 @@ def continuous_crawler(
|
|||
):
|
||||
# Commiting to db
|
||||
commit_session(db_session)
|
||||
|
||||
# Update heartbeat
|
||||
heartbeat_template["last_block"] = end_block
|
||||
heartbeat_template["current_time"] = _date_to_str(current_time)
|
||||
|
|
|
@ -29,6 +29,7 @@ logger = logging.getLogger(__name__)
|
|||
class SubscriptionTypes(Enum):
|
||||
POLYGON_BLOCKCHAIN = "polygon_smartcontract"
|
||||
ETHEREUM_BLOCKCHAIN = "ethereum_smartcontract"
|
||||
XDAI_BLOCKCHAIN = "xdai_smartcontract"
|
||||
|
||||
|
||||
def abi_input_signature(input_abi: Dict[str, Any]) -> str:
|
||||
|
@ -99,6 +100,8 @@ def blockchain_type_to_subscription_type(
|
|||
return SubscriptionTypes.ETHEREUM_BLOCKCHAIN
|
||||
elif blockchain_type == AvailableBlockchainType.POLYGON:
|
||||
return SubscriptionTypes.POLYGON_BLOCKCHAIN
|
||||
elif blockchain_type == AvailableBlockchainType.XDAI:
|
||||
return SubscriptionTypes.XDAI_BLOCKCHAIN
|
||||
else:
|
||||
raise ValueError(f"Unknown blockchain type: {blockchain_type}")
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue