Crates.io | bitski |
lib.rs | bitski |
version | 0.3.1 |
source | src |
created_at | 2022-11-28 19:50:23.153762 |
updated_at | 2024-01-16 18:12:45.48628 |
description | Bitski Rust SDK |
homepage | |
repository | |
max_upload_size | |
id | 724731 |
size | 7,787 |
cargo add bitski bitski-provider
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),
}
}