Skip to content

Commit 57bd3b8

Browse files
committed
Merge branch 'main' of github.com:pyth-network/pyth-crosschain into mike/hip3-next-round
2 parents 6c285be + e204c9f commit 57bd3b8

File tree

17 files changed

+254
-92
lines changed

17 files changed

+254
-92
lines changed

apps/developer-hub/content/docs/entropy/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"error-codes",
2121
"[Example Applications](https://github.com/pyth-network/pyth-examples/tree/main/entropy)",
2222
"[Entropy Explorer](https://entropy-explorer.pyth.network/)",
23-
"[Fortuna API Reference](https://fortuna.dourolabs.app/docs/)",
23+
"[Fortuna API Reference](/openapi/fortuna)",
2424
"---Understanding Entropy---",
2525
"protocol-design",
2626
"fees"

apps/developer-hub/content/docs/openapi/(generated)/index.mdx

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Get the list of supported chain ids
3+
description: Get the list of supported chain ids
4+
full: true
5+
_openapi:
6+
method: GET
7+
route: /v1/chains
8+
toc: []
9+
structuredData:
10+
headings: []
11+
contents:
12+
- content: Get the list of supported chain ids
13+
---
14+
15+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
16+
17+
<APIPage
18+
document={"https://fortuna-staging.dourolabs.app/docs/openapi.json"}
19+
operations={[{ path: "/v1/chains", method: "get" }]}
20+
webhooks={[]}
21+
hasHead={false}
22+
/>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: Returns the logs of all requests captured by the keeper.
3+
description: >-
4+
Returns the logs of all requests captured by the keeper.
5+
6+
7+
This endpoint allows you to filter the logs by a specific network ID, a query
8+
string (which can be a transaction hash, sender address, or sequence number),
9+
and a time range.
10+
11+
This is useful for debugging and monitoring the requests made to the Entropy
12+
contracts on various chains.
13+
full: true
14+
_openapi:
15+
method: GET
16+
route: /v1/logs
17+
toc: []
18+
structuredData:
19+
headings: []
20+
contents:
21+
- content: >-
22+
Returns the logs of all requests captured by the keeper.
23+
24+
25+
This endpoint allows you to filter the logs by a specific network ID,
26+
a query string (which can be a transaction hash, sender address, or
27+
sequence number), and a time range.
28+
29+
This is useful for debugging and monitoring the requests made to the
30+
Entropy contracts on various chains.
31+
---
32+
33+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
34+
35+
<APIPage
36+
document={"https://fortuna-staging.dourolabs.app/docs/openapi.json"}
37+
operations={[{ path: "/v1/logs", method: "get" }]}
38+
webhooks={[]}
39+
hasHead={false}
40+
/>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Overview
3+
---
4+
5+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
6+
7+
<Cards>
8+
<Card
9+
href="/openapi/fortuna/chain_ids"
10+
title="Get the list of supported chain ids"
11+
description="Get the list of supported chain ids"
12+
/>
13+
<Card
14+
href="/openapi/fortuna/revelation"
15+
title="Reveal the random value for a given sequence number and blockchain."
16+
description="Reveal the random value for a given sequence number and blockchain.\n\nGiven a sequence number, retrieve the corresponding random value that this provider has committed to.\nThis endpoint will not return the random value unless someone has requested the sequence number on-chain.\n\nEvery blockchain supported by this service has a distinct sequence of random numbers and chain_id.\nCallers must pass the appropriate chain_id to ensure they fetch the correct random number."
17+
/>
18+
<Card
19+
href="/openapi/fortuna/explorer"
20+
title="Returns the logs of all requests captured by the keeper."
21+
description="Returns the logs of all requests captured by the keeper.\n\nThis endpoint allows you to filter the logs by a specific network ID, a query string (which can be a transaction hash, sender address, or sequence number), and a time range.\nThis is useful for debugging and monitoring the requests made to the Entropy contracts on various chains."
22+
/>
23+
</Cards>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Reveal the random value for a given sequence number and blockchain.
3+
description: >-
4+
Reveal the random value for a given sequence number and blockchain.
5+
6+
7+
Given a sequence number, retrieve the corresponding random value that this
8+
provider has committed to.
9+
10+
This endpoint will not return the random value unless someone has requested
11+
the sequence number on-chain.
12+
13+
14+
Every blockchain supported by this service has a distinct sequence of random
15+
numbers and chain_id.
16+
17+
Callers must pass the appropriate chain_id to ensure they fetch the correct
18+
random number.
19+
full: true
20+
_openapi:
21+
method: GET
22+
route: /v1/chains/{chain_id}/revelations/{sequence}
23+
toc: []
24+
structuredData:
25+
headings: []
26+
contents:
27+
- content: >-
28+
Reveal the random value for a given sequence number and blockchain.
29+
30+
31+
Given a sequence number, retrieve the corresponding random value that
32+
this provider has committed to.
33+
34+
This endpoint will not return the random value unless someone has
35+
requested the sequence number on-chain.
36+
37+
38+
Every blockchain supported by this service has a distinct sequence of
39+
random numbers and chain_id.
40+
41+
Callers must pass the appropriate chain_id to ensure they fetch the
42+
correct random number.
43+
---
44+
45+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
46+
47+
<APIPage
48+
document={"https://fortuna-staging.dourolabs.app/docs/openapi.json"}
49+
operations={[
50+
{ path: "/v1/chains/{chain_id}/revelations/{sequence}", method: "get" },
51+
]}
52+
webhooks={[]}
53+
hasHead={false}
54+
/>
Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,50 @@
11
import { generateFiles } from "fumadocs-openapi";
22

