Skip to content

Commit

Permalink
remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridel1e committed Jan 1, 2024
1 parent b3b7a97 commit 957e12f
Show file tree
Hide file tree
Showing 192 changed files with 257 additions and 13,758 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"dependencies": {
"@dcspark/adalib": "^1.3.1",
"@emurgo/cardano-serialization-lib-nodejs": "^11.4.0",
"@ergolabs/ergo-dex-sdk": "^1.9.67",
"@ergolabs/ergo-sdk": "^0.5.7",
"@ergolabs/ui-kit": "^2.5.2",
Expand All @@ -25,7 +24,6 @@
"@sentry/react": "^6.16.1",
"@sentry/tracing": "^6.16.1",
"@spectrumlabs/analytics": "^1.1.9",
"@spectrumlabs/cardano-dex-sdk": "^0.1.233",
"@types/file-saver": "^2.0.5",
"@types/lodash": "^4.14.172",
"@types/numeral": "^2.0.2",
Expand Down Expand Up @@ -113,6 +111,6 @@
]
},
"engines": {
"node": "^19"
"node": "^20"
}
}
44 changes: 0 additions & 44 deletions src/@types/dapp-cardano-wallet-web-bridge.d.ts

This file was deleted.

10 changes: 4 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { BrowserRouter } from 'react-router-dom';
import { BehaviorSubject, first, mapTo, Observable, tap, zip } from 'rxjs';

