nym_cli_commands/validator/block/get.rs
1// Copyright 2022 - Nym Technologies SA <contact@nymtech.net>
2// SPDX-License-Identifier: Apache-2.0
3
4use clap::Parser;
5
6use crate::context::QueryClient;
7use crate::utils::show_error;
8use serde_json::json;
9
10#[derive(Debug, Parser)]
11pub struct Args {
12 #[clap(value_parser)]
13 #[clap(help = "The block height")]
14 pub height: u32,
15}
16
17pub async fn query_for_block(args: Args, client: &QueryClient) {
18 match client.get_block(Some(args.height)).await {
19 Ok(res) => {
20 println!("{}", json!(res))
21 }
22 Err(e) => show_error(e),
23 }
24}