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",
 | 
			
		||||
        type=str,
 | 
			
		||||
        required=True,
 | 
			
		||||
        choices=[
 | 
			
		||||
            AvailableBlockchainType.ETHEREUM.value,
 | 
			
		||||
            AvailableBlockchainType.POLYGON.value,
 | 
			
		||||
        ],
 | 
			
		||||
        help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
 | 
			
		||||
    )
 | 
			
		||||
    crawl_parser.add_argument(
 | 
			
		||||
        "--abi",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,8 +43,6 @@ def handle_crawl(args: argparse.Namespace) -> None:
 | 
			
		|||
        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)
 | 
			
		||||
 | 
			
		||||
    logger.info(f"Blockchain type: {blockchain_type.value}")
 | 
			
		||||
| 
						 | 
				
			
			@ -128,11 +126,7 @@ def main() -> None:
 | 
			
		|||
        "--blockchain-type",
 | 
			
		||||
        "-b",
 | 
			
		||||
        type=str,
 | 
			
		||||
        choices=[
 | 
			
		||||
            AvailableBlockchainType.ETHEREUM.value,
 | 
			
		||||
            AvailableBlockchainType.POLYGON.value,
 | 
			
		||||
        ],
 | 
			
		||||
        required=True,
 | 
			
		||||
        help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
 | 
			
		||||
    )
 | 
			
		||||
    crawl_parser.add_argument(
 | 
			
		||||
        "--web3",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -83,9 +83,7 @@ def handle_materialize(args: argparse.Namespace) -> None:
 | 
			
		|||
    with yield_db_session_ctx() as db_session, contextlib.closing(
 | 
			
		||||
        sqlite3.connect(args.datastore)
 | 
			
		||||
    ) as moonstream_datastore:
 | 
			
		||||
        last_saved_block = get_last_saved_block(
 | 
			
		||||
            moonstream_datastore, args.blockchain.value
 | 
			
		||||
        )
 | 
			
		||||
        last_saved_block = get_last_saved_block(moonstream_datastore, args.blockchain)
 | 
			
		||||
        logger.info(f"Last saved block: {last_saved_block}")
 | 
			
		||||
        if last_saved_block and last_saved_block >= bounds.starting_block:
 | 
			
		||||
            logger.info(
 | 
			
		||||
| 
						 | 
				
			
			@ -173,9 +171,8 @@ def main() -> None:
 | 
			
		|||
 | 
			
		||||
    parser_materialize.add_argument(
 | 
			
		||||
        "--blockchain",
 | 
			
		||||
        type=AvailableBlockchainType,
 | 
			
		||||
        choices=[AvailableBlockchainType.ETHEREUM, AvailableBlockchainType.POLYGON],
 | 
			
		||||
        help="Blockchain to use",
 | 
			
		||||
        type=str,
 | 
			
		||||
        help=f"Available blockchain types: {[member.value for member in AvailableBlockchainType]}",
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    parser_materialize.set_defaults(func=handle_materialize)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue