Documentation Index
Fetch the complete documentation index at: https://new-docs.velora.xyz/llms.txt
Use this file to discover all available pages before exploring further.
A minimal Rust program that calls GET /quote?mode=DELTA and prints the indicative destAmount, deadline, and hmac from the returned delta payload. 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 Delta {
#[serde(rename = "destAmount")]
dest_amount: String,
deadline: i64,
hmac: String,
}
#[derive(Deserialize, Debug)]
struct QuoteResponse {
delta: Delta,
}
#[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/quote")
.query(¶ms)
.send()
.await?
.error_for_status()?
.json::<QuoteResponse>()
.await?;
println!("destAmount: {}", res.delta.dest_amount);
println!("deadline: {}", res.delta.deadline);
println!("hmac: {}", res.delta.hmac);
Ok(())
}
Run it
You should see the indicative destAmount (USDC, 6 decimals), the order deadline (unix seconds), and the hmac you must pass through verbatim when building the order.
Next: build, sign, submit
Pass the whole delta object into POST /delta/orders/build (as the price field) to get EIP-712 typed data. Sign it with an ERC-2098 compact signature, then POST /delta/orders with the order + signature. See Delta → How it works.
Pass the delta payload verbatim to /delta/orders/build. Mutating any field (including hmac) will cause the build call to reject.
Related pages