Expand description
Rust client for the Velora (ParaSwap) DEX aggregator API
Velora (formerly ParaSwap) is a leading DEX aggregator that provides optimal
swap routes across multiple DEXs. It offers advanced features like MEV protection,
gas optimization, and multi-path routing.
§Features
- Multi-chain support (Ethereum, BSC, Polygon, Arbitrum, Optimism, etc.)
- MEV protection through private transactions
- Advanced routing with multi-path swaps
- Gas optimization
- Delta pricing algorithm
§Quick Start
use vlra::{Client, Chain, PriceRequest};
#[tokio::main]
async fn main() -> Result<(), vlra::Error> {
let client = Client::new()?;
// Get price for swapping 1 ETH to USDC
let request = PriceRequest::sell(
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native ETH
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
"1000000000000000000", // 1 ETH in wei
);
let response = client.get_price(Chain::Ethereum, &request).await?;
println!("You would receive: {} USDC (in minimal units)", response.price_route.dest_amount);
Ok(())
}Re-exports§
pub use error::Error;pub use error::Result;pub use types::ApiErrorResponse;pub use types::Chain;pub use types::PriceRequest;pub use types::PriceResponse;pub use types::PriceRoute;pub use types::Route;pub use types::Side;pub use types::Swap;pub use types::SwapExchange;pub use types::Token;pub use types::TokenListResponse;pub use types::TransactionRequest;pub use types::TransactionResponse;
Modules§
Structs§
- ApiConfig
- Generic API configuration
- Base
Client - A base HTTP client that handles common request/response patterns.
- Client
- Client for interacting with the Velora (
ParaSwap) API - Retry
Config - Configuration for retry behavior
- Retry
Error - Error wrapper that includes retry information
Constants§
- DEFAULT_
BASE_ URL - Default base URL for the Velora API
- NATIVE_
TOKEN_ ADDRESS - Native token address (used for ETH and other native tokens)
Traits§
- Retryable
Error - Determines if an error should be retried
Functions§
- config_
with_ api_ key - Create a config with an API key
- default_
config - Create a default Velora config
- with_
retry - Execute an async operation with retries
- with_
simple_ retry - Simple retry wrapper for operations that return Result with any error type
Type Aliases§
- Config
- Configuration for the Velora API client