Skip to content

Commit

Permalink
add ping and example
Browse files Browse the repository at this point in the history
  • Loading branch information
mycognosist committed Feb 12, 2024
1 parent b46b429 commit 1ff1361
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions solar_client/examples/ping.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use anyhow::Result;
use solar_client::{Client, SolarClient};

const SERVER_ADDR: &str = "http://127.0.0.1:3030";

#[tokio::main]
async fn main() -> Result<()> {
let client = Client::new(SERVER_ADDR.to_owned())?;

let ping = client.ping().await?;
println!("{}", ping);
// pong!

Ok(())
}
2 changes: 2 additions & 0 deletions solar_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use anyhow::Result;

#[jsonrpc_client::api]
pub trait SolarClient {
async fn ping(&self) -> String;

async fn whoami(&self) -> String;
}

Expand Down

0 comments on commit 1ff1361

Please sign in to comment.