diff --git a/.gitignore b/.gitignore index 4251b4f5a1..2f609dbecc 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ __pycache__ .turbo/ .cursorrules .corepack -justfile \ No newline at end of file +justfile +dist/ diff --git a/apps/api-reference/.gitignore b/apps/api-reference/.gitignore index 9d2ee2a739..1c2de6461f 100644 --- a/apps/api-reference/.gitignore +++ b/apps/api-reference/.gitignore @@ -1 +1,3 @@ .env*.local + +dist/ diff --git a/apps/api-reference/.prettierignore b/apps/api-reference/.prettierignore index 0feb81e1df..78ddc9bcd9 100644 --- a/apps/api-reference/.prettierignore +++ b/apps/api-reference/.prettierignore @@ -6,3 +6,9 @@ node_modules/ .env*.local .env .DS_Store +dist/ +lib/ +build/ +node_modules/ +package.json +tsconfig*.json diff --git a/apps/api-reference/jest.config.js b/apps/api-reference/jest.config.js index 0bac66ed0e..d4d43899af 100644 --- a/apps/api-reference/jest.config.js +++ b/apps/api-reference/jest.config.js @@ -1 +1,3 @@ -export { nextjs as default } from "@cprussin/jest-config/next"; +import { defineJestConfigForNextJs } from "@pythnetwork/jest-config/define-next-config"; + +export default defineJestConfigForNextJs(); diff --git a/apps/api-reference/package.json b/apps/api-reference/package.json index d611311c28..97a33b79f4 100644 --- a/apps/api-reference/package.json +++ b/apps/api-reference/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "engines": { - "node": "22" + "node": ">=22.14.0" }, "scripts": { "build:vercel": "next build", @@ -47,7 +47,7 @@ "devDependencies": { "@axe-core/react": "catalog:", "@cprussin/eslint-config": "catalog:", - "@cprussin/jest-config": "catalog:", + "@pythnetwork/jest-config": "workspace:", "@cprussin/prettier-config": "catalog:", "@cprussin/tsconfig": "catalog:", "@svgr/webpack": "catalog:", @@ -62,7 +62,6 @@ "postcss": "catalog:", "prettier": "catalog:", "tailwindcss": "catalog:", - "typescript": "catalog:", "vercel": "catalog:" } -} +} \ No newline at end of file diff --git a/apps/argus/.gitignore b/apps/argus/.gitignore index 7e54106f12..990b9a2b20 100644 --- a/apps/argus/.gitignore +++ b/apps/argus/.gitignore @@ -2,3 +2,5 @@ *config.yaml *secret* *private-key* + +dist/ diff --git a/apps/developer-hub/.gitignore b/apps/developer-hub/.gitignore index 1ae255e6f6..3edbc4f043 100644 --- a/apps/developer-hub/.gitignore +++ b/apps/developer-hub/.gitignore @@ -1,2 +1,3 @@ .env*.local -.source \ No newline at end of file +.source +dist/ diff --git a/apps/developer-hub/.prettierignore b/apps/developer-hub/.prettierignore index 5f66a649b5..e69f4c0a14 100644 --- a/apps/developer-hub/.prettierignore +++ b/apps/developer-hub/.prettierignore @@ -5,3 +5,9 @@ node_modules/ .env*.local .env .DS_Store +dist/ +lib/ +build/ +node_modules/ +package.json +tsconfig*.json diff --git a/apps/developer-hub/jest.config.js b/apps/developer-hub/jest.config.js index 0bac66ed0e..d4d43899af 100644 --- a/apps/developer-hub/jest.config.js +++ b/apps/developer-hub/jest.config.js @@ -1 +1,3 @@ -export { nextjs as default } from "@cprussin/jest-config/next"; +import { defineJestConfigForNextJs } from "@pythnetwork/jest-config/define-next-config"; + +export default defineJestConfigForNextJs(); diff --git a/apps/developer-hub/package.json b/apps/developer-hub/package.json index 62190c32ea..02fd46091a 100644 --- a/apps/developer-hub/package.json +++ b/apps/developer-hub/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "engines": { - "node": "22" + "node": ">=22.14.0" }, "scripts": { "build": "next build", @@ -51,7 +51,7 @@ }, "devDependencies": { "@cprussin/eslint-config": "catalog:", - "@cprussin/jest-config": "catalog:", + "@pythnetwork/jest-config": "workspace:", "@cprussin/prettier-config": "catalog:", "@cprussin/tsconfig": "catalog:", "@svgr/webpack": "catalog:", @@ -70,7 +70,6 @@ "stylelint": "catalog:", "stylelint-config-standard-scss": "catalog:", "tailwindcss": "^4.1.6", - "typescript": "catalog:", "vercel": "catalog:" } -} +} \ No newline at end of file diff --git a/apps/entropy-debugger/.gitignore b/apps/entropy-debugger/.gitignore deleted file mode 100644 index 9d2ee2a739..0000000000 --- a/apps/entropy-debugger/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.env*.local diff --git a/apps/entropy-debugger/.prettierignore b/apps/entropy-debugger/.prettierignore deleted file mode 100644 index 5f66a649b5..0000000000 --- a/apps/entropy-debugger/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -.next/ -coverage/ -node_modules/ -*.tsbuildinfo -.env*.local -.env -.DS_Store diff --git a/apps/entropy-debugger/README.md b/apps/entropy-debugger/README.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/entropy-debugger/components.json b/apps/entropy-debugger/components.json deleted file mode 100644 index dd679c08d9..0000000000 --- a/apps/entropy-debugger/components.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://ui.shadcn.com/schema.json", - "style": "default", - "rsc": true, - "tsx": true, - "tailwind": { - "config": "tailwind.config.ts", - "css": "src/app/globals.css", - "baseColor": "neutral", - "cssVariables": true, - "prefix": "" - }, - "iconLibrary": "lucide" -} diff --git a/apps/entropy-debugger/eslint.config.js b/apps/entropy-debugger/eslint.config.js deleted file mode 100644 index 7035c57cb4..0000000000 --- a/apps/entropy-debugger/eslint.config.js +++ /dev/null @@ -1 +0,0 @@ -export { nextjs as default } from "@cprussin/eslint-config"; diff --git a/apps/entropy-debugger/jest.config.js b/apps/entropy-debugger/jest.config.js deleted file mode 100644 index 0bac66ed0e..0000000000 --- a/apps/entropy-debugger/jest.config.js +++ /dev/null @@ -1 +0,0 @@ -export { nextjs as default } from "@cprussin/jest-config/next"; diff --git a/apps/entropy-debugger/next-env.d.ts b/apps/entropy-debugger/next-env.d.ts deleted file mode 100644 index 830fb594ca..0000000000 --- a/apps/entropy-debugger/next-env.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -/// -/// - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/entropy-debugger/next.config.js b/apps/entropy-debugger/next.config.js deleted file mode 100644 index dc9820062d..0000000000 --- a/apps/entropy-debugger/next.config.js +++ /dev/null @@ -1,49 +0,0 @@ -const config = { - reactStrictMode: true, - - pageExtensions: ["ts", "tsx", "mdx"], - - logging: { - fetches: { - fullUrl: true, - }, - }, - - webpack(config) { - config.resolve.extensionAlias = { - ".js": [".js", ".ts", ".tsx"], - }; - - return config; - }, - - headers: async () => [ - { - source: "/:path*", - headers: [ - { - key: "X-XSS-Protection", - value: "1; mode=block", - }, - { - key: "Referrer-Policy", - value: "strict-origin-when-cross-origin", - }, - { - key: "Strict-Transport-Security", - value: "max-age=2592000", - }, - { - key: "X-Content-Type-Options", - value: "nosniff", - }, - { - key: "Permissions-Policy", - value: - "vibrate=(), geolocation=(), midi=(), notifications=(), push=(), sync-xhr=(), microphone=(), camera=(), magnetometer=(), gyroscope=(), speaker=(), vibrate=(), fullscreen=self", - }, - ], - }, - ], -}; -export default config; diff --git a/apps/entropy-debugger/package.json b/apps/entropy-debugger/package.json deleted file mode 100644 index 90ee754cb4..0000000000 --- a/apps/entropy-debugger/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@pythnetwork/entropy-debugger", - "version": "0.0.0", - "private": true, - "type": "module", - "engines": { - "node": "22" - }, - "scripts": { - "build": "next build", - "fix:format": "prettier --write .", - "fix:lint": "eslint --fix . --max-warnings 0", - "start:dev": "next dev --port 3005", - "start:prod": "next start --port 3005", - "test:format": "prettier --check .", - "test:lint": "eslint . --max-warnings 0", - "test:types": "tsc" - }, - "dependencies": { - "@radix-ui/react-select": "catalog:", - "@radix-ui/react-slot": "catalog:", - "@radix-ui/react-switch": "catalog:", - "class-variance-authority": "catalog:", - "clsx": "catalog:", - "highlight.js": "catalog:", - "lucide-react": "catalog:", - "next": "catalog:", - "react": "catalog:", - "react-dom": "catalog:", - "tailwind-merge": "catalog:", - "tailwindcss-animate": "catalog:", - "viem": "catalog:", - "zod": "catalog:" - }, - "devDependencies": { - "@cprussin/eslint-config": "catalog:", - "@cprussin/jest-config": "catalog:", - "@cprussin/prettier-config": "catalog:", - "@cprussin/tsconfig": "catalog:", - "@types/jest": "catalog:", - "@types/node": "catalog:", - "@types/react": "catalog:", - "@types/react-dom": "catalog:", - "eslint": "catalog:", - "jest": "catalog:", - "postcss": "catalog:", - "prettier": "catalog:", - "tailwindcss": "catalog:", - "typescript": "catalog:", - "vercel": "catalog:" - } -} diff --git a/apps/entropy-debugger/postcss.config.js b/apps/entropy-debugger/postcss.config.js deleted file mode 100644 index 1a69fd2a45..0000000000 --- a/apps/entropy-debugger/postcss.config.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @type {import('postcss-load-config').Config} */ -const config = { - plugins: { - tailwindcss: {}, - }, -}; - -export default config; diff --git a/apps/entropy-debugger/prettier.config.js b/apps/entropy-debugger/prettier.config.js deleted file mode 100644 index 1e43aeeddb..0000000000 --- a/apps/entropy-debugger/prettier.config.js +++ /dev/null @@ -1 +0,0 @@ -export { base as default } from "@cprussin/prettier-config"; diff --git a/apps/entropy-debugger/prettierignore b/apps/entropy-debugger/prettierignore deleted file mode 100644 index 5f66a649b5..0000000000 --- a/apps/entropy-debugger/prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -.next/ -coverage/ -node_modules/ -*.tsbuildinfo -.env*.local -.env -.DS_Store diff --git a/apps/entropy-debugger/src/app/favicon.ico b/apps/entropy-debugger/src/app/favicon.ico deleted file mode 100644 index 718d6fea48..0000000000 Binary files a/apps/entropy-debugger/src/app/favicon.ico and /dev/null differ diff --git a/apps/entropy-debugger/src/app/fonts/GeistMonoVF.woff b/apps/entropy-debugger/src/app/fonts/GeistMonoVF.woff deleted file mode 100644 index f2ae185cbf..0000000000 Binary files a/apps/entropy-debugger/src/app/fonts/GeistMonoVF.woff and /dev/null differ diff --git a/apps/entropy-debugger/src/app/fonts/GeistVF.woff b/apps/entropy-debugger/src/app/fonts/GeistVF.woff deleted file mode 100644 index 1b62daacff..0000000000 Binary files a/apps/entropy-debugger/src/app/fonts/GeistVF.woff and /dev/null differ diff --git a/apps/entropy-debugger/src/app/globals.css b/apps/entropy-debugger/src/app/globals.css deleted file mode 100644 index a23ac26b0e..0000000000 --- a/apps/entropy-debugger/src/app/globals.css +++ /dev/null @@ -1,72 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -body { - font-family: Arial, Helvetica, sans-serif; -} - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 0 0% 3.9%; - --card: 0 0% 100%; - --card-foreground: 0 0% 3.9%; - --popover: 0 0% 100%; - --popover-foreground: 0 0% 3.9%; - --primary: 0 0% 9%; - --primary-foreground: 0 0% 98%; - --secondary: 0 0% 96.1%; - --secondary-foreground: 0 0% 9%; - --muted: 0 0% 96.1%; - --muted-foreground: 0 0% 45.1%; - --accent: 0 0% 96.1%; - --accent-foreground: 0 0% 9%; - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 0 0% 98%; - --border: 0 0% 89.8%; - --input: 0 0% 89.8%; - --ring: 0 0% 3.9%; - --chart-1: 12 76% 61%; - --chart-2: 173 58% 39%; - --chart-3: 197 37% 24%; - --chart-4: 43 74% 66%; - --chart-5: 27 87% 67%; - --radius: 0.5rem; - } - .dark { - --background: 0 0% 3.9%; - --foreground: 0 0% 98%; - --card: 0 0% 3.9%; - --card-foreground: 0 0% 98%; - --popover: 0 0% 3.9%; - --popover-foreground: 0 0% 98%; - --primary: 0 0% 98%; - --primary-foreground: 0 0% 9%; - --secondary: 0 0% 14.9%; - --secondary-foreground: 0 0% 98%; - --muted: 0 0% 14.9%; - --muted-foreground: 0 0% 63.9%; - --accent: 0 0% 14.9%; - --accent-foreground: 0 0% 98%; - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 0 0% 98%; - --border: 0 0% 14.9%; - --input: 0 0% 14.9%; - --ring: 0 0% 83.1%; - --chart-1: 220 70% 50%; - --chart-2: 160 60% 45%; - --chart-3: 30 80% 55%; - --chart-4: 280 65% 60%; - --chart-5: 340 75% 55%; - } -} - -@layer base { - * { - @apply border-border; - } - body { - @apply bg-background text-foreground; - } -} diff --git a/apps/entropy-debugger/src/app/layout.tsx b/apps/entropy-debugger/src/app/layout.tsx deleted file mode 100644 index 382a9c96af..0000000000 --- a/apps/entropy-debugger/src/app/layout.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import type { Metadata } from "next"; -import localFont from "next/font/local"; -import "./globals.css"; - -const geistSans = localFont({ - src: "./fonts/GeistVF.woff", - variable: "--font-geist-sans", - weight: "100 900", -}); -const geistMono = localFont({ - src: "./fonts/GeistMonoVF.woff", - variable: "--font-geist-mono", - weight: "100 900", -}); - -export const metadata: Metadata = { - title: "Pyth Entropy Debug App", - description: "Pyth Entropy Debug App", -}; - -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - return ( - - - {children} - - - ); -} diff --git a/apps/entropy-debugger/src/app/page.tsx b/apps/entropy-debugger/src/app/page.tsx deleted file mode 100644 index 4e3e06e00b..0000000000 --- a/apps/entropy-debugger/src/app/page.tsx +++ /dev/null @@ -1,240 +0,0 @@ -"use client"; - -import hljs from "highlight.js/lib/core"; -import bash from "highlight.js/lib/languages/bash"; -import { useState, useMemo, useCallback, useEffect, useRef } from "react"; - -import { Input } from "../components/ui/input"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "../components/ui/select"; -import { Switch } from "../components/ui/switch"; -import { requestCallback } from "../lib/revelation"; -import { - EntropyDeployments, - isValidDeployment, -} from "../store/entropy-deployments"; - -import "highlight.js/styles/github-dark.css"; // You can choose different themes - -// Register the bash language -hljs.registerLanguage("bash", bash); - -class BaseError extends Error { - constructor(message: string) { - super(message); - this.name = "BaseError"; - } -} - -class InvalidTxHashError extends BaseError { - constructor(message: string) { - super(message); - this.name = "InvalidTxHashError"; - } -} - -enum TxStateType { - NotLoaded, - Loading, - Success, - Error, -} - -const TxState = { - NotLoaded: () => ({ status: TxStateType.NotLoaded as const }), - Loading: () => ({ status: TxStateType.Loading as const }), - Success: (data: string) => ({ status: TxStateType.Success as const, data }), - ErrorState: (error: unknown) => ({ - status: TxStateType.Error as const, - error, - }), -}; - -type TxStateContext = - | ReturnType - | ReturnType - | ReturnType - | ReturnType; - -export default function PythEntropyDebugApp() { - const [state, setState] = useState(TxState.NotLoaded()); - const [isMainnet, setIsMainnet] = useState(false); - const [txHash, setTxHash] = useState(""); - const [error, setError] = useState(undefined); - const [selectedChain, setSelectedChain] = useState< - "" | keyof typeof EntropyDeployments - >(""); - - const validateTxHash = (hash: string) => { - if (!isValidTxHash(hash) && hash !== "") { - setError( - new InvalidTxHashError( - "Transaction hash must be 64 hexadecimal characters", - ), - ); - } else { - setError(undefined); - } - setTxHash(hash); - }; - - const availableChains = useMemo(() => { - return Object.entries(EntropyDeployments) - .filter( - ([, deployment]) => - deployment.network === (isMainnet ? "mainnet" : "testnet"), - ) - .toSorted(([a], [b]) => a.localeCompare(b)) - .map(([key]) => key); - }, [isMainnet]); - - const oncClickFetchInfo = useCallback(() => { - if (selectedChain !== "") { - setState(TxState.Loading()); - requestCallback(txHash, selectedChain) - .then((data) => { - setState(TxState.Success(data)); - }) - .catch((error: unknown) => { - setState(TxState.ErrorState(error)); - }); - } - }, [txHash, selectedChain]); - - const updateIsMainnet = useCallback( - (newValue: boolean) => { - setSelectedChain(""); - setIsMainnet(newValue); - }, - [setSelectedChain, setIsMainnet], - ); - - const updateSelectedChain = useCallback( - (chain: string) => { - if (isValidDeployment(chain)) { - setSelectedChain(chain); - } - }, - [setSelectedChain], - ); - - return ( -
-

