diff --git a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py index 32af00d8..b2cf5a9c 100644 --- a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py +++ b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/cli.py @@ -548,7 +548,10 @@ def handle_historical_crawl_v3(args: argparse.Namespace) -> None: f"Initial function call crawl jobs count: {len(initial_function_call_jobs)}" ) - customer_connection = get_db_connection(args.customer_uuid) + if args.customer_uri is not None: + customer_connection = args.customer_uri + else: + customer_connection = get_db_connection(args.customer_uuid) if customer_connection == "": raise ValueError("No connection string found for the customer") @@ -1083,6 +1086,13 @@ def main() -> None: help="User UUID", ) + historical_crawl_parser_v3.add_argument( + "--customer-uri", + type=str, + required=False, + help="Customer URI", + ) + historical_crawl_parser_v3.set_defaults(func=handle_historical_crawl_v3) args = parser.parse_args() diff --git a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/db.py b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/db.py index 05e8f16c..3bb98723 100644 --- a/crawlers/mooncrawl/mooncrawl/moonworm_crawler/db.py +++ b/crawlers/mooncrawl/mooncrawl/moonworm_crawler/db.py @@ -1,5 +1,6 @@ import json import logging +from hexbytes import HexBytes from typing import Dict, List, Optional, Union, Any from moonstreamdb.models import Base @@ -265,7 +266,9 @@ def add_events_to_session( "block_timestamp": label_event.block_timestamp, "caller_address": None, "origin_address": None, - "address": bytes.fromhex(label_event.address[2:]), + "address": HexBytes( + label_event.address + ), # transform to \x00 format on insert "label_name": label_event.label_name, "label_type": "event", "label_data": label_event.label_data, @@ -355,9 +358,11 @@ def add_function_calls_to_session( "block_number": label_function_call.block_number, "block_hash": label_function_call.block_hash, "block_timestamp": label_function_call.block_timestamp, - "caller_address": bytes.fromhex(label_function_call.caller_address[2:]), - "origin_address": bytes.fromhex(label_function_call.caller_address[2:]), - "address": bytes.fromhex(label_function_call.address[2:]), + "caller_address": HexBytes(label_function_call.caller_address), + "origin_address": HexBytes(label_function_call.caller_address), + "address": HexBytes( + label_function_call.address + ), # transform to \x00 format on insert "label_name": label_function_call.label_name, "label_type": "tx_call", "label_data": label_function_call.label_data,