Skip to content

Commit

Permalink
chore: general web cleanup (#5015)
Browse files Browse the repository at this point in the history
* chore: remove redundant type arguments

* chore: remove unneeded anys

* chore: remove duplicate unions

* chore: fix jsdoc return type

* chore: fix jsdocs

* chore: shorten imports

* chore: remove double line break

* chore: remove redundant initializer

* chore: remove unused AccountRow.tsx

* chore: remove unused AprTag.tsx

* chore: remove unused ChainOption.tsx

* chore: remove unused getAssetBalance.ts & unused constants

* chore: remove unused swapper logic

* chore: remove unused defi logic
  • Loading branch information
0xApotheosis authored Aug 2, 2023
1 parent d4989d4 commit 002e16f
Show file tree
Hide file tree
Showing 56 changed files with 70 additions and 365 deletions.
1 change: 0 additions & 1 deletion .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ REACT_APP_MTPELERIN_BUY_URL=https://buy.mtpelerin.com/
REACT_APP_MTPELERIN_SELL_URL=https://sell.mtpelerin.com/
REACT_APP_MTPELERIN_REFERRAL_CODE=shapeshift


# onramper
REACT_APP_ONRAMPER_WIDGET_URL=https://buy.onramper.com/
REACT_APP_ONRAMPER_API_URL=https://api.onramper.com/
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/avalanche/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { avalancheChainId } from '@shapeshiftoss/caip'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../../src/lib/asset-service'
import { avax } from '../baseAssets'
import * as coingecko from '../coingecko'
import { getRenderedIdenticonBase64 } from '../generateAssetIcon/generateAssetIcon'
Expand Down
3 changes: 1 addition & 2 deletions scripts/generateAssetData/baseAssets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as caip from '@shapeshiftoss/caip'

import type { Asset } from '../../src/lib/asset-service'
import type { Asset } from 'lib/asset-service'

type AssetWithNetworkName = Asset & { networkName: string }

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/coingecko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
toAssetId,
} from '@shapeshiftoss/caip'
import axios from 'axios'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../src/lib/asset-service'
import { avax, bnbsmartchain, ethereum, gnosis, optimism, polygon } from './baseAssets'
import { colorMap } from './colorMap'

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/ethTokens/uniswap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ethChainId as chainId, toAssetId } from '@shapeshiftoss/caip'
import axios from 'axios'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../../src/lib/asset-service'
import { colorMap } from '../colorMap'

type UniswapToken = {
Expand Down
6 changes: 3 additions & 3 deletions scripts/generateAssetData/ethereum/idleVaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import 'dotenv/config'
import { ethChainId as chainId, toAssetId } from '@shapeshiftoss/caip'
import assert from 'assert'
import axios from 'axios'
import type { Asset } from 'lib/asset-service'
import type { IdleVault } from 'lib/investor/investor-idle'
import { IdleSdk } from 'lib/investor/investor-idle'

import type { Asset } from '../../../src/lib/asset-service'
import type { IdleVault } from '../../../src/lib/investor/investor-idle'
import { IdleSdk } from '../../../src/lib/investor/investor-idle'
import { ethereum } from '../baseAssets'
import { colorMap } from '../colorMap'

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/ethereum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import axios from 'axios'
import chunk from 'lodash/chunk'
import orderBy from 'lodash/orderBy'
import uniqBy from 'lodash/uniqBy'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../../src/lib/asset-service'
import { ethereum } from '../baseAssets'
import * as coingecko from '../coingecko'
import type { IdenticonOptions } from '../generateAssetIcon/generateAssetIcon'
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/ethereum/uniswapV2Pools.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ethChainId as chainId, toAssetId } from '@shapeshiftoss/caip'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../../src/lib/asset-service'
import { ethereum } from '../baseAssets'
import { colorMap } from '../colorMap'

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/ethereum/yearnVaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { Token, Vault } from '@yfi/sdk'
import { Yearn } from '@yfi/sdk'
import { ethers } from 'ethers'
import toLower from 'lodash/toLower'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../../src/lib/asset-service'
import { ethereum } from '../baseAssets'
import { colorMap } from '../colorMap'

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/generateAssetData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import fs from 'fs'
import merge from 'lodash/merge'
import orderBy from 'lodash/orderBy'
import path from 'path'
import type { Asset, AssetsById } from 'lib/asset-service'

