Lucia

A flexible client API framework as well as a set of API collections written in Rust.

```rust // lucia = { default-features = false, features = ["reqwest", "solana", "tokio-tungstenite"], version = "0.1" }

use lucia::{ api::blockchain::solana::Solana, network::{Transport, TransportWrapper}, Api, Client, };

async fn http() -> lucia::Result<()> { let (mut rb, mut trans) = Client::new( TransportWrapper::withreqwest(), Solana::fromorigin("https://api.mainnet-beta.solana.com")?, ) .into_parts();

// Single request let req = rb.getlatestblockhash(None); let res = trans.sendretrieveanddecodeone(&req, rb.tp_mut()).await?; println!("{:?}", res);

// Batch request let firstreq = rb.getslot(None); let secondreq = rb.getslot(None); let mut responses = Vec::new(); trans .sendretrieveanddecodemany(&mut responses, &[firstreq, secondreq], rb.tp_mut()) .await?; println!("{:?}", responses);

Ok(()) }

async fn web_socket() -> lucia::Result<()> { use futures::StreamExt;

let api = Solana::fromorigin("wss://api.mainnet-beta.solana.com")?; let (mut rb, mut trans) = Client::new(TransportWrapper::withtokiotungstenite(&api).await?, api).intoparts();

let sub = rb.slotsubscribe(); let subid = trans.sendretrieveanddecodeone(&sub, rb.tp_mut()).await?.result;

let data = trans.backend.next().await; println!("{:?}", _data); let _moredata = trans.backend.next().await; println!("{:?}", moredata);

let unsub = rb.slotunsubscribe(subid); trans.send(&unsub, rb.tp_mut()).await?;

Ok(()) } ```

API

Blockchain

|Name |URL |Pct | |--------|------------------------------------------------------|----| |Ethereum|https://web3js.readthedocs.io/en/v1.7.4/web3-eth.html | 3%| |Solana |https://docs.solana.com/developing/clients/jsonrpc-api| 85%|

Exchange

|Name |URL |Pct | |------|------------------------------------------------------|----| |KuCoin|https://docs.kucoin.com | 5%|

Game

|Name |URL |Pct | |-----------------|-----------------------------------------------------|----| |Age of Empires II|https://age-of-empires-2-api.herokuapp.com/docs | 50%|

Health

|Name |URL |Pct | |--------|---------------------------------------------------|----| |Covid-19|https://github.com/M-Media-Group/Covid-19-API |100%|

Test data

|Name |URL |Pct | |---------------|------------------------------------------------|----| |JSONPlaceholder|http://jsonplaceholder.typicode.com |60%|

Backend

|Name |URL | |-----------------|---------------------------------------------| |reqwest |https://github.com/seanmonstar/reqwest | |surf |https://github.com/http-rs/surf | |tokio-tungstenite|https://github.com/snapview/tokio-tungstenite|

Code

Protocol

|Name |URL | |------------|-------------------------------------| |JSON |https://www.json.org | |JSON-RPC 2.0|https://www.jsonrpc.org/specification|

Transport

|Name |URL | |---------|---------------------------------------------------------| |HTTP |https://en.wikipedia.org/wiki/HypertextTransferProtocol| |WebSocket|https://en.wikipedia.org/wiki/WebSocket |