-
@@ -664,14 +665,13 @@ const DepthChart = ({
backgroundColor="var(--complimentary-background)"
size={"sm"}
isDisabled={
- zoomIndex == zoomLevels.length - 1 || disablePlusButton == true
+ zoomIndex == zoomLevels.length - 1 || disablePlusButton
}
>
+
- >
);
};
diff --git a/src/components/charts/ohlcChart.tsx b/src/components/charts/ohlcChart.tsx
index 5d5f698a..d5f7e8db 100644
--- a/src/components/charts/ohlcChart.tsx
+++ b/src/components/charts/ohlcChart.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// src/components/charts/ohlcChart.tsx
import React, { useEffect, useState } from "react";
@@ -17,9 +19,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
const [isTimestampsLoading, setIsTimestampsLoading] = useState(true);
const [ohlcData, setOHLCData] = useState([]); // [{open, high, low, close, directVolume, swapVolume, height}]
const [originalOHLCData, setOriginalOHLCData] = useState([]); // [{open, high, low, close, directVolume, swapVolume, height}
- const [blockToTimestamp, setBlockToTimestamp] = useState<{
- [key: string]: string;
- }>({}); // {height: timestamp}
+ const [blockToTimestamp, setBlockToTimestamp] = useState
>({}); // {height: timestamp}
const [error, setError] = useState(undefined); // [error message]
const [chartData, setChartData] = useState<
[string, number, number, number, number][]
@@ -43,7 +43,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
const startBlock = await fetch("/api/blocks/1")
.then((res) => res.json())
.then((data) => {
- const currentBlock = data[0]['height']
+ const currentBlock = data[0].height
console.log(currentBlock)
const startBlock = currentBlock - Math.trunc(daysLookback * 24 * 60 * 60 / blockTimeSeconds);
console.log("Start block: ", startBlock);
@@ -192,7 +192,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
// Process the data and make a list of OHLC heights
// format needed is '/api/blockTimestamps/range/{startHeight}/{endHeight}'
const timestampsForHeights = fetch(
- `/api/blockTimestamps/range/${originalOHLCData[0]["height"]}/${originalOHLCData[originalOHLCData.length - 1]["height"]}`
+ `/api/blockTimestamps/range/${originalOHLCData[0].height}/${originalOHLCData[originalOHLCData.length - 1].height}`
).then((res) => res.json());
Promise.all([timestampsForHeights])
@@ -219,7 +219,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
console.log("Timestamps: ", timestampsForHeightsResponse);
// Convert to a dictionary with height as key and timestamp as value
- const timestampMapping: { [key: string]: string } = {};
+ const timestampMapping: Record = {};
timestampsForHeightsResponse.forEach(
(item: { height: string; created_at: string }) => {
timestampMapping[item.height] = item.created_at;
@@ -258,13 +258,13 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
// blockToTimestamp is a dictionary with height as key and timestamp as value
const preparedData = ohlcData
.map((ohlc) => {
- const formattedDate = formatTimestamp(blockToTimestamp[ohlc["height"]]);
+ const formattedDate = formatTimestamp(blockToTimestamp[ohlc.height]);
if (!formattedDate) {
console.error(
- `Invalid timestamp for height ${ohlc["height"]}: ${blockToTimestamp[ohlc["height"]]
+ `Invalid timestamp for height ${ohlc.height}: ${blockToTimestamp[ohlc.height]
}`
);
- setError("Missing timestamp for height " + ohlc["height"]);
+ setError("Missing timestamp for height " + ohlc.height);
return null;
}
@@ -272,15 +272,15 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
10 ** Math.abs(asset2Token.decimals - asset1Token.decimals);
return [
formattedDate,
- ((ohlc["open"] as number) / decimalCorrection).toFixed(6),
- ((ohlc["close"] as number) / decimalCorrection).toFixed(6),
- ((ohlc["low"] as number) / decimalCorrection).toFixed(6),
- ((ohlc["high"] as number) / decimalCorrection).toFixed(6),
+ ((ohlc.open as number) / decimalCorrection).toFixed(6),
+ ((ohlc.close as number) / decimalCorrection).toFixed(6),
+ ((ohlc.low as number) / decimalCorrection).toFixed(6),
+ ((ohlc.high as number) / decimalCorrection).toFixed(6),
// Volume
// Divide volume by decimals of the quote token depending on the direction of the canldestick data
(
- (((ohlc["swapVolume"] as number) +
- ohlc["directVolume"]) as number) /
+ (((ohlc.swapVolume as number) +
+ ohlc.directVolume)) /
10 ** asset1Token.decimals
).toFixed(2),
];
@@ -299,7 +299,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
const volumePreparedData = preparedData.map((item) => [
item[0],
item[5],
- ]) as [string, number][];
+ ]);
setChartData(
preparedData.map((item) => [item[0], item[1], item[2], item[3], item[4]])
@@ -327,17 +327,17 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
const batchOHLCData = (batch: any[], intervalStart: Date) => {
const aggregatedOHLC: any = {
- open: batch[0]["open"],
- high: Math.max(...batch.map((ohlc) => ohlc["high"])),
- low: Math.min(...batch.map((ohlc) => ohlc["low"])),
- close: batch[batch.length - 1]["close"],
- directVolume: batch.reduce((acc, ohlc) => acc + ohlc["directVolume"], 0),
- swapVolume: batch.reduce((acc, ohlc) => acc + ohlc["swapVolume"], 0),
- height: batch[0]["height"],
+ open: batch[0].open,
+ high: Math.max(...batch.map((ohlc) => ohlc.high)),
+ low: Math.min(...batch.map((ohlc) => ohlc.low)),
+ close: batch[batch.length - 1].close,
+ directVolume: batch.reduce((acc, ohlc) => acc + ohlc.directVolume, 0),
+ swapVolume: batch.reduce((acc, ohlc) => acc + ohlc.swapVolume, 0),
+ height: batch[0].height,
};
// Add the interval start time to blockToTimestamp
- blockToTimestamp[aggregatedOHLC["height"]] = intervalStart.toISOString();
+ blockToTimestamp[aggregatedOHLC.height] = intervalStart.toISOString();
return aggregatedOHLC;
};
@@ -388,7 +388,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
let currentIntervalStart: Date | null = null;
originalOHLCData.forEach((ohlc, index) => {
- const timestamp = new Date(blockToTimestamp[ohlc["height"]]);
+ const timestamp = new Date(blockToTimestamp[ohlc.height]);
const intervalStart = getIntervalStart(timestamp.toISOString());
if (currentIntervalStart === null) {
@@ -408,7 +408,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
currentIntervalStart = new Date(currentIntervalStart.getTime() + timeAggregateSeconds * 1000);
if (currentIntervalStart < intervalStart) {
const previousOHLC = aggregatedData[aggregatedData.length - 1];
- const placeholderOHLC = createPlaceholderOHLC(currentIntervalStart, previousOHLC["close"]);
+ const placeholderOHLC = createPlaceholderOHLC(currentIntervalStart, previousOHLC.close);
aggregatedData.push(placeholderOHLC);
}
}
@@ -583,7 +583,7 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
},
fillerColor: "rgba(255, 255, 255, 0.2)", // Slightly brighter fill color
borderColor: "rgba(255, 255, 255, 0.2)", // Light grey border
- //handleIcon:"M8.2,13.4c0,0.6-0.4,1-1,1H1.8c-0.6,0-1-0.4-1-1v-6.8c0-0.6,0.4-1,1-1h5.4c0.6,0,1,0.4,1,1V13.4z", // Handle icon
+ // handleIcon:"M8.2,13.4c0,0.6-0.4,1-1,1H1.8c-0.6,0-1-0.4-1-1v-6.8c0-0.6,0.4-1,1-1h5.4c0.6,0,1,0.4,1,1V13.4z", // Handle icon
handleSize: "100%", // Size of the handle
handleStyle: {
color: "rgba(255, 255, 255, 0.6)", // Light grey handle
@@ -609,11 +609,10 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
justifyContent="center"
alignItems="center"
>
- {`${error}`}
+ {error}
) : (
- <>
-
+
{
style={{ height: "400px", width: "100%" }}
/>
- >
)}
);
diff --git a/src/components/copiedTx.tsx b/src/components/copiedTx.tsx
index 3d8e3112..de7116f5 100644
--- a/src/components/copiedTx.tsx
+++ b/src/components/copiedTx.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { FC, useState } from "react";
import { CopyIcon } from "@radix-ui/react-icons";
import { HStack } from "@chakra-ui/react";
diff --git a/src/components/executionHistory/blockDetails.tsx b/src/components/executionHistory/blockDetails.tsx
index d6c99e89..d7dab9a3 100644
--- a/src/components/executionHistory/blockDetails.tsx
+++ b/src/components/executionHistory/blockDetails.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { BlockSummaryData } from "@/utils/types/block";
import { VStack, Text } from "@chakra-ui/react";
@@ -7,8 +9,7 @@ export interface BlockDetailsProps {
export const BlockDetails = ({ blockSummary }: BlockDetailsProps) => {
return (
- <>
-
+
{"Positions Opened: "}
{blockSummary.openPositionEvents.length}
@@ -30,6 +31,5 @@ export const BlockDetails = ({ blockSummary }: BlockDetailsProps) => {
{blockSummary.arbExecutions.length}
- >
);
}
\ No newline at end of file
diff --git a/src/components/executionHistory/blockSummary.tsx b/src/components/executionHistory/blockSummary.tsx
index 8217c84b..198a19ec 100644
--- a/src/components/executionHistory/blockSummary.tsx
+++ b/src/components/executionHistory/blockSummary.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Box, HStack, Flex, Text } from "@chakra-ui/react";
import BlockTimestampView from "../blockTimestamp";
import { BlockDetails } from "./blockDetails";
@@ -30,4 +32,4 @@ export const BlockSummary = ({ blockHeight, blockSummary }: BlockSummaryProps) =
);
-};
\ No newline at end of file
+};
diff --git a/src/components/layout.tsx b/src/components/layout.tsx
index e3d41a2b..8a42c76f 100644
--- a/src/components/layout.tsx
+++ b/src/components/layout.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// components/Layout.js
import Head from "next/head";
diff --git a/src/components/liquidityPositions/closedStatus.tsx b/src/components/liquidityPositions/closedStatus.tsx
index e7a5e8ff..8df8d1fb 100644
--- a/src/components/liquidityPositions/closedStatus.tsx
+++ b/src/components/liquidityPositions/closedStatus.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React from "react";
import {
VStack,
@@ -14,8 +16,7 @@ interface ClosedPositionStatusProps {
const ClosedPositionStatus = ({ nftId, lp_event }: ClosedPositionStatusProps) => {
return (
- <>
-
+
Position Closed
@@ -30,7 +31,6 @@ const ClosedPositionStatus = ({ nftId, lp_event }: ClosedPositionStatusProps) =>
/>
- >
);
};
diff --git a/src/components/liquidityPositions/currentStatus.tsx b/src/components/liquidityPositions/currentStatus.tsx
index 17321912..7306af73 100644
--- a/src/components/liquidityPositions/currentStatus.tsx
+++ b/src/components/liquidityPositions/currentStatus.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useEffect, useState } from "react";
import { VStack, Text, Badge, HStack, Image, Avatar } from "@chakra-ui/react";
import {
@@ -30,7 +32,7 @@ const CurrentLPStatus = ({ nftId, position }: CurrentLPStatusProps) => {
// First process position to human readable pieces
// Get status
- const status = (position.state as PositionState).state.toString();
+ const status = (position.state!).state.toString();
// https://buf.build/penumbra-zone/penumbra/docs/main:penumbra.core.component.dex.v1#penumbra.core.component.dex.v1.PositionState.PositionStateEnum
let statusText = "";
@@ -56,10 +58,10 @@ const CurrentLPStatus = ({ nftId, position }: CurrentLPStatusProps) => {
}
// Get fee tier
- const feeTier = Number(position!.phi!.component!.fee);
+ const feeTier = Number(position.phi!.component!.fee);
- const asset1 = position!.phi!.pair!.asset1;
- const asset2 = position!.phi!.pair!.asset2;
+ const asset1 = position.phi!.pair!.asset1;
+ const asset2 = position.phi!.pair!.asset2;
// States for tokens
const [asset1Token, setAsset1Token] = useState({
@@ -82,10 +84,10 @@ const CurrentLPStatus = ({ nftId, position }: CurrentLPStatusProps) => {
// Function to fetch tokens asynchronously
const fetchTokens = async () => {
try {
- const asset1 = position!.phi!.pair!.asset1;
- const asset2 = position!.phi!.pair!.asset2;
+ const asset1 = position.phi!.pair!.asset1;
+ const asset2 = position.phi!.pair!.asset2;
- if (asset1 && asset1.inner) {
+ if (asset1?.inner) {
const fetchedAsset1Token = fetchTokenAsset(asset1.inner);
if (!fetchedAsset1Token) {
setAssetError("Asset 1 token not found");
@@ -94,7 +96,7 @@ const CurrentLPStatus = ({ nftId, position }: CurrentLPStatusProps) => {
setAsset1Token(fetchedAsset1Token);
}
- if (asset2 && asset2.inner) {
+ if (asset2?.inner) {
const fetchedAsset2Token = fetchTokenAsset(asset2.inner);
if (!fetchedAsset2Token) {
setAssetError("Asset 2 token not found");
@@ -115,25 +117,25 @@ const CurrentLPStatus = ({ nftId, position }: CurrentLPStatusProps) => {
}
const reserves1 = fromBaseUnit(
- BigInt(position!.reserves!.r1?.lo || 0),
- BigInt(position!.reserves!.r1?.hi || 0),
+ BigInt(position.reserves!.r1?.lo || 0),
+ BigInt(position.reserves!.r1?.hi || 0),
asset1Token.decimals
);
const reserves2 = fromBaseUnit(
- BigInt(position!.reserves!.r2?.lo || 0),
- BigInt(position!.reserves!.r2?.hi || 0),
+ BigInt(position.reserves!.r2?.lo || 0),
+ BigInt(position.reserves!.r2?.hi || 0),
asset2Token.decimals
);
const p: BigNumber = fromBaseUnit(
- BigInt(position!.phi!.component!.p!.lo || 0),
- BigInt(position!.phi!.component!.p!.hi || 0),
+ BigInt(position.phi!.component!.p!.lo || 0),
+ BigInt(position.phi!.component!.p!.hi || 0),
asset2Token.decimals
);
const q: BigNumber = fromBaseUnit(
- BigInt(position!.phi!.component!.q!.lo || 0),
- BigInt(position!.phi!.component!.q!.hi || 0),
+ BigInt(position.phi!.component!.q!.lo || 0),
+ BigInt(position.phi!.component!.q!.hi || 0),
asset1Token.decimals
);
diff --git a/src/components/liquidityPositions/executionEvent.tsx b/src/components/liquidityPositions/executionEvent.tsx
index 40d2c582..849ba3b1 100644
--- a/src/components/liquidityPositions/executionEvent.tsx
+++ b/src/components/liquidityPositions/executionEvent.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useEffect, useState } from "react";
import {
Box,
diff --git a/src/components/liquidityPositions/openStatus.tsx b/src/components/liquidityPositions/openStatus.tsx
index ba327dea..28d3eabd 100644
--- a/src/components/liquidityPositions/openStatus.tsx
+++ b/src/components/liquidityPositions/openStatus.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { useEffect, useState } from "react";
import {
Box,
@@ -27,8 +29,7 @@ interface OpenPositionStatusProps {
const OpenPositionStatus = ({ nftId, lp_event }: OpenPositionStatusProps) => {
return (
- <>
-
+
Position Opened
@@ -44,7 +45,6 @@ const OpenPositionStatus = ({ nftId, lp_event }: OpenPositionStatusProps) => {
- >
);
};
diff --git a/src/components/liquidityPositions/timelinePosition.tsx b/src/components/liquidityPositions/timelinePosition.tsx
index ce869055..321a4496 100644
--- a/src/components/liquidityPositions/timelinePosition.tsx
+++ b/src/components/liquidityPositions/timelinePosition.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* 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";
@@ -16,10 +18,9 @@ export const POSITION_CLOSE_EVENT = "EventQueuePositionClose";
export const POSITION_WITHDRAW_EVENT = "EventPositionWithdraw";
const TimelinePosition = ({ nftId, lp_event }: TimelinePositionProps) => {
- //console.log(lp_event);
+ // console.log(lp_event);
return (
- <>
- {
- >
);
};
diff --git a/src/components/liquidityPositions/withdrawnStatus.tsx b/src/components/liquidityPositions/withdrawnStatus.tsx
index 8fdd7c1a..68da90af 100644
--- a/src/components/liquidityPositions/withdrawnStatus.tsx
+++ b/src/components/liquidityPositions/withdrawnStatus.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React from "react";
import {
VStack,
@@ -18,8 +20,7 @@ const WithdrawnPositionStatus = ({
lp_event,
}: WithdrawnPositionStatusProps) => {
return (
- <>
-
+
Position Withdrawn
@@ -35,7 +36,6 @@ const WithdrawnPositionStatus = ({
- >
);
};
diff --git a/src/components/lpAssetView.tsx b/src/components/lpAssetView.tsx
index 2ae65c3c..4ffc0455 100644
--- a/src/components/lpAssetView.tsx
+++ b/src/components/lpAssetView.tsx
@@ -1,7 +1,8 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import React, { FC, useEffect, useState } from "react";
import { CopyIcon } from "@radix-ui/react-icons";
-import { Avatar, HStack, VStack } from "@chakra-ui/react";
-import { Text } from "@chakra-ui/react";
+import { Avatar, HStack, VStack , Text } from "@chakra-ui/react";
import {
LiquidityPositionEvent,
PositionExecutionEvent,
@@ -72,7 +73,7 @@ const LPAssetView: FC = ({ sectionTitle, lp_event }) => {
if (asset2) {
const fetchedAsset2Token = fetchTokenAsset(asset2)
- //const fetchedAsset2Token = await fetchToken(asset2);
+ // const fetchedAsset2Token = await fetchToken(asset2);
if (!fetchedAsset2Token) {
setAssetError("Asset 2 token not found");
throw new Error("Asset 2 token not found");
@@ -128,8 +129,7 @@ const LPAssetView: FC = ({ sectionTitle, lp_event }) => {
}, [lp_event, asset1Token, asset2Token]);
return (
- <>
-
+
{sectionTitle}{" "}
@@ -163,7 +163,6 @@ const LPAssetView: FC = ({ sectionTitle, lp_event }) => {
- >
);
};
diff --git a/src/components/lpSearchBar.tsx b/src/components/lpSearchBar.tsx
index e0ece1b3..30bb8ee5 100644
--- a/src/components/lpSearchBar.tsx
+++ b/src/components/lpSearchBar.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// components/lpSearchBar.tsx
import React, { useState } from "react";
diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx
index bc3af84e..57a42c4f 100644
--- a/src/components/navbar.tsx
+++ b/src/components/navbar.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// components/navbar.tsx
import Image from "next/image";
diff --git a/src/components/pairSelector.tsx b/src/components/pairSelector.tsx
index 3f6b4abe..fe0c9f14 100644
--- a/src/components/pairSelector.tsx
+++ b/src/components/pairSelector.tsx
@@ -1,17 +1,17 @@
-import { useEffect, useState } from "react";
-import { Box, Text, Flex } from "@chakra-ui/react";
-import { fetchAllTokenAssets } from "@/utils/token/tokenFetch";
-import OutsideClickHandler from "react-outside-click-handler";
-import { Token } from "@/utils/types/token";
+import { useEffect, useState } from 'react';
+import { Box, Text, Flex } from '@chakra-ui/react';
+import { fetchAllTokenAssets } from '@/utils/token/tokenFetch';
+import OutsideClickHandler from 'react-outside-click-handler';
+import { Token } from '@/utils/types/token';
-const orderedAssets = ["UM", "USDC"];
+const orderedAssets = ['UM', 'USDC'];
export default function PairSelector({
show,
setShow,
onSelect,
}: {
- show: Boolean;
+ show: boolean;
setShow: (show: boolean) => void;
onSelect: (assets: [Token, Token]) => void;
}) {
@@ -20,9 +20,7 @@ export default function PairSelector({
useEffect(() => {
const tokenAssets = fetchAllTokenAssets();
- setTokenAssets(
- Object.fromEntries(tokenAssets.map((asset) => [asset.symbol, asset]))
- );
+ setTokenAssets(Object.fromEntries(tokenAssets.map(asset => [asset.symbol, asset])));
}, []);
useEffect(() => {
@@ -34,56 +32,61 @@ export default function PairSelector({
onSelect(selectedAssets as [Token, Token]);
setShow(false);
}
- }, [selectedAssets]);
+ }, [selectedAssets, onSelect, setShow]);
return (
setShow(false)}>
- {!selectedAssets.length ? "Select Base Asset" : "Select Quote Asset"}
+ {!selectedAssets.length ? 'Select Base Asset' : 'Select Quote Asset'}
{[
- ...orderedAssets.map((symbol) => tokenAssets[symbol]),
+ ...orderedAssets.map(symbol => tokenAssets[symbol]),
...Object.values(tokenAssets)
- .filter((asset) => !orderedAssets.includes(asset.symbol))
+ .filter(asset => !orderedAssets.includes(asset.symbol))
.sort((a, b) => {
return a.symbol.localeCompare(b.symbol);
}),
]
- .filter((asset) => asset && !selectedAssets.includes(asset))
- .map((asset) => (
- setSelectedAssets([...selectedAssets, asset])}
- >
-
- {asset.symbol}
-
-
- {asset.display}
-
-
- ))}
+ .filter(asset => asset && !selectedAssets.includes(asset))
+ .map(asset => {
+ if (!asset) {
+ return null;
+ }
+ return (
+ setSelectedAssets([...selectedAssets, asset])}
+ >
+
+ {asset.symbol}
+
+
+ {asset.display}
+
+
+ );
+ })}
);
diff --git a/src/components/swaps/index.tsx b/src/components/swaps/index.tsx
index 2b3bced9..105d221c 100644
--- a/src/components/swaps/index.tsx
+++ b/src/components/swaps/index.tsx
@@ -1,8 +1,9 @@
// copied from pages/index
+/* 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 { Box, Heading, HStack, Link, Stack, VStack } from "@chakra-ui/react";
+import { Box, Link, Stack, VStack } from "@chakra-ui/react";
import {
SwapExecution,
SwapExecution_Trace,
@@ -27,11 +28,11 @@ export default function Swaps() {
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
- let fetchData = async () => {
+ const fetchData = async () => {
const blockHeight = await fetch("/api/blocks/1")
.then((res) => res.json())
.then((data) => {
- return data[0]["height"];
+ return data[0].height;
})
.catch((err) => {
console.error(err);
@@ -42,7 +43,7 @@ export default function Swaps() {
let swaps = [];
let blockRange = 10;
- let maxBlocks = 100000;
+ const maxBlocks = 100000;
while (blockRange <= maxBlocks && swaps.length == 0) {
console.log(
diff --git a/src/components/util/loadingSpinner.tsx b/src/components/util/loadingSpinner.tsx
index e009d5e9..44f96ffe 100644
--- a/src/components/util/loadingSpinner.tsx
+++ b/src/components/util/loadingSpinner.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Center, VStack, Spinner, Text } from "@chakra-ui/react";
export const LoadingSpinner = () => {
diff --git a/src/constants/configConstants.ts b/src/constants/configConstants.ts
index fc165028..f131f3ed 100644
--- a/src/constants/configConstants.ts
+++ b/src/constants/configConstants.ts
@@ -3,10 +3,10 @@ export interface ConstantsConfig {
chainId: string;
}
-const defaultChainId = "penumbra-1"
-const defaultCuiolaUrl = "https://cuiloa.testnet.penumbra.zone"
+const defaultChainId = "penumbra-1";
+const defaultCuiolaUrl = "https://cuiloa.testnet.penumbra.zone";
export const Constants: ConstantsConfig = {
- cuiloaUrl: process.env.NEXT_PUBLIC_CUILOA_URL ? process.env.NEXT_PUBLIC_CUILOA_URL : defaultCuiolaUrl,
- chainId: process.env.NEXT_PUBLIC_CHAIN_ID ? process.env.NEXT_PUBLIC_CHAIN_ID : defaultChainId,
+ cuiloaUrl: process.env["NEXT_PUBLIC_CUILOA_URL"] ?? defaultCuiolaUrl,
+ chainId: process.env["NEXT_PUBLIC_CHAIN_ID"] ?? defaultChainId,
};
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 77c1d2f2..7637681e 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import type { AppProps } from "next/app";
import React from "react";
import "@/global.css";
diff --git a/src/pages/api/arbs/[...params].ts b/src/pages/api/arbs/[...params].ts
index abad9d04..77f27a89 100644
--- a/src/pages/api/arbs/[...params].ts
+++ b/src/pages/api/arbs/[...params].ts
@@ -1,39 +1,36 @@
// pages/api/arbs/[...params].ts
-import { DexQueryServiceClient } from "@/utils/protos/services/dex/dex-query-service-client";
-import { SwapExecutionWithBlockHeight } from "@/utils/protos/types/DexQueryServiceClientInterface";
-import { NextApiRequest, NextApiResponse } from "next";
+import { DexQueryServiceClient } from '@/utils/protos/services/dex/dex-query-service-client';
+import { NextApiRequest, NextApiResponse } from 'next';
-const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT!
+const grpcEndpoint = process.env['PENUMBRA_GRPC_ENDPOINT'];
if (!grpcEndpoint) {
- throw new Error("PENUMBRA_GRPC_ENDPOINT is not set")
+ throw new Error('PENUMBRA_GRPC_ENDPOINT is not set');
}
export default async function arbsByBlockRange(req: NextApiRequest, res: NextApiResponse) {
- const params = req.query.params as string[];
+ const params = req.query['params'] as string[];
- const startHeight = params[0] || null;
- const endHeight = params[1] || null;
+ const startHeight = params[0] ?? null;
+ const endHeight = params[1] ?? null;
- try {
- if (!startHeight || !endHeight) {
- return res.status(400).json({ error: "Invalid query parameters" });
- }
- // TODO: validate StartHeight/EndHeight are numbers
- const dex_querier = new DexQueryServiceClient({
- grpcEndpoint: grpcEndpoint,
- });
+ try {
+ if (!startHeight || !endHeight) {
+ res.status(400).json({ error: 'Invalid query parameters' });
+ return;
+ }
+ // TODO: validate StartHeight/EndHeight are numbers
+ const dex_querier = new DexQueryServiceClient({
+ grpcEndpoint: grpcEndpoint ?? '',
+ });
- const data = await dex_querier.arbExecutions(
- parseInt(startHeight),
- parseInt(endHeight)
- );
+ const data = await dex_querier.arbExecutions(parseInt(startHeight), parseInt(endHeight));
- res.status(200).json(data as SwapExecutionWithBlockHeight[]);
- } catch (error) {
- console.error("Error getting liquidty positions by price grpc data:", error);
- res.status(500).json({
- error: `Error getting liquidty positions by price grpc data: ${error}`,
- });
- }
+ res.status(200).json(data ?? null);
+ } catch (error) {
+ console.error('Error getting liquidty positions by price grpc data:', error);
+ res.status(500).json({
+ error: `Error getting liquidty positions by price grpc data: ${error as string}`,
+ });
+ }
}
diff --git a/src/pages/api/blockTimestamps/[...params].js b/src/pages/api/blockTimestamps/[...params].js
index 4388875f..94d9948d 100644
--- a/src/pages/api/blockTimestamps/[...params].js
+++ b/src/pages/api/blockTimestamps/[...params].js
@@ -1,23 +1,25 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/blockTimestamps/[...params].js
import { IndexerQuerier } from "../../../utils/indexer/connector";
-const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT
+const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT;
if (!indexerEndpoint) {
- throw new Error("PENUMBRA_INDEXER_ENDPOINT is not set")
+ throw new Error("PENUMBRA_INDEXER_ENDPOINT is not set");
}
export default async function blockTimestampsFetchHandler(req, res) {
const indexerQuerier = new IndexerQuerier(indexerEndpoint);
// if the first param is 'range' then we are fetching a range of blocks
-
+
// Params will be an arbitrarily long list of block heights
const params = req.query.params;
let blocks = [];
- if (params[0] == "range") {
- if (params.length != 3 || isNaN(params[1]) || isNaN(params[2])) {
+ if (params[0] === "range") {
+ if (params.length !== 3 || isNaN(params[1]) || isNaN(params[2])) {
res.status(400).json({ error: "Invalid block height range" });
return;
}
@@ -25,7 +27,7 @@ export default async function blockTimestampsFetchHandler(req, res) {
// define blocks as inclusive range between the two block heights
const start = parseInt(params[1]);
const end = parseInt(params[2]);
- blocks = Array.from({length: end - start + 1}, (_, i) => start + i);
+ blocks = Array.from({ length: end - start + 1 }, (_, i) => start + i);
} else {
for (const param of params) {
if (isNaN(param)) {
diff --git a/src/pages/api/blocks/[...params].js b/src/pages/api/blocks/[...params].js
index 734a5c06..ccc7cc9c 100644
--- a/src/pages/api/blocks/[...params].js
+++ b/src/pages/api/blocks/[...params].js
@@ -1,30 +1,34 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/api/blocks/[...params].js
import { IndexerQuerier } from "../../../utils/indexer/connector";
-const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT
+const grpcEndpoint = process.env.PENUMBRA_GRPC_ENDPOINT;
if (!grpcEndpoint) {
- throw new Error("PENUMBRA_GRPC_ENDPOINT is not set")
+ throw new Error("PENUMBRA_GRPC_ENDPOINT is not set");
}
-const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT
+const indexerEndpoint = process.env.PENUMBRA_INDEXER_ENDPOINT;
if (!indexerEndpoint) {
- throw new Error("PENUMBRA_INDEXER_ENDPOINT is not set")
+ throw new Error("PENUMBRA_INDEXER_ENDPOINT is not set");
}
export default async function blockInfoFetchHandler(req, res) {
-
const indexerQuerier = new IndexerQuerier(indexerEndpoint);
try {
if (req.query.params.length === 1) {
- const n = req.query.params[0];
- const data = await indexerQuerier.fetchMostRecentNBlocks(parseInt(n));
- res.status(200).json(data);
- } else {
- const startHeight = req.query.params[0];
- const endHeight = req.query.params[1];
- const data = await indexerQuerier.fetchBlocksWithinRange(parseInt(startHeight), parseInt(endHeight))
- res.status(200).json(data);
+ const n = req.query.params[0];
+ const data = await indexerQuerier.fetchMostRecentNBlocks(parseInt(n));
+ res.status(200).json(data);
+ } else {
+ const startHeight = req.query.params[0];
+ const endHeight = req.query.params[1];
+ const data = await indexerQuerier.fetchBlocksWithinRange(
+ parseInt(startHeight),
+ parseInt(endHeight),
+ );
+ res.status(200).json(data);
}
} catch (error) {
console.error("Error fetching block data:", error);
diff --git a/src/pages/api/lp/[lp_nft_id].js b/src/pages/api/lp/[lp_nft_id].js
index c00c971d..1869519a 100644
--- a/src/pages/api/lp/[lp_nft_id].js
+++ b/src/pages/api/lp/[lp_nft_id].js
@@ -1,3 +1,5 @@
+// @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";
diff --git a/src/pages/api/lp/[lp_nft_id]/position.ts b/src/pages/api/lp/[lp_nft_id]/position.ts
index c79399b5..af2f8bdd 100644
--- a/src/pages/api/lp/[lp_nft_id]/position.ts
+++ b/src/pages/api/lp/[lp_nft_id]/position.ts
@@ -1,3 +1,5 @@
+// @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 {
@@ -24,7 +26,7 @@ export default async function liquidityPositionDataHandler(req: any, res: any) {
const data = await lp_querier.liquidityPositionById(positionId);
- res.status(200).json(data as Position);
+ res.status(200).json(data!);
} catch (error) {
console.error("Error fetching liquidity position grpc data:", error);
res
diff --git a/src/pages/api/lp/[lp_nft_id]/trades.js b/src/pages/api/lp/[lp_nft_id]/trades.js
index e75c1a57..b48a4ccd 100644
--- a/src/pages/api/lp/[lp_nft_id]/trades.js
+++ b/src/pages/api/lp/[lp_nft_id]/trades.js
@@ -1,3 +1,5 @@
+// @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";
diff --git a/src/pages/api/lp/block/[...params].js b/src/pages/api/lp/block/[...params].js
index 0ff947e0..6f78ba6a 100644
--- a/src/pages/api/lp/block/[...params].js
+++ b/src/pages/api/lp/block/[...params].js
@@ -1,3 +1,5 @@
+// @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";
diff --git a/src/pages/api/lp/positionsByPrice/[...params].ts b/src/pages/api/lp/positionsByPrice/[...params].ts
index fea0ea66..d41a85b2 100644
--- a/src/pages/api/lp/positionsByPrice/[...params].ts
+++ b/src/pages/api/lp/positionsByPrice/[...params].ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* 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";
@@ -25,7 +27,7 @@ export default async function positionsByPriceHandler(
try {
if (!token1 || !token2 || !limit) {
- return res.status(400).json({ error: "Invalid query parameters" });
+ res.status(400).json({ error: "Invalid query parameters" }); return;
}
// Get token 1 & 2
@@ -38,9 +40,9 @@ export default async function positionsByPriceHandler(
);
if (!asset1Token || !asset2Token) {
- return res
+ res
.status(400)
- .json({ error: "Could not find requested token in registry" });
+ .json({ error: "Could not find requested token in registry" }); return;
}
const lp_querier = new DexQueryServiceClient({
diff --git a/src/pages/api/ohlc/[...params].ts b/src/pages/api/ohlc/[...params].ts
index 55f71090..3fbcfe7e 100644
--- a/src/pages/api/ohlc/[...params].ts
+++ b/src/pages/api/ohlc/[...params].ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* 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";
@@ -29,12 +31,12 @@ export default async function candleStickData(
try {
const tokenAssets = fetchAllTokenAssets();
if (!startHeight || !tokenIn || !tokenOut || !limit) {
- return res.status(400).json({ error: "Invalid query parameters" });
+ res.status(400).json({ error: "Invalid query parameters" }); return;
}
// Set a HARD limit to prevent abuse
if (parseInt(limit) > 10000) {
- return res.status(400).json({ error: "Limit exceeded" });
+ res.status(400).json({ error: "Limit exceeded" }); return;
}
const dex_querier = new DexQueryServiceClient({
@@ -48,9 +50,9 @@ export default async function candleStickData(
(x) => x.display.toLowerCase() === tokenOut.toLowerCase()
)?.inner;
if (!tokenInInner || !tokenOutInner) {
- return res.status(400).json({
+ res.status(400).json({
error: `Invalid token pair, a token was not found: ${tokenIn} ${tokenOut}`,
- });
+ }); return;
}
const tradingPair = new DirectedTradingPair();
diff --git a/src/pages/api/shieldedPool/[token_inner].ts b/src/pages/api/shieldedPool/[token_inner].ts
index a3a2601c..f278a074 100644
--- a/src/pages/api/shieldedPool/[token_inner].ts
+++ b/src/pages/api/shieldedPool/[token_inner].ts
@@ -1,3 +1,5 @@
+// @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";
@@ -27,7 +29,7 @@ export default async function assetMetadataHandler(req: any, res: any) {
const data = await pool_querier.assetMetadata(positionId);
- res.status(200).json(data as Metadata);
+ res.status(200).json(data!);
} catch (error) {
console.error("Error fetching asset metadata grpc data:", error);
res
diff --git a/src/pages/api/simulations/[...params].ts b/src/pages/api/simulations/[...params].ts
index 1a96d6fd..d8967f80 100644
--- a/src/pages/api/simulations/[...params].ts
+++ b/src/pages/api/simulations/[...params].ts
@@ -1,3 +1,5 @@
+// @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";
@@ -31,7 +33,7 @@ export default async function simulationHandler(
try {
if (!token1 || !token2 || !amountIn) {
- return res.status(400).json({ error: "Invalid query parameters" });
+ res.status(400).json({ error: "Invalid query parameters" }); return;
}
if (String(singleHop).toLocaleLowerCase() === "singlehop") {
@@ -48,9 +50,9 @@ export default async function simulationHandler(
);
if (!asset1Token || !asset2Token) {
- return res
+ res
.status(400)
- .json({ error: "Could not find requested token in registry" });
+ .json({ error: "Could not find requested token in registry" }); return;
}
const sim_querier = new SimulationQuerier({
grpcEndpoint: grpcEndpoint,
@@ -112,7 +114,7 @@ export default async function simulationHandler(
// If the error message contains 'there are no orders to fulfill this swap', return an empty array
if (errorMessage.includes("there are no orders to fulfill this swap")) {
console.log("No orders to fulfill swap");
- return res.status(200).json({ traces: [] });
+ res.status(200).json({ traces: [] }); return;
}
}
diff --git a/src/pages/api/swaps/[...params].ts b/src/pages/api/swaps/[...params].ts
index a2a62aa8..f696a2b1 100644
--- a/src/pages/api/swaps/[...params].ts
+++ b/src/pages/api/swaps/[...params].ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* 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";
@@ -18,7 +20,7 @@ export default async function swapsByBlockRange(req: NextApiRequest, res: NextAp
try {
if (!startHeight || !endHeight) {
- return res.status(400).json({ error: "Invalid query parameters" });
+ res.status(400).json({ error: "Invalid query parameters" }); return;
}
// TODO: validate StartHeight/EndHeight are numbers
const dex_querier = new DexQueryServiceClient({
diff --git a/src/pages/block/[block_height].tsx b/src/pages/block/[block_height].tsx
index 9cb873b8..ce911fc2 100644
--- a/src/pages/block/[block_height].tsx
+++ b/src/pages/block/[block_height].tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import Layout from "@/components/layout";
import { useRouter } from "next/router";
import {
@@ -53,13 +55,13 @@ export const Price = ({
const inputDisplayDenomExponent = firstValueMetadata.decimals ?? 0;
const outputDisplayDenomExponent = lastValueMetadata.decimals ?? 0;
const formattedInputAmount = fromBaseUnit(
- BigInt(inputValue.amount?.lo ?? 0),
- BigInt(inputValue.amount?.hi ?? 0),
+ BigInt(inputValue.amount.lo ?? 0),
+ BigInt(inputValue.amount.hi ?? 0),
inputDisplayDenomExponent
).toFixed(6);
const formattedOutputAmount = fromBaseUnit(
- BigInt(outputValue.amount?.lo ?? 0),
- BigInt(outputValue.amount?.hi ?? 0),
+ BigInt(outputValue.amount.lo ?? 0),
+ BigInt(outputValue.amount.hi ?? 0),
outputDisplayDenomExponent
).toFixed(6);
const outputToInputRatio = new BigNumber(formattedOutputAmount)
@@ -73,7 +75,7 @@ export const Price = ({
}
}
- if (!price) return null;
+ if (!price) {return null;}
return {price};
};
@@ -340,19 +342,19 @@ export default function Block() {
arbsResponse,
swapsResponse,
]) => {
- const blockInfoList: BlockInfo[] = blockInfoResponse as BlockInfo[];
+ const blockInfoList: BlockInfo[] = blockInfoResponse;
const positionData: LiquidityPositionEvent[] =
- liquidityPositionOpenCloseResponse as LiquidityPositionEvent[];
+ liquidityPositionOpenCloseResponse;
const otherPositionData: LiquidityPositionEvent[] =
- liquidityPositionOtherResponse as LiquidityPositionEvent[];
+ liquidityPositionOtherResponse;
const arbData: SwapExecutionWithBlockHeight[] =
- arbsResponse as SwapExecutionWithBlockHeight[];
+ arbsResponse;
const swapData: SwapExecutionWithBlockHeight[] =
- swapsResponse as SwapExecutionWithBlockHeight[];
+ swapsResponse;
if (blockInfoList.length === 0) {
- //setError(`No data for block ${block_height} found`);
- //setIsLoading(false);
+ // setError(`No data for block ${block_height} found`);
+ // setIsLoading(false);
console.log(`No data for block ${block_height} found`);
blockInfoList.push({
height: height,
@@ -368,24 +370,24 @@ export default function Block() {
otherPositionEvents: [],
swapExecutions: [],
arbExecutions: [],
- createdAt: blockInfoList[0]["created_at"],
+ createdAt: blockInfoList[0].created_at,
};
positionData.forEach(
(positionOpenCloseEvent: LiquidityPositionEvent) => {
- if (positionOpenCloseEvent["type"].includes("PositionOpen")) {
- detailedBlockSummaryData["openPositionEvents"].push(
+ if (positionOpenCloseEvent.type.includes("PositionOpen")) {
+ detailedBlockSummaryData.openPositionEvents.push(
positionOpenCloseEvent
);
} else if (
- positionOpenCloseEvent["type"].includes("PositionClose")
+ positionOpenCloseEvent.type.includes("PositionClose")
) {
- detailedBlockSummaryData["closePositionEvents"].push(
+ detailedBlockSummaryData.closePositionEvents.push(
positionOpenCloseEvent
);
} else if (
- positionOpenCloseEvent["type"].includes("PositionWithdraw")
+ positionOpenCloseEvent.type.includes("PositionWithdraw")
) {
- detailedBlockSummaryData["withdrawPositionEvents"].push(
+ detailedBlockSummaryData.withdrawPositionEvents.push(
positionOpenCloseEvent
);
}
@@ -393,16 +395,16 @@ export default function Block() {
);
otherPositionData.forEach(
(positionEvent: LiquidityPositionEvent) => {
- detailedBlockSummaryData["otherPositionEvents"].push(
+ detailedBlockSummaryData.otherPositionEvents.push(
positionEvent
);
}
);
arbData.forEach((arb: SwapExecutionWithBlockHeight) => {
- detailedBlockSummaryData["arbExecutions"].push(arb.swapExecution);
+ detailedBlockSummaryData.arbExecutions.push(arb.swapExecution);
});
swapData.forEach((swap: SwapExecutionWithBlockHeight) => {
- detailedBlockSummaryData["swapExecutions"].push(
+ detailedBlockSummaryData.swapExecutions.push(
swap.swapExecution
);
});
@@ -577,8 +579,7 @@ export default function Block() {
>
{blockData!.swapExecutions.map(
(swapExecution: SwapExecution) => (
- <>
-
+
- >
)
)}
diff --git a/src/pages/explorer/index.tsx b/src/pages/explorer/index.tsx
index e208d173..d0267e35 100644
--- a/src/pages/explorer/index.tsx
+++ b/src/pages/explorer/index.tsx
@@ -1,3 +1,5 @@
+// @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";
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 29eb4d99..f4e83465 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,3 +1,4 @@
+/* eslint-disable -- disabling this file as this was created before our strict rules */
export default function Home() {
return null;
}
@@ -5,7 +6,7 @@ export default function Home() {
export async function getServerSideProps() {
return {
redirect: {
- destination: "/trade",
+ destination: '/trade',
},
};
}
diff --git a/src/pages/lp/[lp_nft_id].tsx b/src/pages/lp/[lp_nft_id].tsx
index 6662e41b..7beb5ff6 100644
--- a/src/pages/lp/[lp_nft_id].tsx
+++ b/src/pages/lp/[lp_nft_id].tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/lp/[lp_nft_id].js
import React, { useEffect, useRef, useState } from "react";
@@ -126,7 +128,7 @@ export default function LP() {
// if showAllTradeEvents, dont do anything, however if its false, remove all but the first and last n trade events
if (!showAllTradeEvents) {
// Find the first and last trade events
- //! In theory they always have to be sandwiched between LP events
+ // ! In theory they always have to be sandwiched between LP events
let firstTradeIndex = allEvents.findIndex(
(event) => "lpevent_attributes" in event
);
diff --git a/src/pages/lp/utils.tsx b/src/pages/lp/utils.tsx
index 4594c4b9..92b6699b 100644
--- a/src/pages/lp/utils.tsx
+++ b/src/pages/lp/utils.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/lp/utils.tsx
import React, { useState } from "react";
diff --git a/src/pages/pair/[...params].tsx b/src/pages/pair/[...params].tsx
index d6a804a3..e3b3966d 100644
--- a/src/pages/pair/[...params].tsx
+++ b/src/pages/pair/[...params].tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/tradingPairs/index.tsx
import React, { useEffect, useRef, useState } from "react";
@@ -330,14 +332,14 @@ export default function TradingPairs() {
console.log(asset2Token);
// Set single and multi hop depth chart data
- simulatedMultiHopAsset1SellData!.traces.forEach((trace) => {
+ simulatedMultiHopAsset1SellData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(trace.value.length - 1);
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset1Token.decimals);
const outputValue =
Number(
@@ -347,7 +349,7 @@ export default function TradingPairs() {
const price: number = outputValue / inputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedMultiHopAsset1SellData!.traces[0]) {
+ if (trace === simulatedMultiHopAsset1SellData.traces[0]) {
console.log("Best Asset1 Sell Price for multi hop", price);
setBestAsset1SellPriceMultiHop(Number(price));
bestAsset1SellPriceMultiHop = price;
@@ -376,14 +378,14 @@ export default function TradingPairs() {
});
// Similar logic for single hop
- simulatedSingleHopAsset1SellData!.traces.forEach((trace) => {
+ simulatedSingleHopAsset1SellData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(1); // If this isnt 1 then something is wrong
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset1Token.decimals);
const outputValue =
Number(
@@ -393,7 +395,7 @@ export default function TradingPairs() {
const price: number = outputValue / inputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedSingleHopAsset1SellData!.traces[0]) {
+ if (trace === simulatedSingleHopAsset1SellData.traces[0]) {
console.log("Best Asset1 Sell Price for single hop", price);
setBestAsset1SellPriceSingleHop(Number(price));
bestAsset1SellPriceSingleHop = price;
@@ -421,7 +423,7 @@ export default function TradingPairs() {
});
// Do it all again for the buy side :)
- //! Maybe theres a way to refactor this to be more concise
+ // ! Maybe theres a way to refactor this to be more concise
let bestAsset1BuyPriceMultiHop: number | undefined;
let bestAsset1BuyPriceSingleHop: number | undefined;
@@ -430,14 +432,14 @@ export default function TradingPairs() {
setDepthChartSingleHopAsset1BuyPoints([]);
// Set single and multi hop depth chart data
- simulatedMultiHopAsset1BuyData!.traces.forEach((trace) => {
+ simulatedMultiHopAsset1BuyData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(trace.value.length - 1);
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset2Token.decimals);
const outputValue =
Number(
@@ -448,7 +450,7 @@ export default function TradingPairs() {
const price: number = inputValue / outputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedMultiHopAsset1BuyData!.traces[0]) {
+ if (trace === simulatedMultiHopAsset1BuyData.traces[0]) {
console.log("Best Asset1 Buy Price for multi hop", price);
setBestAsset1BuyPriceMultiHop(Number(price));
bestAsset1BuyPriceMultiHop = price;
@@ -477,14 +479,14 @@ export default function TradingPairs() {
});
// Similar logic for single hop
- simulatedSingleHopAsset1BuyData!.traces.forEach((trace) => {
+ simulatedSingleHopAsset1BuyData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(1); // If this isnt 1 then something is wrong
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset2Token.decimals);
const outputValue =
Number(
@@ -495,7 +497,7 @@ export default function TradingPairs() {
const price: number = inputValue / outputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedSingleHopAsset1BuyData!.traces[0]) {
+ if (trace === simulatedSingleHopAsset1BuyData.traces[0]) {
console.log("Best Asset1 Buy Price for single hop", price);
setBestAsset1BuyPriceSingleHop(Number(price));
bestAsset1BuyPriceSingleHop = price;
diff --git a/src/pages/pair/index.tsx b/src/pages/pair/index.tsx
index aa74a7e6..eb24ea43 100644
--- a/src/pages/pair/index.tsx
+++ b/src/pages/pair/index.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/pairs.tsx
import { useState, useEffect } from 'react';
@@ -43,8 +45,7 @@ export default function Pairs() {
{isLoading ? (
) :
- <>
-
+
@@ -67,7 +68,6 @@ export default function Pairs() {
- >
}
)
diff --git a/src/pages/trade/[[...params]].tsx b/src/pages/trade/[[...params]].tsx
index 44e99a8b..2b481128 100644
--- a/src/pages/trade/[[...params]].tsx
+++ b/src/pages/trade/[[...params]].tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* 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";
@@ -329,14 +331,14 @@ export default function TradingPairs() {
console.log(asset2Token);
// Set single and multi hop depth chart data
- simulatedMultiHopAsset1SellData!.traces.forEach((trace) => {
+ simulatedMultiHopAsset1SellData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(trace.value.length - 1);
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset1Token.decimals);
const outputValue =
Number(
@@ -346,7 +348,7 @@ export default function TradingPairs() {
const price: number = outputValue / inputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedMultiHopAsset1SellData!.traces[0]) {
+ if (trace === simulatedMultiHopAsset1SellData.traces[0]) {
console.log("Best Asset1 Sell Price for multi hop", price);
setBestAsset1SellPriceMultiHop(Number(price));
bestAsset1SellPriceMultiHop = price;
@@ -375,14 +377,14 @@ export default function TradingPairs() {
});
// Similar logic for single hop
- simulatedSingleHopAsset1SellData!.traces.forEach((trace) => {
+ simulatedSingleHopAsset1SellData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(1); // If this isnt 1 then something is wrong
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset1Token.decimals);
const outputValue =
Number(
@@ -392,7 +394,7 @@ export default function TradingPairs() {
const price: number = outputValue / inputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedSingleHopAsset1SellData!.traces[0]) {
+ if (trace === simulatedSingleHopAsset1SellData.traces[0]) {
console.log("Best Asset1 Sell Price for single hop", price);
setBestAsset1SellPriceSingleHop(Number(price));
bestAsset1SellPriceSingleHop = price;
@@ -420,7 +422,7 @@ export default function TradingPairs() {
});
// Do it all again for the buy side :)
- //! Maybe theres a way to refactor this to be more concise
+ // ! Maybe theres a way to refactor this to be more concise
let bestAsset1BuyPriceMultiHop: number | undefined;
let bestAsset1BuyPriceSingleHop: number | undefined;
@@ -429,14 +431,14 @@ export default function TradingPairs() {
setDepthChartSingleHopAsset1BuyPoints([]);
// Set single and multi hop depth chart data
- simulatedMultiHopAsset1BuyData!.traces.forEach((trace) => {
+ simulatedMultiHopAsset1BuyData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(trace.value.length - 1);
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset2Token.decimals);
const outputValue =
Number(
@@ -447,7 +449,7 @@ export default function TradingPairs() {
const price: number = inputValue / outputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedMultiHopAsset1BuyData!.traces[0]) {
+ if (trace === simulatedMultiHopAsset1BuyData.traces[0]) {
console.log("Best Asset1 Buy Price for multi hop", price);
setBestAsset1BuyPriceMultiHop(Number(price));
bestAsset1BuyPriceMultiHop = price;
@@ -476,14 +478,14 @@ export default function TradingPairs() {
});
// Similar logic for single hop
- simulatedSingleHopAsset1BuyData!.traces.forEach((trace) => {
+ simulatedSingleHopAsset1BuyData.traces.forEach((trace) => {
// First item is the input, last item is the output
const input = trace.value.at(0);
const output = trace.value.at(1); // If this isnt 1 then something is wrong
const inputValue =
Number(
- joinLoHi(BigInt(input!.amount!.lo!), BigInt(input!.amount!.hi))
+ joinLoHi(BigInt(input!.amount!.lo), BigInt(input!.amount!.hi))
) / Number(10 ** asset2Token.decimals);
const outputValue =
Number(
@@ -494,7 +496,7 @@ export default function TradingPairs() {
const price: number = inputValue / outputValue;
// First trace will have best price, so set only on first iteration
- if (trace === simulatedSingleHopAsset1BuyData!.traces[0]) {
+ if (trace === simulatedSingleHopAsset1BuyData.traces[0]) {
console.log("Best Asset1 Buy Price for single hop", price);
setBestAsset1BuyPriceSingleHop(Number(price));
bestAsset1BuyPriceSingleHop = price;
diff --git a/src/pages/trades.tsx b/src/pages/trades.tsx
index c58edd81..8f3304c1 100644
--- a/src/pages/trades.tsx
+++ b/src/pages/trades.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// pages/trades.tsx
import {
@@ -43,7 +45,7 @@ export default function Trades() {
useEffect(() => {
setIsBlockRangeLoading(true);
if (endingBlockHeight <= 0 || startingBlockHeight <= 0) {
- var blockInfoPromise: Promise;
+ let blockInfoPromise: Promise;
if (userRequestedBlockEndHeight >= 1) {
const startHeight = Math.max(
userRequestedBlockEndHeight - NUMBER_BLOCKS_IN_TIMELINE + 1,
@@ -59,11 +61,11 @@ export default function Trades() {
}
Promise.all([blockInfoPromise])
.then(([blockInfoResponse]) => {
- const blockInfoList: BlockInfo[] = blockInfoResponse as BlockInfo[];
+ const blockInfoList: BlockInfo[] = blockInfoResponse;
const blockInfoMap: BlockInfoMap = {};
blockInfoList.forEach((blockInfo: BlockInfo, i: number) => {
- //console.log(blockInfo)
- blockInfoMap[blockInfo["height"]] = blockInfo;
+ // console.log(blockInfo)
+ blockInfoMap[blockInfo.height] = blockInfo;
});
if (blockInfoList.length === 0) {
@@ -72,9 +74,9 @@ export default function Trades() {
console.log("No blocks found");
return;
} else {
- setEndingBlockHeight(blockInfoList[0]["height"]);
+ setEndingBlockHeight(blockInfoList[0].height);
setStartingBlockHeight(
- blockInfoList[NUMBER_BLOCKS_IN_TIMELINE - 1]["height"]
+ blockInfoList[NUMBER_BLOCKS_IN_TIMELINE - 1].height
);
setBlockInfo(blockInfoMap);
setError(undefined);
@@ -127,7 +129,7 @@ export default function Trades() {
// Initialize blocks
const blockSummaryMap: BlockSummaryMap = {};
- var i: number;
+ let i: number;
for (i = startingBlockHeight; i <= endingBlockHeight; i++) {
blockSummaryMap[i] = {
openPositionEvents: [],
@@ -135,40 +137,34 @@ export default function Trades() {
withdrawPositionEvents: [],
swapExecutions: [],
arbExecutions: [],
- createdAt: blockInfo[i]["created_at"],
+ createdAt: blockInfo[i].created_at,
};
}
positionData.forEach(
(positionOpenCloseEvent: LiquidityPositionEvent) => {
- if (positionOpenCloseEvent["type"].includes("PositionOpen")) {
- blockSummaryMap[positionOpenCloseEvent["block_height"]][
- "openPositionEvents"
- ].push(positionOpenCloseEvent);
+ if (positionOpenCloseEvent.type.includes("PositionOpen")) {
+ blockSummaryMap[positionOpenCloseEvent.block_height].openPositionEvents.push(positionOpenCloseEvent);
} else if (
- positionOpenCloseEvent["type"].includes("PositionClose")
+ positionOpenCloseEvent.type.includes("PositionClose")
) {
- blockSummaryMap[positionOpenCloseEvent["block_height"]][
- "closePositionEvents"
- ].push(positionOpenCloseEvent);
+ blockSummaryMap[positionOpenCloseEvent.block_height].closePositionEvents.push(positionOpenCloseEvent);
} else if (
- positionOpenCloseEvent["type"].includes("PositionWithdraw")
+ positionOpenCloseEvent.type.includes("PositionWithdraw")
) {
- blockSummaryMap[positionOpenCloseEvent["block_height"]][
- "withdrawPositionEvents"
- ].push(positionOpenCloseEvent);
+ blockSummaryMap[positionOpenCloseEvent.block_height].withdrawPositionEvents.push(positionOpenCloseEvent);
}
}
);
arbData.forEach((arb: SwapExecutionWithBlockHeight) => {
- blockSummaryMap[arb.blockHeight]["arbExecutions"].push(
+ blockSummaryMap[arb.blockHeight].arbExecutions.push(
arb.swapExecution
);
});
swapData.forEach((swap: SwapExecutionWithBlockHeight) => {
- blockSummaryMap[swap.blockHeight]["swapExecutions"].push(
+ blockSummaryMap[swap.blockHeight].swapExecutions.push(
swap.swapExecution
);
});
@@ -273,8 +269,7 @@ export default function Trades() {
{Array.from(
Array(endingBlockHeight - startingBlockHeight + 1)
).map((_, index: number) => (
- <>
-
- >
))}
diff --git a/src/utils/indexer/connector.tsx b/src/utils/indexer/connector.tsx
index efcb5e4e..e7b86274 100644
--- a/src/utils/indexer/connector.tsx
+++ b/src/utils/indexer/connector.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Pool } from "pg";
import { BlockInfo, LiquidityPositionEvent } from "./types/lps";
import { bech32ToInner } from "../math/bech32";
@@ -49,7 +51,7 @@ export class IndexerQuerier {
return value.map((item) => this.recursivelyParseJSON(item));
} else if (typeof value === "object" && value !== null) {
// If it's an object, apply recursively to each value
- const parsedObject: { [key: string]: any } = {};
+ const parsedObject: Record = {};
Object.keys(value).forEach((key) => {
parsedObject[key] = this.recursivelyParseJSON(value[key]);
});
@@ -165,7 +167,7 @@ export class IndexerQuerier {
`;
// Use parameterized query to prevent SQL injection
- //const res = await this.query(queryText);
+ // const res = await this.query(queryText);
const res = await this.query(queryText, [`${startHeight}`, `${endHeight}`]);
return res;
}
diff --git a/src/utils/indexer/types/lps.tsx b/src/utils/indexer/types/lps.tsx
index 9672b9dc..fd72f33e 100644
--- a/src/utils/indexer/types/lps.tsx
+++ b/src/utils/indexer/types/lps.tsx
@@ -1,6 +1,8 @@
-export type LiquidityPositionEvent = {
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
+export interface LiquidityPositionEvent {
block_height: number;
- event_id: number; //! Needed for sorting
+ event_id: number; // ! Needed for sorting
block_id: number;
tx_id: number;
type: string;
@@ -29,11 +31,11 @@ export type LiquidityPositionEvent = {
};
};
};
-};
+}
-export type PositionExecutionEvent = {
+export interface PositionExecutionEvent {
block_height: number;
- event_id: number; //! Needed for sorting
+ event_id: number; // ! Needed for sorting
block_id: number;
tx_id: number;
type: string;
@@ -62,9 +64,9 @@ export type PositionExecutionEvent = {
};
};
};
-};
+}
export interface BlockInfo {
height: number,
created_at: string,
-}
\ No newline at end of file
+}
diff --git a/src/utils/math/base64.ts b/src/utils/math/base64.ts
index 7d1e74f0..ecf4917e 100644
--- a/src/utils/math/base64.ts
+++ b/src/utils/math/base64.ts
@@ -10,7 +10,7 @@ export const Base64StringSchema = z.string().refine(
},
{
message: "Invalid base64 string",
- }
+ },
);
export type Base64Str = z.infer;
@@ -20,7 +20,7 @@ export const InnerBase64Schema = z.object({ inner: Base64StringSchema });
export const base64ToUint8Array = (base64: string): Uint8Array => {
const validated = validateSchema(Base64StringSchema, base64);
const binString = atob(validated);
- return Uint8Array.from(binString, (byte) => byte.codePointAt(0)!);
+ return Uint8Array.from(binString, (byte) => byte.codePointAt(0) ?? 0);
};
export const uint8ArrayToBase64 = (byteArray: Uint8Array): string => {
diff --git a/src/utils/math/bech32.ts b/src/utils/math/bech32.ts
index 98193df0..54e7890b 100644
--- a/src/utils/math/bech32.ts
+++ b/src/utils/math/bech32.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { bech32m } from "bech32";
import { uint8ArrayToBase64, base64ToUint8Array } from "./base64";
diff --git a/src/utils/math/hex.ts b/src/utils/math/hex.ts
index 3018b21a..77425e66 100644
--- a/src/utils/math/hex.ts
+++ b/src/utils/math/hex.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { Base64StringSchema } from "./base64";
import { validateSchema } from "./validation";
@@ -21,10 +23,10 @@ export const base64ToHex = (base64: string): string => {
* @see https://stackoverflow.com/a/41797377/974981
*/
export const hexToBase64 = (hex: string): string => {
- if (!hex) return "";
+ if (!hex) {return "";}
const hexPairs = hex.match(/[0-9A-Fa-f]{2}/g);
- if (!hexPairs) throw new Error("Invalid hexadecimal input");
+ if (!hexPairs) {throw new Error("Invalid hexadecimal input");}
const binaryString = hexPairs
.map((a) => String.fromCharCode(parseInt(a, 16)))
@@ -51,7 +53,7 @@ export const hexToUint8Array = (hexString: string): Uint8Array => {
throw new Error(`Invalid hexadecimal string: ${hexString}`);
}
- if (!hexString) return new Uint8Array();
+ if (!hexString) {return new Uint8Array();}
// Split the string into pairs of characters
const hexPairs = hexString.match(/.{1,2}/g)!;
diff --git a/src/utils/math/hiLo.ts b/src/utils/math/hiLo.ts
index 738e82e6..f96272bf 100644
--- a/src/utils/math/hiLo.ts
+++ b/src/utils/math/hiLo.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
// https://github.com/penumbra-zone/web/blob/main/packages/types/src/lo-hi.ts
import BigNumber from "bignumber.js";
diff --git a/src/utils/protos/services/app/shielded-pool.ts b/src/utils/protos/services/app/shielded-pool.ts
index 1ff211fe..caf42891 100644
--- a/src/utils/protos/services/app/shielded-pool.ts
+++ b/src/utils/protos/services/app/shielded-pool.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { PromiseClient } from "@connectrpc/connect";
import { createClient } from "../utils";
import { ShieldedPoolService } from "@penumbra-zone/protobuf";
@@ -16,7 +18,7 @@ export class ShieldedPoolQuerier implements ShieldedPoolQuerierInterface {
async assetMetadata(assetId: AssetId): Promise {
const res = await this.client.assetMetadataById({ assetId });
- //console.info(res)
+ // console.info(res)
return res.denomMetadata;
}
}
diff --git a/src/utils/protos/services/dex/dex-query-service-client.ts b/src/utils/protos/services/dex/dex-query-service-client.ts
index a7fbcee2..9711ddfc 100644
--- a/src/utils/protos/services/dex/dex-query-service-client.ts
+++ b/src/utils/protos/services/dex/dex-query-service-client.ts
@@ -1,18 +1,20 @@
-import { PromiseClient } from "@connectrpc/connect";
-import { createClient } from "../utils";
-import { DexService } from "@penumbra-zone/protobuf";
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
+import { PromiseClient } from '@connectrpc/connect';
+import { createClient } from '../utils';
+import { DexService } from '@penumbra-zone/protobuf';
import {
PositionId,
Position,
DirectedTradingPair,
SwapExecution,
CandlestickData,
-} from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb";
+} from '@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb';
import {
DexQueryServiceClientInterface,
SwapExecutionWithBlockHeight,
-} from "../../types/DexQueryServiceClientInterface";
-import { Readable } from "stream";
+} from '../../types/DexQueryServiceClientInterface';
+import { Readable } from 'stream';
export class DexQueryServiceClient implements DexQueryServiceClientInterface {
private readonly client: PromiseClient;
@@ -21,17 +23,15 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
this.client = createClient(grpcEndpoint, DexService);
}
- async liquidityPositionById(
- positionId: PositionId
- ): Promise {
- //console.log('liquidityPositionById', positionId)
+ async liquidityPositionById(positionId: PositionId): Promise {
+ // console.log('liquidityPositionById', positionId)
const res = await this.client.liquidityPositionById({ positionId });
return res.data;
}
async liquidityPositionsByPrice(
tradingPair: DirectedTradingPair,
- limit: number
+ limit: number,
): Promise {
const res = await this.client.liquidityPositionsByPrice({
tradingPair,
@@ -39,9 +39,9 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
});
if (!res[Symbol.asyncIterator]) {
- console.error("Received:", res);
+ console.error('Received:', res);
throw new Error(
- "Received an unexpected response type from the server, expected an async iterable."
+ 'Received an unexpected response type from the server, expected an async iterable.',
);
}
@@ -55,7 +55,7 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
async arbExecutions(
startHeight: number,
- endHeight: number
+ endHeight: number,
): Promise {
const res = await this.client.arbExecutions({
startHeight: BigInt(startHeight),
@@ -63,16 +63,16 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
});
if (!res[Symbol.asyncIterator]) {
- console.error("Received:", res);
+ console.error('Received:', res);
throw new Error(
- "Received an unexpected response type from the server, expected an async iterable."
+ 'Received an unexpected response type from the server, expected an async iterable.',
);
}
const arbs: SwapExecutionWithBlockHeight[] = [];
for await (const arb of res as Readable) {
const swapExecution: SwapExecution = arb.swapExecution;
- const blockHeight: number = Number(arb.height);
+ const blockHeight = Number(arb.height);
arbs.push({ swapExecution, blockHeight });
}
return arbs;
@@ -80,7 +80,7 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
async swapExecutions(
startHeight: number,
- endHeight: number
+ endHeight: number,
): Promise {
const res = await this.client.swapExecutions({
startHeight: BigInt(startHeight),
@@ -88,16 +88,16 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
});
if (!res[Symbol.asyncIterator]) {
- console.error("Received:", res);
+ console.error('Received:', res);
throw new Error(
- "Received an unexpected response type from the server, expected an async iterable."
+ 'Received an unexpected response type from the server, expected an async iterable.',
);
}
const swaps: SwapExecutionWithBlockHeight[] = [];
for await (const swap of res as Readable) {
const swapExecution: SwapExecution = swap.swapExecution;
- const blockHeight: number = Number(swap.height);
+ const blockHeight = Number(swap.height);
swaps.push({ swapExecution, blockHeight });
}
return swaps;
@@ -106,7 +106,7 @@ export class DexQueryServiceClient implements DexQueryServiceClientInterface {
async candlestickData(
pair: DirectedTradingPair,
startHeight: number,
- limit: number
+ limit: number,
): Promise {
const res = await this.client.candlestickData({
pair,
diff --git a/src/utils/protos/services/dex/simulated-trades.ts b/src/utils/protos/services/dex/simulated-trades.ts
index 4cfe8a98..3c410f09 100644
--- a/src/utils/protos/services/dex/simulated-trades.ts
+++ b/src/utils/protos/services/dex/simulated-trades.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { PromiseClient } from "@connectrpc/connect";
import { createClient } from "../utils";
import { SimulationService } from "@penumbra-zone/protobuf";
diff --git a/src/utils/protos/types/ShieldedPoolQuerier.ts b/src/utils/protos/types/ShieldedPoolQuerier.ts
index 6c8ae1fd..5fd6b30b 100644
--- a/src/utils/protos/types/ShieldedPoolQuerier.ts
+++ b/src/utils/protos/types/ShieldedPoolQuerier.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import {
AssetId,
Metadata,
diff --git a/src/utils/protos/types/SimulationQuerier.ts b/src/utils/protos/types/SimulationQuerier.ts
index 02856904..18170247 100644
--- a/src/utils/protos/types/SimulationQuerier.ts
+++ b/src/utils/protos/types/SimulationQuerier.ts
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import {
SimulateTradeRequest,
SwapExecution,
diff --git a/src/utils/token/tokenFetch.tsx b/src/utils/token/tokenFetch.tsx
index 72fe9893..98df7f7b 100644
--- a/src/utils/token/tokenFetch.tsx
+++ b/src/utils/token/tokenFetch.tsx
@@ -1,13 +1,9 @@
-import {
- uint8ArrayToBase64,
- base64ToUint8Array,
-} from "../../utils/math/base64";
+import { uint8ArrayToBase64, base64ToUint8Array } from "../math/base64";
import { Constants } from "../../constants/configConstants";
import {
AssetId,
AssetImage,
DenomUnit,
- Metadata,
} from "@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb";
import { ChainRegistryClient, Registry } from "@penumbra-labs/registry";
import { Token } from "../types/token";
@@ -29,9 +25,9 @@ export const fetchAllTokenAssets = (): Token[] => {
const displayParts = x.display.split("/");
tokens.push({
decimals: decimalsFromDenomUnits(x.denomUnits),
- display: displayParts[displayParts.length - 1],
+ display: displayParts[displayParts.length - 1] ?? "",
symbol: x.symbol,
- inner: uint8ArrayToBase64(x.penumbraAssetId?.inner),
+ inner: uint8ArrayToBase64(x.penumbraAssetId.inner),
imagePath: imagePathFromAssetImages(x.images),
});
}
@@ -40,7 +36,7 @@ export const fetchAllTokenAssets = (): Token[] => {
};
export const fetchTokenAsset = (
- tokenId: Uint8Array | string
+ tokenId: Uint8Array | string,
): Token | undefined => {
const assetId: AssetId = new AssetId();
assetId.inner =
@@ -51,7 +47,7 @@ export const fetchTokenAsset = (
const displayParts = tokenMetadata.display.split("/");
return {
decimals: decimalsFromDenomUnits(tokenMetadata.denomUnits),
- display: displayParts[displayParts.length - 1],
+ display: displayParts[displayParts.length - 1] ?? "",
symbol: tokenMetadata.symbol,
inner: typeof tokenId !== "string" ? uint8ArrayToBase64(tokenId) : tokenId,
imagePath: imagePathFromAssetImages(tokenMetadata.images),
@@ -59,10 +55,10 @@ export const fetchTokenAsset = (
};
export const imagePathFromAssetImages = (
- assetImages: AssetImage[]
+ assetImages: AssetImage[],
): string | undefined => {
// Take first png/svg from first AssetImage
- var imagePath: string | undefined = undefined;
+ let imagePath: string | undefined = undefined;
assetImages.forEach((x) => {
if (x.png.length > 0) {
imagePath = x.png;
@@ -75,7 +71,7 @@ export const imagePathFromAssetImages = (
export const decimalsFromDenomUnits = (denomUnits: DenomUnit[]): number => {
// Search denomUnits for highest exponent
- var decimals = 0;
+ let decimals = 0;
denomUnits.forEach((x) => {
if (x.exponent >= decimals) {
decimals = x.exponent;
diff --git a/src/utils/types/block.tsx b/src/utils/types/block.tsx
index d1ade3e0..345cc24c 100644
--- a/src/utils/types/block.tsx
+++ b/src/utils/types/block.tsx
@@ -1,3 +1,5 @@
+// @ts-nocheck
+/* eslint-disable -- disabling this file as this was created before our strict rules */
import { SwapExecution } from "@penumbra-zone/protobuf/penumbra/core/component/dex/v1/dex_pb";
import { BlockInfo, LiquidityPositionEvent } from "../indexer/types/lps";
@@ -20,10 +22,6 @@ export interface BlockDetailedSummaryData {
createdAt: string;
}
-export interface BlockInfoMap {
- [key: number]: BlockInfo;
-}
+export type BlockInfoMap = Record;
-export interface BlockSummaryMap {
- [key: number]: BlockSummaryData;
-}
+export type BlockSummaryMap = Record;
diff --git a/src/utils/types/token.tsx b/src/utils/types/token.tsx
index 1fcabbd8..88f3f225 100644
--- a/src/utils/types/token.tsx
+++ b/src/utils/types/token.tsx
@@ -1,8 +1,7 @@
-
export interface Token {
- decimals: number;
- display: string;
- symbol: string;
- inner: string;
- imagePath?: string;
-}
\ No newline at end of file
+ decimals: number;
+ display: string;
+ symbol: string;
+ inner: string;
+ imagePath?: string;
+}
diff --git a/tsconfig.json b/tsconfig.json
index d10e8655..6ba43ba1 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,27 +1,35 @@
{
"compilerOptions": {
- "jsx": "preserve",
+ "composite": true,
+ "exactOptionalPropertyTypes": false,
+ "lib": [
+ "ESNext",
+ "DOM",
+ "DOM.Iterable",
+ "DOM.AsyncIterable"
+ ],
+ "noEmit": true,
"target": "ESNext",
- "lib": ["dom", "dom.iterable", "esnext"],
- "allowJs": true,
"skipLibCheck": true,
- "strict": true,
- "noEmit": true,
- "esModuleInterop": true,
- "module": "esnext",
- "moduleResolution": "bundler",
- "resolveJsonModule": true,
- "isolatedModules": true,
- "incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
- "@/*": ["./src/*", "./styles/*"]
- }
+ "@/*": [
+ "./src/*",
+ "./styles/*"
+ ]
+ },
+ "allowJs": true,
+ "incremental": true,
+ "jsx": "preserve"
},
+ "extends": [
+ "@tsconfig/strictest/tsconfig.json",
+ "@tsconfig/vite-react/tsconfig.json"
+ ],
"include": [
"next-env.d.ts",
"**/*.ts",
@@ -29,5 +37,7 @@
".next/types/**/*.ts",
"styles/styles.d.ts"
],
- "exclude": ["node_modules"]
-}
+ "exclude": [
+ "node_modules"
+ ]
+}
\ No newline at end of file