import type { Asset, AssetsById } from '../../src/lib/asset-service'
import * as avalanche from './avalanche'
import { atom, bitcoin, bitcoincash, dogecoin, litecoin, thorchain } from './baseAssets'
import * as bnbsmartchain from './bnbsmartchain'
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/generateColorMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'dotenv/config'
import type { AssetId } from '@shapeshiftoss/caip'
import fs from 'fs'
import orderBy from 'lodash/orderBy'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../src/lib/asset-service'
import * as avalanche from './avalanche'
import { atom, bitcoin, bitcoincash, dogecoin, litecoin, thorchain } from './baseAssets'
import * as bnbsmartchain from './bnbsmartchain'
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/osmosis/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ASSET_REFERENCE, osmosisChainId, toAssetId } from '@shapeshiftoss/caip'
import axios from 'axios'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../../src/lib/asset-service'
import { osmosis } from '../baseAssets'
import { colorMap } from '../colorMap'
import type { IdenticonOptions } from '../generateAssetIcon/generateAssetIcon'
Expand Down
3 changes: 1 addition & 2 deletions scripts/generateAssetData/overrides.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { AssetId } from '@shapeshiftoss/caip'

import type { Asset } from '../../src/lib/asset-service'
import type { Asset } from 'lib/asset-service'

const fox: Partial<Asset> = {
color: '#3761F9',
Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/setColors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Asset } from '../../src/lib/asset-service'
import type { Asset } from 'lib/asset-service'

const colorThief = require('colorthief') as any

Expand Down
2 changes: 1 addition & 1 deletion scripts/generateAssetData/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import filter from 'lodash/filter'
import type { Asset } from 'lib/asset-service'

import type { Asset } from '../../src/lib/asset-service'
import blacklist from './blacklist.json'

// blacklist wormhole assets as well - users can't hold a balance and we don't support wormholes
Expand Down
3 changes: 1 addition & 2 deletions scripts/scrapeWalletConnectRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as fs from 'fs'
import fetch from 'node-fetch'
import * as path from 'path'

import type { APIRegistryItem, RegistryItem } from '../src/plugins/walletConnectToDapps/types'
import type { APIRegistryItem, RegistryItem } from 'src/plugins/walletConnectToDapps/types'

const registryJsonUrl =
'https://explorer-api.walletconnect.com/v3/all?projectId=2f05ae7f1116030fde2d36508f472bfb'
Expand Down
109 changes: 0 additions & 109 deletions src/components/AccountRow/AccountRow.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/AssetHeader/AssetChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { IconCircle } from 'components/IconCircle'
import { StakingUpArrowIcon } from 'components/Icons/StakingUpArrow'
import { PriceChart } from 'components/PriceChart/PriceChart'
import { RawText, Text } from 'components/Text'
import { useIsBalanceChartDataUnavailable } from 'hooks/useBalanceChartData/utils'
import { useLocaleFormatter } from 'hooks/useLocaleFormatter/useLocaleFormatter'
import { useTimeframeChange } from 'hooks/useTimeframeChange/useTimeframeChange'
import { bn, bnOrZero } from 'lib/bignumber/bignumber'
Expand All @@ -41,7 +42,6 @@ import {
} from 'state/slices/selectors'
import { useAppSelector } from 'state/store'

import { useIsBalanceChartDataUnavailable } from '../../hooks/useBalanceChartData/utils'
import { HelperTooltip } from '../HelperTooltip/HelperTooltip'

