Skip to content

Commit 85f5953

Browse files
authored
Refactor documentation take 2 (#153)
* refactor stuff * working on doc structure * cleanup * grrr * reorg a different way * fix image links * more cleanup * clean up * cleanup docs * fix links * fix stuff * fix redirects * fix tests * move example out * add solana addresses * comments * hrm * fix table * add back links to contracts * hm * with redirects * fix comments
1 parent 96c7897 commit 85f5953

File tree

164 files changed

+952
-548
lines changed

Some content is hidden

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

164 files changed

+952
-548
lines changed

__tests__/validateCodeSnippets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,6 @@ function validateCodeSnippets(directoryPath: string): void {
199199
describe("Validate code snippets", () => {
200200
// We only validate code snippets in the API reference.
201201
// However, we exclude Aptos for now because it's annoying (and doesn't seem worth it).
202-
validateCodeSnippets("./pages/api-explorer/evm");
203-
validateCodeSnippets("./pages/api-explorer/cosmwasm");
202+
validateCodeSnippets("./pages/price-feeds/api-reference/evm");
203+
validateCodeSnippets("./pages/price-feeds/api-reference/cosmwasm");
204204
});

next.config.js

Lines changed: 102 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,102 @@ const withNextra = require("nextra")({
44
latex: true,
55
});
66

7+
// Use this array as a shorter way to specify redirect URLs so we can write down a lot of them.
8+
const permanentRedirectArray = [
9+
// Third version redirects
10+
["/", "/home"],
11+
12+
// First version of docs site -> third version
13+
14+
["/evm", "/price-feeds/use-real-time-data/evm"],
15+
["/aptos", "/price-feeds/use-real-time-data/aptos"],
16+
["/cosmwasm", "/price-feeds/use-real-time-data/cosmwasm"],
17+
18+
// Second version of docs site -> third version
19+
["/documentation/metrics/:path*", "/home/metrics/:path*"],
20+
[
21+
"/documentation/how-pyth-works/:slug*",
22+
"/price-feeds/how-pyth-works/:slug*",
23+
],
24+
["/documentation/benchmarks", "/benchmarks"],
25+
["/pyth-token", "/home/pyth-token"],
26+
["/documentation/publish-data/:slug*", "/price-feeds/publish-data/:slug*"],
27+
[
28+
"/documentation/solana-price-feeds/:slug*",
29+
"/price-feeds/solana-price-feeds/:slug*",
30+
],
31+
["/documentation/whitepaper/:slug*", "/price-feeds/whitepaper/:slug*"],
32+
["/documentation/security", "/home/security"],
33+
34+
["/documentation/entropy", "/entropy"],
35+
["/documentation/entropy/protocol-design", "/entropy/protocol-design"],
36+
["/documentation/entropy/best-practices", "/entropy/best-practices"],
37+
[
38+
"/documentation/entropy/solidity-sdk",
39+
"/entropy/generate-random-numbers/solidity-sdk",
40+
],
41+
[
42+
"/documentation/entropy/evm",
43+
"/entropy/generate-random-numbers/solidity-sdk",
44+
],
45+
46+
["/documentation/pythnet-price-feeds", "/price-feeds/pythnet-price-feeds"],
47+
[
48+
"/documentation/pythnet-price-feeds/on-demand",
49+
"/price-feeds/pythnet-price-feeds/pull-updates",
50+
],
51+
[
52+
"/documentation/pythnet-price-feeds/best-practices",
53+
"/price-feeds/pythnet-price-feeds/best-practices",
54+
],
55+
[
56+
"/documentation/pythnet-price-feeds/hermes",
57+
"/price-feeds/pythnet-price-feeds/hermes",
58+
],
59+
[
60+
"/documentation/pythnet-price-feeds/scheduler",
61+
"/price-feeds/schedule-price-updates/using-scheduler",
62+
],
63+
[
64+
"/documentation/pythnet-price-feeds/aptos",
65+
"/price-feeds/use-real-time-data/aptos",
66+
],
67+
[
68+
"/documentation/pythnet-price-feeds/cosmwasm",
69+
"/price-feeds/use-real-time-data/cosmwasm",
70+
],
71+
[
72+
"/documentation/pythnet-price-feeds/sui",
73+
"/price-feeds/use-real-time-data/sui",
74+
],
75+
[
76+
"/documentation/pythnet-price-feeds/near",
77+
"/price-feeds/use-real-time-data/near",
78+
],
79+
[
80+
"/documentation/pythnet-price-feeds/off-chain",
81+
"/price-feeds/use-real-time-data/off-chain",
82+
],
83+
[
84+
"/documentation/pythnet-price-feeds/evm",
85+
"/price-feeds/use-real-time-data/evm",
86+
],
87+
88+
["/documentation", "/home"],
89+
90+
["/api-explorer/:slug*", "/price-feeds/api-reference/:slug*"],
91+
92+
[
93+
"/guides/how-to-schedule-price-updates-with-gelato",
94+
"/price-feeds/schedule-price-updates/using-gelato",
95+
],
96+
[
97+
"/guides/how-to-create-tradingview-charts",
98+
"/benchmarks/how-to-create-tradingview-charts",
99+
],
100+
["/guides", "/price-feeds"],
101+
];
102+
7103
/** @type {import('next').NextConfig} */
8104
const nextConfig = {
9105
reactStrictMode: true,
@@ -15,28 +111,13 @@ const nextConfig = {
15111
return config;
16112
},
17113
async redirects() {
18-
return [
19-
{
20-
source: "/",
21-
destination: "/documentation",
22-
permanent: true,
23-
},
24-
{
25-
source: "/evm",
26-
destination: "/api-explorer/evm",
27-
permanent: true,
28-
},
29-
{
30-
source: "/aptos",
31-
destination: "/api-explorer/aptos",
32-
permanent: true,
33-
},
34-
{
35-
source: "/cosmwasm",
36-
destination: "/api-explorer/cosmwasm",
114+
return permanentRedirectArray.map((value) => {
115+
return {
116+
source: value[0],
117+
destination: value[1],
37118
permanent: true,
38-
},
39-
];
119+
};
120+
});
40121
},
41122
};
42123

pages/_meta.json

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
{
2-
"index": {
3-
"title": "Introduction",
4-
"type": "page",
5-
"display": "hidden"
2+
"home": {
3+
"title": "Home",
4+
"type": "page"
5+
},
6+
7+
"price-feeds": {
8+
"title": "Price Feeds",
9+
"type": "page"
10+
},
11+
12+
"benchmarks": {
13+
"title": "Benchmarks",
14+
"type": "page"
15+
},
16+
17+
"entropy": {
18+
"title": "Entropy",
19+
"type": "page"
620
},
7-
"documentation": "Documentation",
8-
"api-explorer": "API Explorer",
9-
"guides": "How-To Guides",
10-
"pyth-token": "PYTH Token",
11-
"contact": {
12-
"title": "Contact ↗",
21+
22+
"get-in-touch": {
23+
"title": "Get In Touch ↗",
1324
"type": "page",
1425
"href": "https://pyth.network/contact",
1526
"newWindow": true

pages/api-explorer.mdx

Lines changed: 0 additions & 3 deletions
This file was deleted.

pages/api-explorer/_meta.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

pages/api-explorer/evm/configuration.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.

pages/benchmarks/_meta.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"index": "Introduction",
3+
"documentation-home": {
4+
"title": "← Documentation Home",
5+
"href": "/home"
6+
},
7+
8+
"-- How-To Guides": {
9+
"title": "How-To Guides",
10+
"type": "separator"
11+
},
12+
13+
"how-to-create-tradingview-charts": "Create Charts with TradingView",
14+
15+
"-- Reference Material": {
16+
"title": "Reference Material",
17+
"type": "separator"
18+
},
19+
20+
"benchmarks-api-explorer": {
21+
"title": "Benchmarks API Explorer ↗",
22+
"href": "https://benchmarks.pyth.network/docs/",
23+
"newWindow": true
24+
},
25+
26+
"api-instances": "API Instances",
27+
"rate-limits": "Rate Limits"
28+
}

pages/benchmarks/api-instances.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Benchmarks API Instances
2+
3+
The Pyth Data Association hosts a public instance of the Benchmarks API at the following URL:
4+
5+
| Channel | URL |
6+
| ------- | ------------------------------- |
7+
| Stable | https://benchmarks.pyth.network |
8+
9+
There is currently no Benchmarks instance for the Beta channel.

pages/documentation/benchmarks.mdx renamed to pages/benchmarks/index.mdx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# Benchmarks
22

3-
Pyth benchmarks allows users to query a historical archive of prices from [Pythnet Price Feeds](pythnet-price-feeds.md).
3+
Pyth benchmarks allows users to query a historical archive of prices from [Price Feeds](price-feeds).
44
For example, applications can retrieve the price of BTC/USD as of last Friday at 8:00 AM UTC.
55
This price can be used for contract settlement or any other application that requires historical price data.
6-
Benchmarks data is signed and verifiable on-chain with the same trust assumptions as Pythnet Price Feeds.
7-
8-
In order to maximize the reliability of the Pyth Benchmarks API, a request rate limit is enforced.
9-
All endpoints limits are set at 30 requests every 10 seconds per IP address.
10-
One exception: the TradingView endpoint will allow 90 requests every 10 seconds. Clients issuing request above the limit will receive a 429 (Too Many Requests) response for the subsequent 60-second period.
11-
Users can access benchmark prices in several different ways, depending on the use case:
6+
Benchmarks data is signed and verifiable on-chain with the same trust assumptions as Price Feeds.
127

138
## TradingView Integration
149

15-
There is a how-to guide for [integrating Pyth Benchmarks with TradingView](../../guides/how-to-create-tradingview-charts.mdx).
10+
There is a how-to guide for [integrating Pyth Benchmarks with TradingView](benchmarks/how-to-create-tradingview-charts).
1611

1712
## Manual Browsing
1813

0 commit comments

Comments
 (0)