near-api 0.8.6

Rust library to interact with NEAR Protocol via RPC API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use near_api::{Chain, NetworkConfig, RPCEndpoint, types::Reference};

#[tokio::main]
async fn main() -> testresult::TestResult {
    let mut network = NetworkConfig::mainnet();
    network.rpc_endpoints.push(
        RPCEndpoint::new("https://near.lava.build:443".parse()?)
            .with_retries(5)
            .with_api_key("some potential api key".to_string()),
    );
    // Query latest block
    let _block = Chain::block()
        .at(Reference::Optimistic)
        .fetch_from_mainnet()
        .await?;

    Ok(())
}