ReferenceHTTP
Get the tip floor
GET
Read an edge's observed landed-tip percentiles as a JSON array, without a JSON-RPC envelope.
header
x-api-key<token>Send the SWQoS API key in this header. See the authentication reference for compatibility forms and precedence.
Returns an array of zero or one observed tip-floor snapshots as an application/json array, without a JSON-RPC envelope. An empty array means no recent landing data is available.
application/json- response
Zero or one tip floor snapshot; an empty array means no recent landing data is available. Token tips count at their SOL value. The snapshot describes tips that already landed and does not predict landing; your key's minimum tip still applies. Each metro reports its own values; use a named metro hostname to compare them.
Items
items <= 1[index: integer]?// src/bin/http_tip_floor.rs
// Builds on the example project (/reference/json-rpc#example-project).
use serde::Deserialize;
use swqos_examples::swqos::{Result, required, url};
#[derive(Deserialize)]
struct TipFloor {
time: String,
landed_tips_50th_percentile: u64,
}
#[tokio::main]
async fn main() -> Result<()> {
let mut endpoint = reqwest::Url::parse(&url())?;
endpoint.set_path("/tip_floor");
endpoint.set_query(None);
let response = reqwest::Client::new().get(endpoint)
.header("x-api-key", required("SWQOS_API_KEY")?)
.send().await?;
let status = response.status();
let body = response.text().await?;
if !status.is_success() {
return Err(format!("HTTP {status}: {body}").into());
}
let floors: Vec<TipFloor> = serde_json::from_str(&body)?;
if let Some(floor) = floors.first() {
println!("{}: median landed tip {} lamports", floor.time, floor.landed_tips_50th_percentile);
} else {
println!("no recent landing data");
}
Ok(())
}[]