Rust core lightning common client

This crate provides an generic interface from rust to the core lightning daemon through RPC with a generic interface.

Project Homepage

GitHub Workflow Status (branch) Crates.io Crates.io docs.rs

This crate provides an generic interface from rust to the c-lightning daemon through RPC with a generic interface.

From the crate clightningrpc you can find this quote

Be aware that the API (of rust-clighting-rpc, but also that of c-lightning itself) is not finalized. This means that it may change from version to version and break your compile, sorry!

This crate solve the versioning with core lightning by offering a strongly type library with a generic interface, an example can be:

```rust extern crate clightningrpc_common;

use serde::{Deserialize, Serialize}; use std::env;

use clightningrpccommon::client; use clightningrpccommon::types::Response;

/// Example of type definition

[derive(Debug, Clone, Deserialize, Serialize)]

struct GetInfoResponse { pub id: String, }

/// Example of type definition

[derive(Debug, Clone, Deserialize, Serialize)]

struct GetInfoRequest {}

fn main() { let sock = env::homedir().unwrap().join(".lightning/lightning-rpc"); println!("Using socket {}", sock.display()); let client = client::Client::new(&sock); let method = "getinfo"; let params = GetInfoRequest {}; match client .sendrequest(method, params) .andthen(|res: Response| res.intoresult()) { Ok(d) => { println!("Ok! {:?}", d); } Err(e) => { println!("Error! {}", e); } } } ```

Contributing guidelines

Supports

If you want support this library consider to donate with the following methods

Credits

This library is based on Andrew Poelstra's rust-jsonrpc.