diff --git a/.envrc b/.envrc index c604e3d6ed..3550a30f2d 100644 --- a/.envrc +++ b/.envrc @@ -1,7 +1 @@ -#!/usr/bin/env bash -# the shebang is ignored, but nice for editors - -if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w=" -fi use flake diff --git a/apps/api-reference/jest.config.js b/apps/api-reference/jest.config.js index b7edcf4c8a..0bac66ed0e 100644 --- a/apps/api-reference/jest.config.js +++ b/apps/api-reference/jest.config.js @@ -1 +1 @@ -export { nextjs as default } from "@cprussin/jest-config"; +export { nextjs as default } from "@cprussin/jest-config/next"; diff --git a/apps/api-reference/package.json b/apps/api-reference/package.json index d72384589d..af03d2ed42 100644 --- a/apps/api-reference/package.json +++ b/apps/api-reference/package.json @@ -18,51 +18,51 @@ "test:types": "tsc" }, "dependencies": { - "@amplitude/analytics-browser": "^2.9.0", - "@amplitude/plugin-autocapture-browser": "^0.9.0", - "@floating-ui/react": "^0.26.17", - "@headlessui/react": "^2.2.0", - "@heroicons/react": "^2.1.4", - "@next/third-parties": "^14.2.4", + "@amplitude/analytics-browser": "catalog:", + "@amplitude/plugin-autocapture-browser": "catalog:", + "@floating-ui/react": "catalog:", + "@headlessui/react": "catalog:", + "@heroicons/react": "catalog:", + "@next/third-parties": "catalog:", "@pythnetwork/client": "catalog:", - "@pythnetwork/pyth-sdk-solidity": "workspace:^", - "@solana/web3.js": "^1.95.1", - "@tanstack/react-query": "^5.45.1", - "bs58": "^5.0.0", - "clsx": "^2.1.1", - "connectkit": "^1.8.2", - "cryptocurrency-icons": "^0.18.1", - "framer-motion": "^11.3.8", + "@pythnetwork/pyth-sdk-solidity": "workspace:*", + "@solana/web3.js": "catalog:", + "@tanstack/react-query": "catalog:", + "bs58": "catalog:", + "clsx": "catalog:", + "connectkit": "catalog:", + "cryptocurrency-icons": "catalog:", + "framer-motion": "catalog:", "next": "catalog:", - "next-themes": "^0.3.0", - "pino": "^9.2.0", + "next-themes": "catalog:", + "pino": "catalog:", "react": "catalog:", "react-dom": "catalog:", - "react-markdown": "^9.0.1", - "shiki": "^1.7.0", - "viem": "^2.22.23", - "wagmi": "^2.10.4", - "zod": "^3.23.8" + "react-markdown": "catalog:", + "shiki": "catalog:", + "viem": "catalog:", + "wagmi": "catalog:", + "zod": "catalog:" }, "devDependencies": { - "@axe-core/react": "^4.9.1", + "@axe-core/react": "catalog:", "@cprussin/eslint-config": "catalog:", "@cprussin/jest-config": "catalog:", "@cprussin/prettier-config": "catalog:", "@cprussin/tsconfig": "catalog:", - "@svgr/webpack": "^8.1.0", - "@tailwindcss/forms": "^0.5.7", - "@types/jest": "^29.5.12", - "@types/node": "^20.14.6", + "@svgr/webpack": "catalog:", + "@tailwindcss/forms": "catalog:", + "@types/jest": "catalog:", + "@types/node": "catalog:", "@types/react": "catalog:", "@types/react-dom": "catalog:", - "autoprefixer": "^10.4.19", - "eslint": "^9.5.0", - "jest": "^29.7.0", - "postcss": "^8.4.38", + "autoprefixer": "catalog:", + "eslint": "catalog:", + "jest": "catalog:", + "postcss": "catalog:", "prettier": "catalog:", - "tailwindcss": "^3.4.4", - "typescript": "^5.5.2", - "vercel": "^34.2.7" + "tailwindcss": "catalog:", + "typescript": "catalog:", + "vercel": "catalog:" } } diff --git a/apps/api-reference/src/apis/evm/common.ts b/apps/api-reference/src/apis/evm/common.ts index c50bc51f98..b2b30ecd65 100644 --- a/apps/api-reference/src/apis/evm/common.ts +++ b/apps/api-reference/src/apis/evm/common.ts @@ -1,12 +1,7 @@ import { z } from "zod"; -import { - type ReadApi, - type WriteApi, - type NetworkInfo, - EvmApiType, - Language, -} from "../../components/EvmApi"; +import type { ReadApi, WriteApi, NetworkInfo } from "../../components/EvmApi"; +import { EvmApiType, Language } from "../../components/EvmApi"; import { singletonArray, safeFetch } from "../../zod-utils"; export const readApi = ( diff --git a/apps/api-reference/src/app/price-feeds/[chain]/[method]/page.tsx b/apps/api-reference/src/app/price-feeds/[chain]/[method]/page.tsx index 2653af8cb8..65207291fc 100644 --- a/apps/api-reference/src/app/price-feeds/[chain]/[method]/page.tsx +++ b/apps/api-reference/src/app/price-feeds/[chain]/[method]/page.tsx @@ -1,7 +1,8 @@ "use client"; import { notFound } from "next/navigation"; -import { type ComponentProps, use } from "react"; +import type { ComponentProps } from "react"; +import { use } from "react"; import * as apis from "../../../../apis"; import { EvmApi } from "../../../../components/EvmApi"; diff --git a/apps/api-reference/src/browser-logger.ts b/apps/api-reference/src/browser-logger.ts index 9a746bf4dc..f92669debe 100644 --- a/apps/api-reference/src/browser-logger.ts +++ b/apps/api-reference/src/browser-logger.ts @@ -1,4 +1,5 @@ -import pino, { type Logger } from "pino"; +import type { Logger } from "pino"; +import pino from "pino"; import { IS_PRODUCTION_BUILD } from "./isomorphic-config"; diff --git a/apps/api-reference/src/components/Accordion/index.tsx b/apps/api-reference/src/components/Accordion/index.tsx index 98f6c99d41..ca6350f71b 100644 --- a/apps/api-reference/src/components/Accordion/index.tsx +++ b/apps/api-reference/src/components/Accordion/index.tsx @@ -1,6 +1,7 @@ import { Disclosure, DisclosurePanel } from "@headlessui/react"; import { LazyMotion, AnimatePresence, m, domAnimation } from "framer-motion"; -import { type ComponentProps, type Ref, forwardRef } from "react"; +import type { ComponentProps, Ref } from "react"; +import { forwardRef } from "react"; export { DisclosureButton as AccordionButton } from "@headlessui/react"; diff --git a/apps/api-reference/src/components/Button/index.tsx b/apps/api-reference/src/components/Button/index.tsx index 9960b01c96..5ad3eff0d7 100644 --- a/apps/api-reference/src/components/Button/index.tsx +++ b/apps/api-reference/src/components/Button/index.tsx @@ -1,14 +1,13 @@ "use client"; import clsx from "clsx"; -import { - type ComponentProps, - type ElementType, - type MouseEvent, - type CSSProperties, - useState, - useCallback, +import type { + ComponentProps, + ElementType, + MouseEvent, + CSSProperties, } from "react"; +import { useState, useCallback } from "react"; const DEFAULT_GRADIENT_SIZE = "30rem"; diff --git a/apps/api-reference/src/components/Code/index.tsx b/apps/api-reference/src/components/Code/index.tsx index cfb091da66..4bdd971500 100644 --- a/apps/api-reference/src/components/Code/index.tsx +++ b/apps/api-reference/src/components/Code/index.tsx @@ -1,8 +1,8 @@ import { Transition } from "@headlessui/react"; import { ClipboardDocumentIcon, CheckIcon } from "@heroicons/react/24/outline"; import clsx from "clsx"; -import { useMemo, useCallback, type HTMLAttributes } from "react"; -import { useEffect, useState } from "react"; +import type { HTMLAttributes } from "react"; +import { useMemo, useCallback, useEffect, useState } from "react"; import type { OffsetOrPosition } from "shiki"; import style from "./style.module.css"; diff --git a/apps/api-reference/src/components/Code/shiki.ts b/apps/api-reference/src/components/Code/shiki.ts index db4f97716d..fb460bc621 100644 --- a/apps/api-reference/src/components/Code/shiki.ts +++ b/apps/api-reference/src/components/Code/shiki.ts @@ -1,14 +1,11 @@ -import { - type HighlighterCore, - type DecorationItem, - getHighlighterCore as shikiGetHighlighterCore, -} from "shiki/core"; +import type { HighlighterCore, DecorationItem } from "shiki/core"; +import { createHighlighterCore } from "shiki/core"; +import { createOnigurumaEngine } from "shiki/engine/oniguruma"; import javascript from "shiki/langs/javascript.mjs"; import json from "shiki/langs/json.mjs"; import solidity from "shiki/langs/solidity.mjs"; import darkPlus from "shiki/themes/dark-plus.mjs"; import lightPlus from "shiki/themes/light-plus.mjs"; -import loadWasm from "shiki/wasm"; import type { SupportedLanguage } from "./supported-language"; @@ -16,7 +13,7 @@ export type Highlighter = { highlight: ( lang: SupportedLanguage | undefined, code: string, - options?: HighlightOptions | undefined, + options?: HighlightOptions, ) => string; }; @@ -25,17 +22,17 @@ export type HighlightOptions = { }; export const getHighlighter = async (): Promise => { - const highlighterCore = await shikiGetHighlighterCore({ + const highlighterCore = await createHighlighterCore({ langs: [javascript, solidity, json], themes: [darkPlus, lightPlus], - loadWasm, + engine: createOnigurumaEngine(() => import("shiki/wasm")), }); return { highlight: ( lang: SupportedLanguage | undefined, code: string, - options?: HighlightOptions | undefined, + options?: HighlightOptions, ) => highlight(highlighterCore, lang, code, options), }; }; @@ -44,7 +41,7 @@ const highlight = ( highlighter: HighlighterCore, lang: SupportedLanguage | undefined, code: string, - options?: HighlightOptions | undefined, + options?: HighlightOptions, ) => highlighter.codeToHtml(code, { lang: lang ?? "text", diff --git a/apps/api-reference/src/components/Code/use-highlighted-code.tsx b/apps/api-reference/src/components/Code/use-highlighted-code.tsx index 64c325b191..a75ab37b9e 100644 --- a/apps/api-reference/src/components/Code/use-highlighted-code.tsx +++ b/apps/api-reference/src/components/Code/use-highlighted-code.tsx @@ -1,8 +1,7 @@ "use client"; +import type { ReactNode, RefObject } from "react"; import { - type ReactNode, - type RefObject, createContext, useContext, useState, @@ -48,7 +47,7 @@ const useHighlighter = () => { export const useHighlightedCode = ( language: SupportedLanguage | undefined, code: string, - dimRange?: readonly [OffsetOrPosition, OffsetOrPosition] | undefined, + dimRange?: readonly [OffsetOrPosition, OffsetOrPosition], ) => { const highlighter = useHighlighter(); const decorations = useMemo( diff --git a/apps/api-reference/src/components/EvmApi/index.tsx b/apps/api-reference/src/components/EvmApi/index.tsx index e1f57d0524..2aebfaa956 100644 --- a/apps/api-reference/src/components/EvmApi/index.tsx +++ b/apps/api-reference/src/components/EvmApi/index.tsx @@ -13,26 +13,26 @@ import { ArrowPathIcon } from "@heroicons/react/24/outline"; import PythAbi from "@pythnetwork/pyth-sdk-solidity/abis/IPyth.json"; import PythErrorsAbi from "@pythnetwork/pyth-sdk-solidity/abis/PythErrors.json"; import { ChainIcon } from "connectkit"; -import { - type Dispatch, - type SetStateAction, - type ComponentProps, - type ElementType, - type SVGAttributes, - useState, - useCallback, - useMemo, +import type { + Dispatch, + SetStateAction, + ComponentProps, + ElementType, + SVGAttributes, } from "react"; +import { useState, useCallback, useMemo } from "react"; import { useSwitchChain, useChainId, useConfig } from "wagmi"; import { readContract } from "wagmi/actions"; import type { Parameter } from "./parameter"; import { ParameterInput } from "./parameter-input"; -import { type EvmApiType, RunButton } from "./run-button"; +import type { EvmApiType } from "./run-button"; +import { RunButton } from "./run-button"; import { getLogger } from "../../browser-logger"; import { getContractAddress } from "../../evm-networks"; import { useIsMounted } from "../../use-is-mounted"; -import { type SupportedLanguage, Code } from "../Code"; +import type { SupportedLanguage } from "../Code"; +import { Code } from "../Code"; import { ErrorTooltip } from "../ErrorTooltip"; import { InlineLink } from "../InlineLink"; import { Markdown } from "../Markdown"; diff --git a/apps/api-reference/src/components/EvmApi/parameter-input.tsx b/apps/api-reference/src/components/EvmApi/parameter-input.tsx index c7a6d2f7ef..c7d461164c 100644 --- a/apps/api-reference/src/components/EvmApi/parameter-input.tsx +++ b/apps/api-reference/src/components/EvmApi/parameter-input.tsx @@ -8,25 +8,18 @@ import { ArrowPathIcon } from "@heroicons/react/24/outline"; import base58 from "bs58"; import clsx from "clsx"; import Image from "next/image"; -import { - type ChangeEvent, - type Dispatch, - type SetStateAction, - useState, - useCallback, - useMemo, - useEffect, -} from "react"; +import type { ChangeEvent, Dispatch, SetStateAction } from "react"; +import { useState, useCallback, useMemo, useEffect } from "react"; +import type { Parameter } from "./parameter"; import { - type Parameter, PLACEHOLDERS, isValid, getValidationError, ParameterType, } from "./parameter"; +import type { PriceFeed } from "../../use-price-feed-list"; import { - type PriceFeed, PriceFeedListContextType, usePriceFeedList, } from "../../use-price-feed-list"; diff --git a/apps/api-reference/src/components/EvmApi/parameter.ts b/apps/api-reference/src/components/EvmApi/parameter.ts index d1a3b7fa5f..02a1e609e1 100644 --- a/apps/api-reference/src/components/EvmApi/parameter.ts +++ b/apps/api-reference/src/components/EvmApi/parameter.ts @@ -13,9 +13,9 @@ export enum ParameterType { IntArray, } -export const TRANSFORMS: { - [paramType in ParameterType]?: (value: string) => unknown; -} = { +export const TRANSFORMS: Partial< + Record unknown> +> = { [ParameterType.PriceFeedIdArray]: (value) => [value], [ParameterType.HexArray]: (value) => [value], [ParameterType.IntArray]: (value) => [value], diff --git a/apps/api-reference/src/components/EvmApi/run-button.tsx b/apps/api-reference/src/components/EvmApi/run-button.tsx index 3439fbc0e0..c5313f3d22 100644 --- a/apps/api-reference/src/components/EvmApi/run-button.tsx +++ b/apps/api-reference/src/components/EvmApi/run-button.tsx @@ -9,7 +9,8 @@ import { ContractFunctionExecutionError } from "viem"; import { useAccount, useConfig } from "wagmi"; import { readContract, simulateContract, writeContract } from "wagmi/actions"; -import { type Parameter, TRANSFORMS } from "./parameter"; +import type { Parameter } from "./parameter"; +import { TRANSFORMS } from "./parameter"; import { getContractAddress } from "../../evm-networks"; import { useIsMounted } from "../../use-is-mounted"; import { Button } from "../Button"; diff --git a/apps/api-reference/src/components/Header/nav-link.tsx b/apps/api-reference/src/components/Header/nav-link.tsx index 187ee938cf..66a104c29c 100644 --- a/apps/api-reference/src/components/Header/nav-link.tsx +++ b/apps/api-reference/src/components/Header/nav-link.tsx @@ -3,7 +3,8 @@ import clsx from "clsx"; import Link from "next/link"; import { useSelectedLayoutSegment } from "next/navigation"; -import { type ComponentProps, useMemo } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; const baseClasses = "font-semibold text-sm py-2 px-3"; diff --git a/apps/api-reference/src/components/Input/index.tsx b/apps/api-reference/src/components/Input/index.tsx index 8b9e31efce..20596da579 100644 --- a/apps/api-reference/src/components/Input/index.tsx +++ b/apps/api-reference/src/components/Input/index.tsx @@ -1,12 +1,13 @@ +import type { InputProps } from "@headlessui/react"; import { Field, Label, Description, Input as HeadlessUiInput, - type InputProps, } from "@headlessui/react"; import clsx from "clsx"; -import { type Ref, type ReactNode, forwardRef } from "react"; +import type { Ref, ReactNode } from "react"; +import { forwardRef } from "react"; import { ErrorTooltip } from "../ErrorTooltip"; diff --git a/apps/api-reference/src/components/Markdown/index.tsx b/apps/api-reference/src/components/Markdown/index.tsx index b569ec0b01..2ce434630e 100644 --- a/apps/api-reference/src/components/Markdown/index.tsx +++ b/apps/api-reference/src/components/Markdown/index.tsx @@ -1,4 +1,4 @@ -import { type ComponentProps } from "react"; +import type { ComponentProps } from "react"; import MarkdownComponent from "react-markdown"; import { MARKDOWN_COMPONENTS } from "../../markdown-components"; diff --git a/apps/api-reference/src/components/Modal/index.tsx b/apps/api-reference/src/components/Modal/index.tsx index c04b8fadbe..d81911d98c 100644 --- a/apps/api-reference/src/components/Modal/index.tsx +++ b/apps/api-reference/src/components/Modal/index.tsx @@ -8,7 +8,8 @@ import { CloseButton, } from "@headlessui/react"; import { XMarkIcon } from "@heroicons/react/24/outline"; -import { type ReactNode, Fragment } from "react"; +import type { ReactNode } from "react"; +import { Fragment } from "react"; import { Button } from "../Button"; diff --git a/apps/api-reference/src/components/Select/index.tsx b/apps/api-reference/src/components/Select/index.tsx index 65e135060f..1482bc9d67 100644 --- a/apps/api-reference/src/components/Select/index.tsx +++ b/apps/api-reference/src/components/Select/index.tsx @@ -11,13 +11,8 @@ import { ChevronRightIcon, } from "@heroicons/react/24/outline"; import clsx from "clsx"; -import { - type ReactNode, - type ChangeEvent, - useState, - useCallback, - useMemo, -} from "react"; +import type { ReactNode, ChangeEvent } from "react"; +import { useState, useCallback, useMemo } from "react"; import { Accordion, AccordionButton, AccordionPanel } from "../Accordion"; diff --git a/apps/api-reference/src/components/Sidebar/index.tsx b/apps/api-reference/src/components/Sidebar/index.tsx index d503fc242a..2abb7f1e28 100644 --- a/apps/api-reference/src/components/Sidebar/index.tsx +++ b/apps/api-reference/src/components/Sidebar/index.tsx @@ -4,12 +4,8 @@ import { Field, Label } from "@headlessui/react"; import clsx from "clsx"; import Link from "next/link"; import { useSelectedLayoutSegments } from "next/navigation"; -import { - type HTMLAttributes, - useState, - type ComponentProps, - type ElementType, -} from "react"; +import type { HTMLAttributes, ComponentProps, ElementType } from "react"; +import { useState } from "react"; import * as apis from "../../apis"; import { Select } from "../Select"; diff --git a/apps/api-reference/src/components/Tooltip/index.tsx b/apps/api-reference/src/components/Tooltip/index.tsx index b1136b76ba..051bcf0e8e 100644 --- a/apps/api-reference/src/components/Tooltip/index.tsx +++ b/apps/api-reference/src/components/Tooltip/index.tsx @@ -1,7 +1,7 @@ "use client"; +import type { Placement } from "@floating-ui/react"; import { - type Placement, FloatingArrow, FloatingPortal, useFloating, @@ -20,10 +20,8 @@ import { flip, shift, } from "@floating-ui/react"; +import type { ComponentProps, ElementType, Ref } from "react"; import { - type ComponentProps, - type ElementType, - type Ref, useState, useMemo, createContext, diff --git a/apps/api-reference/src/use-price-feed-list.tsx b/apps/api-reference/src/use-price-feed-list.tsx index c0d077b317..825ee4ae7d 100644 --- a/apps/api-reference/src/use-price-feed-list.tsx +++ b/apps/api-reference/src/use-price-feed-list.tsx @@ -2,13 +2,8 @@ import { PythHttpClient } from "@pythnetwork/client"; import { Connection, PublicKey } from "@solana/web3.js"; -import { - type ComponentProps, - createContext, - useContext, - useState, - useEffect, -} from "react"; +import type { ComponentProps } from "react"; +import { createContext, useContext, useState, useEffect } from "react"; import { z } from "zod"; const PYTHNET_RPC_URL = "https://api2.pythnet.pyth.network"; diff --git a/apps/api-reference/src/zod-utils.ts b/apps/api-reference/src/zod-utils.ts index d6ad03aa48..eb879de978 100644 --- a/apps/api-reference/src/zod-utils.ts +++ b/apps/api-reference/src/zod-utils.ts @@ -1,4 +1,5 @@ -import { type ZodSchema, type ZodTypeDef, z } from "zod"; +import type { ZodSchema, ZodTypeDef } from "zod"; +import { z } from "zod"; export const singletonArray = ( schema: ZodSchema, diff --git a/apps/entropy-debugger/jest.config.js b/apps/entropy-debugger/jest.config.js index b7edcf4c8a..0bac66ed0e 100644 --- a/apps/entropy-debugger/jest.config.js +++ b/apps/entropy-debugger/jest.config.js @@ -1 +1 @@ -export { nextjs as default } from "@cprussin/jest-config"; +export { nextjs as default } from "@cprussin/jest-config/next"; diff --git a/apps/entropy-debugger/package.json b/apps/entropy-debugger/package.json index 61f166c033..90ee754cb4 100644 --- a/apps/entropy-debugger/package.json +++ b/apps/entropy-debugger/package.json @@ -17,19 +17,19 @@ "test:types": "tsc" }, "dependencies": { - "@radix-ui/react-select": "^2.1.2", - "@radix-ui/react-slot": "^1.1.0", - "@radix-ui/react-switch": "^1.1.1", - "class-variance-authority": "^0.7.1", + "@radix-ui/react-select": "catalog:", + "@radix-ui/react-slot": "catalog:", + "@radix-ui/react-switch": "catalog:", + "class-variance-authority": "catalog:", "clsx": "catalog:", - "highlight.js": "^11.10.0", - "lucide-react": "^0.465.0", + "highlight.js": "catalog:", + "lucide-react": "catalog:", "next": "catalog:", "react": "catalog:", "react-dom": "catalog:", - "tailwind-merge": "^2.5.5", - "tailwindcss-animate": "^1.0.7", - "viem": "^2.21.53", + "tailwind-merge": "catalog:", + "tailwindcss-animate": "catalog:", + "viem": "catalog:", "zod": "catalog:" }, "devDependencies": { diff --git a/apps/entropy-debugger/src/components/ui/button.tsx b/apps/entropy-debugger/src/components/ui/button.tsx index 9b598d87eb..1ff3b71b57 100644 --- a/apps/entropy-debugger/src/components/ui/button.tsx +++ b/apps/entropy-debugger/src/components/ui/button.tsx @@ -1,5 +1,6 @@ import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; +import type { VariantProps } from "class-variance-authority"; +import { cva } from "class-variance-authority"; import type { ComponentProps } from "react"; import { cn } from "../../lib/utils"; diff --git a/apps/entropy-debugger/src/lib/revelation.ts b/apps/entropy-debugger/src/lib/revelation.ts index c7a1cdba8e..224e0d1532 100644 --- a/apps/entropy-debugger/src/lib/revelation.ts +++ b/apps/entropy-debugger/src/lib/revelation.ts @@ -2,10 +2,8 @@ import { createPublicClient, http, parseEventLogs, publicActions } from "viem"; import { z } from "zod"; import { EntropyAbi } from "./entropy-abi"; -import { - type EntropyDeployment, - EntropyDeployments, -} from "../store/entropy-deployments"; +import type { EntropyDeployment } from "../store/entropy-deployments"; +import { EntropyDeployments } from "../store/entropy-deployments"; export async function requestCallback( txHash: string, diff --git a/apps/entropy-debugger/src/lib/utils.ts b/apps/entropy-debugger/src/lib/utils.ts index a500a73858..31f0864a43 100644 --- a/apps/entropy-debugger/src/lib/utils.ts +++ b/apps/entropy-debugger/src/lib/utils.ts @@ -1,4 +1,5 @@ -import { clsx, type ClassValue } from "clsx"; +import type { ClassValue } from "clsx"; +import { clsx } from "clsx"; import { twMerge } from "tailwind-merge"; export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs)); diff --git a/apps/insights/jest.config.js b/apps/insights/jest.config.js index b7edcf4c8a..0bac66ed0e 100644 --- a/apps/insights/jest.config.js +++ b/apps/insights/jest.config.js @@ -1 +1 @@ -export { nextjs as default } from "@cprussin/jest-config"; +export { nextjs as default } from "@cprussin/jest-config/next"; diff --git a/apps/insights/package.json b/apps/insights/package.json index fdf4bd3141..b3442f7ff3 100644 --- a/apps/insights/package.json +++ b/apps/insights/package.json @@ -54,7 +54,7 @@ "@cprussin/jest-config": "catalog:", "@cprussin/prettier-config": "catalog:", "@cprussin/tsconfig": "catalog:", - "@pythnetwork/staking-sdk": "workspace:", + "@pythnetwork/staking-sdk": "workspace:*", "@svgr/webpack": "catalog:", "@types/jest": "catalog:", "@types/node": "catalog:", diff --git a/apps/insights/src/components/ChartCard/index.tsx b/apps/insights/src/components/ChartCard/index.tsx index 24e561cd87..9051df7f4e 100644 --- a/apps/insights/src/components/ChartCard/index.tsx +++ b/apps/insights/src/components/ChartCard/index.tsx @@ -3,15 +3,8 @@ import { StatCard } from "@pythnetwork/component-library/StatCard"; import clsx from "clsx"; import dynamic from "next/dynamic"; -import { - type ElementType, - type ComponentProps, - type ReactNode, - Suspense, - useState, - useMemo, - useCallback, -} from "react"; +import type { ElementType, ComponentProps, ReactNode } from "react"; +import { Suspense, useState, useMemo, useCallback } from "react"; import { ResponsiveContainer, Tooltip, Line, XAxis, YAxis } from "recharts"; import type { CategoricalChartState } from "recharts/types/chart/types"; diff --git a/apps/insights/src/components/CopyButton/index.tsx b/apps/insights/src/components/CopyButton/index.tsx index 200e2a82f0..2943823327 100644 --- a/apps/insights/src/components/CopyButton/index.tsx +++ b/apps/insights/src/components/CopyButton/index.tsx @@ -5,7 +5,8 @@ import { Copy } from "@phosphor-icons/react/dist/ssr/Copy"; import { useLogger } from "@pythnetwork/app-logger"; import { Button } from "@pythnetwork/component-library/unstyled/Button"; import clsx from "clsx"; -import { type ComponentProps, useCallback, useEffect, useState } from "react"; +import type { ComponentProps } from "react"; +import { useCallback, useEffect, useState } from "react"; import styles from "./index.module.scss"; diff --git a/apps/insights/src/components/FeedKey/index.tsx b/apps/insights/src/components/FeedKey/index.tsx index e6267267ec..0f253e3dfe 100644 --- a/apps/insights/src/components/FeedKey/index.tsx +++ b/apps/insights/src/components/FeedKey/index.tsx @@ -1,4 +1,5 @@ -import { useMemo, type ComponentProps } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; import { toHex, truncateHex } from "../../hex"; import { CopyButton } from "../CopyButton"; diff --git a/apps/insights/src/components/LayoutTransition/index.tsx b/apps/insights/src/components/LayoutTransition/index.tsx index 65910a308e..15622a1fed 100644 --- a/apps/insights/src/components/LayoutTransition/index.tsx +++ b/apps/insights/src/components/LayoutTransition/index.tsx @@ -1,20 +1,11 @@ "use client"; -import { - type TargetAndTransition, - type Target, - AnimatePresence, - motion, -} from "motion/react"; +import type { TargetAndTransition, Target } from "motion/react"; +import { AnimatePresence, motion } from "motion/react"; import { LayoutRouterContext } from "next/dist/shared/lib/app-router-context.shared-runtime"; import { useSelectedLayoutSegment } from "next/navigation"; -import { - type ReactNode, - type ComponentProps, - useContext, - useEffect, - useRef, -} from "react"; +import type { ReactNode, ComponentProps } from "react"; +import { useContext, useEffect, useRef } from "react"; type OwnProps = { children: ReactNode; diff --git a/apps/insights/src/components/LivePrices/index.tsx b/apps/insights/src/components/LivePrices/index.tsx index 0c2f3b9f95..db45c120d0 100644 --- a/apps/insights/src/components/LivePrices/index.tsx +++ b/apps/insights/src/components/LivePrices/index.tsx @@ -3,7 +3,8 @@ import { PlusMinus } from "@phosphor-icons/react/dist/ssr/PlusMinus"; import type { PriceData, PriceComponent } from "@pythnetwork/client"; import { Skeleton } from "@pythnetwork/component-library/Skeleton"; -import { type ReactNode, useMemo } from "react"; +import type { ReactNode } from "react"; +import { useMemo } from "react"; import { useNumberFormatter, useDateFormatter } from "react-aria"; import styles from "./index.module.scss"; @@ -177,11 +178,18 @@ export const LiveValue = ({ }: LiveValueProps) => { const { current } = useLivePriceData(cluster, feedKey); - return current !== undefined || defaultValue !== undefined ? ( - (current?.[field]?.toString() ?? defaultValue) - ) : ( - - ); + if (current !== undefined || defaultValue !== undefined) { + const value = current?.[field]; + if (typeof value === "string") { + return value; + } else if (typeof value === "number" || typeof value === "bigint") { + return value.toString(); + } else { + return value ? JSON.stringify(value) : defaultValue; + } + } else { + return ; + } }; type LiveComponentValueProps = { diff --git a/apps/insights/src/components/Overview/tab-list.tsx b/apps/insights/src/components/Overview/tab-list.tsx index d0e1e771f6..0f4921d43d 100644 --- a/apps/insights/src/components/Overview/tab-list.tsx +++ b/apps/insights/src/components/Overview/tab-list.tsx @@ -6,7 +6,8 @@ import { } from "@pythnetwork/component-library/unstyled/Tabs"; import clsx from "clsx"; import { motion } from "motion/react"; -import { type ComponentProps, useId } from "react"; +import type { ComponentProps } from "react"; +import { useId } from "react"; import styles from "./tab-list.module.scss"; diff --git a/apps/insights/src/components/PriceComponentDrawer/index.tsx b/apps/insights/src/components/PriceComponentDrawer/index.tsx index 5da6cd3a29..87a3047653 100644 --- a/apps/insights/src/components/PriceComponentDrawer/index.tsx +++ b/apps/insights/src/components/PriceComponentDrawer/index.tsx @@ -10,14 +10,8 @@ import { StatCard } from "@pythnetwork/component-library/StatCard"; import { Table } from "@pythnetwork/component-library/Table"; import dynamic from "next/dynamic"; import { useRouter } from "next/navigation"; -import { - type ReactNode, - Suspense, - useState, - useRef, - useCallback, - useMemo, -} from "react"; +import type { ReactNode } from "react"; +import { Suspense, useState, useRef, useCallback, useMemo } from "react"; import { RouterProvider, useDateFormatter, @@ -343,7 +337,7 @@ const getScoreHistory = async ([ symbol, selectedPeriod, ]: [Cluster, string, string, EvaluationPeriod]) => { - const url = new URL("/component-score-history", window.location.origin); + const url = new URL("/component-score-history", globalThis.location.origin); url.searchParams.set("cluster", ClusterToName[cluster]); url.searchParams.set("publisherKey", publisherKey); url.searchParams.set("symbol", symbol); diff --git a/apps/insights/src/components/PriceComponentsCard/index.tsx b/apps/insights/src/components/PriceComponentsCard/index.tsx index 6ceb735f5f..7b9e5d7745 100644 --- a/apps/insights/src/components/PriceComponentsCard/index.tsx +++ b/apps/insights/src/components/PriceComponentsCard/index.tsx @@ -8,28 +8,23 @@ import { Paginator } from "@pythnetwork/component-library/Paginator"; import { SearchInput } from "@pythnetwork/component-library/SearchInput"; import { Select } from "@pythnetwork/component-library/Select"; import { SingleToggleGroup } from "@pythnetwork/component-library/SingleToggleGroup"; -import { - type RowConfig, - type ColumnConfig, - type SortDescriptor, - Table, +import type { + RowConfig, + ColumnConfig, + SortDescriptor, } from "@pythnetwork/component-library/Table"; +import { Table } from "@pythnetwork/component-library/Table"; import clsx from "clsx"; import { useQueryState, parseAsStringEnum, parseAsBoolean } from "nuqs"; -import { - type ReactNode, - Fragment, - Suspense, - useMemo, - useCallback, -} from "react"; +import type { ReactNode } from "react"; +import { Fragment, Suspense, useMemo, useCallback } from "react"; import { useFilter, useCollator } from "react-aria"; import styles from "./index.module.scss"; import { useQueryParamFilterPagination } from "../../hooks/use-query-param-filter-pagination"; import { Cluster } from "../../services/pyth"; +import type { StatusName } from "../../status"; import { - type StatusName, STATUS_NAMES, Status as StatusType, statusNameToStatus, diff --git a/apps/insights/src/components/PriceFeed/chart.tsx b/apps/insights/src/components/PriceFeed/chart.tsx index 5e7a8bdb71..f1f21c8f55 100644 --- a/apps/insights/src/components/PriceFeed/chart.tsx +++ b/apps/insights/src/components/PriceFeed/chart.tsx @@ -2,15 +2,11 @@ import { useLogger } from "@pythnetwork/app-logger"; import { useResizeObserver } from "@react-hookz/web"; -import { - type IChartApi, - type ISeriesApi, - type UTCTimestamp, - LineStyle, - createChart, -} from "lightweight-charts"; +import type { IChartApi, ISeriesApi, UTCTimestamp } from "lightweight-charts"; +import { LineSeries, LineStyle, createChart } from "lightweight-charts"; import { useTheme } from "next-themes"; -import { type RefObject, useEffect, useRef, useCallback } from "react"; +import type { RefObject } from "react"; +import { useEffect, useRef, useCallback } from "react"; import { z } from "zod"; import theme from "./theme.module.scss"; @@ -48,7 +44,7 @@ const useChartElem = (symbol: string, feedId: string) => { const backfillData = useCallback(() => { if (!isBackfilling.current && earliestDateRef.current) { isBackfilling.current = true; - const url = new URL("/historical-prices", window.location.origin); + const url = new URL("/historical-prices", globalThis.location.origin); url.searchParams.set("symbol", symbol); url.searchParams.set("until", earliestDateRef.current.toString()); fetch(url) @@ -115,7 +111,7 @@ const useChartElem = (symbol: string, feedId: string) => { }, }); - const price = chart.addLineSeries({ priceFormat }); + const price = chart.addSeries(LineSeries, { priceFormat }); chart.timeScale().subscribeVisibleLogicalRangeChange((range) => { if ( @@ -133,8 +129,8 @@ const useChartElem = (symbol: string, feedId: string) => { chartRef.current = { resolution: Resolution.Tick, chart, - confidenceHigh: chart.addLineSeries(confidenceConfig), - confidenceLow: chart.addLineSeries(confidenceConfig), + confidenceHigh: chart.addSeries(LineSeries, confidenceConfig), + confidenceLow: chart.addSeries(LineSeries, confidenceConfig), price, }; return () => { diff --git a/apps/insights/src/components/PriceFeed/price-feed-select.tsx b/apps/insights/src/components/PriceFeed/price-feed-select.tsx index ee446a6a4b..c4d9d89e7d 100644 --- a/apps/insights/src/components/PriceFeed/price-feed-select.tsx +++ b/apps/insights/src/components/PriceFeed/price-feed-select.tsx @@ -16,7 +16,8 @@ import { SearchField } from "@pythnetwork/component-library/unstyled/SearchField import { Select } from "@pythnetwork/component-library/unstyled/Select"; import { Input } from "@pythnetwork/component-library/unstyled/TextField"; import clsx from "clsx"; -import { type ReactNode, useMemo, useState } from "react"; +import type { ReactNode } from "react"; +import { useMemo, useState } from "react"; import { useCollator, useFilter } from "react-aria"; import styles from "./price-feed-select.module.scss"; diff --git a/apps/insights/src/components/PriceFeed/publishers-card.tsx b/apps/insights/src/components/PriceFeed/publishers-card.tsx index 65516316f6..7b1a8afa05 100644 --- a/apps/insights/src/components/PriceFeed/publishers-card.tsx +++ b/apps/insights/src/components/PriceFeed/publishers-card.tsx @@ -3,7 +3,8 @@ import { useLogger } from "@pythnetwork/app-logger"; import { Switch } from "@pythnetwork/component-library/Switch"; import { useQueryState, parseAsString, parseAsBoolean } from "nuqs"; -import { type ComponentProps, Suspense, useCallback, useMemo } from "react"; +import type { ComponentProps } from "react"; +import { Suspense, useCallback, useMemo } from "react"; import { Cluster, ClusterToName } from "../../services/pyth"; import { PriceComponentDrawer } from "../PriceComponentDrawer"; diff --git a/apps/insights/src/components/PriceFeedChangePercent/index.tsx b/apps/insights/src/components/PriceFeedChangePercent/index.tsx index 2c1f7929c8..5fbd80108b 100644 --- a/apps/insights/src/components/PriceFeedChangePercent/index.tsx +++ b/apps/insights/src/components/PriceFeedChangePercent/index.tsx @@ -1,6 +1,7 @@ "use client"; -import { type ComponentProps, createContext, use } from "react"; +import type { ComponentProps } from "react"; +import { createContext, use } from "react"; import { z } from "zod"; import { StateType, useData } from "../../hooks/use-data"; @@ -42,7 +43,7 @@ export const YesterdaysPricesProvider = ({ const getYesterdaysPrices = async ( feeds: YesterdaysPricesProviderProps["feeds"], ): Promise> => { - const url = new URL("/yesterdays-prices", window.location.origin); + const url = new URL("/yesterdays-prices", globalThis.location.origin); for (const symbol of Object.keys(feeds)) { url.searchParams.append("symbols", symbol); } diff --git a/apps/insights/src/components/PriceFeedTag/index.tsx b/apps/insights/src/components/PriceFeedTag/index.tsx index ab8a2c029d..741d8bd3ed 100644 --- a/apps/insights/src/components/PriceFeedTag/index.tsx +++ b/apps/insights/src/components/PriceFeedTag/index.tsx @@ -2,7 +2,8 @@ import { Skeleton } from "@pythnetwork/component-library/Skeleton"; import clsx from "clsx"; -import { type ComponentProps, type ReactNode, Fragment } from "react"; +import type { ComponentProps, ReactNode } from "react"; +import { Fragment } from "react"; import styles from "./index.module.scss"; import { usePriceFeeds } from "../../hooks/use-price-feeds"; diff --git a/apps/insights/src/components/PriceFeeds/asset-classes-drawer.tsx b/apps/insights/src/components/PriceFeeds/asset-classes-drawer.tsx index a7bf0c687d..1beb6189cb 100644 --- a/apps/insights/src/components/PriceFeeds/asset-classes-drawer.tsx +++ b/apps/insights/src/components/PriceFeeds/asset-classes-drawer.tsx @@ -15,7 +15,8 @@ import { useQueryStates, createSerializer, } from "nuqs"; -import { type ReactNode, useMemo } from "react"; +import type { ReactNode } from "react"; +import { useMemo } from "react"; import { useCollator } from "react-aria"; type Props = { diff --git a/apps/insights/src/components/PriceFeeds/index.tsx b/apps/insights/src/components/PriceFeeds/index.tsx index ebbbd2b3db..a4dece550e 100644 --- a/apps/insights/src/components/PriceFeeds/index.tsx +++ b/apps/insights/src/components/PriceFeeds/index.tsx @@ -5,10 +5,8 @@ import { ClockCountdown } from "@phosphor-icons/react/dist/ssr/ClockCountdown"; import { Star } from "@phosphor-icons/react/dist/ssr/Star"; import { Badge } from "@pythnetwork/component-library/Badge"; import { Button } from "@pythnetwork/component-library/Button"; -import { - type Props as CardProps, - Card, -} from "@pythnetwork/component-library/Card"; +import type { Props as CardProps } from "@pythnetwork/component-library/Card"; +import { Card } from "@pythnetwork/component-library/Card"; import { Drawer, DrawerTrigger } from "@pythnetwork/component-library/Drawer"; import { StatCard } from "@pythnetwork/component-library/StatCard"; import { TabList } from "@pythnetwork/component-library/TabList"; diff --git a/apps/insights/src/components/PriceFeeds/price-feeds-card.tsx b/apps/insights/src/components/PriceFeeds/price-feeds-card.tsx index 3e490a9891..c7f3ca44f3 100644 --- a/apps/insights/src/components/PriceFeeds/price-feeds-card.tsx +++ b/apps/insights/src/components/PriceFeeds/price-feeds-card.tsx @@ -7,11 +7,11 @@ import { Card } from "@pythnetwork/component-library/Card"; import { Paginator } from "@pythnetwork/component-library/Paginator"; import { SearchInput } from "@pythnetwork/component-library/SearchInput"; import { Select } from "@pythnetwork/component-library/Select"; -import { - type RowConfig, - type SortDescriptor, - Table, +import type { + RowConfig, + SortDescriptor, } from "@pythnetwork/component-library/Table"; +import { Table } from "@pythnetwork/component-library/Table"; import { useQueryState, parseAsString } from "nuqs"; import { Suspense, useCallback, useMemo } from "react"; import { useFilter, useCollator } from "react-aria"; diff --git a/apps/insights/src/components/PriceName/index.tsx b/apps/insights/src/components/PriceName/index.tsx index 5b37aeb2df..3f49bcc09b 100644 --- a/apps/insights/src/components/PriceName/index.tsx +++ b/apps/insights/src/components/PriceName/index.tsx @@ -9,7 +9,7 @@ export const PriceName = ({ assetClass, uppercase, plural }: Props) => uppercase ? "upcase" : "title" ]; -const getLabels = (assetClass?: string | undefined) => { +const getLabels = (assetClass?: string) => { if (assetClass === undefined) { return LABELS.ambiguous; } else { diff --git a/apps/insights/src/components/Publisher/get-price-feeds.tsx b/apps/insights/src/components/Publisher/get-price-feeds.tsx index 397396a06b..ee87dab147 100644 --- a/apps/insights/src/components/Publisher/get-price-feeds.tsx +++ b/apps/insights/src/components/Publisher/get-price-feeds.tsx @@ -1,9 +1,6 @@ import { getRankingsByPublisher } from "../../services/clickhouse"; -import { - type Cluster, - ClusterToName, - getFeedsForPublisher, -} from "../../services/pyth"; +import type { Cluster } from "../../services/pyth"; +import { ClusterToName, getFeedsForPublisher } from "../../services/pyth"; import { getStatus } from "../../status"; export const getPriceFeeds = async (cluster: Cluster, key: string) => { diff --git a/apps/insights/src/components/Publisher/performance.tsx b/apps/insights/src/components/Publisher/performance.tsx index abbd2dd96d..748805e9d0 100644 --- a/apps/insights/src/components/Publisher/performance.tsx +++ b/apps/insights/src/components/Publisher/performance.tsx @@ -22,7 +22,8 @@ import { ExplainInactive, ExplainAverage, } from "../Explanations"; -import { type Variant as NoResultsVariant, NoResults } from "../NoResults"; +import type { Variant as NoResultsVariant } from "../NoResults"; +import { NoResults } from "../NoResults"; import { PriceFeedTag } from "../PriceFeedTag"; import { PublisherIcon } from "../PublisherIcon"; import { PublisherTag } from "../PublisherTag"; diff --git a/apps/insights/src/components/Publisher/price-feed-drawer-provider.tsx b/apps/insights/src/components/Publisher/price-feed-drawer-provider.tsx index 0a24cc456a..911740cd11 100644 --- a/apps/insights/src/components/Publisher/price-feed-drawer-provider.tsx +++ b/apps/insights/src/components/Publisher/price-feed-drawer-provider.tsx @@ -2,14 +2,8 @@ import { useLogger } from "@pythnetwork/app-logger"; import { parseAsString, useQueryState } from "nuqs"; -import { - type ComponentProps, - Suspense, - createContext, - useMemo, - useCallback, - use, -} from "react"; +import type { ComponentProps } from "react"; +import { Suspense, createContext, useMemo, useCallback, use } from "react"; import { usePriceFeeds } from "../../hooks/use-price-feeds"; import type { Cluster } from "../../services/pyth"; diff --git a/apps/insights/src/components/Publisher/price-feeds-card.tsx b/apps/insights/src/components/Publisher/price-feeds-card.tsx index 0ed6948383..8c14f46a5c 100644 --- a/apps/insights/src/components/Publisher/price-feeds-card.tsx +++ b/apps/insights/src/components/Publisher/price-feeds-card.tsx @@ -1,6 +1,7 @@ "use client"; -import { type ComponentProps, useCallback } from "react"; +import type { ComponentProps } from "react"; +import { useCallback } from "react"; import { useSelectPriceFeed } from "./price-feed-drawer-provider"; import { usePriceFeeds } from "../../hooks/use-price-feeds"; diff --git a/apps/insights/src/components/Publisher/top-feeds-table.tsx b/apps/insights/src/components/Publisher/top-feeds-table.tsx index b388a95cbf..186b2ade05 100644 --- a/apps/insights/src/components/Publisher/top-feeds-table.tsx +++ b/apps/insights/src/components/Publisher/top-feeds-table.tsx @@ -1,6 +1,7 @@ "use client"; -import { type RowConfig, Table } from "@pythnetwork/component-library/Table"; +import type { RowConfig } from "@pythnetwork/component-library/Table"; +import { Table } from "@pythnetwork/component-library/Table"; import { useMemo } from "react"; import { useSelectPriceFeed } from "./price-feed-drawer-provider"; diff --git a/apps/insights/src/components/Publishers/publishers-card.tsx b/apps/insights/src/components/Publishers/publishers-card.tsx index ddaca905a3..56918ac736 100644 --- a/apps/insights/src/components/Publishers/publishers-card.tsx +++ b/apps/insights/src/components/Publishers/publishers-card.tsx @@ -9,14 +9,15 @@ import { Link } from "@pythnetwork/component-library/Link"; import { Paginator } from "@pythnetwork/component-library/Paginator"; import { SearchInput } from "@pythnetwork/component-library/SearchInput"; import { Select } from "@pythnetwork/component-library/Select"; -import { - type RowConfig, - type SortDescriptor, - Table, +import type { + RowConfig, + SortDescriptor, } from "@pythnetwork/component-library/Table"; +import { Table } from "@pythnetwork/component-library/Table"; import clsx from "clsx"; import { useQueryState, parseAsStringEnum } from "nuqs"; -import { type ReactNode, Suspense, useMemo, useCallback } from "react"; +import type { ReactNode } from "react"; +import { Suspense, useMemo, useCallback } from "react"; import { useFilter, useCollator } from "react-aria"; import styles from "./publishers-card.module.scss"; diff --git a/apps/insights/src/components/Root/footer.tsx b/apps/insights/src/components/Root/footer.tsx index d16e1c9512..7f9325edd6 100644 --- a/apps/insights/src/components/Root/footer.tsx +++ b/apps/insights/src/components/Root/footer.tsx @@ -1,7 +1,5 @@ -import { - type Props as ButtonProps, - Button, -} from "@pythnetwork/component-library/Button"; +import type { Props as ButtonProps } from "@pythnetwork/component-library/Button"; +import { Button } from "@pythnetwork/component-library/Button"; import { DrawerTrigger } from "@pythnetwork/component-library/Drawer"; import { Link } from "@pythnetwork/component-library/Link"; import type { ComponentProps, ElementType } from "react"; diff --git a/apps/insights/src/components/Root/mobile-nav-tabs.tsx b/apps/insights/src/components/Root/mobile-nav-tabs.tsx index 76597ccc81..dfefa9ca07 100644 --- a/apps/insights/src/components/Root/mobile-nav-tabs.tsx +++ b/apps/insights/src/components/Root/mobile-nav-tabs.tsx @@ -4,7 +4,8 @@ import { Link } from "@pythnetwork/component-library/unstyled/Link"; import clsx from "clsx"; import { motion } from "motion/react"; import { usePathname } from "next/navigation"; -import { type ReactNode, useId, useMemo } from "react"; +import type { ReactNode } from "react"; +import { useId, useMemo } from "react"; import styles from "./mobile-nav-tabs.module.scss"; diff --git a/apps/insights/src/components/Root/search-button.tsx b/apps/insights/src/components/Root/search-button.tsx index a26c0a2a1b..5ba7964f79 100644 --- a/apps/insights/src/components/Root/search-button.tsx +++ b/apps/insights/src/components/Root/search-button.tsx @@ -3,7 +3,8 @@ import { MagnifyingGlass } from "@phosphor-icons/react/dist/ssr/MagnifyingGlass"; import { Button } from "@pythnetwork/component-library/Button"; import { Skeleton } from "@pythnetwork/component-library/Skeleton"; -import { type ComponentProps, useMemo } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; import { useIsSSR } from "react-aria"; import { useToggleSearchDialog } from "./search-dialog"; diff --git a/apps/insights/src/components/Root/search-dialog.tsx b/apps/insights/src/components/Root/search-dialog.tsx index b0fa49231c..c750d17c10 100644 --- a/apps/insights/src/components/Root/search-dialog.tsx +++ b/apps/insights/src/components/Root/search-dialog.tsx @@ -17,9 +17,8 @@ import { } from "@pythnetwork/component-library/unstyled/ListBox"; import { useMediaQuery } from "@react-hookz/web"; import { useRouter } from "next/navigation"; +import type { ReactNode, ComponentProps } from "react"; import { - type ReactNode, - type ComponentProps, useState, useCallback, useEffect, @@ -435,9 +434,9 @@ const useSearchDialogStateContext = () => { ); useEffect(() => { - window.addEventListener("keydown", handleKeyDown); + globalThis.addEventListener("keydown", handleKeyDown); return () => { - window.removeEventListener("keydown", handleKeyDown); + globalThis.removeEventListener("keydown", handleKeyDown); }; }, [handleKeyDown]); diff --git a/apps/insights/src/components/Root/support-drawer.tsx b/apps/insights/src/components/Root/support-drawer.tsx index 15b5374872..433b9e3425 100644 --- a/apps/insights/src/components/Root/support-drawer.tsx +++ b/apps/insights/src/components/Root/support-drawer.tsx @@ -5,10 +5,8 @@ import { Coins } from "@phosphor-icons/react/dist/ssr/Coins"; import { Gavel } from "@phosphor-icons/react/dist/ssr/Gavel"; import { Plug } from "@phosphor-icons/react/dist/ssr/Plug"; import { ShieldChevron } from "@phosphor-icons/react/dist/ssr/ShieldChevron"; -import { - type Props as CardProps, - Card, -} from "@pythnetwork/component-library/Card"; +import type { Props as CardProps } from "@pythnetwork/component-library/Card"; +import { Card } from "@pythnetwork/component-library/Card"; import { Drawer } from "@pythnetwork/component-library/Drawer"; import type { Link as UnstyledLink } from "@pythnetwork/component-library/unstyled/Link"; import type { ComponentProps, ReactNode } from "react"; diff --git a/apps/insights/src/components/Root/tabs.tsx b/apps/insights/src/components/Root/tabs.tsx index 75842c5131..21778c2ad0 100644 --- a/apps/insights/src/components/Root/tabs.tsx +++ b/apps/insights/src/components/Root/tabs.tsx @@ -6,9 +6,10 @@ import { Tabs, } from "@pythnetwork/component-library/unstyled/Tabs"; import { useSelectedLayoutSegment, usePathname } from "next/navigation"; -import { type ComponentProps } from "react"; +import type { ComponentProps } from "react"; -import { type VariantArg, LayoutTransition } from "../LayoutTransition"; +import type { VariantArg } from "../LayoutTransition"; +import { LayoutTransition } from "../LayoutTransition"; export const TabRoot = ( props: Omit, "selectedKey">, diff --git a/apps/insights/src/components/Root/theme-switch.tsx b/apps/insights/src/components/Root/theme-switch.tsx index 67a21260a8..fddc15f709 100644 --- a/apps/insights/src/components/Root/theme-switch.tsx +++ b/apps/insights/src/components/Root/theme-switch.tsx @@ -4,20 +4,13 @@ import type { IconProps } from "@phosphor-icons/react"; import { Desktop } from "@phosphor-icons/react/dist/ssr/Desktop"; import { Moon } from "@phosphor-icons/react/dist/ssr/Moon"; import { Sun } from "@phosphor-icons/react/dist/ssr/Sun"; -import { - type Props as ButtonProps, - Button, -} from "@pythnetwork/component-library/Button"; +import type { Props as ButtonProps } from "@pythnetwork/component-library/Button"; +import { Button } from "@pythnetwork/component-library/Button"; import clsx from "clsx"; import { motion } from "motion/react"; import { useTheme } from "next-themes"; -import { - type ReactNode, - type ElementType, - useCallback, - useRef, - useMemo, -} from "react"; +import type { ReactNode, ElementType } from "react"; +import { useCallback, useRef, useMemo } from "react"; import { useIsSSR } from "react-aria"; import styles from "./theme-switch.module.scss"; diff --git a/apps/insights/src/components/SemicircleMeter/index.tsx b/apps/insights/src/components/SemicircleMeter/index.tsx index 8226ef31ee..e69fb6e712 100644 --- a/apps/insights/src/components/SemicircleMeter/index.tsx +++ b/apps/insights/src/components/SemicircleMeter/index.tsx @@ -3,7 +3,8 @@ import { Meter } from "@pythnetwork/component-library/unstyled/Meter"; import clsx from "clsx"; import dynamic from "next/dynamic"; -import { type ComponentProps, type CSSProperties, Suspense } from "react"; +import type { ComponentProps, CSSProperties } from "react"; +import { Suspense } from "react"; import { PolarAngleAxis, RadialBar } from "recharts"; import styles from "./index.module.scss"; diff --git a/apps/insights/src/components/Tabs/index.tsx b/apps/insights/src/components/Tabs/index.tsx index c2d37547cd..6ab5994f9f 100644 --- a/apps/insights/src/components/Tabs/index.tsx +++ b/apps/insights/src/components/Tabs/index.tsx @@ -6,7 +6,8 @@ import { Tabs as UnstyledTabs, } from "@pythnetwork/component-library/unstyled/Tabs"; import { useSelectedLayoutSegment, usePathname } from "next/navigation"; -import { useMemo, type ComponentProps } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; import { LayoutTransition } from "../LayoutTransition"; diff --git a/apps/insights/src/components/ZoomLayoutTransition/index.tsx b/apps/insights/src/components/ZoomLayoutTransition/index.tsx index 33afd0ac4b..16dd3cb534 100644 --- a/apps/insights/src/components/ZoomLayoutTransition/index.tsx +++ b/apps/insights/src/components/ZoomLayoutTransition/index.tsx @@ -2,7 +2,8 @@ import type { ReactNode } from "react"; -import { type VariantArg, LayoutTransition } from "../LayoutTransition"; +import type { VariantArg } from "../LayoutTransition"; +import { LayoutTransition } from "../LayoutTransition"; type Props = { children: ReactNode; diff --git a/apps/insights/src/hooks/use-data.ts b/apps/insights/src/hooks/use-data.ts index 17f15bd77e..c5eb6d9a7c 100644 --- a/apps/insights/src/hooks/use-data.ts +++ b/apps/insights/src/hooks/use-data.ts @@ -1,6 +1,7 @@ import { useLogger } from "@pythnetwork/app-logger"; import { useCallback } from "react"; -import useSWR, { type KeyedMutator } from "swr"; +import type { KeyedMutator } from "swr"; +import useSWR from "swr"; export const useData = ( key: Parameters>[0], diff --git a/apps/insights/src/hooks/use-live-price-data.tsx b/apps/insights/src/hooks/use-live-price-data.tsx index 24a7ff0e5e..53bf948b0c 100644 --- a/apps/insights/src/hooks/use-live-price-data.tsx +++ b/apps/insights/src/hooks/use-live-price-data.tsx @@ -4,8 +4,8 @@ import { useLogger } from "@pythnetwork/app-logger"; import type { PriceData } from "@pythnetwork/client"; import { useMap } from "@react-hookz/web"; import { PublicKey } from "@solana/web3.js"; +import type { ComponentProps } from "react"; import { - type ComponentProps, use, createContext, useEffect, diff --git a/apps/insights/src/hooks/use-price-feeds.tsx b/apps/insights/src/hooks/use-price-feeds.tsx index decb024bf7..144e309459 100644 --- a/apps/insights/src/hooks/use-price-feeds.tsx +++ b/apps/insights/src/hooks/use-price-feeds.tsx @@ -1,6 +1,7 @@ "use client"; -import { type ReactNode, type ComponentProps, createContext, use } from "react"; +import type { ReactNode, ComponentProps } from "react"; +import { createContext, use } from "react"; import type { Cluster } from "../services/pyth"; diff --git a/apps/insights/src/hooks/use-query-param-filter-pagination.ts b/apps/insights/src/hooks/use-query-param-filter-pagination.ts index fc1f7fd601..6a80de88d1 100644 --- a/apps/insights/src/hooks/use-query-param-filter-pagination.ts +++ b/apps/insights/src/hooks/use-query-param-filter-pagination.ts @@ -16,13 +16,11 @@ export const useQueryParamFilterPagination = ( items: T[], predicate: (item: T, term: string) => boolean, doSort: (a: T, b: T, descriptor: SortDescriptor) => number, - options?: - | { - defaultPageSize?: number | undefined; - defaultSort?: string | undefined; - defaultDescending?: boolean; - } - | undefined, + options?: { + defaultPageSize?: number | undefined; + defaultSort?: string | undefined; + defaultDescending?: boolean; + }, ) => { const logger = useLogger(); diff --git a/apps/insights/src/omit-keys.ts b/apps/insights/src/omit-keys.ts index a9aedd5dc0..bd77f9d1db 100644 --- a/apps/insights/src/omit-keys.ts +++ b/apps/insights/src/omit-keys.ts @@ -1,7 +1,4 @@ -export const omitKeys = >( - obj: T, - keys: string[], -) => { +export const omitKeys = (obj: Record, keys: string[]) => { const omitSet = new Set(keys); return Object.fromEntries( Object.entries(obj).filter(([key]) => !omitSet.has(key)), diff --git a/apps/insights/src/services/clickhouse.ts b/apps/insights/src/services/clickhouse.ts index c444cc4666..c6796a4cc8 100644 --- a/apps/insights/src/services/clickhouse.ts +++ b/apps/insights/src/services/clickhouse.ts @@ -1,7 +1,8 @@ import "server-only"; import { createClient } from "@clickhouse/client"; -import { z, type ZodSchema, type ZodTypeDef } from "zod"; +import type { ZodSchema, ZodTypeDef } from "zod"; +import { z } from "zod"; import { Cluster, ClusterToName } from "./pyth"; import { CLICKHOUSE } from "../config/server"; diff --git a/apps/staking/jest.config.js b/apps/staking/jest.config.js index b7edcf4c8a..0bac66ed0e 100644 --- a/apps/staking/jest.config.js +++ b/apps/staking/jest.config.js @@ -1 +1 @@ -export { nextjs as default } from "@cprussin/jest-config"; +export { nextjs as default } from "@cprussin/jest-config/next"; diff --git a/apps/staking/package.json b/apps/staking/package.json index d4e4d57f62..f0c2e237e3 100644 --- a/apps/staking/package.json +++ b/apps/staking/package.json @@ -19,60 +19,58 @@ "test:unit": "jest --selectProjects unit" }, "dependencies": { - "@amplitude/analytics-browser": "^2.9.3", - "@amplitude/plugin-autocapture-browser": "^0.9.0", - "@bonfida/spl-name-service": "^3.0.0", - "@heroicons/react": "^2.1.4", - "@next/third-parties": "^14.2.5", + "@amplitude/analytics-browser": "catalog:", + "@amplitude/plugin-autocapture-browser": "catalog:", + "@bonfida/spl-name-service": "catalog:", + "@heroicons/react": "catalog:", + "@next/third-parties": "catalog:", "@pythnetwork/hermes-client": "workspace:*", "@pythnetwork/known-publishers": "workspace:*", "@pythnetwork/staking-sdk": "workspace:*", - "@react-aria/toast": "3.0.0-beta.16", - "@react-hookz/web": "^24.0.4", - "@react-stately/toast": "3.0.0-beta.6", - "@solana/wallet-adapter-base": "^0.9.23", - "@solana/wallet-adapter-react": "^0.15.35", - "@solana/wallet-adapter-react-ui": "^0.9.35", - "@solana/wallet-adapter-wallets": "0.19.10", - "@solana/web3.js": "1.92.3", - "@vercel/functions": "^1.5.0", - "bcp-47": "^2.1.0", - "clsx": "^2.1.1", - "dnum": "^2.13.1", + "@react-hookz/web": "catalog:", + "@solana/wallet-adapter-base": "catalog:", + "@solana/wallet-adapter-react": "catalog:", + "@solana/wallet-adapter-react-ui": "catalog:", + "@solana/wallet-adapter-wallets": "catalog:", + "@solana/web3.js": "catalog:", + "@vercel/functions": "catalog:", + "bcp-47": "catalog:", + "clsx": "catalog:", + "dnum": "catalog:", "framer-motion": "catalog:", - "ip-range-check": "^0.2.0", + "ip-range-check": "catalog:", "next": "catalog:", - "pino": "^9.3.2", - "proxycheck-ts": "^0.0.11", + "pino": "catalog:", + "proxycheck-ts": "catalog:", "react": "catalog:", "react-aria": "catalog:", "react-aria-components": "catalog:", "react-dom": "catalog:", - "recharts": "^2.13.3", - "swr": "^2.2.5", - "zod": "^3.23.8" + "recharts": "catalog:", + "swr": "catalog:", + "zod": "catalog:" }, "devDependencies": { - "@axe-core/react": "^4.9.1", + "@axe-core/react": "catalog:", "@cprussin/eslint-config": "catalog:", "@cprussin/jest-config": "catalog:", "@cprussin/prettier-config": "catalog:", "@cprussin/tsconfig": "catalog:", - "@svgr/webpack": "^8.1.0", - "@tailwindcss/forms": "^0.5.7", - "@types/jest": "^29.5.12", - "@types/node": "^22.0.0", + "@svgr/webpack": "catalog:", + "@tailwindcss/forms": "catalog:", + "@types/jest": "catalog:", + "@types/node": "catalog:", "@types/react": "catalog:", "@types/react-dom": "catalog:", - "autoprefixer": "^10.4.19", - "eslint": "^9.8.0", - "jest": "^29.7.0", - "postcss": "^8.4.40", + "autoprefixer": "catalog:", + "eslint": "catalog:", + "jest": "catalog:", + "postcss": "catalog:", "prettier": "catalog:", - "tailwindcss": "^3.4.7", - "tailwindcss-animate": "^1.0.7", - "tailwindcss-react-aria-components": "^1.1.5", - "typescript": "^5.5.4", - "vercel": "^35.2.2" + "tailwindcss": "catalog:", + "tailwindcss-animate": "catalog:", + "tailwindcss-react-aria-components": "catalog:", + "typescript": "catalog:", + "vercel": "catalog:" } } diff --git a/apps/staking/src/api.ts b/apps/staking/src/api.ts index cdd7011e96..3619ac49c6 100644 --- a/apps/staking/src/api.ts +++ b/apps/staking/src/api.ts @@ -1,5 +1,6 @@ import type { HermesClient, PublisherCaps } from "@pythnetwork/hermes-client"; import { lookup } from "@pythnetwork/known-publishers"; +import type { StakeAccountPositions } from "@pythnetwork/staking-sdk"; import { epochToDate, extractPublisherData, @@ -8,7 +9,6 @@ import { PositionState, PythnetClient, PythStakingClient, - type StakeAccountPositions, } from "@pythnetwork/staking-sdk"; import { PublicKey } from "@solana/web3.js"; import { z } from "zod"; @@ -102,7 +102,7 @@ export const loadData = async ( client: PythStakingClient, pythnetClient: PythnetClient, hermesClient: HermesClient, - stakeAccount?: PublicKey | undefined, + stakeAccount?: PublicKey, simulationPayer?: PublicKey, ): Promise => stakeAccount === undefined diff --git a/apps/staking/src/components/AccountSummary/index.tsx b/apps/staking/src/components/AccountSummary/index.tsx index 107dc89992..0c1044a767 100644 --- a/apps/staking/src/components/AccountSummary/index.tsx +++ b/apps/staking/src/components/AccountSummary/index.tsx @@ -2,20 +2,16 @@ import { InformationCircleIcon } from "@heroicons/react/24/outline"; import { epochToDate } from "@pythnetwork/staking-sdk"; import clsx from "clsx"; import Image from "next/image"; -import { - type ComponentProps, - type ReactNode, - useCallback, - useState, - useMemo, -} from "react"; +import type { ComponentProps, ReactNode } from "react"; +import { useCallback, useState, useMemo } from "react"; import { DialogTrigger, Button as ReactAriaButton, } from "react-aria-components"; import background from "./background.png"; -import { type States, StateType as ApiStateType } from "../../hooks/use-api"; +import type { States } from "../../hooks/use-api"; +import { StateType as ApiStateType } from "../../hooks/use-api"; import { StateType, useAsync } from "../../hooks/use-async"; import { useToast } from "../../hooks/use-toast"; import { Button } from "../Button"; diff --git a/apps/staking/src/components/CopyButton/index.tsx b/apps/staking/src/components/CopyButton/index.tsx index 8754904058..0289883f93 100644 --- a/apps/staking/src/components/CopyButton/index.tsx +++ b/apps/staking/src/components/CopyButton/index.tsx @@ -1,6 +1,7 @@ import { ClipboardDocumentIcon, CheckIcon } from "@heroicons/react/24/outline"; import clsx from "clsx"; -import { type ComponentProps, useCallback, useEffect, useState } from "react"; +import type { ComponentProps } from "react"; +import { useCallback, useEffect, useState } from "react"; import { Button } from "react-aria-components"; import { useLogger } from "../../hooks/use-logger"; diff --git a/apps/staking/src/components/Dashboard/index.tsx b/apps/staking/src/components/Dashboard/index.tsx index 940d18fb91..74f1607ca5 100644 --- a/apps/staking/src/components/Dashboard/index.tsx +++ b/apps/staking/src/components/Dashboard/index.tsx @@ -1,15 +1,9 @@ import { useLocalStorageValue } from "@react-hookz/web"; import clsx from "clsx"; -import Image, { type StaticImageData } from "next/image"; -import { - type ComponentProps, - type ReactNode, - type FormEvent, - useState, - useMemo, - useEffect, - useCallback, -} from "react"; +import type { StaticImageData } from "next/image"; +import Image from "next/image"; +import type { ComponentProps, ReactNode, FormEvent } from "react"; +import { useState, useMemo, useEffect, useCallback } from "react"; import { Tabs, TabList, TabPanel, Tab, Form } from "react-aria-components"; import type { States, StateType as ApiStateType } from "../../hooks/use-api"; @@ -252,7 +246,7 @@ const useIntegrityStakingSum = ( [publishers, field], ); -// eslint-disable-next-line unicorn/no-array-reduce +// eslint-disable-next-line unicorn/no-array-reduce, unicorn/prefer-math-min-max const bigIntMin = (...args: bigint[]) => args.reduce((m, e) => (e < m ? e : m)); type TabId = Exclude["selectedKey"], undefined>; @@ -274,12 +268,12 @@ const Journey = ({ }: JourneyProps) => ( -
+
{longText} diff --git a/apps/staking/src/components/Date/index.tsx b/apps/staking/src/components/Date/index.tsx index 467aaeb92c..d2516b17fe 100644 --- a/apps/staking/src/components/Date/index.tsx +++ b/apps/staking/src/components/Date/index.tsx @@ -1,5 +1,7 @@ -import { useMemo, type HTMLProps } from "react"; -import { useDateFormatter, type DateFormatterOptions } from "react-aria"; +import type { HTMLProps } from "react"; +import { useMemo } from "react"; +import type { DateFormatterOptions } from "react-aria"; +import { useDateFormatter } from "react-aria"; type Props = Omit, "children"> & { children: Date; diff --git a/apps/staking/src/components/ErrorMessage/index.tsx b/apps/staking/src/components/ErrorMessage/index.tsx index 410b4b39d5..2efb1d78f9 100644 --- a/apps/staking/src/components/ErrorMessage/index.tsx +++ b/apps/staking/src/components/ErrorMessage/index.tsx @@ -49,9 +49,6 @@ const UnknownError = ({ error }: { error: unknown }) => {
, "title"> & { @@ -60,9 +56,6 @@ export const Faq = ({ title, questions, className, ...props }: Props) => { { {({ title, icon: Icon, index }) => ( - +
STEP {index + 1}
-
+
{title}
@@ -95,7 +95,7 @@ export const Guide = ({ title, description, steps, ...props }: Props) => { {({ title, index: subtabIndex }) => ( {title} diff --git a/apps/staking/src/components/Header/current-stake-account.tsx b/apps/staking/src/components/Header/current-stake-account.tsx index 5e62639585..aae48161d5 100644 --- a/apps/staking/src/components/Header/current-stake-account.tsx +++ b/apps/staking/src/components/Header/current-stake-account.tsx @@ -2,7 +2,7 @@ import clsx from "clsx"; import { useSelectedLayoutSegment } from "next/navigation"; -import { type HTMLProps } from "react"; +import type { HTMLProps } from "react"; import { VPN_BLOCKED_SEGMENT } from "../../config/isomorphic"; import { StateType as ApiStateType, useApi } from "../../hooks/use-api"; diff --git a/apps/staking/src/components/Home/index.tsx b/apps/staking/src/components/Home/index.tsx index 21b9cd032e..102f1a1c46 100644 --- a/apps/staking/src/components/Home/index.tsx +++ b/apps/staking/src/components/Home/index.tsx @@ -2,11 +2,8 @@ import { useIsSSR } from "react-aria"; -import { - type States, - StateType as ApiStateType, - useApi, -} from "../../hooks/use-api"; +import type { States } from "../../hooks/use-api"; +import { StateType as ApiStateType, useApi } from "../../hooks/use-api"; import { StateType as DashboardDataStateType, useData, diff --git a/apps/staking/src/components/Menu/index.tsx b/apps/staking/src/components/Menu/index.tsx index 752c81dfb5..4b681cac9f 100644 --- a/apps/staking/src/components/Menu/index.tsx +++ b/apps/staking/src/components/Menu/index.tsx @@ -9,7 +9,7 @@ import { Popover, Menu as BaseMenu, MenuItem as BaseMenuItem, - Section as BaseSection, + MenuSection as BaseSection, Separator as BaseSeparator, } from "react-aria-components"; diff --git a/apps/staking/src/components/NoWalletHome/index.tsx b/apps/staking/src/components/NoWalletHome/index.tsx index 58201093d8..0f54355978 100644 --- a/apps/staking/src/components/NoWalletHome/index.tsx +++ b/apps/staking/src/components/NoWalletHome/index.tsx @@ -1,17 +1,10 @@ import { WalletIcon } from "@heroicons/react/24/outline"; import { useWalletModal } from "@solana/wallet-adapter-react-ui"; import clsx from "clsx"; -import Image, { type StaticImageData } from "next/image"; -import { - type ReactNode, - type ComponentType, - type SVGProps, - type ComponentProps, - useCallback, - useState, - useRef, - useEffect, -} from "react"; +import type { StaticImageData } from "next/image"; +import Image from "next/image"; +import type { ReactNode, ComponentType, SVGProps, ComponentProps } from "react"; +import { useCallback, useState, useRef, useEffect } from "react"; import { Tabs, TabList, Tab, TabPanel } from "react-aria-components"; import governance from "./governance.png"; @@ -211,19 +204,19 @@ const ProgramTab = ({ }: ProgramTabProps) => ( -
+
{description}
-
+
{children}
diff --git a/apps/staking/src/components/OracleIntegrityStaking/index.tsx b/apps/staking/src/components/OracleIntegrityStaking/index.tsx index a90fb8f8e4..414f32d689 100644 --- a/apps/staking/src/components/OracleIntegrityStaking/index.tsx +++ b/apps/staking/src/components/OracleIntegrityStaking/index.tsx @@ -11,18 +11,14 @@ import type { lookup } from "@pythnetwork/known-publishers"; import { calculateApy } from "@pythnetwork/staking-sdk"; import { PublicKey } from "@solana/web3.js"; import clsx from "clsx"; -import { - useMemo, - useCallback, - useState, - useRef, - createElement, - type ComponentProps, - type Dispatch, - type SetStateAction, - type HTMLAttributes, - type FormEvent, +import type { + ComponentProps, + Dispatch, + SetStateAction, + HTMLAttributes, + FormEvent, } from "react"; +import { useMemo, useCallback, useState, useRef, createElement } from "react"; import { useFilter, useCollator } from "react-aria"; import { SearchField, @@ -35,7 +31,8 @@ import { MenuTrigger, } from "react-aria-components"; -import { type States, StateType as ApiStateType } from "../../hooks/use-api"; +import type { States } from "../../hooks/use-api"; +import { StateType as ApiStateType } from "../../hooks/use-api"; import { StateType as UseAsyncStateType, useAsync, diff --git a/apps/staking/src/components/Root/i18n-provider.tsx b/apps/staking/src/components/Root/i18n-provider.tsx index 1a9c88513f..efabd850b1 100644 --- a/apps/staking/src/components/Root/i18n-provider.tsx +++ b/apps/staking/src/components/Root/i18n-provider.tsx @@ -1,7 +1,8 @@ "use client"; import { parse } from "bcp-47"; -import { useMemo, type ComponentProps } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; import { I18nProvider as I18nProviderBase, useIsSSR } from "react-aria"; const SUPPORTED_LANGUAGES = new Set(["en"]); @@ -15,7 +16,7 @@ export const I18nProvider = ( () => isSSR ? DEFAULT_LOCALE - : (window.navigator.languages.find((locale) => { + : (globalThis.navigator.languages.find((locale) => { const language = parse(locale).language; return ( language !== undefined && diff --git a/apps/staking/src/components/Root/toast-region.tsx b/apps/staking/src/components/Root/toast-region.tsx index c22d5193fe..b434fb5135 100644 --- a/apps/staking/src/components/Root/toast-region.tsx +++ b/apps/staking/src/components/Root/toast-region.tsx @@ -1,94 +1,100 @@ "use client"; import { XMarkIcon } from "@heroicons/react/24/solid"; -import { - type AriaToastRegionProps, - type AriaToastProps, - useToastRegion, - useToast as reactAriaUseToast, -} from "@react-aria/toast"; import clsx from "clsx"; -import { useRef, useState } from "react"; -import { Button } from "react-aria-components"; - +import { AnimatePresence, motion } from "framer-motion"; +import type { ComponentProps } from "react"; +import { useState, useCallback } from "react"; import { - type Toast as ToastContentType, - ToastType, - useToast, -} from "../../hooks/use-toast"; + Button, + Text, + UNSTABLE_Toast as BaseToast, + UNSTABLE_ToastContent as BaseToastContent, + UNSTABLE_ToastRegion as BaseToastRegion, +} from "react-aria-components"; + +import type { Toast as ToastContentType } from "../../hooks/use-toast"; +import { ToastType, useToast } from "../../hooks/use-toast"; import { ErrorMessage } from "../ErrorMessage"; -export const ToastRegion = (props: AriaToastRegionProps) => { - const state = useToast(); - const ref = useRef(null); - const { regionProps } = useToastRegion(props, state, ref); +const MotionBaseToast = motion(BaseToast); + +export const ToastRegion = ( + props: Omit< + ComponentProps>, + "queue" | "children" + >, +) => { + const toast = useToast(); return ( -
- {state.visibleToasts.map((toast) => ( - - ))} -
+ {({ toast }) => } + ); }; -const Toast = (props: AriaToastProps) => { +const Toast = (props: ComponentProps>) => { + const toast = useToast(); + const [isVisible, setIsVisible] = useState(true); const [isTimerStarted, setIsTimerStarted] = useState(false); - const state = useToast(); - const ref = useRef(null); - const { toastProps, contentProps, titleProps, closeButtonProps } = - reactAriaUseToast(props, state, ref); + const hide = useCallback(() => { + setIsVisible(false); + }, [setIsVisible]); + const handlePresenceAnimationComplete = useCallback( + (name: string) => { + if (name === "exit") { + toast.queue.close(props.toast.key); + } else { + setIsTimerStarted(true); + } + }, + [toast, props.toast, setIsTimerStarted], + ); return ( -
{ - if ( - props.toast.animation === "entering" || - props.toast.animation === "queued" - ) { - setIsTimerStarted(true); - } - if (props.toast.animation === "exiting") { - state.remove(props.toast.key); - } - }} - > -
-
{ - state.close(props.toast.key); - }} - /> -
-
-
- {props.toast.content} -
+ + {isVisible && ( + +
+
+ + + {props.toast.content} + + +
- -
-
-
+ + )} + ); }; diff --git a/apps/staking/src/components/RouterProvider/index.tsx b/apps/staking/src/components/RouterProvider/index.tsx index b5ec660ae4..75de748296 100644 --- a/apps/staking/src/components/RouterProvider/index.tsx +++ b/apps/staking/src/components/RouterProvider/index.tsx @@ -1,7 +1,8 @@ "use client"; import { useRouter } from "next/navigation"; -import { type ComponentProps, useCallback } from "react"; +import type { ComponentProps } from "react"; +import { useCallback } from "react"; import { RouterProvider as ReactAriaRouterProvider } from "react-aria-components"; export const RouterProvider = ( diff --git a/apps/staking/src/components/Tokens/index.tsx b/apps/staking/src/components/Tokens/index.tsx index 6c7d5e046c..7c7a0268cc 100644 --- a/apps/staking/src/components/Tokens/index.tsx +++ b/apps/staking/src/components/Tokens/index.tsx @@ -2,7 +2,8 @@ import clsx from "clsx"; import * as dnum from "dnum"; -import { type ComponentProps, useMemo } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; import { Button, TooltipTrigger, useLocale } from "react-aria-components"; import Pyth from "./pyth.svg"; diff --git a/apps/staking/src/components/TransferButton/index.tsx b/apps/staking/src/components/TransferButton/index.tsx index bcf5544e8d..bd52b087d3 100644 --- a/apps/staking/src/components/TransferButton/index.tsx +++ b/apps/staking/src/components/TransferButton/index.tsx @@ -1,11 +1,5 @@ -import { - type ComponentProps, - type ReactNode, - type FormEvent, - useCallback, - useMemo, - useState, -} from "react"; +import type { ComponentProps, ReactNode, FormEvent } from "react"; +import { useCallback, useMemo, useState } from "react"; import { DialogTrigger, TextField, diff --git a/apps/staking/src/components/TruncatedKey/index.tsx b/apps/staking/src/components/TruncatedKey/index.tsx index 9373194b2e..7fcdfea35b 100644 --- a/apps/staking/src/components/TruncatedKey/index.tsx +++ b/apps/staking/src/components/TruncatedKey/index.tsx @@ -1,5 +1,6 @@ import type { PublicKey } from "@solana/web3.js"; -import { useMemo, type HTMLAttributes } from "react"; +import type { HTMLAttributes } from "react"; +import { useMemo } from "react"; type Props = Omit, "children"> & { children: PublicKey | `0x${string}`; diff --git a/apps/staking/src/components/WalletButton/index.tsx b/apps/staking/src/components/WalletButton/index.tsx index ea90ee80c8..11502f5787 100644 --- a/apps/staking/src/components/WalletButton/index.tsx +++ b/apps/staking/src/components/WalletButton/index.tsx @@ -14,13 +14,8 @@ import { useWalletModal } from "@solana/wallet-adapter-react-ui"; import type { PublicKey } from "@solana/web3.js"; import clsx from "clsx"; import { useSelectedLayoutSegment } from "next/navigation"; -import { - type ComponentProps, - type ReactNode, - useCallback, - useMemo, - type ReactElement, -} from "react"; +import type { ComponentProps, ReactNode, ReactElement } from "react"; +import { useCallback, useMemo } from "react"; import { MenuTrigger, SubmenuTrigger, @@ -30,11 +25,8 @@ import { } from "react-aria-components"; import { VPN_BLOCKED_SEGMENT } from "../../config/isomorphic"; -import { - StateType as ApiStateType, - type States, - useApi, -} from "../../hooks/use-api"; +import type { States } from "../../hooks/use-api"; +import { StateType as ApiStateType, useApi } from "../../hooks/use-api"; import { StateType as DataStateType, useData } from "../../hooks/use-data"; import { useLogger } from "../../hooks/use-logger"; import { useNetwork } from "../../hooks/use-network"; diff --git a/apps/staking/src/components/WalletProvider/index.tsx b/apps/staking/src/components/WalletProvider/index.tsx index cbc2eb0720..87b6ea9d70 100644 --- a/apps/staking/src/components/WalletProvider/index.tsx +++ b/apps/staking/src/components/WalletProvider/index.tsx @@ -7,18 +7,16 @@ import { } from "@solana/wallet-adapter-react"; import { WalletModalProvider } from "@solana/wallet-adapter-react-ui"; import { - BraveWalletAdapter, - BackpackWalletAdapter, CoinbaseWalletAdapter, PhantomWalletAdapter, - GlowWalletAdapter, LedgerWalletAdapter, SolflareWalletAdapter, TorusWalletAdapter, WalletConnectWalletAdapter, } from "@solana/wallet-adapter-wallets"; import { clusterApiUrl } from "@solana/web3.js"; -import { type ReactNode, useMemo } from "react"; +import type { ReactNode } from "react"; +import { useMemo } from "react"; import { useNetwork } from "../../hooks/use-network"; import { metadata } from "../../metadata"; @@ -52,11 +50,8 @@ export const WalletProvider = ({ const wallets = useMemo( () => [ - new BraveWalletAdapter(), - new BackpackWalletAdapter(), new CoinbaseWalletAdapter(), new PhantomWalletAdapter(), - new GlowWalletAdapter(), new LedgerWalletAdapter(), new SolflareWalletAdapter(), new TorusWalletAdapter(), diff --git a/apps/staking/src/hooks/use-api.tsx b/apps/staking/src/hooks/use-api.tsx index a998b5b8aa..5d4a6a9c4d 100644 --- a/apps/staking/src/hooks/use-api.tsx +++ b/apps/staking/src/hooks/use-api.tsx @@ -5,7 +5,8 @@ import { PythnetClient, PythStakingClient } from "@pythnetwork/staking-sdk"; import { useLocalStorageValue } from "@react-hookz/web"; import { useConnection, useWallet } from "@solana/wallet-adapter-react"; import { Connection, PublicKey } from "@solana/web3.js"; -import { type ComponentProps, createContext, useContext, useMemo } from "react"; +import type { ComponentProps } from "react"; +import { createContext, useContext, useMemo } from "react"; import { useSWRConfig } from "swr"; import { StateType as DataStateType, useData } from "./use-data"; diff --git a/apps/staking/src/hooks/use-data.ts b/apps/staking/src/hooks/use-data.ts index 94d7d0a3c5..8d889123a4 100644 --- a/apps/staking/src/hooks/use-data.ts +++ b/apps/staking/src/hooks/use-data.ts @@ -1,5 +1,6 @@ import { useCallback } from "react"; -import useSWR, { type KeyedMutator } from "swr"; +import type { KeyedMutator } from "swr"; +import useSWR from "swr"; import { useLogger } from "./use-logger"; diff --git a/apps/staking/src/hooks/use-logger.tsx b/apps/staking/src/hooks/use-logger.tsx index 2013526cb7..f429061e4b 100644 --- a/apps/staking/src/hooks/use-logger.tsx +++ b/apps/staking/src/hooks/use-logger.tsx @@ -1,7 +1,9 @@ "use client"; -import pino, { type Logger } from "pino"; -import { type ComponentProps, createContext, useContext, useMemo } from "react"; +import type { Logger } from "pino"; +import pino from "pino"; +import type { ComponentProps } from "react"; +import { createContext, useContext, useMemo } from "react"; const LoggerContext = createContext>(undefined); diff --git a/apps/staking/src/hooks/use-network.tsx b/apps/staking/src/hooks/use-network.tsx index 4ab9fa764b..8dbc96c3ad 100644 --- a/apps/staking/src/hooks/use-network.tsx +++ b/apps/staking/src/hooks/use-network.tsx @@ -1,12 +1,7 @@ "use client"; -import { - type ComponentProps, - createContext, - useContext, - useState, - useCallback, -} from "react"; +import type { ComponentProps } from "react"; +import { createContext, useContext, useState, useCallback } from "react"; const NetworkContext = createContext(undefined); diff --git a/apps/staking/src/hooks/use-toast.tsx b/apps/staking/src/hooks/use-toast.tsx index f2695051be..f2ab1226fd 100644 --- a/apps/staking/src/hooks/use-toast.tsx +++ b/apps/staking/src/hooks/use-toast.tsx @@ -1,16 +1,8 @@ "use client"; -import { - type ToastState as BaseToastState, - useToastState, -} from "@react-stately/toast"; -import { - type ComponentProps, - type ReactNode, - createContext, - useContext, - useCallback, -} from "react"; +import type { ComponentProps, ReactNode } from "react"; +import { createContext, useContext, useCallback, useMemo } from "react"; +import { UNSTABLE_ToastQueue as ToastQueue } from "react-aria-components"; export enum ToastType { Success, @@ -25,7 +17,8 @@ const Toast = { }; export type Toast = ReturnType<(typeof Toast)[keyof typeof Toast]>; -type ToastState = BaseToastState & { +type ToastState = { + queue: ToastQueue; success: (message: ReactNode) => void; error: (error: unknown) => void; }; @@ -38,23 +31,24 @@ type ToastContextProps = Omit< >; export const ToastProvider = (props: ToastContextProps) => { - const toast = useToastState({ - maxVisibleToasts: 3, - hasExitAnimation: true, - }); + const queue = useMemo( + () => + new ToastQueue({ + maxVisibleToasts: 3, + }), + [], + ); const success = useCallback( - (message: ReactNode) => toast.add(Toast.Success(message)), - [toast], + (message: ReactNode) => queue.add(Toast.Success(message)), + [queue], ); const error = useCallback( - (error: unknown) => toast.add(Toast.ErrorToast(error)), - [toast], + (error: unknown) => queue.add(Toast.ErrorToast(error)), + [queue], ); - return ( - - ); + return ; }; export const useToast = () => { diff --git a/apps/staking/src/middleware.ts b/apps/staking/src/middleware.ts index e5c06a3962..d6e19980d4 100644 --- a/apps/staking/src/middleware.ts +++ b/apps/staking/src/middleware.ts @@ -1,6 +1,8 @@ -import { type Geo, geolocation, ipAddress } from "@vercel/functions"; +import type { Geo } from "@vercel/functions"; +import { geolocation, ipAddress } from "@vercel/functions"; import ipRangeCheck from "ip-range-check"; -import { type NextRequest, NextResponse } from "next/server"; +import type { NextRequest } from "next/server"; +import { NextResponse } from "next/server"; import ProxyCheck from "proxycheck-ts"; import { diff --git a/apps/staking/tailwind.config.ts b/apps/staking/tailwind.config.ts index 1fc1e2460c..98eaa278c2 100644 --- a/apps/staking/tailwind.config.ts +++ b/apps/staking/tailwind.config.ts @@ -11,9 +11,9 @@ const tailwindConfig = { forms, animate, reactAria, - tailwindPlugin(({ addVariant }) => { - addVariant("search-cancel", "&::-webkit-search-cancel-button"); - addVariant("search-decoration", "&::-webkit-search-decoration"); + tailwindPlugin((plugin) => { + plugin.addVariant("search-cancel", "&::-webkit-search-cancel-button"); + plugin.addVariant("search-decoration", "&::-webkit-search-decoration"); }), ], theme: { diff --git a/flake.lock b/flake.lock index 78a5445220..26171d154c 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1736916747, - "narHash": "sha256-ZqZQVXR1tIjfXGpZ+A3YuJzUuOKT7JfTAO/FTrQBQug=", + "lastModified": 1742091044, + "narHash": "sha256-uygocyOFl9KlzpUbQrYn0/D0eE5rc+jRp+5qqm+0L3Q=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e6b98fad93f8c937bc20ee3fbc2e1897266fe59c", + "rev": "fb6ff3988cc0f68d23b6db9cd70b87f2f88e1a32", "type": "github" }, "original": { diff --git a/governance/pyth_staking_sdk/eslint.config.mjs b/governance/pyth_staking_sdk/eslint.config.js similarity index 100% rename from governance/pyth_staking_sdk/eslint.config.mjs rename to governance/pyth_staking_sdk/eslint.config.js diff --git a/governance/pyth_staking_sdk/integration-tests/all.test.ts b/governance/pyth_staking_sdk/integration-tests/all.test.ts index 7a386a4755..b9ce41abef 100644 --- a/governance/pyth_staking_sdk/integration-tests/all.test.ts +++ b/governance/pyth_staking_sdk/integration-tests/all.test.ts @@ -1,17 +1,15 @@ import { Wallet } from "@coral-xyz/anchor"; +import type { Connection } from "@solana/web3.js"; import { Keypair, PublicKey, sendAndConfirmTransaction, SystemProgram, Transaction, - type Connection, } from "@solana/web3.js"; -import { - type CustomAbortController, - startValidatorRaw, -} from "./start-validator"; +import type { CustomAbortController } from "./start-validator"; +import { startValidatorRaw } from "./start-validator"; import { getCurrentEpoch } from "../src"; import { getConfigAddress } from "../src/pdas"; import { PythStakingClient } from "../src/pyth-staking-client"; diff --git a/governance/pyth_staking_sdk/jest.config.mjs b/governance/pyth_staking_sdk/jest.config.js similarity index 100% rename from governance/pyth_staking_sdk/jest.config.mjs rename to governance/pyth_staking_sdk/jest.config.js diff --git a/governance/pyth_staking_sdk/package.json b/governance/pyth_staking_sdk/package.json index b8b2038387..73ad61ed00 100644 --- a/governance/pyth_staking_sdk/package.json +++ b/governance/pyth_staking_sdk/package.json @@ -4,6 +4,7 @@ "description": "Pyth staking SDK", "main": "src/index.ts", "types": "src/index.d.ts", + "type": "module", "files": [ "dist/**/*" ], @@ -20,18 +21,17 @@ "test:types": "tsc" }, "devDependencies": { - "@cprussin/eslint-config": "^3.0.0", - "@cprussin/jest-config": "^1.4.1", - "@cprussin/prettier-config": "^2.1.1", - "@cprussin/tsconfig": "^3.0.1", - "@solana/wallet-adapter-react": "^0.15.28", - "@types/jest": "^29.5.12", - "@types/node": "^22.0.0", - "@typescript-eslint/parser": "^8.3.0", - "eslint": "^9.8.0", - "jest": "^29.7.0", + "@cprussin/eslint-config": "catalog:", + "@cprussin/jest-config": "catalog:", + "@cprussin/prettier-config": "catalog:", + "@cprussin/tsconfig": "catalog:", + "@solana/wallet-adapter-react": "catalog:", + "@types/jest": "catalog:", + "@types/node": "catalog:", + "eslint": "catalog:", + "jest": "catalog:", "prettier": "catalog:", - "typescript": "^5.5.4" + "typescript": "catalog:" }, "dependencies": { "@coral-xyz/anchor": "^0.30.1", @@ -39,6 +39,6 @@ "@pythnetwork/solana-utils": "workspace:*", "@solana/spl-governance": "^0.3.28", "@solana/spl-token": "^0.3.7", - "@solana/web3.js": "^1.95.3" + "@solana/web3.js": "catalog:" } } diff --git a/governance/pyth_staking_sdk/prettier.config.mjs b/governance/pyth_staking_sdk/prettier.config.js similarity index 100% rename from governance/pyth_staking_sdk/prettier.config.mjs rename to governance/pyth_staking_sdk/prettier.config.js diff --git a/governance/pyth_staking_sdk/src/pyth-staking-client.ts b/governance/pyth_staking_sdk/src/pyth-staking-client.ts index d56e485604..0f4b317388 100644 --- a/governance/pyth_staking_sdk/src/pyth-staking-client.ts +++ b/governance/pyth_staking_sdk/src/pyth-staking-client.ts @@ -6,14 +6,13 @@ import { PROGRAM_VERSION_V2, withCreateTokenOwnerRecord, } from "@solana/spl-governance"; +import type { Account, Mint } from "@solana/spl-token"; import { - type Account, createAssociatedTokenAccountInstruction, createTransferInstruction, getAccount, getAssociatedTokenAddressSync, getMint, - type Mint, } from "@solana/spl-token"; import type { AnchorWallet } from "@solana/wallet-adapter-react"; import { @@ -39,16 +38,16 @@ import { getStakeAccountMetadataAddress, getTargetAccountAddress, } from "./pdas"; -import { - PositionState, - type GlobalConfig, - type PoolConfig, - type PoolDataAccount, - type StakeAccountPositions, - type TargetAccount, - type VoterWeightAction, - type VestingSchedule, +import type { + GlobalConfig, + PoolConfig, + PoolDataAccount, + StakeAccountPositions, + TargetAccount, + VoterWeightAction, + VestingSchedule, } from "./types"; +import { PositionState } from "./types"; import { bigintMax, bigintMin } from "./utils/bigint"; import { convertBigIntToBN, convertBNToBigInt } from "./utils/bn"; import { epochToDate, getCurrentEpoch } from "./utils/clock"; @@ -810,6 +809,7 @@ export class PythStakingClient { for (const instruction of instructions.advanceDelegationRecordInstructions) { const tx = new Transaction().add(instruction); tx.feePayer = simulationPayer ?? this.wallet.publicKey; + // eslint-disable-next-line @typescript-eslint/no-deprecated const res = await this.connection.simulateTransaction(tx); const val = res.value.returnData?.data[0]; if (val === undefined) { diff --git a/governance/pyth_staking_sdk/src/utils/apy.ts b/governance/pyth_staking_sdk/src/utils/apy.ts index f9e51b7ba8..539540559b 100644 --- a/governance/pyth_staking_sdk/src/utils/apy.ts +++ b/governance/pyth_staking_sdk/src/utils/apy.ts @@ -17,6 +17,9 @@ export const calculateApy = ( } & ({ isSelf: true } | { isSelf: false; poolUtilization: bigint }), ) => { const { selfStake, poolCapacity, yieldRate, isSelf } = options; + // This eslint rule incorrectly tries to use Math.min() here instead, which + // casts down to number + // eslint-disable-next-line unicorn/prefer-math-min-max const eligibleSelfStake = selfStake > poolCapacity ? poolCapacity : selfStake; if (poolCapacity === 0n) { @@ -40,6 +43,9 @@ export const calculateApy = ( const delegatorPoolUtilization = poolUtilization - selfStake; const delegatorPoolCapacity = poolCapacity - eligibleSelfStake; const eligibleStake = + // This eslint rule incorrectly tries to use Math.min() here instead, which + // casts down to number + // eslint-disable-next-line unicorn/prefer-math-min-max delegatorPoolUtilization > delegatorPoolCapacity ? delegatorPoolCapacity : delegatorPoolUtilization; diff --git a/governance/pyth_staking_sdk/src/utils/position.ts b/governance/pyth_staking_sdk/src/utils/position.ts index 7abc2830a9..65a4f11b5b 100644 --- a/governance/pyth_staking_sdk/src/utils/position.ts +++ b/governance/pyth_staking_sdk/src/utils/position.ts @@ -7,13 +7,13 @@ import { POSITION_BUFFER_SIZE, POSITIONS_ACCOUNT_HEADER_SIZE, } from "../constants"; -import { - type Position, - type PositionAnchor, - PositionState, - type StakeAccountPositions, - type TargetWithParameters, +import type { + Position, + PositionAnchor, + StakeAccountPositions, + TargetWithParameters, } from "../types"; +import { PositionState } from "../types"; export const getPositionState = ( position: Position, @@ -71,7 +71,7 @@ export const deserializeStakeAccountPositions = ( ) => { const coder = new BorshCoder(idl); let i = 8; // Skip discriminator - const owner = new PublicKey(data.slice(i, i + 32)); + const owner = new PublicKey(data.subarray(i, i + 32)); const numberOfPositions = Math.floor( (data.length - POSITIONS_ACCOUNT_HEADER_SIZE) / POSITION_BUFFER_SIZE, ); diff --git a/governance/xc_admin/packages/xc_admin_frontend/next.config.js b/governance/xc_admin/packages/xc_admin_frontend/next.config.js index c92c49ee6a..57fdd29055 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/next.config.js +++ b/governance/xc_admin/packages/xc_admin_frontend/next.config.js @@ -5,7 +5,7 @@ const nextConfig = { reactStrictMode: true, output: process.env.BUILD_STANDALONE === 'true' ? 'standalone' : undefined, webpack(config, { isServer }) { - config.experiments = { asyncWebAssembly: true } + config.experiments = { asyncWebAssembly: true, layers: true } config.resolve.fallback = { fs: false } const fileLoaderRule = config.module.rules.find( (rule) => rule.test && rule.test?.test?.('.svg') diff --git a/governance/xc_admin/packages/xc_admin_frontend/package.json b/governance/xc_admin/packages/xc_admin_frontend/package.json index 53ab649e97..1fb0be5d66 100644 --- a/governance/xc_admin/packages/xc_admin_frontend/package.json +++ b/governance/xc_admin/packages/xc_admin_frontend/package.json @@ -11,8 +11,10 @@ "start:dev": "next dev --port 3004", "start:prod": "next start --port 3004", "fix:format": "prettier --write .", + "fix:lint": "next lint --fix --max-warnings 0", "test:format": "prettier --check .", - "test:lint": "next lint --max-warnings 0" + "test:lint": "next lint --max-warnings 0", + "test:types": "tsc" }, "dependencies": { "@coral-xyz/anchor": "^0.29.0", diff --git a/lazer/sdk/js/package.json b/lazer/sdk/js/package.json index 1facbc18bc..5a12be14ec 100644 --- a/lazer/sdk/js/package.json +++ b/lazer/sdk/js/package.json @@ -33,18 +33,15 @@ "publish": "pnpm run script -- publish" }, "devDependencies": { - "@cprussin/eslint-config": "^3.0.0", - "@cprussin/tsconfig": "^3.0.1", - "@eslint/js": "^9.12.0", - "@types/eslint__js": "^8.42.3", + "@cprussin/eslint-config": "catalog:", + "@cprussin/tsconfig": "catalog:", "@types/node": "^18.19.54", "@types/ws": "^8.5.12", - "eslint": "^9.12.0", + "eslint": "catalog:", "prettier": "catalog:", "ts-node": "^10.9.2", "typedoc": "^0.26.8", - "typescript": ">=5.5.0 < 5.6.0", - "typescript-eslint": "^8.8.0" + "typescript": "catalog:" }, "bugs": { "url": "https://github.com/pyth-lazer-sdk/pyth-lazer-sdk/issues" diff --git a/lazer/sdk/js/src/client.ts b/lazer/sdk/js/src/client.ts index 84a259ce2d..16dd155144 100644 --- a/lazer/sdk/js/src/client.ts +++ b/lazer/sdk/js/src/client.ts @@ -1,13 +1,9 @@ import WebSocket from "isomorphic-ws"; -import { dummyLogger, type Logger } from "ts-log"; +import type { Logger } from "ts-log"; +import { dummyLogger } from "ts-log"; -import { - BINARY_UPDATE_FORMAT_MAGIC_LE, - FORMAT_MAGICS_LE, - type ParsedPayload, - type Request, - type Response, -} from "./protocol.js"; +import type { ParsedPayload, Request, Response } from "./protocol.js"; +import { BINARY_UPDATE_FORMAT_MAGIC_LE, FORMAT_MAGICS_LE } from "./protocol.js"; import { WebSocketPool } from "./socket/websocket-pool.js"; export type BinaryResponse = { diff --git a/lazer/sdk/js/src/socket/resilient-websocket.ts b/lazer/sdk/js/src/socket/resilient-websocket.ts index 747e4bfc63..8966804a57 100644 --- a/lazer/sdk/js/src/socket/resilient-websocket.ts +++ b/lazer/sdk/js/src/socket/resilient-websocket.ts @@ -1,6 +1,7 @@ import type { ClientRequestArgs } from "node:http"; -import WebSocket, { type ClientOptions, type ErrorEvent } from "isomorphic-ws"; +import type { ClientOptions, ErrorEvent } from "isomorphic-ws"; +import WebSocket from "isomorphic-ws"; import type { Logger } from "ts-log"; const HEARTBEAT_TIMEOUT_DURATION = 10_000; diff --git a/lazer/sdk/js/src/socket/websocket-pool.ts b/lazer/sdk/js/src/socket/websocket-pool.ts index 2bca315cc2..f7b940bc56 100644 --- a/lazer/sdk/js/src/socket/websocket-pool.ts +++ b/lazer/sdk/js/src/socket/websocket-pool.ts @@ -1,9 +1,10 @@ import TTLCache from "@isaacs/ttlcache"; import WebSocket from "isomorphic-ws"; -import { dummyLogger, type Logger } from "ts-log"; +import type { Logger } from "ts-log"; +import { dummyLogger } from "ts-log"; -import { ResilientWebSocket } from "./resilient-websocket.js"; import type { Request, Response } from "../protocol.js"; +import { ResilientWebSocket } from "./resilient-websocket.js"; const DEFAULT_NUM_CONNECTIONS = 3; diff --git a/package.json b/package.json index 08a8e2a61e..a76443cf8f 100644 --- a/package.json +++ b/package.json @@ -15,18 +15,16 @@ "turbo": "[ ! -d node_modules ] && pnpm install; turbo" }, "devDependencies": { - "@cprussin/prettier-config": "^2.2.1", - "lerna": "^8.1.8", + "@cprussin/prettier-config": "catalog:", + "lerna": "catalog:", "prettier": "catalog:", "prettier-plugin-solidity": "catalog:", - "turbo": "^2.2.3" + "turbo": "^2.4.4" }, "pnpm": { "overrides": { "@injectivelabs/sdk-ts@1.10.72>@injectivelabs/token-metadata": "1.10.42", - "eslint-config-next>@typescript-eslint/parser": "^7.0.0", - "@solana/web3.js@^1.93.0": "1.92.3", - "eslint-config-turbo": "^2.2.3" + "@solana/web3.js@^1.93.0": "1.92.3" }, "patchedDependencies": { "eccrypto@1.1.6": "patches/eccrypto@1.1.6.patch" diff --git a/packages/app-logger/src/provider.tsx b/packages/app-logger/src/provider.tsx index 1593b3eac0..a17be757a5 100644 --- a/packages/app-logger/src/provider.tsx +++ b/packages/app-logger/src/provider.tsx @@ -1,7 +1,8 @@ "use client"; import { pino } from "pino"; -import { type ComponentProps, useMemo } from "react"; +import type { ComponentProps } from "react"; +import { useMemo } from "react"; import { LoggerContext } from "./context.js"; diff --git a/packages/component-library/src/Alert/index.stories.tsx b/packages/component-library/src/Alert/index.stories.tsx index 5f82370ecc..787b0fe378 100644 --- a/packages/component-library/src/Alert/index.stories.tsx +++ b/packages/component-library/src/Alert/index.stories.tsx @@ -19,7 +19,10 @@ const meta = { control: "select", options: Object.keys(Icon), mapping: Object.fromEntries( - Object.entries(Icon).map(([key, Icon]) => [key, ]), + Object.entries(Icon).map(([key, Icon]) => [ + key, + , + ]), ), table: { category: "Contents", diff --git a/packages/component-library/src/Breadcrumbs/index.tsx b/packages/component-library/src/Breadcrumbs/index.tsx index 33cacf6897..acfeb48bed 100644 --- a/packages/component-library/src/Breadcrumbs/index.tsx +++ b/packages/component-library/src/Breadcrumbs/index.tsx @@ -41,11 +41,6 @@ export const Breadcrumbs = ({ label, className, items, ...props }: Props) => (