enum View {
Expand Down
33 changes: 0 additions & 33 deletions src/components/ChainOption/ChainOption.tsx

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions src/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import type { SelectProps } from '@chakra-ui/react'
import { Select } from '@chakra-ui/react'
import React from 'react'
import { locales } from 'assets/translations/constants'
import { getMixPanel } from 'lib/mixpanel/mixPanelSingleton'
import { MixPanelEvents } from 'lib/mixpanel/types'
import { preferences } from 'state/slices/preferencesSlice/preferencesSlice'
import { selectSelectedLocale } from 'state/slices/selectors'
import { useAppDispatch, useAppSelector } from 'state/store'

import { locales } from '../assets/translations/constants'

export const LanguageSelector: React.FC<SelectProps> = props => {
const dispatch = useAppDispatch()
const selectedLocale = useAppSelector(selectSelectedLocale)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/Header/SideNavContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Box, Flex, IconButton, Stack, useMediaQuery } from '@chakra-ui/react'
import { WalletConnectToDappsHeaderButton } from 'plugins/walletConnectToDapps/components/header/WalletConnectToDappsHeaderButton'
import { memo, useCallback } from 'react'
import { useTranslate } from 'react-polyglot'
import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag'
import { useModal } from 'hooks/useModal/useModal'
import { breakpoints } from 'theme/theme'

import { useFeatureFlag } from '../../../hooks/useFeatureFlag/useFeatureFlag'
import { ChainMenu } from './NavBar/ChainMenu'
import { MainNavLink } from './NavBar/MainNavLink'
import { NavBar } from './NavBar/NavBar'
Expand Down
5 changes: 2 additions & 3 deletions src/components/Modals/Settings/Languages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ import { Button, Flex, Icon, IconButton, ModalBody, ModalHeader } from '@chakra-
import { FaCheck } from 'react-icons/fa'
import { useTranslate } from 'react-polyglot'
import { useHistory } from 'react-router-dom'
import { locales } from 'assets/translations/constants'
import { getLocaleLabel } from 'assets/translations/utils'
import { SlideTransition } from 'components/SlideTransition'
import { RawText } from 'components/Text'
import { preferences } from 'state/slices/preferencesSlice/preferencesSlice'
import { selectSelectedLocale } from 'state/slices/selectors'
import { useAppDispatch, useAppSelector } from 'state/store'

import { locales } from '../../../assets/translations/constants'
import { getLocaleLabel } from '../../../assets/translations/utils'

export const Languages = () => {
const dispatch = useAppDispatch()
const history = useHistory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import type { Features } from '@keepkey/device-protocol/lib/messages_pb'
import { KeepKeyHDWallet } from '@shapeshiftoss/hdwallet-keepkey'
import axios from 'axios'
import { getConfig } from 'config'
import { MINIMUM_KK_FIRMWARE_VERSION_SUPPORTING_LITECOIN } from 'constants/Config'
import {
MINIMUM_KK_FIRMWARE_VERSION_SUPPORTING_EIP712,
MINIMUM_KK_FIRMWARE_VERSION_SUPPORTING_LITECOIN,
} from 'constants/Config'
import { useEffect, useState } from 'react'
import semverGte from 'semver/functions/gte'
import { useWallet } from 'hooks/useWallet/useWallet'

import { MINIMUM_KK_FIRMWARE_VERSION_SUPPORTING_EIP712 } from '../../../../constants/Config'

interface VersionUrl {
version: string
url: string
Expand Down
3 changes: 1 addition & 2 deletions src/context/WalletProvider/components/FailureModal.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { NotAllowedIcon } from '@chakra-ui/icons'
import { ModalBody } from '@chakra-ui/react'
import type { ReactNode } from 'react'

import { Text } from '../../../components/Text'
import { Text } from 'components/Text'

export type FailureModalProps = {
headerText: string
Expand Down
Loading

0 comments on commit 002e16f

Please sign in to comment.