fireblocks_sdk
is an async library for the Fireblocks API
!!!! Note this is community driven project and not affiliated with Fireblocks !!!!!
cargo install fireblocks-sdk
See developer portal and sign up for a sandbox account
use fireblocks_sdk::ClientBuilder;
use fireblocks_sdk::apis::vaults_api::GetPagedVaultAccountsParams;
use crate::fireblocks_sdk::apis::Api;
use std::time::Duration;
async fn vaults() -> anyhow::Result<()> {
let api_key = std::env::var("FIREBLOCKS_API_KEY")?;
let secret = std::env::var("FIREBLOCKS_SECRET")?;
let client = ClientBuilder::new(&api_key, &secret.into_bytes())
.with_timeout(Duration::from_secs(10))
.with_connect_timeout(Duration::from_secs(5))
.build()?;
// Auto generate ApiClient
let api_client = client.apis();
let params = GetPagedVaultAccountsParams::builder()
.limit(50.0)
.build();
let vault_accounts = api_client.vaults_api().get_paged_vault_accounts(params).await?;
println!("vault accounts: {:#?}", vault_accounts);
Ok(())
}
The client is a small wrapper to the auto-generate APIs using openapi generator.
use crate::fireblocks_sdk::apis::Api;
use fireblocks_sdk::Client;
fn demo(client: Client) {
// Access to generated API client
let api_client = client.apis();
// External Wallet Api (whitlisted)
let external_wallet_api = api_client.whitelisted_external_wallets_api();
}
This is bon crate for construction parameters to API endpoints (both query and body)
The openapi-generator decided that all integers are floats. Annoying yes, but it is what it is.
Create a .env file
cp .env-sameple .env
Edit .env and configure your API and secret key. You also need to create some whitlisted (see test for details)
Run tests:
cargo test
Run a single test:
cargo test --test wallets
Code was generatered by Fireblocks openapi spec using openapi-generator with this config
See docs