Crate blockfrost[−][src]
Expand description
blockfrost-rust
A Rust SDK for Blockfrost.io API.
Getting started • Installation • Examples
Getting started
To use this SDK you need to login at blockfrost.io and create a new project to receive an API key.
Installation
Add to your project’s Cargo.toml
:
blockfrost = "0.2.0"
Examples
All the examples are located at the examples/
folder.
You might want to check all_requests.rs
and ipfs.rs
.
Here is simple_request.rs
with the basic setup necessary and no settings
customization:
use blockfrost::{load, BlockFrostApi};
fn build_api() -> blockfrost::Result<BlockFrostApi> {
let configurations = load::configurations_from_env()?;
let project_id = configurations["project_id"].as_str().unwrap();
let api = BlockFrostApi::new(project_id, Default::default());
Ok(api)
}
#[tokio::main]
async fn main() -> blockfrost::Result<()> {
let api = build_api()?;
let genesis = api.genesis().await?;
println!("{:#?}", genesis);
Ok(())
}
Re-exports
Modules
Custom errors from this crate.
Utils for loading common settings from config file and environment variables.
Definitions for common types returned in requests.
Structs
Provides methods for making requests to the BlockFrost API.
Customizable settings for requests made with BlockFrostApi
.
Customizable settings for requests made with IpfsApi
.
Settings for retrying when API rate limit is reached.
Enums
The ordering of items inside of a page.
Constants
The URL of the BlockFrost API for the Cardano mainnet.
The URL of the BlockFrost API for the Cardano testnet.
The URL of the BlockFrost IPFS network.
SDK version being used.