4 releases

0.1.3 Aug 17, 2023
0.1.2 Jun 18, 2023
0.1.1 Jun 17, 2023
0.1.0 Jun 17, 2023

#9 in #rustup

Download history 6/week @ 2024-02-19 7/week @ 2024-02-26 1/week @ 2024-03-11 50/week @ 2024-04-01

51 downloads per month
Used in blockless-web-cgi

MIT/Apache

38KB
529 lines

Blockless-sdk-rust

How to build

  1. Install the rust with rustup, please visit the site 'https://rustup.rs/'.

  2. Use follow command for build the project.

$ cargo build

The example

use blockless_sdk::*;
use json;

fn main() {
    let opts = HttpOptions::new("GET", 30, 10);
    let http = BlocklessHttp::open("https://demo.bls.dev/tokens", &opts);
    let http = http.unwrap();
    let body = http.get_all_body().unwrap();
    let body = String::from_utf8(body).unwrap();
    let tokens = match json::parse(&body).unwrap() {
        json::JsonValue::Object(o) => o,
        _ => panic!("must be object"),
    };
    let tokens = match tokens.get("tokens") {
        Some(json::JsonValue::Array(tokens)) => tokens,
        _ => panic!("must be array"),
    };
    tokens.iter().for_each(|s| {
        println!("{:?}", s.as_str());
    });
}

Dependencies

~145KB