| Crates.io | dllma |
| lib.rs | dllma |
| version | 0.1.1 |
| created_at | 2026-01-17 12:43:37.26563+00 |
| updated_at | 2026-01-22 21:40:27.47236+00 |
| description | Unofficial Rust client for the DefiLlama API (dllma) |
| homepage | |
| repository | https://github.com/yldfi/yldfi-rs/tree/main/crates/dllma |
| max_upload_size | |
| id | 2050388 |
| size | 179,388 |
Unofficial Rust client for the DefiLlama API
[dependencies]
dllma = "0.1"
tokio = { version = "1", features = ["full"] }
use dllma::Client;
#[tokio::main]
async fn main() -> Result<(), dllma::Error> {
// Create a free-tier client
let client = Client::new()?;
// Get all protocols
let protocols = client.tvl().protocols().await?;
println!("Found {} protocols", protocols.len());
// Get current ETH price
use dllma::coins::Token;
let tokens = vec![Token::coingecko("ethereum")];
let prices = client.coins().current(&tokens).await?;
Ok(())
}
Some endpoints require a Pro API key. Get one at defillama.com/subscription.
// Create client with Pro API key
let client = Client::with_api_key("your-api-key")?;
// Or from environment variable
let client = Client::from_env()?; // reads DEFILLAMA_API_KEY
// Access Pro endpoints
let yields = client.yields().pools().await?;
DEFILLAMA_API_KEY - Your DefiLlama Pro API key (optional, for Pro endpoints)MIT