kaspa_cli_lib/modules/
ping.rs

1use crate::imports::*;
2
3#[derive(Default, Handler)]
4#[help("Ping the connected node")]
5pub struct Ping;
6
7impl Ping {
8    async fn main(self: Arc<Self>, ctx: &Arc<dyn Context>, _argv: Vec<String>, _cmd: &str) -> Result<()> {
9        let ctx = ctx.clone().downcast_arc::<KaspaCli>()?;
10        if ctx.wallet().ping(None).await.is_ok() {
11            tprintln!(ctx, "ping ok");
12        } else {
13            terrorln!(ctx, "ping error");
14        }
15        Ok(())
16    }
17}