| Crates.io | zerox |
| lib.rs | zerox |
| version | 0.1.0 |
| created_at | 2026-01-17 09:41:03.360461+00 |
| updated_at | 2026-01-17 09:41:03.360461+00 |
| description | Unofficial Rust client for the 0x (ZeroEx) DEX aggregator API |
| homepage | |
| repository | https://github.com/yldfi/yldfi-rs/tree/main/crates/zerox |
| max_upload_size | |
| id | 2050201 |
| size | 95,009 |
Unofficial Rust client for the 0x (ZeroEx) DEX Aggregator API v2
0x is a professional-grade DEX aggregator that finds optimal swap routes across 100+ DEXs on Ethereum and EVM-compatible chains.
An API key is required for production use. Get one at 0x.org.
use zerox::{Client, Chain, QuoteRequest};
#[tokio::main]
async fn main() -> Result<(), zerox::Error> {
// Create a client with your API key
let client = Client::with_api_key("your-api-key")?;
// Get an indicative price for swapping 1 ETH to USDC
let request = QuoteRequest::sell(
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native ETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"1000000000000000000", // 1 ETH in wei
);
let price = client.get_price(Chain::Ethereum, &request).await?;
println!("You would receive: {} USDC", price.buy_amount);
Ok(())
}
[dependencies]
zerox = "0.1"
tokio = { version = "1", features = ["full"] }
MIT