Pyth Entropy Debug App

- -
- - - -
-
- -
-
- - { - validateTxHash(e.target.value); - }} - /> - {error &&

{error.message}

} -
-
- -
- -
- ); -} - -const Info = ({ state }: { state: TxStateContext }) => { - const preRef = useRef(null); - - useEffect(() => { - if (preRef.current && state.status === TxStateType.Success) { - hljs.highlightElement(preRef.current); - } - }, [state]); - - switch (state.status) { - case TxStateType.NotLoaded: { - return
Not loaded
; - } - case TxStateType.Loading: { - return
Loading...
; - } - case TxStateType.Success: { - return ( -
-

- Please run the following command in your terminal: -

-
-
-              {state.data}
-            
- -
-
- ); - } - case TxStateType.Error: { - return ( -
-
{String(state.error)}
-
- ); - } - } -}; - -function isValidTxHash(hash: string) { - const cleanHash = hash.toLowerCase().replace("0x", ""); - return /^[\da-f]{64}$/.test(cleanHash); -} diff --git a/apps/entropy-debugger/src/components/ui/button.tsx b/apps/entropy-debugger/src/components/ui/button.tsx deleted file mode 100644 index 1ff3b71b57..0000000000 --- a/apps/entropy-debugger/src/components/ui/button.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Slot } from "@radix-ui/react-slot"; -import type { VariantProps } from "class-variance-authority"; -import { cva } from "class-variance-authority"; -import type { ComponentProps } from "react"; - -import { cn } from "../../lib/utils"; - -const buttonVariants = cva( - "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", - { - variants: { - variant: { - default: "bg-primary text-primary-foreground hover:bg-primary/90", - destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", - outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", - icon: "h-10 w-10", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - -export type ButtonProps = { - asChild?: boolean; -} & ComponentProps<"button"> & - VariantProps; - -export const Button = ({ - className, - variant, - size, - asChild = false, - ...props -}: ButtonProps) => { - const Comp = asChild ? Slot : "button"; - return ( - - ); -}; diff --git a/apps/entropy-debugger/src/components/ui/input.tsx b/apps/entropy-debugger/src/components/ui/input.tsx deleted file mode 100644 index 5c2e6d5387..0000000000 --- a/apps/entropy-debugger/src/components/ui/input.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import type { ComponentProps } from "react"; - -import { cn } from "../../lib/utils"; - -export const Input = ({ className, ...props }: ComponentProps<"input">) => ( - -); diff --git a/apps/entropy-debugger/src/components/ui/select.tsx b/apps/entropy-debugger/src/components/ui/select.tsx deleted file mode 100644 index edb852f46a..0000000000 --- a/apps/entropy-debugger/src/components/ui/select.tsx +++ /dev/null @@ -1,146 +0,0 @@ -"use client"; - -import { - Trigger, - ScrollUpButton, - ScrollDownButton, - Icon, - Portal, - Content, - Viewport, - Label, - ItemIndicator, - ItemText, - Item, - Separator, -} from "@radix-ui/react-select"; -import { Check, ChevronDown, ChevronUp } from "lucide-react"; -import type { ComponentProps } from "react"; - -import { cn } from "../../lib/utils"; - -export { - Root as Select, - Group as SelectGroup, - Value as SelectValue, -} from "@radix-ui/react-select"; - -export const SelectTrigger = ({ - className, - children, - ...props -}: ComponentProps) => ( - span]:line-clamp-1", - className, - )} - {...props} - > - {children} - - - - -); - -export const SelectScrollUpButton = ({ - className, - ...props -}: ComponentProps) => ( - - - -); - -export const SelectScrollDownButton = ({ - className, - ...props -}: ComponentProps) => ( - - - -); - -export const SelectContent = ({ - className, - children, - position = "popper", - ...props -}: ComponentProps) => ( - - - - - {children} - - - - -); - -export const SelectLabel = ({ - className, - ...props -}: ComponentProps) => ( -