Skip to content

Commit

Permalink
fix: update API endpoint example
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisjoshford committed Nov 18, 2024
1 parent f48d120 commit d30fad4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/2.build/5.primitives/oracles.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,18 @@ Pyth Network uses price feed IDs that map to their contract addresses to uniquel
Fetch price feeds using the [Hermes API](https://docs.pyth.network/price-feeds/how-pyth-works/hermes) `/get_vaa` endpoint using the following parameters:

- Price Feed ID
- Publish Time in milliseconds
- Publish Time

`Example:`
`Example Endpoint:`

https://hermes-beta.pyth.network/api/get_vaa?id=f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b&publish_time=1731713981

```js
// Define priceId and publishTime variables
// NOTE: Remove the `0x` prefix from the price feed ID
const priceId =
'f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b'; // BTC testnet price feed ID
const publishTime = Math.floor(Date.now() / 1000) - 1; // Current time minus 1 millisecond to account for latency
const publishTime = Math.floor(Date.now() / 1000) - .5; // Current time minus 0.5 seconds

// Fetch price data from Hermes API beta endpoint for testnet
const response = await axios.get(
Expand Down

0 comments on commit d30fad4

Please sign in to comment.