def add_transaction_parser(subparsers, parent_parser): """Adds argument parsers for the transaction list and show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser( 'transaction', help='Shows information on transactions in the current chain', description='Provides subcommands to display information about ' 'the transactions in the current blockchain.') grand_parsers = parser.add_subparsers( title='subcommands', dest='subcommand') grand_parsers.required = True grand_parsers.add_parser( 'list', description='Lists all transactions in the current blockchain.', parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser = grand_parsers.add_parser( 'show', description='Displays information for the specified transaction.', parents=[base_http_parser(), base_show_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument( 'transaction_id', type=str, help='id (header_signature) of the transaction')
def add_block_parser(subparsers, parent_parser): """Adds arguments parsers for the block list and block show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser('block') grand_parsers = parser.add_subparsers(title='grandchildcommands', dest='subcommand') grand_parsers.required = True epilog = '''details: Lists committed blocks from the newest to the oldest, including their id (i.e. header signature), batch and transaction count, and their signer's public key. ''' grand_parsers.add_parser( 'list', epilog=epilog, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) epilog = '''details: Shows the data for a single block, or for a particular property within that block or its header. Displays data in YAML (default), or JSON formats. ''' show_parser = grand_parsers.add_parser( 'show', epilog=epilog, parents=[base_http_parser(), base_show_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument( 'block_id', type=str, help='the id (i.e. header_signature) of the block')
def add_transaction_parser(subparsers, parent_parser): """Adds argument parsers for the transaction list and show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser( 'transaction', help='Shows information on transactions in the current chain', description='Provides subcommands to display information about ' 'the transactions in the current blockchain.') grand_parsers = parser.add_subparsers(title='subcommands', dest='subcommand') grand_parsers.required = True grand_parsers.add_parser( 'list', description='Lists all transactions in the current blockchain.', parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser = grand_parsers.add_parser( 'show', description='Displays information for the specified transaction.', parents=[base_http_parser(), base_show_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument('transaction_id', type=str, help='id (header_signature) of the transaction')
def add_batch_list_parser(subparsers, parent_parser): epilog = '''details: Lists committed batches from newest to oldest, including their id (i.e. header signature), transaction count, and their signer's public key. ''' subparsers.add_parser( 'list', epilog=epilog, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter)
def add_peer_list_parser(subparsers, parent_parser): description = ( 'Displays the addresses of the validators with which ' 'a specified validator is peered.') subparsers.add_parser( 'list', description=description, parents=[base_http_parser(), base_list_parser()])
def add_batch_list_parser(subparsers, parent_parser): epilog = '''details: Lists committed batches from newest to oldest, including their id (i.e. header signature), transaction count, and their signer's public key. ''' subparsers.add_parser('list', epilog=epilog, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter)
def add_state_parser(subparsers, parent_parser): """Adds arguments parsers for the state list and state show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser( 'state', help='Displays information on the entries in state', description='Provides subcommands to display information about the ' 'state entries in the current blockchain state.') grand_parsers = parser.add_subparsers( title='subcommands', dest='subcommand') grand_parsers.required = True list_parser = grand_parsers.add_parser( 'list', description='Lists all state entries in the current blockchain.', parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) list_parser.add_argument( 'subtree', type=str, nargs='?', default=None, help='address of a subtree to filter the list by') list_parser.add_argument( '--head', action='store', default=None, help='specify the id of the block to set as the chain head') show_parser = grand_parsers.add_parser( 'show', description='Displays information for the specified state address in ' 'the current blockchain.', parents=[base_http_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument( 'address', type=str, help='address of the leaf') show_parser.add_argument( '--head', action='store', default=None, help='specify the id of the block to set as the chain head')
def add_batch_list_parser(subparsers, parent_parser): description = ( 'Displays all information about all committed Batches for ' 'the specified validator, including the Batch id, public keys of all ' 'signers, and number of transactions in each Batch.') subparsers.add_parser( 'list', description=description, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter)
def add_block_parser(subparsers, parent_parser): """Adds arguments parsers for the block list and block show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser( 'block', description='Provides subcommands to display information about the ' 'blocks in the current blockchain.', help='Displays information on blocks in the current blockchain') grand_parsers = parser.add_subparsers( title='subcommands', dest='subcommand') grand_parsers.required = True description = ( 'Displays information for all blocks on the current ' 'blockchain, including the block id and number, public keys all ' 'of allsigners, and number of transactions and batches.') list_parser = grand_parsers.add_parser( 'list', help='Displays information for all blocks on the current blockchain', description=description, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) list_parser.add_argument( '-n', '--count', default=100, type=int, help='the number of blocks to list', ) description = ( 'Displays information about the specified block on ' 'the current blockchain') show_parser = grand_parsers.add_parser( 'show', help=description, description=description + '.', parents=[base_http_parser(), base_show_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument( 'block_id', type=str, help='id (header_signature) of the block')
def add_block_parser(subparsers, parent_parser): """Adds arguments parsers for the block list and block show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser( 'block', description='Provides subcommands to display information about the ' 'blocks in the current blockchain.', help='Displays information on blocks in the current blockchain') grand_parsers = parser.add_subparsers(title='subcommands', dest='subcommand') grand_parsers.required = True description = ( 'Displays information for all blocks on the current ' 'blockchain, including the block id and number, public keys all ' 'of allsigners, and number of transactions and batches.') list_parser = grand_parsers.add_parser( 'list', help='Displays information for all blocks on the current blockchain', description=description, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) list_parser.add_argument( '-n', '--count', default=100, type=int, help='the number of blocks to list', ) description = ('Displays information about the specified block on ' 'the current blockchain') show_parser = grand_parsers.add_parser( 'show', help=description, description=description + '.', parents=[base_http_parser(), base_show_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument('block_id', type=str, help='id (header_signature) of the block')
def add_state_parser(subparsers, parent_parser): """Adds arguments parsers for the state list and state show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser('state') grand_parsers = parser.add_subparsers(title='grandchildcommands', dest='subcommand') grand_parsers.required = True epilog = '''details: Lists state in the form of leaves from the merkle tree. List can be narrowed using the address of a subtree. ''' list_parser = grand_parsers.add_parser( 'list', epilog=epilog, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) list_parser.add_argument('subtree', type=str, nargs='?', default=None, help='the address of a subtree to filter list by') list_parser.add_argument( '--head', action='store', default=None, help='the id of the block to set as the chain head') epilog = '''details: Shows the data for a single leaf on the merkle tree. ''' show_parser = grand_parsers.add_parser( 'show', epilog=epilog, parents=[base_http_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument('address', type=str, help='the address of the leaf') show_parser.add_argument( '--head', action='store', default=None, help='the id of the block to set as the chain head')
def add_state_parser(subparsers, parent_parser): """Adds arguments parsers for the state list and state show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser('state') grand_parsers = parser.add_subparsers(title='grandchildcommands', dest='subcommand') grand_parsers.required = True epilog = '''details: Lists state in the form of leaves from the merkle tree. List can be narrowed using the address of a subtree. ''' list_parser = grand_parsers.add_parser( 'list', epilog=epilog, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) list_parser.add_argument( 'subtree', type=str, nargs='?', default=None, help='the address of a subtree to filter list by') list_parser.add_argument( '--head', action='store', default=None, help='the id of the block to set as the chain head') epilog = '''details: Shows the data for a single leaf on the merkle tree. ''' show_parser = grand_parsers.add_parser( 'show', epilog=epilog, parents=[base_http_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument( 'address', type=str, help='the address of the leaf') show_parser.add_argument( '--head', action='store', default=None, help='the id of the block to set as the chain head')
def add_transaction_parser(subparsers, parent_parser): """Adds argument parsers for the transaction list and show commands Args: subparsers: Add parsers to this subparser object parent_parser: The parent argparse.ArgumentParser object """ parser = subparsers.add_parser('transaction') grand_parsers = parser.add_subparsers(title='grandchildcommands', dest='subcommand') grand_parsers.required = True epilog = '''details: Lists committed transactions from newest to oldest, including their id (i.e. header_signature), transaction family and version, and their payload. ''' grand_parsers.add_parser( 'list', epilog=epilog, parents=[base_http_parser(), base_list_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) epilog = '''details: Shows the data for a single transaction, or for a particular property within that transaction or its header. Displays data in YAML (default), or JSON formats. ''' show_parser = grand_parsers.add_parser( 'show', epilog=epilog, parents=[base_http_parser(), base_show_parser()], formatter_class=argparse.RawDescriptionHelpFormatter) show_parser.add_argument( 'transaction_id', type=str, help='the id (i.e. header_signature) of the transaction')