From 75e5f03816d96c77d8298788f13a9a5d2c9f7c24 Mon Sep 17 00:00:00 2001 From: Callum McIntyre Date: Fri, 14 Jul 2023 15:31:14 +0100 Subject: [PATCH] Refactor ClusterModal to remove web3js dependency (#268) This PR refactors `ClusterModal` to remove its web3js dependency, by inlining a utils function that only it was using --- app/components/ClusterModal.tsx | 5 ++++- app/utils/index.ts | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/components/ClusterModal.tsx b/app/components/ClusterModal.tsx index 1285ba96..8160d757 100644 --- a/app/components/ClusterModal.tsx +++ b/app/components/ClusterModal.tsx @@ -3,7 +3,6 @@ import { useCluster, useClusterModal, useUpdateCustomUrl } from '@providers/cluster'; import { useDebounceCallback } from '@react-hook/debounce'; import { Cluster, clusterName, CLUSTERS, clusterSlug, ClusterStatus } from '@utils/cluster'; -import { assertUnreachable } from '@utils/index'; import dynamic from 'next/dynamic'; import Link from 'next/link'; import { usePathname, useRouter, useSearchParams } from 'next/navigation'; @@ -82,6 +81,10 @@ function CustomClusterInput({ activeSuffix, active }: InputProps) { ); } +function assertUnreachable(_x: never): never { + throw new Error('Unreachable!'); +} + function ClusterToggle() { const { status, cluster } = useCluster(); diff --git a/app/utils/index.ts b/app/utils/index.ts index bd3fe74d..74aa6853 100644 --- a/app/utils/index.ts +++ b/app/utils/index.ts @@ -16,10 +16,6 @@ export type SignatureProps = { signature: TransactionSignature; }; -export function assertUnreachable(_x: never): never { - throw new Error('Unreachable!'); -} - export function normalizeTokenAmount(raw: string | number, decimals: number): number { let rawTokens: number; if (typeof raw === 'string') rawTokens = parseInt(raw);