kopia lustrzana https://github.com/bugout-dev/moonstream
fixed cli choices, added help messages
rodzic
5d31b8d58a
commit
181d1769a0
|
@ -173,10 +173,7 @@ def main():
|
||||||
"--blockchain_type",
|
"--blockchain_type",
|
||||||
type=str,
|
type=str,
|
||||||
required=True,
|
required=True,
|
||||||
choices=[
|
help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
|
||||||
AvailableBlockchainType.ETHEREUM.value,
|
|
||||||
AvailableBlockchainType.POLYGON.value,
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
crawl_parser.add_argument(
|
crawl_parser.add_argument(
|
||||||
"--abi",
|
"--abi",
|
||||||
|
|
|
@ -43,8 +43,6 @@ def handle_crawl(args: argparse.Namespace) -> None:
|
||||||
f"Initial function call crawl jobs count: {len(initial_function_call_jobs)}"
|
f"Initial function call crawl jobs count: {len(initial_function_call_jobs)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Couldn't figure out how to convert from string to AvailableBlockchainType
|
|
||||||
# AvailableBlockchainType(args.blockchain_type) is not working
|
|
||||||
blockchain_type = AvailableBlockchainType(args.blockchain_type)
|
blockchain_type = AvailableBlockchainType(args.blockchain_type)
|
||||||
|
|
||||||
logger.info(f"Blockchain type: {blockchain_type.value}")
|
logger.info(f"Blockchain type: {blockchain_type.value}")
|
||||||
|
@ -128,11 +126,7 @@ def main() -> None:
|
||||||
"--blockchain-type",
|
"--blockchain-type",
|
||||||
"-b",
|
"-b",
|
||||||
type=str,
|
type=str,
|
||||||
choices=[
|
help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
|
||||||
AvailableBlockchainType.ETHEREUM.value,
|
|
||||||
AvailableBlockchainType.POLYGON.value,
|
|
||||||
],
|
|
||||||
required=True,
|
|
||||||
)
|
)
|
||||||
crawl_parser.add_argument(
|
crawl_parser.add_argument(
|
||||||
"--web3",
|
"--web3",
|
||||||
|
|
|
@ -83,9 +83,7 @@ def handle_materialize(args: argparse.Namespace) -> None:
|
||||||
with yield_db_session_ctx() as db_session, contextlib.closing(
|
with yield_db_session_ctx() as db_session, contextlib.closing(
|
||||||
sqlite3.connect(args.datastore)
|
sqlite3.connect(args.datastore)
|
||||||
) as moonstream_datastore:
|
) as moonstream_datastore:
|
||||||
last_saved_block = get_last_saved_block(
|
last_saved_block = get_last_saved_block(moonstream_datastore, args.blockchain)
|
||||||
moonstream_datastore, args.blockchain.value
|
|
||||||
)
|
|
||||||
logger.info(f"Last saved block: {last_saved_block}")
|
logger.info(f"Last saved block: {last_saved_block}")
|
||||||
if last_saved_block and last_saved_block >= bounds.starting_block:
|
if last_saved_block and last_saved_block >= bounds.starting_block:
|
||||||
logger.info(
|
logger.info(
|
||||||
|
@ -173,9 +171,8 @@ def main() -> None:
|
||||||
|
|
||||||
parser_materialize.add_argument(
|
parser_materialize.add_argument(
|
||||||
"--blockchain",
|
"--blockchain",
|
||||||
type=AvailableBlockchainType,
|
type=str,
|
||||||
choices=[AvailableBlockchainType.ETHEREUM, AvailableBlockchainType.POLYGON],
|
help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
|
||||||
help="Blockchain to use",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
parser_materialize.set_defaults(func=handle_materialize)
|
parser_materialize.set_defaults(func=handle_materialize)
|
||||||
|
|
Ładowanie…
Reference in New Issue