Skip to main content
A minimal Rust program that calls GET /v2/quote?mode=DELTA and prints the recommended route’s expected output and the spender from the returned delta block. Uses reqwest with tokio.

File tree

my-app/
├─ Cargo.toml
└─ src/
   └─ main.rs

Install

cargo new my-app
cd my-app
cargo add reqwest --features json
cargo add tokio --features full
cargo add serde --features derive

src/main.rs

use serde::Deserialize;

#[derive(Deserialize, Debug)]
struct TokenAmount {
    amount: String,
}

#[derive(Deserialize, Debug)]
struct RouteStep {
    output: TokenAmount,
}

#[derive(Deserialize, Debug)]
struct Route {
    origin: RouteStep,
}

#[derive(Deserialize, Debug)]
struct DeltaPrice {
    route: Route,
    spender: String,
}

#[derive(Deserialize, Debug)]
struct QuoteResponse {
    delta: DeltaPrice,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let params = [
        ("srcToken",     "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"), // ETH
        ("destToken",    "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"), // USDC
        ("amount",       "1000000000000000000"),                       // 1 ETH
        ("srcDecimals",  "18"),
        ("destDecimals", "6"),
        ("side",         "SELL"),
        ("chainId",      "1"),
        ("mode",         "DELTA"),
        ("userAddress",  "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"),
        ("partner",      "my-app-name"),
    ];

    let res = reqwest::Client::new()
        .get("https://api.velora.xyz/v2/quote")
        .query(&params)
        .send()
        .await?
        .error_for_status()?
        .json::<QuoteResponse>()
        .await?;

    println!("expected output: {}", res.delta.route.origin.output.amount);
    println!("spender:         {}", res.delta.spender);

    Ok(())
}

Run it

cargo run
You should see the recommended route’s expected output (USDC, 6 decimals) and the spender address to approve before building the order.

Next: build, sign, submit

Pass the unmodified delta.route into POST /v2/delta/orders/build (with owner set to the user address) to get EIP-712 typed data back as { toSign, orderHash }. Sign toSign with an ERC-2098 compact signature, then POST /v2/delta/orders with order (the toSign.value), the signature, chainId, and your partner. Poll GET /v2/delta/orders/{orderId} for status. See Delta → How it works.
Pass delta.route verbatim to /v2/delta/orders/build. Reordering or re-encoding it will cause the build call to reject.
Last modified on June 11, 2026