#near #tokio #api #json-rpc #api-bindings #rpc

near-api-tokio

Rust implementation of Near API library that compatible with tokio

1 unstable release

0.1.0 Oct 22, 2021

#144 in #near

MIT license

14KB
241 lines

Near API

Rust implementation of Near API library that compatible with tokio.

Crates.io

Usage

First, add this to your Cargo.toml:

[dependencies]
near-api-tokio = "0.1.0"

Example

use near_primitives_v01::types::{BlockReference, Finality};

#[tokio::test]
async fn get_pools() {
    let near_client = near_api::new_client("https://rpc.mainnet.near.org");
    let block = near_client
        .block(BlockReference::Finality(Finality::Final))
        .await
        .unwrap();
    println!("block {}", block.header.height);
}

Dependencies

~28–41MB
~693K SLoC