curl "https://api.metastreams.dev/v1/native-prices?chains=solana,bsc" \
-H "Authorization: Bearer $API_KEY"
const url = new URL("https://api.metastreams.dev/v1/native-prices");
url.searchParams.set("chains", "solana,bsc");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { nativePrices } = await response.json();
use serde_json::Value;
let response: Value = reqwest::Client::new()
.get("https://api.metastreams.dev/v1/native-prices")
.query(&[("chains", "solana,bsc")])
.bearer_auth(std::env::var("API_KEY")?)
.send()
.await?
.error_for_status()?
.json()
.await?;
let native_prices = &response["nativePrices"];
{
"nativePrices": [
{
"chain": "solana",
"asset": "SOL",
"price": { "native": "1", "usd": "178.42" },
"observedAt": 1789632015120
},
{
"chain": "bsc",
"asset": "BNB",
"price": { "native": "1", "usd": "612.35" },
"observedAt": 1789632014870
}
]
}
REST
Native prices
Returns the latest USD price of each chain’s gas asset.
GET
/
v1
/
native-prices
curl "https://api.metastreams.dev/v1/native-prices?chains=solana,bsc" \
-H "Authorization: Bearer $API_KEY"
const url = new URL("https://api.metastreams.dev/v1/native-prices");
url.searchParams.set("chains", "solana,bsc");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { nativePrices } = await response.json();
use serde_json::Value;
let response: Value = reqwest::Client::new()
.get("https://api.metastreams.dev/v1/native-prices")
.query(&[("chains", "solana,bsc")])
.bearer_auth(std::env::var("API_KEY")?)
.send()
.await?
.error_for_status()?
.json()
.await?;
let native_prices = &response["nativePrices"];
{
"nativePrices": [
{
"chain": "solana",
"asset": "SOL",
"price": { "native": "1", "usd": "178.42" },
"observedAt": 1789632015120
},
{
"chain": "bsc",
"asset": "BNB",
"price": { "native": "1", "usd": "612.35" },
"observedAt": 1789632014870
}
]
}
Returns the latest USD price of each chain’s gas asset: SOL on
solana, ETH on base and robinhood, BNB on bsc. chains limits results to specific chains; omit it to include every chain.
Response
nativePrices lists one row per chain with a known price, in the order of the chain table. A chain with no price yet has no row, and a missing row does not mean a price of zero. arc never has a row, because its gas asset is USDC.
price is the price of one whole unit of asset, so price.native is always "1". observedAt is when the price source reported the rate. New asset values can be added, so keep unrecognized values rather than discarding them.
The chain.nativePrices stream sends each new price.
Errors
| Code | When |
|---|---|
UNSUPPORTED_CHAIN | A chains value is not a supported slug |
VALIDATION_ERROR | An unknown parameter |
curl "https://api.metastreams.dev/v1/native-prices?chains=solana,bsc" \
-H "Authorization: Bearer $API_KEY"
const url = new URL("https://api.metastreams.dev/v1/native-prices");
url.searchParams.set("chains", "solana,bsc");
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const { nativePrices } = await response.json();
use serde_json::Value;
let response: Value = reqwest::Client::new()
.get("https://api.metastreams.dev/v1/native-prices")
.query(&[("chains", "solana,bsc")])
.bearer_auth(std::env::var("API_KEY")?)
.send()
.await?
.error_for_status()?
.json()
.await?;
let native_prices = &response["nativePrices"];
{
"nativePrices": [
{
"chain": "solana",
"asset": "SOL",
"price": { "native": "1", "usd": "178.42" },
"observedAt": 1789632015120
},
{
"chain": "bsc",
"asset": "BNB",
"price": { "native": "1", "usd": "612.35" },
"observedAt": 1789632014870
}
]
}