Crate blockfrost

Crate blockfrost 

Source
Expand description

Crates.io link Docs.rs link License

§blockfrost-rust


A Rust SDK for Blockfrost.io API.

Getting startedInstallationExamplesEndpoints

§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 = "1.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::{BlockfrostAPI, BlockfrostResult};

fn build_api() -> BlockfrostResult<BlockfrostAPI> {
    let api = BlockfrostAPI::new("mainnetxvMK4xOpp5mHJgihi055KDLU64JJv2be", Default::default());
    Ok(api)
}

#[tokio::main]
async fn main() -> blockfrost::BlockfrostResult<()> {
    let api = build_api()?;
    let genesis = api.genesis().await?;

    println!("{:#?}", genesis);
    Ok(())
}

Re-exports§

pub use error::*;
pub use types::*;

Modules§

error
types

Structs§

BlockFrostSettings
BlockfrostAPI
BlockfrostIPFS
Provides methods for making requests to the IPFS API.
IpfsSettings
Pagination
RetrySettings
Settings for retrying when API rate limit is reached.

Enums§

Order

Constants§

CARDANO_MAINNET_URL
CARDANO_PREPROD_URL
CARDANO_PREVIEW_URL
CARDANO_TESTNET_URL
DEFAULT_API_VERSION
DEFAULT_BATCH_SIZE
DEFAULT_ORDER
DEFAULT_PAGINATION_PAGE_COUNT
DEFAULT_PAGINATION_PAGE_ITEMS_COUNT
IPFS_URL
USER_AGENT
SDK version being used.