Skip to content

Commit 2972baa

Browse files
committed
shim cli query block
1 parent 113c5a8 commit 2972baa

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

sugondat-shim/src/cli.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ pub mod query {
151151
pub enum Commands {
152152
/// Submits the given blob into a namespace.
153153
Submit(submit::Params),
154+
Block(block::Params),
154155
}
155156

156157
pub mod submit {
@@ -179,4 +180,23 @@ pub mod query {
179180
pub key_management: KeyManagementParams,
180181
}
181182
}
183+
184+
pub mod block {
185+
//! CLI definition for the `query block` subcommand.
186+
187+
use super::SugondatRpcParams;
188+
use clap::Args;
189+
190+
#[derive(Debug, Args)]
191+
pub struct Params {
192+
#[clap(flatten)]
193+
pub rpc: SugondatRpcParams,
194+
195+
/// The block number or hash to query.
196+
///
197+
/// If the value is prefixed with `0x`, it is interpreted as a block hash. Otherwise, it
198+
/// is interpreted as a block number.
199+
pub block_spec: String,
200+
}
201+
}
182202
}

sugondat-shim/src/cmd/query/block.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use anyhow::Context;
2+
3+
use super::connect_rpc;
4+
use crate::cli::query::block::Params;
5+
6+
pub async fn run(params: Params) -> anyhow::Result<()> {
7+
let Params {
8+
rpc,
9+
block_spec,
10+
} = params;
11+
drop((rpc, block_spec));
12+
Ok(())
13+
}

sugondat-shim/src/cmd/query/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ use crate::{
44
};
55

66
mod submit;
7+
mod block;
78

89
pub async fn run(params: Params) -> anyhow::Result<()> {
910
match params.command {
1011
Commands::Submit(params) => submit::run(params).await?,
12+
Commands::Block(params) => block::run(params).await?,
1113
}
1214
Ok(())
1315
}

0 commit comments

Comments
 (0)