Exemple #1
0
def add_status_show_parser(subparsers, parent_parser):
    description = ('Displays information about the status of a validator.')

    subparsers.add_parser('show',
                          description=description,
                          parents=[base_http_parser(),
                                   base_list_parser()])
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')
Exemple #3
0
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()])
Exemple #4
0
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)
Exemple #5
0
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')
Exemple #6
0
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')