Skip to content

Commit 53e66d2

Browse files
committed
chore (wip): copy price feeds content from documentation site 'as-is'
The current documentation does not have the required frontmatter and it uses components which need to be refactored or ported across as well. Because of this rendering will be totally broken while we work on adding the missing metadata and components.
1 parent 25ae56e commit 53e66d2

File tree

112 files changed

+6936
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+6936
-8
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"documentation-home": {
3+
"title": "← Documentation Home",
4+
"href": "/home"
5+
},
6+
7+
"-- Price Feeds": {
8+
"title": "Price Feeds",
9+
"type": "separator"
10+
},
11+
"index": "Introduction",
12+
"getting-started": "Getting Started",
13+
14+
"-- Tutorials": {
15+
"title": "Tutorials",
16+
"type": "separator"
17+
},
18+
19+
"create-your-first-pyth-app": "Create Your First Pyth App",
20+
21+
"-- How-to Guides": {
22+
"title": "How-To Guides",
23+
"type": "separator"
24+
},
25+
26+
"use-real-time-data": "Use Real-Time Price Data",
27+
"fetch-price-updates": "Fetch Price Updates",
28+
"schedule-price-updates": "Schedule Price Updates",
29+
"migrate-an-app-to-pyth": "Migrate an App to Pyth",
30+
"use-pyth-for-morpho": "Use Pyth for Morpho Markets",
31+
"publish-data": "Publish Data",
32+
"troubleshoot": "Troubleshoot Errors",
33+
34+
"-- Reference Material": {
35+
"title": "Reference Material",
36+
"type": "separator"
37+
},
38+
39+
"api-reference": "API Reference",
40+
"price-feeds": "Price Feeds",
41+
"current-fees": "Current Fees",
42+
"sponsored-feeds": "Sponsored Feeds",
43+
"market-hours": "Market Hours",
44+
"best-practices": "Best Practices",
45+
"error-codes": "Error Codes",
46+
"api-instances-and-providers": "API Instances and Providers",
47+
"contract-addresses": "Contract Addresses",
48+
"pythnet-reference": "Pythnet Reference",
49+
50+
"examples": {
51+
"title": "Example Applications ↗",
52+
"href": "https://github.com/pyth-network/pyth-examples/tree/main/price_feeds"
53+
},
54+
"-- Understand Pyth": {
55+
"title": "Understanding Pyth",
56+
"type": "separator"
57+
},
58+
59+
"pull-updates": "What is a Pull Oracle?",
60+
"how-pyth-works": "How Pyth Works"
61+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# API Instances and Providers
2+
3+
The following documentation explains how to get access to an instance of Hermes or a Pythnet RPC.
4+
Developers may need access to these services in order to use Pyth Price Feeds.
5+
Both services can be self-hosted or accessed through a third-party provider.
6+
See the following guides to learn more about how to access each service:
7+
8+
- [Hermes](api-instances-and-providers/hermes)
9+
- [Pythnet RPC](api-instances-and-providers/pythnet-rpc)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"hermes": "Hermes",
3+
"pythnet-rpc": "Pythnet RPC"
4+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Callout } from "nextra/components";
2+
3+
# Hermes
4+
5+
Hermes is an open-source service that listens to the Pythnet and the Wormhole Network for Pyth price updates, and
6+
serves them via a convenient web API.
7+
8+
Hermes allows users to easily [fetch price updates](../fetch-price-updates) via a REST API, or subscribe to server-side streaming
9+
updates.
10+
11+
## Public Endpoints
12+
13+
The Pyth Data Association operates a public endpoint for Hermes, which can be used to test integrations with Pyth
14+
Network:
15+
16+
URL: https://hermes.pyth.network
17+
18+
<Callout type="info" emoji="⚠️">
19+
For developers building on **Aptos testnet**, **Sui testnet** or **Near testnet**, please use the Hermes Beta endpoint:
20+
21+
URL: https://hermes-beta.pyth.network
22+
23+
</Callout>
24+
25+
For production deployments, developers integrating with Pyth Network are **strongly encouraged** to use Node Providers
26+
for maximum resilience and decentralization. Moreover, Hermes is designed to be self-hosted, so developers can run their own
27+
instance of Hermes to fetch Pyth price updates. Please note it is not recommended to use the public endpoint for production as it has rate limits.
28+
29+
## Node Providers
30+
31+
The following node providers offer Hermes:
32+
33+
- [Triton](https://triton.one)
34+
- [P2P](https://p2p.org)
35+
- [extrnode](https://extrnode.com/)
36+
- [Liquify](https://www.liquify.io/)
37+
38+
## Self-Hosting
39+
40+
The Pyth Data Association provides a Helm chart for running Hermes in
41+
[charts](https://github.com/pyth-network/charts/tree/main/charts/hermes) repository. Please refer to the chart's readme
42+
for the configuration values.
43+
You will need a Pythnet RPC to run Hermes; see the [guide for accessing a Pythnet RPC](pythnet-rpc).
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Pythnet RPC
2+
3+
You will need a Pythnet RPC to run Hermes, which you can obtain from any of the Pythnet RPC
4+
providers below:
5+
6+
- [Triton](https://triton.one)
7+
- [P2P](https://p2p.org)
8+
- [Blockdaemon](https://blockdaemon.com/)
9+
- [Figment](https://figment.io)
10+
11+
Alternatively, you can host Pythnet RPC yourself, but this is discouraged due to the potential high cost and maintenance
12+
involved in operating it. If you still wish to run it, please contact the Pyth team for more information.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# API Reference
2+
3+
The API reference is a comprehensive guide to the various APIs -- both on- and off-chain -- that developers can use in their applications.
4+
Developers can consult this reference to better understand what methods exist and what they do.
5+
The API reference is interactive, so developers can try out the APIs from the website to better understand their behavior.
6+
7+
The following on-chain contracts are documented in the API reference:
8+
9+
- [EVM](api-reference/evm)
10+
- [Aptos](api-reference/aptos)
11+
- [CosmWasm](api-reference/cosmwasm)
12+
13+
Hermes also has interactive API documentation hosted by the service itself:
14+
15+
- [Hermes](https://hermes.pyth.network/docs/)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"evm": {
3+
"title": "EVM ↗",
4+
"href": "https://api-reference.pyth.network/price-feeds/evm/getPriceNoOlderThan",
5+
"newWindow": true
6+
},
7+
"aptos": "Aptos",
8+
"cosmwasm": "CosmWasm",
9+
"hermes": {
10+
"title": "Hermes ↗",
11+
"href": "https://hermes.pyth.network/docs/",
12+
"newWindow": true
13+
}
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Pyth Price Feeds Aptos Contract Reference
2+
3+
The Pyth Network Aptos contract allows users to submit price updates for verification and store them for later use.
4+
Please see the documentation section on [Pull Updates](../pythnet-price-feeds/pull-updates) if you haven't already;
5+
this section will explain the differences between Pyth Network and other oracles, and help you understand the expected usage patterns.
6+
7+
Users of the Pyth contract will typically need to perform two operations:
8+
9+
- Update the on-chain price -- In off-chain code, retrieve a price update from
10+
[Hermes](../pythnet-price-feeds/hermes) and submit it to the contract
11+
for verification. This operation makes the price available for on-chain use.
12+
You will typically call [update_price_feeds](aptos/update-price-feeds) to do this.
13+
- Read the on-chain price -- After updating the price, your on-chain contract can call one of the
14+
many getter functions on the contract to get the price. See [get_price](aptos/get-price) and its variants
15+
for more information.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"--- Aptos Contract": {
3+
"title": "Aptos Contract",
4+
"type": "separator"
5+
},
6+
"sdks": "SDKs",
7+
"--- Methods": {
8+
"title": "Methods",
9+
"type": "separator"
10+
},
11+
12+
"get-price": "get_price",
13+
"get-price-unsafe": "get_price_unsafe",
14+
"get-price-no-older-than": "get_price_no_older_than",
15+
"get-ema-price": "get_ema_price",
16+
"get-ema-price-unsafe": "get_ema_price_unsafe",
17+
"get-ema-price-no-older-than": "get_ema_price_no_older_than",
18+
"get-update-fee": "get_update_fee",
19+
"get-stale-price-threshold-secs": "get_stale_price_threshold_secs",
20+
"price-feed-exists": "price_feed_exists",
21+
"update-price-feeds": "update_price_feeds",
22+
"update-price-feeds-with-funder": "update_price_feeds_with_funder"
23+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import Input from "../../../../components/Input";
2+
import Arg from "../../../../components/Arg";
3+
import Example from "../../../../components/Example";
4+
import DynamicCode from "../../../../components/DynamicCode";
5+
import { InputFormats } from "../../../../utils/InputFormat";
6+
import { Tab, Tabs } from "nextra-theme-docs";
7+
import Examples from "../../../../components/Examples";
8+
9+
# Get EMA Price No Older Than
10+
11+
Get the latest exponentially-weighted moving average (EMA) price and confidence interval for the requested price feed id.
12+
The price feed id is a 32-byte id written as a hexadecimal string; see the [price feed ids](https://pyth.network/developers/price-feed-ids) page to look up the id for a given symbol.
13+
The returned price and confidence are decimal numbers written in the form `a * 10^e`, where `e` is an exponent included in the result.
14+
For example, a price of 1234 with an exponent of -2 represents the number 12.34.
15+
The result also includes a `timestamp` which is the unix timestamp for the price update.
16+
The EMA methodology is described in more detail in this [blog post](https://pythnetwork.medium.com/whats-in-a-name-302a03e6c3e1).
17+
18+
The caller provides a `max_age_secs` argument that specifies how old the price can be.
19+
The call reverts if the on-chain price is from more than `max_age_secs` seconds in the past (with respect to the current on-chain timestamp).
20+
21+
Users of this method will typically invoke [update_price_feeds](update-price-feeds) to update the on-chain price before
22+
reading it. This step ensures that the on-chain price is fresh and the call does not revert.
23+
24+
<div className="mt-6 overflow-x-auto">
25+
26+
| Argument | Input | Description |
27+
| ------------------------------------------------------ | --------------------------------------------------------- | --------------------------------------------- |
28+
| <Arg required={true} type="hex">price_identifier</Arg> | <Input id="price_identifier" format={InputFormats.Hex} /> | The ID of the price feed you want to read |
29+
| <Arg required={true} type="int">max_age_secs</Arg> | <Input id="max_age_secs" /> | Maximum age of the on-chain price in seconds. |
30+
31+
</div>
32+
33+
<Examples>
34+
<Example
35+
keyValues={{
36+
price_identifier: (ctx) => ctx.getFeedId("Crypto.BTC/USD"),
37+
max_age_secs: () => 60,
38+
}}
39+
value="BTC/USD"
40+
/>
41+
<Example
42+
keyValues={{
43+
price_identifier: (ctx) => ctx.getFeedId("Crypto.ETH/USD"),
44+
max_age_secs: () => 60,
45+
}}
46+
value="ETH/USD"
47+
/>
48+
</Examples>
49+
50+
## Example Code
51+
52+
<Tabs items={['Move']}>
53+
<Tab>
54+
<DynamicCode targets={{
55+
"\"1111\"": (ctx) => `"${ctx.get("price_identifier", "<price_identifier>")}"`,
56+
"2222": (ctx) => ctx.get("max_age_secs", "<max_age_secs>")
57+
}}>
58+
```rust copy
59+
use pyth::pyth;
60+
use pyth::price_identifier;
61+
62+
pyth::get_ema_price_no_older_than(
63+
price_identifier::from_byte_vec(x"1111"),
64+
2222
65+
);
66+
```
67+
</DynamicCode>
68+
</Tab>
69+
70+
</Tabs>

0 commit comments

Comments
 (0)