blockfrost-rust
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:
= "1.3.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 ;
async
Pagination
Every paginated endpoint takes a Pagination, which controls page, count and order:
use ;
let pagination = new;
let everything = all; // fetch every page
Block range cursors
Three endpoints additionally accept inclusive from/to block cursors:
accounts_transactionsaddresses_transactionsassets_transactions
use ;
// a plain block height, or a block height with a transaction index
let pagination = default.with_range;
Cursors also accept BlockCursor::block(..), BlockCursor::tx(..) and "8929261:10".parse().
They are preserved across pages when fetch_all is set.
Note: every other paginated endpoint ignores
from/to. Passing aPaginationthat carries cursors to, say,accounts_utxosreturns the full unfiltered list rather than an error, so keep cursors on aPaginationyou only hand to the three endpoints above.