import { applicationConfig } from './applicationConfig';
import { ApplicationRoutes, routesConfig } from './ApplicationRoutes';
import { ApplicationRoutes } from './ApplicationRoutes';
import { useObservable } from './common/hooks/useObservable';
import { analyticsInitializer } from './common/initializers/analyticsInitializer';
import { gaInitializer } from './common/initializers/gaInitializer';
import { networkDomInitializer } from './common/initializers/networkDomInitializer';
import { sentryInitializer } from './common/initializers/sentryInitializer';
import { SelectDefaultNetwork } from './common/services/NetworkDomManager/SelectDefaultNetwork/SelectDefaultNetwork';
import { startAppTicks } from './common/streams/appTick';
import { Glow } from './components/common/Layout/Glow/Glow';
import { ErrorEventProvider } from './components/ErrorBoundary/ErrorEventProvider';
Expand All @@ -37,14 +36,15 @@ const Application = () => {
const initializers: Observable<boolean>[] = [
sentryInitializer(),
analyticsInitializer(),
networkDomInitializer(routesConfig),
networkDomInitializer(),
gaInitializer(),
];

const isAppInitialized$ = new BehaviorSubject(false);
const initializeApp = () => {
zip(initializers)
.pipe(
tap(console.log),
mapTo(true),
tap(() => startAppTicks()),
first(),
Expand Down Expand Up @@ -78,9 +78,7 @@ export const ApplicationInitializer: React.FC = () => {
<BrowserRouter>
<LanguageProvider>
<Glow />
<SelectDefaultNetwork>
{isAppInitialized && <Application />}
</SelectDefaultNetwork>
{isAppInitialized && <Application />}
</LanguageProvider>
</BrowserRouter>
</ErrorEventProvider>
Expand Down
136 changes: 53 additions & 83 deletions src/ApplicationRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,139 +4,109 @@ import { FC, useEffect } from 'react';
import { Navigate, Outlet, useRoutes } from 'react-router-dom';

import { version } from '../package.json';
import { NetworkDomManager } from './common/services/NetworkDomManager/NetworkDomManager';
import { Layout } from './components/common/Layout/Layout';
import { RouteConfigExtended } from './components/RouterTitle/RouteConfigExtended';
import { RouterTitle } from './components/RouterTitle/RouterTitle';
import { useApplicationSettings } from './context';
import { AddLiquidity } from './pages/AddLiquidity/AddLiquidity';
import { CreatePool } from './pages/CreatePool/CreatePool';
import { Farms } from './pages/Farms/Farms';
import { IspoRewards } from './pages/IspoRewards/IspoRewards.tsx';
import { Liquidity } from './pages/Liquidity/Liquidity';
import { LockLiquidity } from './pages/LockLiquidity/LockLiquidity';
import { PoolOverview } from './pages/PoolOverview/PoolOverview';
import { RelockLiquidity } from './pages/RelockLiquidity/RelockLiquidity';
import { RemoveLiquidity } from './pages/RemoveLiquidity/RemoveLiquidity';
import { Rewards } from './pages/Rewards/Rewards';
import { Swap } from './pages/Swap/Swap';
import { WithdrawalLiquidity } from './pages/WithdrawalLiquidity/WithdrawalLiquidity';
import { isPreLbspTimeGap } from './utils/lbsp.ts';

export const routesConfig: RouteConfigExtended[] = [
{
path: '/',
element: <NetworkDomManager.Outlet />,
path: `/`,
element: (
<Layout>
<Outlet />
</Layout>
),
children: [
{
path: `:network`,
element: (
<Layout>
<Outlet />
</Layout>
),
path: '',
element: <Navigate to="swap" />,
},
{
title: 'Swap',
path: 'swap',
element: <Swap />,
},
{
title: 'Farm',
path: 'farm',
element: <Farms />,
},
{
path: 'liquidity',
children: [
{
title: 'Liquidity',
path: '',
element: isPreLbspTimeGap() ? (
<Navigate to="liquidity" />
) : (
<Navigate to="swap" />
),
element: <Liquidity />,
},
{
title: 'Swap',
path: 'swap',
element: <Swap />,
title: 'Add Liquidity',
path: 'add',
element: <AddLiquidity />,
},
{
title: 'Farm',
path: 'farm',
element: <Farms />,
title: 'Create Pool',
path: 'create',
element: <CreatePool />,
},
{
path: 'liquidity',
path: ':poolId',
children: [
{
title: 'Liquidity',
path: '',
element: <Liquidity />,
title: 'Remove Liquidity',
path: 'remove',
element: <RemoveLiquidity />,
},
{
title: 'Add Liquidity',
path: 'add',
element: <AddLiquidity />,
title: 'Lock Liquidity',
path: 'lock',
element: <LockLiquidity />,
},
{
title: 'Create Pool',
path: 'create',
element: <CreatePool />,
title: 'Relock Liquidity',
path: 'relock',
element: <RelockLiquidity />,
},
{
path: ':poolId',
children: [
{
title: 'Remove Liquidity',
path: 'remove',
element: <RemoveLiquidity />,
},
{
title: 'Lock Liquidity',
path: 'lock',
element: <LockLiquidity />,
},
{
title: 'Relock Liquidity',
path: 'relock',
element: <RelockLiquidity />,
},
{
title: 'Withdrawal Liquidity',
path: 'withdrawal',
element: <WithdrawalLiquidity />,
},
{
title: 'Add Liquidity',
path: 'add',
element: <AddLiquidity />,
},
{
title: 'Pool Overview',
path: '',
element: <PoolOverview />,
},
],
title: 'Withdrawal Liquidity',
path: 'withdrawal',
element: <WithdrawalLiquidity />,
},
],
},
{
title: 'Rewards',
path: 'rewards',
children: [
{
path: '',
element: <Rewards />,
title: 'Add Liquidity',
path: 'add',
element: <AddLiquidity />,
},
{
title: 'ISPO Rewards',
path: 'ispo',
element: <IspoRewards />,
title: 'Pool Overview',
path: '',
element: <PoolOverview />,
},
],
},
{
path: '*',
element: <Navigate to="swap" />,
},
],
},
{
path: '*',
element: <Navigate to="swap" />,
},
],
},
];

export const ApplicationRoutes: FC = () => {
const routes = useRoutes(routesConfig);
const networkTitle = NetworkDomManager.useNetworkTitle();

const [settings] = useApplicationSettings();

Expand All @@ -154,7 +124,7 @@ export const ApplicationRoutes: FC = () => {
<>
<RouterTitle
divider="·"
pageTitle={networkTitle ? `Spectrum · ${networkTitle}` : 'Spectrum'}
pageTitle={'Spectrum'}
routesConfig={routesConfig}
/>
{routes}
Expand Down
38 changes: 0 additions & 38 deletions src/applicationConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { DateTime } from 'luxon';

import { Dictionary } from './common/utils/Dictionary';
import { isProductionEnv } from './common/utils/env';
import { DefaultTokenListItem } from './network/cardano/api/common/defaultTokenList.ts';

const isProductionHost = 'app.spectrum.fi' === location.host;

Expand All @@ -24,19 +23,11 @@ interface NetworkConfig {
readonly defaultTokenListUrl: string;
readonly lbspWhitelistUrl: string;
readonly isCreatePoolAvailable: boolean;
readonly additionalTokenList?: DefaultTokenListItem[];
}

interface CardanoUpdate {
readonly title: string;
readonly content: string;
}

interface ApplicationConfig {
readonly spfUsdRateUrl: string;
readonly cookieDomain: string | undefined;
readonly cardanoMaintenance: boolean;
readonly cardanoUpdate?: CardanoUpdate;
readonly operationTimeoutTime: number;
readonly reCaptchaKey: string;
readonly networksSettings: Dictionary<NetworkConfig>;
Expand All @@ -59,7 +50,6 @@ interface ApplicationConfig {
readonly testFarms: string[];
readonly operationsRestrictions: OperationRestriction[];
readonly requestRetryCount: number;
readonly cardanoAmmSwapsOpenTime: DateTime;
readonly lbspLiquidityPools: string[];
readonly spfPoolId: string;
readonly specialRewards: string[];
Expand All @@ -73,36 +63,9 @@ export const applicationConfig: ApplicationConfig = {
spfUsdRateUrl: 'https://api.spectrum.fi/v1/price-tracking/spf/price',
operationTimeoutTime: 60_000,
cookieDomain: isProductionEnv() ? 'spectrum.fi' : undefined,
cardanoMaintenance: false,
// cardanoUpdate: {
// title: 'On the way to the mainnet',
// content: 'The Cardano AMM protocol will be available in mainnet soon',
// },
reCaptchaKey: '6LfCKZIiAAAAACypYW5pGlgZNTcwse1njmQMIUUL',
requestRetryCount: 3,
networksSettings: {
cardano_preview: {
defaultTokenListUrl: 'https://spectrum.fi/cardano-token-list.json',
lbspWhitelistUrl: 'https://spectrum.fi/lbsp_whitelist.json',
metadataUrl:
'https://raw.githubusercontent.com/spectrum-finance/token-logos/master/logos/cardano',
networkUrl: 'https://explorer.spectrum.fi/cardano/preview/v1/',
explorerUrl: 'https://preview.cexplorer.io',
lowBalanceGuide: '',
analyticUrl: 'https://analytics.spectrum.fi/cardano/',
isCreatePoolAvailable: false,
},
cardano: {
additionalTokenList: [],
defaultTokenListUrl: 'https://spectrum.fi/cardano-token-list.json',
lbspWhitelistUrl: 'https://spectrum.fi/lbsp_whitelist.json',
metadataUrl: 'https://spectrum.fi/logos/cardano',
networkUrl: 'https://explorer.spectrum.fi/cardano/mainnet/v1/',
explorerUrl: 'https://cardanoscan.io',
lowBalanceGuide: '',
analyticUrl: 'https://analytics-balanced.spectrum.fi/cardano/',
isCreatePoolAvailable: false,
},
ergo: {
defaultTokenListUrl: 'https://spectrum.fi/ergo-token-list.json',
lbspWhitelistUrl: '',
Expand Down Expand Up @@ -289,5 +252,4 @@ export const applicationConfig: ApplicationConfig = {
operation: 'swap',
},
],
cardanoAmmSwapsOpenTime: DateTime.utc(2023, 6, 21, 19, 59, 0),
};
Loading

0 comments on commit 957e12f

Please sign in to comment.