Switch from Pyth Hermes in one line
Point an existing Hermes client at Astra. The code around it does not change.
With @pythnetwork/hermes-client
import {HermesClient} from '@pythnetwork/hermes-client';
const hermes = new HermesClient('https://astra.preview.avee.tech');
const BTC_USD = '0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43';
const latest = await hermes.getLatestPriceUpdates([BTC_USD]);
const {price, expo} = latest.parsed![0].price;
console.log(Number(price) * 10 ** expo);The only change is the URL in the constructor. The feed ID is Pyth's own BTC/USD ID.
Plain HTTP
curl 'https://astra.preview.avee.tech/v2/updates/price/latest?ids[]=e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43'A latest-price response:
{
"binary": {"encoding": "hex", "data": []},
"parsed": [
{
"id": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
"price": {"price": "6512345000000", "conf": "3120000000", "expo": -8, "publish_time": 1790540000},
"ema_price": {"price": "6510012000000", "conf": "3300000000", "expo": -8, "publish_time": 1790540000},
"metadata": {"slot": 0, "proof_available_time": 1790540000, "prev_publish_time": 1790539999}
}
]
}Your Pyth IDs keep working
Every Hermes route accepts Pyth's feed IDs as they are, and echoes back the ID you asked for. A feed
Astra serves under a Pyth ID needs no change in your code. To see which of your IDs those are, paste
them into /v1/feed-ids:
curl 'https://astra.preview.avee.tech/v1/feed-ids?pyth_ids=0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43,0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace'items lists the feeds Astra serves, each with its Astra ID; missing lists the Pyth IDs it does
not. IDs are comma-separated or repeated, with or without 0x. Send at most 200 per request:
longer URLs are rejected before they reach Astra (414, or a framing error over HTTP/2), so split a
longer list into several requests. The SDKs wrap it as feedIds, FeedIDs and feed_ids and split
the list for you.
The same 200-ID limit holds on every route that takes IDs in the URL, /v2/updates/price/latest and
the SSE stream included. To follow more feeds on one connection, subscribe over WebSocket, where IDs
travel in the message body.
Before you switch
Check the feeds you use exist
GET https://astra.preview.avee.tech/v1/feed-ids?pyth_ids=… with every ID you use; anything in missing is not
served. An unknown ID on a Hermes route is 404, or dropped with ignore_invalid_price_ids=true.
Keep your staleness check
A degraded or closed feed stops moving its publish_time, as a Pyth feed does below quorum. Your
existing age check is the right guard. See Statuses.
Do not verify on-chain
There is no signed payload. Read parsed, never binary. See Compatibility.