bitski

Crates.iobitski
lib.rsbitski
version0.3.1
sourcesrc
created_at2022-11-28 19:50:23.153762
updated_at2024-01-16 18:12:45.48628
descriptionBitski Rust SDK
homepage
repository
max_upload_size
id724731
size7,787
Julian Tescher (jtescher)

documentation

README

Bitski Rust SDK

Install

cargo add bitski bitski-provider

Connect via OAuth

You can auth via your Bitski credentials, which can be generated at developer.bitski.com, and return a web3 provider.

If you don't need to send authenticated requests, e.g. for read-only data, you can use BITSKI_API_KEY=local.

use bitski::Bitski;
use tokio;
use web3::Transport;

#[tokio::main]
async fn main() {
    let bitski = Bitski::from_env().expect("Could not initialize");
    let network = "mainnet";
    let provider = bitski
        .get_provider(network)
        .expect("Could not get provider");

    let method = "eth_getTransactionCount";
    let params =
        serde_json::from_str(r#"["0x457044DFF5886a9eb9365015704e1b747F384194", "latest"]"#)
            .expect("Invalid params");
    let result = provider.execute(method, params).await;

    match result {
        Ok(result) => println!("{}", result),
        Err(err) => eprintln!("Error: {:?}", err),
    }
}
Commit count: 0

cargo fmt