3-
import { openapi } from "../src/lib/openapi";
3+
import { openapi, products } from "../src/lib/openapi";
44

5-
// const schemas = await openapi.getSchemas();
5+
const outDir = "./content/docs/openapi/";
66

7-
// const fortunaSchema = schemas[fortunaOpenApiUrl];
8-
// const fortunaStagingSchema = schemas[fortunaStagingOpenApiUrl];
7+
export async function generateDocs() {
8+
await generateFiles({
9+
input: openapi,
10+
output: outDir,
11+
per: "operation",
12+
name: (output, document) => {
13+
// Extract product name from the OpenAPI document info
14+
const productName = getProductName(document.info.title);
915

10-
void generateFiles({
11-
input: openapi,
12-
output: "./content/docs/openapi/(generated)",
13-
per: "file",
14-
includeDescription: true,
15-
});
16+
if (output.type === "operation") {
17+
const operation =
18+
document.paths?.[output.item.path]?.[output.item.method];
19+
const operationId =
20+
operation?.operationId ??
21+
output.item.path.replaceAll(/[^a-zA-Z0-9]/g, "_");
22+
return `${productName}/${operationId}`;
23+
}
24+
25+
return `${productName}/webhooks/${output.item.name}`;
26+
},
27+
index: {
28+
url: {
29+
baseUrl: "/openapi/",
30+
contentDir: "./content/docs/openapi",
31+
},
32+
items: Object.keys(products).map((productName) => ({
33+
path: `${productName}/index.mdx`,
34+
})),
35+
},
36+
});
37+
}
38+
39+
function getProductName(title: string) {
40+
// Match the title to a product name
41+
const titleLower = title.toLowerCase();
42+
for (const [name] of Object.entries(products)) {
43+
if (titleLower.includes(name)) {
44+
return name;
45+
}
46+
}
47+
return "unknown";
48+
}
49+
50+
await generateDocs();

apps/developer-hub/src/components/Root/fumadocs-global-style-overrides.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,24 @@ Overrides for Fumadocs content. Everything after prose is MDX generated content
2626

2727
#nd-sidebar {
2828
--fd-sidebar-top: var(--header-height) !important;
29+
position: sticky !important;
30+
height: calc(100vh - var(--header-height));
31+
}
32+
33+
#nd-docs-layout {
34+
flex-direction: row !important;
35+
padding-inline-start: 0 !important;
36+
}
37+
38+
/* Hacky fix to get the TOC to be sticky */
39+
#nd-toc {
40+
top: var(--header-height) !important;
41+
height: max-content;
42+
position: sticky;
43+
margin-left: calc(-1 * var(--fd-toc-width));
44+
}
45+
46+
#nd-toc > div {
47+
position: relative;
48+
left: var(--fd-toc-width);
2949
}

apps/developer-hub/src/components/search-button.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { SearchButton as SearchButtonComponent } from "@pythnetwork/component-library/SearchButton";
44
import DefaultSearchDialog from "fumadocs-ui/components/dialog/search-default";
55
import { useCallback, useState } from "react";
6+
import { createPortal } from "react-dom";
67

78
export const SearchButton = () => {
89
const [open, setOpen] = useState(false);
@@ -19,11 +20,15 @@ export const SearchButton = () => {
1920
largeScreenContent="Search"
2021
onClick={handleSearch}
2122
/>
22-
<DefaultSearchDialog
23-
open={open}
24-
onOpenChange={setOpen}
25-
api="/api/search"
26-
/>
23+
{open &&
24+
createPortal(
25+
<DefaultSearchDialog
26+
open={open}
27+
onOpenChange={setOpen}
28+
api="/api/search"
29+
/>,
30+
document.body,
31+
)}
2732
</>
2833
);
2934
};
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { createOpenAPI } from "fumadocs-openapi/server";
22

3-
export const fortunaOpenApiUrl =
4-
"https://fortuna.dourolabs.app/docs/openapi.json";
5-
export const fortunaStagingOpenApiUrl =
6-
"https://fortuna-staging.dourolabs.app/docs/openapi.json";
3+
export const products = {
4+
fortuna: {
5+
name: "fortuna",
6+
openApiUrl: "https://fortuna-staging.dourolabs.app/docs/openapi.json",
7+
},
8+
};
79

810
export const openapi = createOpenAPI({
9-
input: [fortunaOpenApiUrl, fortunaStagingOpenApiUrl],
11+
input: Object.values(products).map((product) => product.openApiUrl),
1012
});

0 commit comments

Comments
 (0)