2022-01-14 18:56:00 +01:00
|
|
|
use anyhow::Context;
|
|
|
|
use cln_rpc::{model::GetinfoRequest, ClnRpc, Request};
|
|
|
|
use log::info;
|
|
|
|
use std::env::args;
|
|
|
|
use std::path::Path;
|
|
|
|
use tokio;
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), anyhow::Error> {
|
|
|
|
env_logger::init();
|
|
|
|
let rpc_path = args().nth(1).context("missing argument: socket path")?;
|
|
|
|
let p = Path::new(&rpc_path);
|
|
|
|
|
|
|
|
let mut rpc = ClnRpc::new(p).await?;
|
|
|
|
let response = rpc.call(Request::Getinfo(GetinfoRequest {})).await?;
|
2022-01-21 14:45:16 +01:00
|
|
|
println!("{}", serde_json::to_string_pretty(&response)?);
|
2022-01-14 18:56:00 +01:00
|
|
|
Ok(())
|
|
|
|
}
|