| Crates.io | oneinch |
| lib.rs | oneinch |
| version | 0.1.0 |
| created_at | 2026-01-17 08:20:58.451846+00 |
| updated_at | 2026-01-17 08:20:58.451846+00 |
| description | Unofficial Rust client for the 1inch DEX aggregator API |
| homepage | |
| repository | https://github.com/yldfi/yldfi-rs/tree/main/crates/oneinch |
| max_upload_size | |
| id | 2050132 |
| size | 96,593 |
Rust client for the 1inch DEX Aggregator Swap API v6.0.
1inch is one of the most popular DEX aggregators, offering optimal swap routes across hundreds of liquidity sources on multiple chains.
The 1inch API requires an API key. Get yours at portal.1inch.dev.
use oneinch::{Client, Chain, QuoteRequest};
#[tokio::main]
async fn main() -> Result<(), oneinch::Error> {
// Create client with your API key
let client = Client::new("your-api-key")?;
// Get a quote for swapping 1 ETH to USDC on Ethereum
let request = QuoteRequest::new(
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native ETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"1000000000000000000", // 1 ETH in wei
);
let quote = client.get_quote(Chain::Ethereum, &request).await?;
println!("Expected output: {} USDC", quote.to_amount);
Ok(())
}
[dependencies]
oneinch = "0.1"
tokio = { version = "1", features = ["full"] }
MIT