| Crates.io | zrxswap |
| lib.rs | zrxswap |
| version | 0.1.1 |
| created_at | 2026-01-17 13:00:27.269729+00 |
| updated_at | 2026-01-22 21:41:21.810264+00 |
| description | Unofficial Rust client for the 0x DEX aggregator API (zrxswap) |
| homepage | |
| repository | https://github.com/yldfi/yldfi-rs/tree/main/crates/zrxswap |
| max_upload_size | |
| id | 2050422 |
| size | 95,332 |
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 zrxswap::{Client, Chain, QuoteRequest};
#[tokio::main]
async fn main() -> Result<(), zrxswap::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]
zrxswap = "0.1"
tokio = { version = "1", features = ["full"] }
MIT