Pārlūkot izejas kodu

chore(dev-hub)-llm-improvements

Aditya Arora 2 mēneši atpakaļ
vecāks
revīzija
d6065f008f

+ 18 - 0
apps/developer-hub/content/docs/openapi/(generated)/chain_ids.mdx

@@ -0,0 +1,18 @@
+---
+title: Get the list of supported chain ids
+full: true
+_openapi:
+  method: GET
+  route: /v1/chains
+  toc: []
+  structuredData:
+    headings: []
+    contents:
+      - content: Get the list of supported chain ids
+---
+
+{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
+
+Get the list of supported chain ids
+
+<APIPage document={"https://fortuna.dourolabs.app/docs/openapi.json"} operations={[{"path":"/v1/chains","method":"get"}]} webhooks={[]} hasHead={false} />

+ 30 - 0
apps/developer-hub/content/docs/openapi/(generated)/explorer.mdx

@@ -0,0 +1,30 @@
+---
+title: Returns the logs of all requests captured by the keeper.
+full: true
+_openapi:
+  method: GET
+  route: /v1/logs
+  toc: []
+  structuredData:
+    headings: []
+    contents:
+      - content: >-
+          Returns the logs of all requests captured by the keeper.
+
+
+          This 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.
+
+          This is useful for debugging and monitoring the requests made to the
+          Entropy contracts on various chains.
+---
+
+{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
+
+Returns the logs of all requests captured by the keeper.
+
+This 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.
+This is useful for debugging and monitoring the requests made to the Entropy contracts on various chains.
+
+<APIPage document={"https://fortuna.dourolabs.app/docs/openapi.json"} operations={[{"path":"/v1/logs","method":"get"}]} webhooks={[]} hasHead={false} />

+ 39 - 0
apps/developer-hub/content/docs/openapi/(generated)/revelation.mdx

@@ -0,0 +1,39 @@
+---
+title: Reveal the random value for a given sequence number and blockchain.
+full: true
+_openapi:
+  method: GET
+  route: /v1/chains/{chain_id}/revelations/{sequence}
+  toc: []
+  structuredData:
+    headings: []
+    contents:
+      - content: >-
+          Reveal the random value for a given sequence number and blockchain.
+
+
+          Given a sequence number, retrieve the corresponding random value that
+          this provider has committed to.
+
+          This endpoint will not return the random value unless someone has
+          requested the sequence number on-chain.
+
+
+          Every blockchain supported by this service has a distinct sequence of
+          random numbers and chain_id.
+
+          Callers must pass the appropriate chain_id to ensure they fetch the
+          correct random number.
+---
+
+{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
+
+Reveal the random value for a given sequence number and blockchain.
+
+Given a sequence number, retrieve the corresponding random value that this provider has committed to.
+This endpoint will not return the random value unless someone has requested the sequence number on-chain.
+
+Every blockchain supported by this service has a distinct sequence of random numbers and chain_id.
+Callers must pass the appropriate chain_id to ensure they fetch the correct random number.
+
+<APIPage document={"https://fortuna.dourolabs.app/docs/openapi.json"} operations={[{"path":"/v1/chains/{chain_id}/revelations/{sequence}","method":"get"}]} webhooks={[]} hasHead={false} />

+ 5 - 2
apps/developer-hub/package.json

@@ -17,7 +17,8 @@
     "test:format": "prettier --check .",
     "test:lint:eslint": "eslint . --max-warnings 0",
     "test:lint:stylelint": "stylelint 'src/**/*.scss' --max-warnings 0",
-    "test:types": "tsc"
+    "test:types": "tsc",
+    "generate:docs": "bun ./scripts/generate-docs.ts"
   },
   "dependencies": {
     "@phosphor-icons/react": "catalog:",
@@ -28,7 +29,8 @@
     "clsx": "catalog:",
     "fumadocs-core": "catalog:",
     "fumadocs-mdx": "catalog:",
-    "fumadocs-typescript": "^4.0.8",
+    "fumadocs-openapi": "catalog:",
+    "fumadocs-typescript": "catalog:",
     "fumadocs-ui": "catalog:",
     "katex": "catalog:",
     "next": "catalog:",
@@ -42,6 +44,7 @@
     "remark-gfm": "^4.0.1",
     "remark-math": "^6.0.0",
     "remark-mdx": "^3.1.1",
+    "shiki": "catalog:",
     "viem": "catalog:",
     "zod": "catalog:",
     "zod-validation-error": "catalog:"

+ 17 - 0
apps/developer-hub/scripts/generate-docs.ts

@@ -0,0 +1,17 @@
+import { generateFiles } from 'fumadocs-openapi';
+
+  import { openapi } from '../src/lib/openapi';
+
+// const schemas = await openapi.getSchemas();
+
+// const fortunaSchema = schemas[fortunaOpenApiUrl];
+// const fortunaStagingSchema = schemas[fortunaStagingOpenApiUrl];
+
+void generateFiles({
+  per: 'operation',
+  groupBy: 'route',
+  input: openapi,
+  output: './content/docs/openapi/(generated)',
+  includeDescription: true,
+  addGeneratedComment: true,
+});

+ 2 - 1
apps/developer-hub/src/config/layout.config.tsx

@@ -17,7 +17,8 @@ export const baseOptions: BaseLayoutProps = {
 
 export const docsOptions: DocsLayoutProps = {
   ...baseOptions,
-  tree: source.pageTree,
+  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
+  tree: source.pageTree as any,
   sidebar: {
     tabs: false,
     collapsible: false,

+ 9 - 0
apps/developer-hub/src/lib/openapi.ts

@@ -0,0 +1,9 @@
+import { createOpenAPI } from 'fumadocs-openapi/server';
+
+
+export const fortunaOpenApiUrl = 'https://fortuna.dourolabs.app/docs/openapi.json';
+export const fortunaStagingOpenApiUrl = 'https://fortuna-staging.dourolabs.app/docs/openapi.json';
+
+export const openapi = createOpenAPI({
+  input: [fortunaOpenApiUrl, fortunaStagingOpenApiUrl],
+});

+ 6 - 0
apps/developer-hub/src/lib/source.ts

@@ -22,8 +22,10 @@ import {
 } from "@phosphor-icons/react/dist/ssr";
 import type { InferMetaType, InferPageType } from "fumadocs-core/source";
 import { loader } from "fumadocs-core/source";
+import { transformerOpenAPI } from 'fumadocs-openapi/server';
 import { createElement } from "react";
 
+
 import { docs } from "../../.source";
 
 const icons: Record<string, React.ComponentType> = {
@@ -54,6 +56,10 @@ export const source = loader({
     return icon ? createElement(icons[icon] ?? FolderSimpleDashed) : undefined;
   },
   source: docs.toFumadocsSource(),
+  pageTree: {
+    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
+    transformers: [transformerOpenAPI()],
+  },
 });
 
 export type Page = InferPageType<typeof source>;

+ 6 - 0
apps/developer-hub/src/mdx-components.tsx

@@ -1,11 +1,17 @@
 import { InfoBox } from "@pythnetwork/component-library/InfoBox";
+import type { ApiPageProps } from 'fumadocs-openapi/ui';
+import { APIPage} from 'fumadocs-openapi/ui';
 import { Tab, Tabs } from "fumadocs-ui/components/tabs";
 import defaultMdxComponents from "fumadocs-ui/mdx";
 import type { MDXComponents } from "mdx/types";
 
+import { openapi  } from './lib/openapi';
+
+
 export function getMDXComponents(components?: MDXComponents): MDXComponents {
   return {
     ...defaultMdxComponents,
+    APIPage: (props: ApiPageProps) => <APIPage {...openapi.getAPIPageProps(props)} />,
     Tabs,
     Tab,
     ...components,

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 380 - 63
pnpm-lock.yaml


+ 2 - 0
pnpm-workspace.yaml

@@ -118,6 +118,8 @@ catalog:
   fumadocs-core: ^15.7.12
   fumadocs-mdx: ^11.10.0
   fumadocs-ui: ^15.7.12
+  fumadocs-openapi: ^9.3.8
+  fumadocs-typescript: ^4.0.8
   highlight.js: ^11.11.1
   ip-range-check: ^0.2.0
   jest: ^29.7.0

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels