From bdf9ab6c1989a0ecddaed8f9940ff95b06f9a17d Mon Sep 17 00:00:00 2001 From: Max Korsunov Date: Fri, 4 Oct 2024 11:48:14 +0100 Subject: [PATCH] refactor: directory structure (#81) * refactor: directory structure * refactor: remove unnecessary extensions --- src/app/v2/layout.tsx | 2 +- src/app/v2/page.tsx | 2 +- src/components/header/connection.tsx | 2 +- src/components/header/desktop-nav.tsx | 2 +- src/components/header/links.ts | 2 +- src/components/header/logo.tsx | 2 +- src/components/header/provider-popover.tsx | 2 +- src/components/header/status-popover.tsx | 4 ++-- src/components/header/sync-bar.tsx | 2 +- src/{ => old}/components/blockTimestamp.tsx | 0 src/{ => old}/components/blocks/index.tsx | 10 ++++----- .../components/charts/buySellChart.tsx | 8 +++---- .../components/charts/depthChart.tsx | 2 +- src/{ => old}/components/charts/ohlcChart.tsx | 2 +- src/{ => old}/components/copiedTx.tsx | 2 +- .../executionHistory/blockDetails.tsx | 4 ++-- .../executionHistory/blockSummary.tsx | 2 +- src/{ => old}/components/layout.tsx | 0 .../liquidityPositions/closedStatus.tsx | 4 ++-- .../liquidityPositions/currentStatus.tsx | 8 +++---- .../liquidityPositions/executionEvent.tsx | 6 ++--- .../liquidityPositions/openStatus.tsx | 6 ++--- .../liquidityPositions/timelinePosition.tsx | 8 +++---- .../liquidityPositions/withdrawnStatus.tsx | 2 +- src/{ => old}/components/lpAssetView.tsx | 10 ++++----- src/{ => old}/components/lpSearchBar.tsx | 0 src/{ => old}/components/navbar.tsx | 2 +- src/{ => old}/components/pairSelector.tsx | 4 ++-- src/{ => old}/components/swaps/index.tsx | 8 +++---- .../components/util/loadingSpinner.tsx | 0 src/{ => old}/utils/configConstants.ts | 0 src/{ => old}/utils/indexer/connector.tsx | 0 src/{ => old}/utils/indexer/types/lps.tsx | 0 src/{ => old}/utils/math/base64.ts | 0 src/{ => old}/utils/math/bech32.ts | 0 src/{ => old}/utils/math/hex.ts | 0 src/{ => old}/utils/math/hiLo.ts | 0 src/{ => old}/utils/math/validation.ts | 0 .../protos/services/app/shielded-pool.ts | 0 .../services/dex/dex-query-service-client.ts | 0 .../protos/services/dex/simulated-trades.ts | 0 src/{ => old}/utils/protos/services/utils.ts | 0 .../types/DexQueryServiceClientInterface.ts | 0 .../utils/protos/types/ShieldedPoolQuerier.ts | 0 .../utils/protos/types/SimulationQuerier.ts | 0 src/{ => old}/utils/token/tokenFetch.tsx | 2 +- src/{ => old}/utils/types/block.tsx | 0 src/{ => old}/utils/types/token.tsx | 0 src/pages/api/arbs/[...params].ts | 2 +- src/pages/api/blockTimestamps/[...params].js | 2 +- src/pages/api/blocks/[...params].js | 2 +- src/pages/api/lp/[lp_nft_id].js | 2 +- src/pages/api/lp/[lp_nft_id]/position.ts | 2 +- src/pages/api/lp/[lp_nft_id]/trades.js | 2 +- src/pages/api/lp/block/[...params].js | 2 +- .../api/lp/positionsByPrice/[...params].ts | 6 ++--- src/pages/api/ohlc/[...params].ts | 6 ++--- src/pages/api/shieldedPool/[token_inner].ts | 4 ++-- src/pages/api/simulations/[...params].ts | 8 +++---- src/pages/api/swaps/[...params].ts | 6 ++--- src/pages/block/[block_height].tsx | 22 +++++++++---------- src/pages/explorer/index.tsx | 10 ++++----- src/pages/lp/[lp_nft_id].tsx | 12 +++++----- src/pages/lp/utils.tsx | 6 ++--- src/pages/pair/[...params].tsx | 18 +++++++-------- src/pages/pair/index.tsx | 10 ++++----- src/pages/trade/[[...params]].tsx | 16 +++++++------- src/pages/trades.tsx | 12 +++++----- src/{utils/routes => shared}/pages.ts | 0 src/{utils => shared}/penumbra.ts | 0 src/{ => shared}/state/connection/index.ts | 2 +- .../state/status/getSyncPercent.ts | 0 src/{ => shared}/state/status/index.ts | 6 ++--- src/{utils/routes => shared}/usePagePath.ts | 0 74 files changed, 134 insertions(+), 134 deletions(-) rename src/{ => old}/components/blockTimestamp.tsx (100%) rename src/{ => old}/components/blocks/index.tsx (96%) rename src/{ => old}/components/charts/buySellChart.tsx (98%) rename src/{ => old}/components/charts/depthChart.tsx (99%) rename src/{ => old}/components/charts/ohlcChart.tsx (99%) rename src/{ => old}/components/copiedTx.tsx (97%) rename src/{ => old}/components/executionHistory/blockDetails.tsx (94%) rename src/{ => old}/components/executionHistory/blockSummary.tsx (94%) rename src/{ => old}/components/layout.tsx (100%) rename src/{ => old}/components/liquidityPositions/closedStatus.tsx (87%) rename src/{ => old}/components/liquidityPositions/currentStatus.tsx (96%) rename src/{ => old}/components/liquidityPositions/executionEvent.tsx (91%) rename src/{ => old}/components/liquidityPositions/openStatus.tsx (87%) rename src/{ => old}/components/liquidityPositions/timelinePosition.tsx (82%) rename src/{ => old}/components/liquidityPositions/withdrawnStatus.tsx (93%) rename src/{ => old}/components/lpAssetView.tsx (95%) rename src/{ => old}/components/lpSearchBar.tsx (100%) rename src/{ => old}/components/navbar.tsx (99%) rename src/{ => old}/components/pairSelector.tsx (95%) rename src/{ => old}/components/swaps/index.tsx (95%) rename src/{ => old}/components/util/loadingSpinner.tsx (100%) rename src/{ => old}/utils/configConstants.ts (100%) rename src/{ => old}/utils/indexer/connector.tsx (100%) rename src/{ => old}/utils/indexer/types/lps.tsx (100%) rename src/{ => old}/utils/math/base64.ts (100%) rename src/{ => old}/utils/math/bech32.ts (100%) rename src/{ => old}/utils/math/hex.ts (100%) rename src/{ => old}/utils/math/hiLo.ts (100%) rename src/{ => old}/utils/math/validation.ts (100%) rename src/{ => old}/utils/protos/services/app/shielded-pool.ts (100%) rename src/{ => old}/utils/protos/services/dex/dex-query-service-client.ts (100%) rename src/{ => old}/utils/protos/services/dex/simulated-trades.ts (100%) rename src/{ => old}/utils/protos/services/utils.ts (100%) rename src/{ => old}/utils/protos/types/DexQueryServiceClientInterface.ts (100%) rename src/{ => old}/utils/protos/types/ShieldedPoolQuerier.ts (100%) rename src/{ => old}/utils/protos/types/SimulationQuerier.ts (100%) rename src/{ => old}/utils/token/tokenFetch.tsx (98%) rename src/{ => old}/utils/types/block.tsx (100%) rename src/{ => old}/utils/types/token.tsx (100%) rename src/{utils/routes => shared}/pages.ts (100%) rename src/{utils => shared}/penumbra.ts (100%) rename src/{ => shared}/state/connection/index.ts (97%) rename src/{ => shared}/state/status/getSyncPercent.ts (100%) rename src/{ => shared}/state/status/index.ts (93%) rename src/{utils/routes => shared}/usePagePath.ts (100%) diff --git a/src/app/v2/layout.tsx b/src/app/v2/layout.tsx index c489cca3..99e2bd32 100644 --- a/src/app/v2/layout.tsx +++ b/src/app/v2/layout.tsx @@ -3,7 +3,7 @@ import { ReactNode } from 'react'; import { PenumbraUIProvider } from '@penumbra-zone/ui/PenumbraUIProvider'; import { Display } from '@penumbra-zone/ui/Display'; -import { Header } from '@/components/header'; +import { Header } from '../../components/header'; import { SyncBar } from '@/components/header/sync-bar'; import { enableStaticRendering } from 'mobx-react-lite'; diff --git a/src/app/v2/page.tsx b/src/app/v2/page.tsx index e661dc22..f67c54e7 100644 --- a/src/app/v2/page.tsx +++ b/src/app/v2/page.tsx @@ -1,5 +1,5 @@ import { redirect } from 'next/navigation'; -import { PagePath } from '@/utils/routes/pages.ts'; +import { PagePath } from '@/shared/pages'; export default function RedirectPage() { redirect(PagePath.Trade); diff --git a/src/components/header/connection.tsx b/src/components/header/connection.tsx index 6e7ba838..ab84c29d 100644 --- a/src/components/header/connection.tsx +++ b/src/components/header/connection.tsx @@ -1,6 +1,6 @@ import { Button } from '@penumbra-zone/ui/Button'; import { ProviderPopover } from './provider-popover'; -import { connectionStore } from '@/state/connection'; +import { connectionStore } from '@/shared/state/connection'; import { observer } from 'mobx-react-lite'; export const Connection = observer(() => { diff --git a/src/components/header/desktop-nav.tsx b/src/components/header/desktop-nav.tsx index 2a087eae..1538f107 100644 --- a/src/components/header/desktop-nav.tsx +++ b/src/components/header/desktop-nav.tsx @@ -2,7 +2,7 @@ import { useRouter } from 'next/navigation'; import { Tabs } from '@penumbra-zone/ui/Tabs'; import { Density } from '@penumbra-zone/ui/Density'; import { HEADER_LINKS } from './links'; -import { usePagePath } from '@/utils/routes/usePagePath'; +import { usePagePath } from '@/shared/usePagePath'; export const DesktopNav = () => { const pagePath = usePagePath(); diff --git a/src/components/header/links.ts b/src/components/header/links.ts index 2668935a..85f2355b 100644 --- a/src/components/header/links.ts +++ b/src/components/header/links.ts @@ -1,5 +1,5 @@ import { MoonStar, ArrowUpFromDot, Coins } from 'lucide-react'; -import { PagePath } from '@/utils/routes/pages.ts'; +import { PagePath } from '@/shared/pages'; export const HEADER_LINKS = [ { label: 'Trade', value: PagePath.Trade, icon: ArrowUpFromDot }, diff --git a/src/components/header/logo.tsx b/src/components/header/logo.tsx index db334f6c..c84025a5 100644 --- a/src/components/header/logo.tsx +++ b/src/components/header/logo.tsx @@ -1,5 +1,5 @@ import Link from 'next/link' -import { PagePath } from '@/utils/routes/pages'; +import { PagePath } from '@/shared/pages'; import PenumbraLogo from './logo.svg'; export const HeaderLogo = () => { diff --git a/src/components/header/provider-popover.tsx b/src/components/header/provider-popover.tsx index 71729c0a..90c4f000 100644 --- a/src/components/header/provider-popover.tsx +++ b/src/components/header/provider-popover.tsx @@ -4,7 +4,7 @@ import Image from 'next/image'; import { Popover } from '@penumbra-zone/ui/Popover'; import { Button } from '@penumbra-zone/ui/Button'; import { Text } from '@penumbra-zone/ui/Text'; -import { connectionStore } from '@/state/connection'; +import { connectionStore } from '@/shared/state/connection'; import { observer } from 'mobx-react-lite'; export const ProviderPopover = observer(() => { diff --git a/src/components/header/status-popover.tsx b/src/components/header/status-popover.tsx index dfb4cd98..032a94be 100644 --- a/src/components/header/status-popover.tsx +++ b/src/components/header/status-popover.tsx @@ -5,8 +5,8 @@ import { Button } from '@penumbra-zone/ui/Button'; import { Density } from '@penumbra-zone/ui/Density'; import { Pill } from '@penumbra-zone/ui/Pill'; import { Text } from '@penumbra-zone/ui/Text'; -import { statusStore } from '@/state/status'; -import { connectionStore } from '@/state/connection'; +import { statusStore } from '@/shared/state/status'; +import { connectionStore } from '@/shared/state/connection'; import { observer } from 'mobx-react-lite'; export const StatusPopover = observer(() => { diff --git a/src/components/header/sync-bar.tsx b/src/components/header/sync-bar.tsx index 1512736e..db29f586 100644 --- a/src/components/header/sync-bar.tsx +++ b/src/components/header/sync-bar.tsx @@ -1,5 +1,5 @@ import { Progress } from '@penumbra-zone/ui/Progress'; -import { statusStore } from '@/state/status'; +import { statusStore } from '@/shared/state/status'; import { observer } from 'mobx-react-lite'; export const SyncBar = observer(() => { diff --git a/src/components/blockTimestamp.tsx b/src/old/components/blockTimestamp.tsx similarity index 100% rename from src/components/blockTimestamp.tsx rename to src/old/components/blockTimestamp.tsx diff --git a/src/components/blocks/index.tsx b/src/old/components/blocks/index.tsx similarity index 96% rename from src/components/blocks/index.tsx rename to src/old/components/blocks/index.tsx index 346d98ec..8331409f 100644 --- a/src/components/blocks/index.tsx +++ b/src/old/components/blocks/index.tsx @@ -9,12 +9,12 @@ import { FormControl, NumberInputField, } from "@chakra-ui/react"; -import { LoadingSpinner } from "@/components/util/loadingSpinner"; +import { LoadingSpinner } from "@/old/components/util/loadingSpinner"; import { useEffect, useRef, useState } from "react"; -import { BlockSummary } from "@/components/executionHistory/blockSummary"; -import { BlockInfo, LiquidityPositionEvent } from "@/utils/indexer/types/lps"; -import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface"; -import { BlockInfoMap, BlockSummaryData, BlockSummaryMap } from "@/utils/types/block"; +import { BlockSummary } from "@/old/components/executionHistory/blockSummary"; +import { BlockInfo, LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; +import { SwapExecutionWithBlockHeight } from "@/old/utils/protos/types/DexQueryServiceClientInterface"; +import { BlockInfoMap, BlockSummaryData, BlockSummaryMap } from "@/old/utils/types/block"; export default function Blocks() { // Go back hardcoded N blocks diff --git a/src/components/charts/buySellChart.tsx b/src/old/components/charts/buySellChart.tsx similarity index 98% rename from src/components/charts/buySellChart.tsx rename to src/old/components/charts/buySellChart.tsx index 11b50214..a5ddbe37 100644 --- a/src/components/charts/buySellChart.tsx +++ b/src/old/components/charts/buySellChart.tsx @@ -3,12 +3,12 @@ import React, { useRef, useEffect } from "react"; import { Box, HStack, Spacer, Text, VStack } from "@chakra-ui/react"; import { Position } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { fromBaseUnit, splitLoHi } from "@/utils/math/hiLo"; +import { fromBaseUnit, splitLoHi } from "@/old/utils/math/hiLo"; import BigNumber from "bignumber.js"; -import { Token } from "@/utils/types/token"; +import { Token } from "@/old/utils/types/token"; import dynamic from "next/dynamic"; -import { innerToBech32Address } from "@/utils/math/bech32"; -import { uint8ArrayToBase64 } from "@/utils/math/base64"; +import { innerToBech32Address } from "@/old/utils/math/bech32"; +import { uint8ArrayToBase64 } from "@/old/utils/math/base64"; interface BuySellprops { buySidePositions: Position[]; diff --git a/src/components/charts/depthChart.tsx b/src/old/components/charts/depthChart.tsx similarity index 99% rename from src/components/charts/depthChart.tsx rename to src/old/components/charts/depthChart.tsx index 7b17a26e..8d5fb9ed 100644 --- a/src/components/charts/depthChart.tsx +++ b/src/old/components/charts/depthChart.tsx @@ -10,7 +10,7 @@ import { set, throttle } from 'lodash'; import { Chart } from 'chart.js/auto'; import { Button, HStack, Text, useBreakpoint, VStack } from '@chakra-ui/react'; import zoomPlugin, { zoom } from 'chartjs-plugin-zoom'; -import { Token } from '@/utils/types/token'; +import { Token } from '@/old/utils/types/token.tsx'; // Register the necessary components from chart.js ChartJS.register(...registerables, annotationPlugin); diff --git a/src/components/charts/ohlcChart.tsx b/src/old/components/charts/ohlcChart.tsx similarity index 99% rename from src/components/charts/ohlcChart.tsx rename to src/old/components/charts/ohlcChart.tsx index 61c03449..c933ed30 100644 --- a/src/components/charts/ohlcChart.tsx +++ b/src/old/components/charts/ohlcChart.tsx @@ -5,7 +5,7 @@ import React, { useEffect, useState, useRef } from 'react'; import { VStack, Text, Button, ButtonGroup, Flex } from '@chakra-ui/react'; import useComponentSize from '@rehooks/component-size'; -import { Token } from '@/utils/types/token'; +import { Token } from '@/old/utils/types/token'; import { LoadingSpinner } from '../util/loadingSpinner'; import ReactECharts from 'echarts-for-react'; import { format } from 'date-fns'; diff --git a/src/components/copiedTx.tsx b/src/old/components/copiedTx.tsx similarity index 97% rename from src/components/copiedTx.tsx rename to src/old/components/copiedTx.tsx index 8e72926a..b191fe83 100644 --- a/src/components/copiedTx.tsx +++ b/src/old/components/copiedTx.tsx @@ -3,7 +3,7 @@ import React, { FC, useState } from "react"; import { CopyIcon } from "@radix-ui/react-icons"; import { HStack } from "@chakra-ui/react"; -import { Constants } from "@/utils/configConstants.ts"; +import { Constants } from "@/old/utils/configConstants"; interface CopyTxToClipboardProps { txHash: string; diff --git a/src/components/executionHistory/blockDetails.tsx b/src/old/components/executionHistory/blockDetails.tsx similarity index 94% rename from src/components/executionHistory/blockDetails.tsx rename to src/old/components/executionHistory/blockDetails.tsx index d7dab9a3..035f2612 100644 --- a/src/components/executionHistory/blockDetails.tsx +++ b/src/old/components/executionHistory/blockDetails.tsx @@ -1,6 +1,6 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ -import { BlockSummaryData } from "@/utils/types/block"; +import { BlockSummaryData } from "@/old/utils/types/block"; import { VStack, Text } from "@chakra-ui/react"; export interface BlockDetailsProps { @@ -32,4 +32,4 @@ export const BlockDetails = ({ blockSummary }: BlockDetailsProps) => { ); -} \ No newline at end of file +} diff --git a/src/components/executionHistory/blockSummary.tsx b/src/old/components/executionHistory/blockSummary.tsx similarity index 94% rename from src/components/executionHistory/blockSummary.tsx rename to src/old/components/executionHistory/blockSummary.tsx index 198a19ec..67edd914 100644 --- a/src/components/executionHistory/blockSummary.tsx +++ b/src/old/components/executionHistory/blockSummary.tsx @@ -3,7 +3,7 @@ import { Box, HStack, Flex, Text } from "@chakra-ui/react"; import BlockTimestampView from "../blockTimestamp"; import { BlockDetails } from "./blockDetails"; -import { BlockSummaryData } from "@/utils/types/block"; +import { BlockSummaryData } from "@/old/utils/types/block"; export interface BlockSummaryProps { blockHeight: number diff --git a/src/components/layout.tsx b/src/old/components/layout.tsx similarity index 100% rename from src/components/layout.tsx rename to src/old/components/layout.tsx diff --git a/src/components/liquidityPositions/closedStatus.tsx b/src/old/components/liquidityPositions/closedStatus.tsx similarity index 87% rename from src/components/liquidityPositions/closedStatus.tsx rename to src/old/components/liquidityPositions/closedStatus.tsx index 8df8d1fb..ff17f8c2 100644 --- a/src/components/liquidityPositions/closedStatus.tsx +++ b/src/old/components/liquidityPositions/closedStatus.tsx @@ -6,8 +6,8 @@ import { Text, HStack, } from "@chakra-ui/react"; -import { LiquidityPositionEvent } from "@/utils/indexer/types/lps"; -import CopiedTxToClipboard from "@/components/copiedTx"; +import { LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; +import CopiedTxToClipboard from "@/old/components/copiedTx"; interface ClosedPositionStatusProps { nftId: string; diff --git a/src/components/liquidityPositions/currentStatus.tsx b/src/old/components/liquidityPositions/currentStatus.tsx similarity index 96% rename from src/components/liquidityPositions/currentStatus.tsx rename to src/old/components/liquidityPositions/currentStatus.tsx index 7306af73..6ef1b028 100644 --- a/src/components/liquidityPositions/currentStatus.tsx +++ b/src/old/components/liquidityPositions/currentStatus.tsx @@ -6,12 +6,12 @@ import { Position, PositionState, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { fromBaseUnit } from "../../utils/math/hiLo"; -import { uint8ArrayToBase64 } from "../../utils/math/base64"; -import { fetchTokenAsset } from "../../utils/token/tokenFetch"; +import { fromBaseUnit } from "@/old/utils/math/hiLo"; +import { uint8ArrayToBase64 } from "@/old/utils/math/base64"; +import { fetchTokenAsset } from "@/old/utils/token/tokenFetch"; import BigNumber from "bignumber.js"; import { CopyIcon } from "@radix-ui/react-icons"; -import { Token } from "@/utils/types/token"; +import { Token } from "@/old/utils/types/token"; interface CurrentLPStatusProps { nftId: string; diff --git a/src/components/liquidityPositions/executionEvent.tsx b/src/old/components/liquidityPositions/executionEvent.tsx similarity index 91% rename from src/components/liquidityPositions/executionEvent.tsx rename to src/old/components/liquidityPositions/executionEvent.tsx index 849ba3b1..c8531958 100644 --- a/src/components/liquidityPositions/executionEvent.tsx +++ b/src/old/components/liquidityPositions/executionEvent.tsx @@ -15,13 +15,13 @@ import { Position, PositionState, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { fromBaseUnit } from "../../utils/math/hiLo"; -import { uint8ArrayToBase64 } from "../../utils/math/base64"; +import { fromBaseUnit } from "@/old/utils/math/hiLo"; +import { uint8ArrayToBase64 } from "@/old/utils/math/base64"; import BigNumber from "bignumber.js"; import { LiquidityPositionEvent, PositionExecutionEvent, -} from "@/utils/indexer/types/lps"; +} from "@/old/utils/indexer/types/lps"; import CopiedTxToClipboard from "../copiedTx"; import LPAssetView from "../lpAssetView"; import BlockTimestampView from "../blockTimestamp"; diff --git a/src/components/liquidityPositions/openStatus.tsx b/src/old/components/liquidityPositions/openStatus.tsx similarity index 87% rename from src/components/liquidityPositions/openStatus.tsx rename to src/old/components/liquidityPositions/openStatus.tsx index 28d3eabd..d22cdf35 100644 --- a/src/components/liquidityPositions/openStatus.tsx +++ b/src/old/components/liquidityPositions/openStatus.tsx @@ -15,10 +15,10 @@ import { Position, PositionState, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { fromBaseUnit } from "../../utils/math/hiLo"; -import { uint8ArrayToBase64 } from "../../utils/math/base64"; +import { fromBaseUnit } from "@/old/utils/math/hiLo"; +import { uint8ArrayToBase64 } from "@/old/utils/math/base64"; import BigNumber from "bignumber.js"; -import { LiquidityPositionEvent } from "@/utils/indexer/types/lps"; +import { LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; import CopiedTxToClipboard from "../copiedTx"; import LPAssetView from "../lpAssetView"; diff --git a/src/components/liquidityPositions/timelinePosition.tsx b/src/old/components/liquidityPositions/timelinePosition.tsx similarity index 82% rename from src/components/liquidityPositions/timelinePosition.tsx rename to src/old/components/liquidityPositions/timelinePosition.tsx index 321a4496..5b8eb277 100644 --- a/src/components/liquidityPositions/timelinePosition.tsx +++ b/src/old/components/liquidityPositions/timelinePosition.tsx @@ -2,10 +2,10 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ import React from "react"; import { Box, HStack, Text, VStack } from "@chakra-ui/react"; -import { LiquidityPositionEvent } from "@/utils/indexer/types/lps"; -import ClosedPositionStatus from "@/components/liquidityPositions/closedStatus"; -import OpenPositionStatus from "@/components/liquidityPositions/openStatus"; -import WithdrawnPositionStatus from "@/components/liquidityPositions/withdrawnStatus"; +import { LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; +import ClosedPositionStatus from "@/old/components/liquidityPositions/closedStatus"; +import OpenPositionStatus from "@/old/components/liquidityPositions/openStatus"; +import WithdrawnPositionStatus from "@/old/components/liquidityPositions/withdrawnStatus"; import BlockTimestampView from "../blockTimestamp"; interface TimelinePositionProps { diff --git a/src/components/liquidityPositions/withdrawnStatus.tsx b/src/old/components/liquidityPositions/withdrawnStatus.tsx similarity index 93% rename from src/components/liquidityPositions/withdrawnStatus.tsx rename to src/old/components/liquidityPositions/withdrawnStatus.tsx index 68da90af..19a755c7 100644 --- a/src/components/liquidityPositions/withdrawnStatus.tsx +++ b/src/old/components/liquidityPositions/withdrawnStatus.tsx @@ -6,7 +6,7 @@ import { Text, HStack, } from "@chakra-ui/react"; -import { LiquidityPositionEvent } from "@/utils/indexer/types/lps"; +import { LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; import CopiedTxToClipboard from "../copiedTx"; import LPAssetView from "../lpAssetView"; diff --git a/src/components/lpAssetView.tsx b/src/old/components/lpAssetView.tsx similarity index 95% rename from src/components/lpAssetView.tsx rename to src/old/components/lpAssetView.tsx index 4ffc0455..214b2952 100644 --- a/src/components/lpAssetView.tsx +++ b/src/old/components/lpAssetView.tsx @@ -6,11 +6,11 @@ import { Avatar, HStack, VStack , Text } from "@chakra-ui/react"; import { LiquidityPositionEvent, PositionExecutionEvent, -} from "@/utils/indexer/types/lps"; -import { fetchTokenAsset } from "@/utils/token/tokenFetch"; -import { fromBaseUnit } from "@/utils/math/hiLo"; -import { base64ToUint8Array } from "@/utils/math/base64"; -import { Token } from "@/utils/types/token"; +} from "@/old/utils/indexer/types/lps"; +import { fetchTokenAsset } from "@/old/utils/token/tokenFetch"; +import { fromBaseUnit } from "@/old/utils/math/hiLo"; +import { base64ToUint8Array } from "@/old/utils/math/base64"; +import { Token } from "@/old/utils/types/token"; interface LPAssetViewProps { sectionTitle: string; diff --git a/src/components/lpSearchBar.tsx b/src/old/components/lpSearchBar.tsx similarity index 100% rename from src/components/lpSearchBar.tsx rename to src/old/components/lpSearchBar.tsx diff --git a/src/components/navbar.tsx b/src/old/components/navbar.tsx similarity index 99% rename from src/components/navbar.tsx rename to src/old/components/navbar.tsx index 57a42c4f..e91ef327 100644 --- a/src/components/navbar.tsx +++ b/src/old/components/navbar.tsx @@ -58,4 +58,4 @@ export const Navbar = () => { )} ) -} \ No newline at end of file +} diff --git a/src/components/pairSelector.tsx b/src/old/components/pairSelector.tsx similarity index 95% rename from src/components/pairSelector.tsx rename to src/old/components/pairSelector.tsx index fe0c9f14..e0a60e05 100644 --- a/src/components/pairSelector.tsx +++ b/src/old/components/pairSelector.tsx @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; import { Box, Text, Flex } from '@chakra-ui/react'; -import { fetchAllTokenAssets } from '@/utils/token/tokenFetch'; +import { fetchAllTokenAssets } from '@/old/utils/token/tokenFetch'; import OutsideClickHandler from 'react-outside-click-handler'; -import { Token } from '@/utils/types/token'; +import { Token } from '@/old/utils/types/token'; const orderedAssets = ['UM', 'USDC']; diff --git a/src/components/swaps/index.tsx b/src/old/components/swaps/index.tsx similarity index 95% rename from src/components/swaps/index.tsx rename to src/old/components/swaps/index.tsx index 105d221c..62045ab4 100644 --- a/src/components/swaps/index.tsx +++ b/src/old/components/swaps/index.tsx @@ -2,15 +2,15 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ import { useEffect, useState } from "react"; -import { Price, Trace, TraceType } from "../../pages/block/[block_height]"; +import { Price, Trace, TraceType } from "../../../pages/block/[block_height]"; import { Box, Link, Stack, VStack } from "@chakra-ui/react"; import { SwapExecution, SwapExecution_Trace, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; -import { Token } from "@/utils/types/token"; -import { LoadingSpinner } from "@/components/util/loadingSpinner"; +import { fetchAllTokenAssets } from "@/old/utils/token/tokenFetch"; +import { Token } from "@/old/utils/types/token"; +import { LoadingSpinner } from "@/old/components/util/loadingSpinner"; export const routes = [ { path: "/lp/utils" }, diff --git a/src/components/util/loadingSpinner.tsx b/src/old/components/util/loadingSpinner.tsx similarity index 100% rename from src/components/util/loadingSpinner.tsx rename to src/old/components/util/loadingSpinner.tsx diff --git a/src/utils/configConstants.ts b/src/old/utils/configConstants.ts similarity index 100% rename from src/utils/configConstants.ts rename to src/old/utils/configConstants.ts diff --git a/src/utils/indexer/connector.tsx b/src/old/utils/indexer/connector.tsx similarity index 100% rename from src/utils/indexer/connector.tsx rename to src/old/utils/indexer/connector.tsx diff --git a/src/utils/indexer/types/lps.tsx b/src/old/utils/indexer/types/lps.tsx similarity index 100% rename from src/utils/indexer/types/lps.tsx rename to src/old/utils/indexer/types/lps.tsx diff --git a/src/utils/math/base64.ts b/src/old/utils/math/base64.ts similarity index 100% rename from src/utils/math/base64.ts rename to src/old/utils/math/base64.ts diff --git a/src/utils/math/bech32.ts b/src/old/utils/math/bech32.ts similarity index 100% rename from src/utils/math/bech32.ts rename to src/old/utils/math/bech32.ts diff --git a/src/utils/math/hex.ts b/src/old/utils/math/hex.ts similarity index 100% rename from src/utils/math/hex.ts rename to src/old/utils/math/hex.ts diff --git a/src/utils/math/hiLo.ts b/src/old/utils/math/hiLo.ts similarity index 100% rename from src/utils/math/hiLo.ts rename to src/old/utils/math/hiLo.ts diff --git a/src/utils/math/validation.ts b/src/old/utils/math/validation.ts similarity index 100% rename from src/utils/math/validation.ts rename to src/old/utils/math/validation.ts diff --git a/src/utils/protos/services/app/shielded-pool.ts b/src/old/utils/protos/services/app/shielded-pool.ts similarity index 100% rename from src/utils/protos/services/app/shielded-pool.ts rename to src/old/utils/protos/services/app/shielded-pool.ts diff --git a/src/utils/protos/services/dex/dex-query-service-client.ts b/src/old/utils/protos/services/dex/dex-query-service-client.ts similarity index 100% rename from src/utils/protos/services/dex/dex-query-service-client.ts rename to src/old/utils/protos/services/dex/dex-query-service-client.ts diff --git a/src/utils/protos/services/dex/simulated-trades.ts b/src/old/utils/protos/services/dex/simulated-trades.ts similarity index 100% rename from src/utils/protos/services/dex/simulated-trades.ts rename to src/old/utils/protos/services/dex/simulated-trades.ts diff --git a/src/utils/protos/services/utils.ts b/src/old/utils/protos/services/utils.ts similarity index 100% rename from src/utils/protos/services/utils.ts rename to src/old/utils/protos/services/utils.ts diff --git a/src/utils/protos/types/DexQueryServiceClientInterface.ts b/src/old/utils/protos/types/DexQueryServiceClientInterface.ts similarity index 100% rename from src/utils/protos/types/DexQueryServiceClientInterface.ts rename to src/old/utils/protos/types/DexQueryServiceClientInterface.ts diff --git a/src/utils/protos/types/ShieldedPoolQuerier.ts b/src/old/utils/protos/types/ShieldedPoolQuerier.ts similarity index 100% rename from src/utils/protos/types/ShieldedPoolQuerier.ts rename to src/old/utils/protos/types/ShieldedPoolQuerier.ts diff --git a/src/utils/protos/types/SimulationQuerier.ts b/src/old/utils/protos/types/SimulationQuerier.ts similarity index 100% rename from src/utils/protos/types/SimulationQuerier.ts rename to src/old/utils/protos/types/SimulationQuerier.ts diff --git a/src/utils/token/tokenFetch.tsx b/src/old/utils/token/tokenFetch.tsx similarity index 98% rename from src/utils/token/tokenFetch.tsx rename to src/old/utils/token/tokenFetch.tsx index 85f40233..d8da2ba8 100644 --- a/src/utils/token/tokenFetch.tsx +++ b/src/old/utils/token/tokenFetch.tsx @@ -1,5 +1,5 @@ import { uint8ArrayToBase64, base64ToUint8Array } from "../math/base64"; -import { Constants } from "../configConstants.ts"; +import { Constants } from "../configConstants"; import { AssetId, AssetImage, diff --git a/src/utils/types/block.tsx b/src/old/utils/types/block.tsx similarity index 100% rename from src/utils/types/block.tsx rename to src/old/utils/types/block.tsx diff --git a/src/utils/types/token.tsx b/src/old/utils/types/token.tsx similarity index 100% rename from src/utils/types/token.tsx rename to src/old/utils/types/token.tsx diff --git a/src/pages/api/arbs/[...params].ts b/src/pages/api/arbs/[...params].ts index 77f27a89..d406836f 100644 --- a/src/pages/api/arbs/[...params].ts +++ b/src/pages/api/arbs/[...params].ts @@ -1,6 +1,6 @@ // pages/api/arbs/[...params].ts -import { DexQueryServiceClient } from '@/utils/protos/services/dex/dex-query-service-client'; +import { DexQueryServiceClient } from '@/old/utils/protos/services/dex/dex-query-service-client'; import { NextApiRequest, NextApiResponse } from 'next'; const grpcEndpoint = process.env['PENUMBRA_GRPC_ENDPOINT']; diff --git a/src/pages/api/blockTimestamps/[...params].js b/src/pages/api/blockTimestamps/[...params].js index 94d9948d..97e54694 100644 --- a/src/pages/api/blockTimestamps/[...params].js +++ b/src/pages/api/blockTimestamps/[...params].js @@ -2,7 +2,7 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/blockTimestamps/[...params].js -import { IndexerQuerier } from "../../../utils/indexer/connector"; +import { IndexerQuerier } from "../../../old/utils/indexer/connector"; const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT; if (!indexerEndpoint) { diff --git a/src/pages/api/blocks/[...params].js b/src/pages/api/blocks/[...params].js index ccc7cc9c..1655225a 100644 --- a/src/pages/api/blocks/[...params].js +++ b/src/pages/api/blocks/[...params].js @@ -2,7 +2,7 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/blocks/[...params].js -import { IndexerQuerier } from "../../../utils/indexer/connector"; +import { IndexerQuerier } from "../../../old/utils/indexer/connector"; const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT; if (!grpcEndpoint) { diff --git a/src/pages/api/lp/[lp_nft_id].js b/src/pages/api/lp/[lp_nft_id].js index 1869519a..a9e74116 100644 --- a/src/pages/api/lp/[lp_nft_id].js +++ b/src/pages/api/lp/[lp_nft_id].js @@ -1,7 +1,7 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/lp/[lp_nft_id].js -import { IndexerQuerier } from "../../../utils/indexer/connector"; +import { IndexerQuerier } from "../../../old/utils/indexer/connector"; const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT if (!indexerEndpoint) { diff --git a/src/pages/api/lp/[lp_nft_id]/position.ts b/src/pages/api/lp/[lp_nft_id]/position.ts index af2f8bdd..f65f9889 100644 --- a/src/pages/api/lp/[lp_nft_id]/position.ts +++ b/src/pages/api/lp/[lp_nft_id]/position.ts @@ -1,7 +1,7 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/lp/[lp_nft_id]/position.ts -import { DexQueryServiceClient } from "../../../../utils/protos/services/dex/dex-query-service-client"; +import { DexQueryServiceClient } from "@/old/utils/protos/services/dex/dex-query-service-client"; import { PositionId, Position, diff --git a/src/pages/api/lp/[lp_nft_id]/trades.js b/src/pages/api/lp/[lp_nft_id]/trades.js index b48a4ccd..7d6a38da 100644 --- a/src/pages/api/lp/[lp_nft_id]/trades.js +++ b/src/pages/api/lp/[lp_nft_id]/trades.js @@ -1,7 +1,7 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/lp/[lp_nft_id]/trades.js -import { IndexerQuerier } from "../../../../utils/indexer/connector"; +import { IndexerQuerier } from "../../../../old/utils/indexer/connector"; const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT if (!indexerEndpoint) { diff --git a/src/pages/api/lp/block/[...params].js b/src/pages/api/lp/block/[...params].js index 6f78ba6a..13583e09 100644 --- a/src/pages/api/lp/block/[...params].js +++ b/src/pages/api/lp/block/[...params].js @@ -1,7 +1,7 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/lp/positionsByBlockHeight/[...params].js -import { IndexerQuerier } from "../../../../utils/indexer/connector"; +import { IndexerQuerier } from "../../../../old/utils/indexer/connector"; const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT if (!indexerEndpoint) { diff --git a/src/pages/api/lp/positionsByPrice/[...params].ts b/src/pages/api/lp/positionsByPrice/[...params].ts index d41a85b2..647cd7a8 100644 --- a/src/pages/api/lp/positionsByPrice/[...params].ts +++ b/src/pages/api/lp/positionsByPrice/[...params].ts @@ -2,13 +2,13 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/lp/positionsByPrice/[...params].ts import { NextApiRequest, NextApiResponse } from "next"; -import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client"; +import { DexQueryServiceClient } from "@/old/utils/protos/services/dex/dex-query-service-client"; import { DirectedTradingPair, Position, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { base64ToUint8Array } from "@/utils/math/base64"; -import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; +import { base64ToUint8Array } from "@/old/utils/math/base64"; +import { fetchAllTokenAssets } from "@/old/utils/token/tokenFetch"; const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT!; if (!grpcEndpoint) { diff --git a/src/pages/api/ohlc/[...params].ts b/src/pages/api/ohlc/[...params].ts index 3fbcfe7e..14909333 100644 --- a/src/pages/api/ohlc/[...params].ts +++ b/src/pages/api/ohlc/[...params].ts @@ -2,15 +2,15 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/ohlc/[...params].ts -import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client"; +import { DexQueryServiceClient } from "@/old/utils/protos/services/dex/dex-query-service-client"; import { NextApiRequest, NextApiResponse } from "next"; import { CandlestickData, DirectedTradingPair, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; import { AssetId } from "@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb"; -import { base64ToUint8Array } from "@/utils/math/base64"; -import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; +import { base64ToUint8Array } from "@/old/utils/math/base64"; +import { fetchAllTokenAssets } from "@/old/utils/token/tokenFetch"; const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT!; if (!grpcEndpoint) { diff --git a/src/pages/api/shieldedPool/[token_inner].ts b/src/pages/api/shieldedPool/[token_inner].ts index f278a074..ecab607c 100644 --- a/src/pages/api/shieldedPool/[token_inner].ts +++ b/src/pages/api/shieldedPool/[token_inner].ts @@ -1,8 +1,8 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/shieldedPool/[token_inner].ts -import { ShieldedPoolQuerier } from "../../../utils/protos/services/app/shielded-pool"; -import { base64ToUint8Array } from "../../../utils/math/base64"; +import { ShieldedPoolQuerier } from "@/old/utils/protos/services/app/shielded-pool"; +import { base64ToUint8Array } from "@/old/utils/math/base64"; import { AssetId, Metadata, diff --git a/src/pages/api/simulations/[...params].ts b/src/pages/api/simulations/[...params].ts index d8967f80..ef9c7baa 100644 --- a/src/pages/api/simulations/[...params].ts +++ b/src/pages/api/simulations/[...params].ts @@ -1,17 +1,17 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/simulations/[...params].ts -import { SimulationQuerier } from "@/utils/protos/services/dex/simulated-trades"; -import { base64ToUint8Array } from "../../../utils/math/base64"; +import { SimulationQuerier } from "@/old/utils/protos/services/dex/simulated-trades"; +import { base64ToUint8Array } from "@/old/utils/math/base64"; import { SimulateTradeRequest, SimulateTradeRequest_Routing_SingleHop, SimulateTradeResponse, SwapExecution, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { joinLoHi, splitLoHi } from "@/utils/math/hiLo"; +import { joinLoHi, splitLoHi } from "@/old/utils/math/hiLo"; import { NextApiRequest, NextApiResponse } from "next"; -import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; +import { fetchAllTokenAssets } from "@/old/utils/token/tokenFetch"; const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT!; if (!grpcEndpoint) { diff --git a/src/pages/api/swaps/[...params].ts b/src/pages/api/swaps/[...params].ts index f696a2b1..23a16a9d 100644 --- a/src/pages/api/swaps/[...params].ts +++ b/src/pages/api/swaps/[...params].ts @@ -2,8 +2,8 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ // pages/api/swaps/[...params].ts -import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client"; -import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface"; +import { DexQueryServiceClient } from "@/old/utils/protos/services/dex/dex-query-service-client"; +import { SwapExecutionWithBlockHeight } from "@/old/utils/protos/types/DexQueryServiceClientInterface"; import { NextApiRequest, NextApiResponse } from "next"; const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT! @@ -39,4 +39,4 @@ export default async function swapsByBlockRange(req: NextApiRequest, res: NextAp }); } -} \ No newline at end of file +} diff --git a/src/pages/block/[block_height].tsx b/src/pages/block/[block_height].tsx index a3ee33b1..539a9356 100644 --- a/src/pages/block/[block_height].tsx +++ b/src/pages/block/[block_height].tsx @@ -1,6 +1,6 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ -import Layout from "@/components/layout"; +import Layout from "@/old/components/layout"; import { useRouter } from "next/router"; import { Box, @@ -12,22 +12,22 @@ import { Flex, } from "@chakra-ui/react"; import { useEffect, useState } from "react"; -import { BlockDetailedSummaryData } from "@/utils/types/block"; -import { BlockInfo, LiquidityPositionEvent } from "@/utils/indexer/types/lps"; -import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface"; -import { LoadingSpinner } from "@/components/util/loadingSpinner"; -import { Constants } from "@/utils/configConstants.ts"; -import { formatTimestampShort } from "@/components/blockTimestamp"; +import { BlockDetailedSummaryData } from "@/old/utils/types/block"; +import { BlockInfo, LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; +import { SwapExecutionWithBlockHeight } from "@/old/utils/protos/types/DexQueryServiceClientInterface"; +import { LoadingSpinner } from "@/old/components/util/loadingSpinner"; +import { Constants } from "@/old/utils/configConstants"; +import { formatTimestampShort } from "@/old/components/blockTimestamp"; import { AddIcon, MinusIcon } from "@chakra-ui/icons"; -import { innerToBech32Address } from "@/utils/math/bech32"; +import { innerToBech32Address } from "@/old/utils/math/bech32"; import { SwapExecution, SwapExecution_Trace, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; import BigNumber from "bignumber.js"; -import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; -import { Token } from "@/utils/types/token"; -import { fromBaseUnit } from "@/utils/math/hiLo"; +import { fetchAllTokenAssets } from "@/old/utils/token/tokenFetch"; +import { Token } from "@/old/utils/types/token"; +import { fromBaseUnit } from "@/old/utils/math/hiLo"; export const Price = ({ trace, diff --git a/src/pages/explorer/index.tsx b/src/pages/explorer/index.tsx index d0267e35..4b4f0e8a 100644 --- a/src/pages/explorer/index.tsx +++ b/src/pages/explorer/index.tsx @@ -1,10 +1,10 @@ // @ts-nocheck /* eslint-disable -- disabling this file as this was created before our strict rules */ import { Box, Flex, Text } from "@chakra-ui/react"; -import Layout from "../../components/layout"; -import { LPSearchBar } from "../../components/lpSearchBar"; -import Blocks from '../../components/blocks' -import Swaps from '../../components/swaps' +import Layout from "@/old/components/layout"; +import { LPSearchBar } from "@/old/components/lpSearchBar"; +import Blocks from '@/old/components/blocks' +import Swaps from '@/old/components/swaps' export default function Explorer() { return ( @@ -33,4 +33,4 @@ export default function Explorer() { ); -} \ No newline at end of file +} diff --git a/src/pages/lp/[lp_nft_id].tsx b/src/pages/lp/[lp_nft_id].tsx index 7beb5ff6..e4973ca7 100644 --- a/src/pages/lp/[lp_nft_id].tsx +++ b/src/pages/lp/[lp_nft_id].tsx @@ -6,16 +6,16 @@ import React, { useEffect, useRef, useState } from "react"; import { useRouter } from "next/router"; import styles from "../../../styles/Home.module.css"; import { Position } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import Layout from "../../components/layout"; -import CurrentLPStatus from "../../components/liquidityPositions/currentStatus"; +import Layout from "@/old/components/layout"; +import CurrentLPStatus from "@/old/components/liquidityPositions/currentStatus"; import { VStack, Text, Box, HStack, IconButton } from "@chakra-ui/react"; -import { LoadingSpinner } from "../../components/util/loadingSpinner"; +import { LoadingSpinner } from "@/old/components/util/loadingSpinner"; import { LiquidityPositionEvent, PositionExecutionEvent, -} from "@/utils/indexer/types/lps"; -import TimelinePosition from "@/components/liquidityPositions/timelinePosition"; -import ExecutionEvent from "@/components/liquidityPositions/executionEvent"; +} from "@/old/utils/indexer/types/lps"; +import TimelinePosition from "@/old/components/liquidityPositions/timelinePosition"; +import ExecutionEvent from "@/old/components/liquidityPositions/executionEvent"; import { ChevronDownIcon } from "@chakra-ui/icons"; export default function LP() { diff --git a/src/pages/lp/utils.tsx b/src/pages/lp/utils.tsx index 92b6699b..9db2ce2d 100644 --- a/src/pages/lp/utils.tsx +++ b/src/pages/lp/utils.tsx @@ -3,9 +3,9 @@ // pages/lp/utils.tsx import React, { useState } from "react"; -import Layout from "../../components/layout"; +import Layout from "@/old/components/layout"; import { VStack, Text, Center, HStack, Input, Button } from "@chakra-ui/react"; -import { innerToBech32Address, bech32ToInner } from "../../utils/math/bech32"; +import { innerToBech32Address, bech32ToInner } from "@/old/utils/math/bech32"; export default function Utils() { const [innerAddress, setInnerAddress] = useState(""); @@ -64,4 +64,4 @@ export default function Utils() { ); -} \ No newline at end of file +} diff --git a/src/pages/pair/[...params].tsx b/src/pages/pair/[...params].tsx index e3b3966d..09e16475 100644 --- a/src/pages/pair/[...params].tsx +++ b/src/pages/pair/[...params].tsx @@ -4,7 +4,7 @@ import React, { useEffect, useRef, useState } from "react"; import { useRouter } from "next/router"; -import Layout from "../../components/layout"; +import Layout from "@/old/components/layout"; import { VStack, Text, @@ -22,14 +22,14 @@ import { Position, SwapExecution, } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb"; -import { LoadingSpinner } from "../../components/util/loadingSpinner"; -import { base64ToUint8Array } from "@/utils/math/base64"; -import { joinLoHi, splitLoHi } from "@/utils/math/hiLo"; -import DepthChart from "@/components/charts/depthChart"; -import OHLCChart from "@/components/charts/ohlcChart"; -import BuySellChart from "@/components/charts/buySellChart"; -import { Token } from "@/utils/types/token"; -import { fetchAllTokenAssets } from "@/utils/token/tokenFetch"; +import { LoadingSpinner } from "@/old/components/util/loadingSpinner"; +import { base64ToUint8Array } from "@/old/utils/math/base64"; +import { joinLoHi, splitLoHi } from "@/old/utils/math/hiLo"; +import DepthChart from "@/old/components/charts/depthChart"; +import OHLCChart from "@/old/components/charts/ohlcChart"; +import BuySellChart from "@/old/components/charts/buySellChart"; +import { Token } from "@/old/utils/types/token"; +import { fetchAllTokenAssets } from "@/old/utils/token/tokenFetch"; // TODO: Better parameter check // ! Important note: 'sell' side here refers to selling asset1 for asset2, so its really DEMAND for buying asset 1, anc vice versa for 'buy' side diff --git a/src/pages/pair/index.tsx b/src/pages/pair/index.tsx index eb24ea43..5a2a78f2 100644 --- a/src/pages/pair/index.tsx +++ b/src/pages/pair/index.tsx @@ -4,10 +4,10 @@ import { useState, useEffect } from 'react'; import { VStack, HStack, Box, Select, Button, Avatar } from '@chakra-ui/react'; -import Layout from '@/components/layout'; -import { fetchAllTokenAssets } from '@/utils/token/tokenFetch'; -import { LoadingSpinner } from '@/components/util/loadingSpinner'; -import { Token } from '@/utils/types/token'; +import Layout from '@/old/components/layout'; +import { fetchAllTokenAssets } from '@/old/utils/token/tokenFetch'; +import { LoadingSpinner } from '@/old/components/util/loadingSpinner'; +import { Token } from '@/old/utils/types/token'; export default function Pairs() { const [isLoading, setIsLoading] = useState(true); @@ -44,7 +44,7 @@ export default function Pairs() { {isLoading ? ( - ) : + ) : diff --git a/src/pages/trade/[[...params]].tsx b/src/pages/trade/[[...params]].tsx index 92a75bc3..11871c35 100644 --- a/src/pages/trade/[[...params]].tsx +++ b/src/pages/trade/[[...params]].tsx @@ -2,7 +2,7 @@ /* eslint-disable -- disabling this file as this was created before our strict rules */ import React, { useEffect, useRef, useState } from 'react'; import { useRouter } from 'next/router'; -import Layout from '../../components/layout'; +import Layout from '@/old/components/layout'; import { Text, Box, Flex } from '@chakra-ui/react'; import { useSearchParams } from 'next/navigation'; import { @@ -10,13 +10,13 @@ import { SwapExecution, } from '@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb'; import { ChevronDown } from '@styled-icons/octicons/ChevronDown'; -import { joinLoHi, splitLoHi } from '@/utils/math/hiLo'; -import DepthChart from '@/components/charts/depthChart'; -import OHLCChart from '@/components/charts/ohlcChart'; -import BuySellChart from '@/components/charts/buySellChart'; -import PairSelector from '@/components/pairSelector'; -import { Token } from '@/utils/types/token'; -import { fetchAllTokenAssets } from '@/utils/token/tokenFetch'; +import { joinLoHi, splitLoHi } from '@/old/utils/math/hiLo'; +import DepthChart from '@/old/components/charts/depthChart'; +import OHLCChart from '@/old/components/charts/ohlcChart'; +import BuySellChart from '@/old/components/charts/buySellChart'; +import PairSelector from '@/old/components/pairSelector'; +import { Token } from '@/old/utils/types/token'; +import { fetchAllTokenAssets } from '@/old/utils/token/tokenFetch'; // TODO: Better parameter check // ! Important note: 'sell' side here refers to selling asset1 for asset2, so its really DEMAND for buying asset 1, anc vice versa for 'buy' side diff --git a/src/pages/trades.tsx b/src/pages/trades.tsx index 8f3304c1..c7c75fd1 100644 --- a/src/pages/trades.tsx +++ b/src/pages/trades.tsx @@ -12,13 +12,13 @@ import { FormControl, NumberInputField, } from "@chakra-ui/react"; -import Layout from "../components/layout"; -import { LoadingSpinner } from "@/components/util/loadingSpinner"; +import Layout from "@/old/components/layout"; +import { LoadingSpinner } from "@/old/components/util/loadingSpinner"; import { useEffect, useRef, useState } from "react"; -import { BlockSummary } from "@/components/executionHistory/blockSummary"; -import { BlockInfo, LiquidityPositionEvent } from "@/utils/indexer/types/lps"; -import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface"; -import { BlockInfoMap, BlockSummaryMap } from "@/utils/types/block"; +import { BlockSummary } from "@/old/components/executionHistory/blockSummary"; +import { BlockInfo, LiquidityPositionEvent } from "@/old/utils/indexer/types/lps"; +import { SwapExecutionWithBlockHeight } from "@/old/utils/protos/types/DexQueryServiceClientInterface"; +import { BlockInfoMap, BlockSummaryMap } from "@/old/utils/types/block"; export default function Trades() { // Go back hardcoded N blocks diff --git a/src/utils/routes/pages.ts b/src/shared/pages.ts similarity index 100% rename from src/utils/routes/pages.ts rename to src/shared/pages.ts diff --git a/src/utils/penumbra.ts b/src/shared/penumbra.ts similarity index 100% rename from src/utils/penumbra.ts rename to src/shared/penumbra.ts diff --git a/src/state/connection/index.ts b/src/shared/state/connection/index.ts similarity index 97% rename from src/state/connection/index.ts rename to src/shared/state/connection/index.ts index 2283771b..6c65f415 100644 --- a/src/state/connection/index.ts +++ b/src/shared/state/connection/index.ts @@ -1,5 +1,5 @@ import { PenumbraRequestFailure, PenumbraState, PenumbraManifest } from '@penumbra-zone/client'; -import { penumbra, PRAX_ORIGIN } from '@/utils/penumbra'; +import { penumbra, PRAX_ORIGIN } from '@/shared/penumbra'; import { makeAutoObservable } from 'mobx'; class ConnectionStateStore { diff --git a/src/state/status/getSyncPercent.ts b/src/shared/state/status/getSyncPercent.ts similarity index 100% rename from src/state/status/getSyncPercent.ts rename to src/shared/state/status/getSyncPercent.ts diff --git a/src/state/status/index.ts b/src/shared/state/status/index.ts similarity index 93% rename from src/state/status/index.ts rename to src/shared/state/status/index.ts index 7a63e068..1ef3cf6f 100644 --- a/src/state/status/index.ts +++ b/src/shared/state/status/index.ts @@ -1,12 +1,12 @@ import { ViewService } from '@penumbra-zone/protobuf'; -import { penumbra } from '@/utils/penumbra'; -import { getSyncPercent } from '@/state/status/getSyncPercent'; +import { penumbra } from '@/shared/penumbra'; +import { getSyncPercent } from '@/shared/state/status/getSyncPercent'; import { makeAutoObservable, runInAction, when } from 'mobx'; import { StatusResponse, StatusStreamResponse, } from '@penumbra-zone/protobuf/penumbra/view/v1/view_pb'; -import { connectionStore } from '@/state/connection'; +import { connectionStore } from '@/shared/state/connection'; class StatusState { /** If true, ignore all other state values */ diff --git a/src/utils/routes/usePagePath.ts b/src/shared/usePagePath.ts similarity index 100% rename from src/utils/routes/usePagePath.ts rename to src/shared/usePagePath.ts