| Crates.io | cowp |
| lib.rs | cowp |
| version | 0.1.1 |
| created_at | 2026-01-17 12:48:46.819481+00 |
| updated_at | 2026-01-22 21:40:24.801033+00 |
| description | Unofficial Rust client for the CoW Protocol API (cowp) |
| homepage | |
| repository | https://github.com/yldfi/yldfi-rs/tree/main/crates/cowp |
| max_upload_size | |
| id | 2050400 |
| size | 72,003 |
Unofficial Rust client for the CoW Protocol (CowSwap) API
[dependencies]
cowp = "0.1"
tokio = { version = "1", features = ["full"] }
use cowp::{Client, Chain, QuoteRequest};
#[tokio::main]
async fn main() -> Result<(), cowp::Error> {
let client = Client::new()?;
// Get a sell quote (exact input)
let request = QuoteRequest::sell(
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"1000000000000000000", // 1 WETH
"0xYourAddress",
);
let quote = client.get_quote(None, &request).await?;
println!("Output: {} USDC", quote.quote.buy_amount);
println!("Fee: {} WETH", quote.quote.fee_amount);
Ok(())
}
use cowp::{Client, QuoteRequest};
let request = QuoteRequest::buy(
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"1000000000", // Want exactly 1000 USDC
"0xYourAddress",
);
let quote = client.get_quote(None, &request).await?;
println!("You will pay: {} WETH", quote.quote.sell_amount);
| Chain | API URL |
|---|---|
| Ethereum | https://api.cow.fi/mainnet |
| Gnosis | https://api.cow.fi/xdai |
| Arbitrum | https://api.cow.fi/arbitrum_one |
| Sepolia | https://api.cow.fi/sepolia |
MIT