diff --git a/.env.base b/.env.base index 789030326ca..22df2c2435a 100644 --- a/.env.base +++ b/.env.base @@ -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/ diff --git a/scripts/generateAssetData/avalanche/index.ts b/scripts/generateAssetData/avalanche/index.ts index 9ec3b43e8bd..967c29ce615 100644 --- a/scripts/generateAssetData/avalanche/index.ts +++ b/scripts/generateAssetData/avalanche/index.ts @@ -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' diff --git a/scripts/generateAssetData/baseAssets.ts b/scripts/generateAssetData/baseAssets.ts index 0ab1fd95600..43eb3bf82a1 100644 --- a/scripts/generateAssetData/baseAssets.ts +++ b/scripts/generateAssetData/baseAssets.ts @@ -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 } diff --git a/scripts/generateAssetData/coingecko.ts b/scripts/generateAssetData/coingecko.ts index 1172914e284..fcb30f7226d 100644 --- a/scripts/generateAssetData/coingecko.ts +++ b/scripts/generateAssetData/coingecko.ts @@ -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' diff --git a/scripts/generateAssetData/ethTokens/uniswap.ts b/scripts/generateAssetData/ethTokens/uniswap.ts index f647ab372b1..09ece9b9127 100644 --- a/scripts/generateAssetData/ethTokens/uniswap.ts +++ b/scripts/generateAssetData/ethTokens/uniswap.ts @@ -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 = { diff --git a/scripts/generateAssetData/ethereum/idleVaults.ts b/scripts/generateAssetData/ethereum/idleVaults.ts index 1039301c814..1913c205bd2 100644 --- a/scripts/generateAssetData/ethereum/idleVaults.ts +++ b/scripts/generateAssetData/ethereum/idleVaults.ts @@ -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' diff --git a/scripts/generateAssetData/ethereum/index.ts b/scripts/generateAssetData/ethereum/index.ts index 8be62a5ccff..05c4b71d7f9 100644 --- a/scripts/generateAssetData/ethereum/index.ts +++ b/scripts/generateAssetData/ethereum/index.ts @@ -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' diff --git a/scripts/generateAssetData/ethereum/uniswapV2Pools.ts b/scripts/generateAssetData/ethereum/uniswapV2Pools.ts index aedb075f3cb..58e98af1f1f 100644 --- a/scripts/generateAssetData/ethereum/uniswapV2Pools.ts +++ b/scripts/generateAssetData/ethereum/uniswapV2Pools.ts @@ -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' diff --git a/scripts/generateAssetData/ethereum/yearnVaults.ts b/scripts/generateAssetData/ethereum/yearnVaults.ts index 29414fb5102..c3b96dec5f8 100644 --- a/scripts/generateAssetData/ethereum/yearnVaults.ts +++ b/scripts/generateAssetData/ethereum/yearnVaults.ts @@ -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' diff --git a/scripts/generateAssetData/generateAssetData.ts b/scripts/generateAssetData/generateAssetData.ts index c8283eb8ecb..fe77fc3c941 100644 --- a/scripts/generateAssetData/generateAssetData.ts +++ b/scripts/generateAssetData/generateAssetData.ts @@ -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' diff --git a/scripts/generateAssetData/generateColorMap.ts b/scripts/generateAssetData/generateColorMap.ts index 6f7cc3a377d..75da77c3b57 100644 --- a/scripts/generateAssetData/generateColorMap.ts +++ b/scripts/generateAssetData/generateColorMap.ts @@ -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' diff --git a/scripts/generateAssetData/osmosis/index.ts b/scripts/generateAssetData/osmosis/index.ts index 5387e6d9355..7e168f2230b 100644 --- a/scripts/generateAssetData/osmosis/index.ts +++ b/scripts/generateAssetData/osmosis/index.ts @@ -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' diff --git a/scripts/generateAssetData/overrides.ts b/scripts/generateAssetData/overrides.ts index a2e5c674a7c..f17754b59d8 100644 --- a/scripts/generateAssetData/overrides.ts +++ b/scripts/generateAssetData/overrides.ts @@ -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 = { color: '#3761F9', diff --git a/scripts/generateAssetData/setColors.ts b/scripts/generateAssetData/setColors.ts index d01ca2e4300..dddb1c16746 100644 --- a/scripts/generateAssetData/setColors.ts +++ b/scripts/generateAssetData/setColors.ts @@ -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 diff --git a/scripts/generateAssetData/utils.ts b/scripts/generateAssetData/utils.ts index 60c9b3ee3c7..431a1486a01 100644 --- a/scripts/generateAssetData/utils.ts +++ b/scripts/generateAssetData/utils.ts @@ -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 diff --git a/scripts/scrapeWalletConnectRegistry.ts b/scripts/scrapeWalletConnectRegistry.ts index fdab092ac2d..c0a1dd00fb7 100644 --- a/scripts/scrapeWalletConnectRegistry.ts +++ b/scripts/scrapeWalletConnectRegistry.ts @@ -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' diff --git a/src/components/AccountRow/AccountRow.tsx b/src/components/AccountRow/AccountRow.tsx deleted file mode 100644 index 670e782d267..00000000000 --- a/src/components/AccountRow/AccountRow.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { Flex, SimpleGrid, useColorModeValue } from '@chakra-ui/react' -import type { AssetId } from '@shapeshiftoss/caip' -import { useMemo } from 'react' -import type { LinkProps } from 'react-router-dom' -import { Link } from 'react-router-dom' -import { Amount } from 'components/Amount/Amount' -import { AssetIcon } from 'components/AssetIcon' -import { RawText } from 'components/Text' -import { - selectAssetById, - selectMarketDataById, - selectPortfolioCryptoPrecisionBalanceByFilter, - selectPortfolioUserCurrencyBalanceByAssetId, -} from 'state/slices/selectors' -import { useAppSelector } from 'state/store' - -import { Allocations } from './Allocations' - -export type AccountRowArgs = { - allocationValue: number - assetId: AssetId - to?: LinkProps['to'] -} - -export const AccountRow = ({ allocationValue, assetId, ...rest }: AccountRowArgs) => { - const rowHover = useColorModeValue('gray.100', 'gray.750') - const url = useMemo(() => (assetId ? `/assets/${assetId}` : ''), [assetId]) - - const asset = useAppSelector(state => selectAssetById(state, assetId)) - const marketData = useAppSelector(state => selectMarketDataById(state, assetId)) - const cryptoValue = - useAppSelector(state => selectPortfolioCryptoPrecisionBalanceByFilter(state, { assetId })) ?? - '0' - const userCurrencyValue = - useAppSelector(state => selectPortfolioUserCurrencyBalanceByAssetId(state, { assetId })) ?? '0' - - if (!asset) return null // users may have assets we don't support - - return ( - - - - - - {asset.name} - - - {asset.symbol} - - - - - - - - {!marketData?.price ? '--' : } - - - {!marketData?.price ? ( - '--' - ) : ( - - - - - )} - - - - - - ) -} diff --git a/src/components/AssetHeader/AssetChart.tsx b/src/components/AssetHeader/AssetChart.tsx index 480aaa837d3..a2a2ea958ca 100644 --- a/src/components/AssetHeader/AssetChart.tsx +++ b/src/components/AssetHeader/AssetChart.tsx @@ -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' @@ -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 { diff --git a/src/components/ChainOption/ChainOption.tsx b/src/components/ChainOption/ChainOption.tsx deleted file mode 100644 index 2ca9340eef5..00000000000 --- a/src/components/ChainOption/ChainOption.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { forwardRef, MenuItemOption, Stack } from '@chakra-ui/react' -import type { ChainId } from '@shapeshiftoss/caip' -import { useMemo } from 'react' -import { Amount } from 'components/Amount/Amount' -import { AssetIcon } from 'components/AssetIcon' -import { RawText } from 'components/Text' -import type { Asset } from 'lib/asset-service' -import { selectPortfolioTotalBalanceByChainIdIncludeStaking } from 'state/slices/selectors' -import { useAppSelector } from 'state/store' - -type ChainOptionProps = { - chainId?: ChainId - asset?: Asset - showFiatBalance?: boolean -} - -export const ChainOption = forwardRef( - ({ chainId, asset, showFiatBalance }, ref) => { - const filter = useMemo(() => ({ chainId }), [chainId]) - const chainFiatBalance = useAppSelector(s => - selectPortfolioTotalBalanceByChainIdIncludeStaking(s, filter), - ) - return ( - - - - {asset?.networkName ?? asset?.name} - {showFiatBalance && chainFiatBalance && } - - - ) - }, -) diff --git a/src/components/EarnDashboard/components/ProviderDetails/ProviderDetails.tsx b/src/components/EarnDashboard/components/ProviderDetails/ProviderDetails.tsx deleted file mode 100644 index 9c83c54af60..00000000000 --- a/src/components/EarnDashboard/components/ProviderDetails/ProviderDetails.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Flex } from '@chakra-ui/react' -import type { AggregatedOpportunitiesByProviderReturn } from 'state/slices/opportunitiesSlice/types' - -import { LpPositionsByAsset } from './LpPositionsByAsset' -import { StakingPositionsByAsset } from './StakingOpportunitiesByAsset' - -export const ProviderDetails: React.FC = ({ - provider, - opportunities, -}) => { - if (!provider) return null - return ( - - - - - ) -} diff --git a/src/components/LanguageSelector.tsx b/src/components/LanguageSelector.tsx index 0f246e5bb91..8446b8694c8 100644 --- a/src/components/LanguageSelector.tsx +++ b/src/components/LanguageSelector.tsx @@ -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 = props => { const dispatch = useAppDispatch() const selectedLocale = useAppSelector(selectSelectedLocale) diff --git a/src/components/Layout/Header/SideNavContent.tsx b/src/components/Layout/Header/SideNavContent.tsx index a675c36f59e..339db07fdfa 100644 --- a/src/components/Layout/Header/SideNavContent.tsx +++ b/src/components/Layout/Header/SideNavContent.tsx @@ -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' diff --git a/src/components/Modals/Settings/Languages.tsx b/src/components/Modals/Settings/Languages.tsx index 31487d1b65e..751995991f5 100644 --- a/src/components/Modals/Settings/Languages.tsx +++ b/src/components/Modals/Settings/Languages.tsx @@ -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() diff --git a/src/context/WalletProvider/KeepKey/hooks/useKeepKeyVersions.ts b/src/context/WalletProvider/KeepKey/hooks/useKeepKeyVersions.ts index 79231210cb8..a145af437a4 100644 --- a/src/context/WalletProvider/KeepKey/hooks/useKeepKeyVersions.ts +++ b/src/context/WalletProvider/KeepKey/hooks/useKeepKeyVersions.ts @@ -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 diff --git a/src/context/WalletProvider/components/FailureModal.tsx b/src/context/WalletProvider/components/FailureModal.tsx index f4b4631e0a2..92986c52a27 100644 --- a/src/context/WalletProvider/components/FailureModal.tsx +++ b/src/context/WalletProvider/components/FailureModal.tsx @@ -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 diff --git a/src/contracts/contractManager.ts b/src/contracts/contractManager.ts index b0069832c40..5bc4d003f6c 100644 --- a/src/contracts/contractManager.ts +++ b/src/contracts/contractManager.ts @@ -2,17 +2,17 @@ import type { AssetId, ChainId } from '@shapeshiftoss/caip' import { fromAssetId, toAssetId } from '@shapeshiftoss/caip' import type { Token } from '@uniswap/sdk' import { Fetcher } from '@uniswap/sdk' -import { ethers } from 'ethers' -import memoize from 'lodash/memoize' -import { getEthersProvider } from 'lib/ethersProviderSingleton' - -import type { IUniswapV2Pair } from './__generated' import { ERC20ABI__factory, FarmingAbi__factory, IUniswapV2Pair__factory, IUniswapV2Router02__factory, -} from './__generated/factories' +} from 'contracts/__generated' +import { ethers } from 'ethers' +import memoize from 'lodash/memoize' +import { getEthersProvider } from 'lib/ethersProviderSingleton' + +import type { IUniswapV2Pair } from './__generated' import { ETH_FOX_POOL_CONTRACT_ADDRESS, ETH_FOX_STAKING_CONTRACT_ADDRESS_V1, diff --git a/src/features/defi/providers/idle/components/IdleManager/Deposit/components/Deposit.tsx b/src/features/defi/providers/idle/components/IdleManager/Deposit/components/Deposit.tsx index c31bc6ae96f..5eae29a8a3b 100644 --- a/src/features/defi/providers/idle/components/IdleManager/Deposit/components/Deposit.tsx +++ b/src/features/defi/providers/idle/components/IdleManager/Deposit/components/Deposit.tsx @@ -37,7 +37,7 @@ import { DepositContext } from '../DepositContext' type DepositProps = StepComponentProps & { accountId?: AccountId | undefined onAccountIdChange: AccountDropdownProps['onChange'] -} & StepComponentProps +} export const Deposit: React.FC = ({ accountId, diff --git a/src/features/defi/providers/osmosis/components/OsmosisManager/Lp/Deposit/components/Deposit.tsx b/src/features/defi/providers/osmosis/components/OsmosisManager/Lp/Deposit/components/Deposit.tsx index 0dfa749f86e..b8e922f9317 100644 --- a/src/features/defi/providers/osmosis/components/OsmosisManager/Lp/Deposit/components/Deposit.tsx +++ b/src/features/defi/providers/osmosis/components/OsmosisManager/Lp/Deposit/components/Deposit.tsx @@ -52,7 +52,7 @@ const DEFAULT_SLIPPAGE = '0.025' // Allow for 2.5% slippage. TODO(pastaghost): i type DepositProps = StepComponentProps & { accountId?: AccountId | undefined onAccountIdChange: AccountDropdownProps['onChange'] -} & StepComponentProps +} export const Deposit: React.FC = ({ accountId, diff --git a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx index a294e228dc8..d2efc78555a 100644 --- a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx +++ b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Deposit/components/Deposit.tsx @@ -57,7 +57,7 @@ import { DepositContext } from '../DepositContext' type DepositProps = StepComponentProps & { accountId?: AccountId | undefined onAccountIdChange: AccountDropdownProps['onChange'] -} & StepComponentProps +} export const Deposit: React.FC = ({ accountId, diff --git a/src/hooks/useLocaleFormatter/useLocaleFormatter.ts b/src/hooks/useLocaleFormatter/useLocaleFormatter.ts index 4589b5131bc..ee4a123ca58 100644 --- a/src/hooks/useLocaleFormatter/useLocaleFormatter.ts +++ b/src/hooks/useLocaleFormatter/useLocaleFormatter.ts @@ -151,6 +151,7 @@ export const useLocaleFormatter = (args?: useLocaleFormatterArgs): NumberFormatt /** * Helper function to abbreviate number to truncate rather than round fractions * @param {number} maximumFractionDigits - truncate fraction after this number of digits. Use 0 for no fraction. + * @param omitDecimalTrailingZeros */ function partsReducer(maximumFractionDigits: number, omitDecimalTrailingZeros?: boolean) { return (accum: string, { type, value }: Intl.NumberFormatPart) => { diff --git a/src/lib/investor/investor-idle/IdleOpportunity.ts b/src/lib/investor/investor-idle/IdleOpportunity.ts index 394e2740067..f6e1ae29eea 100644 --- a/src/lib/investor/investor-idle/IdleOpportunity.ts +++ b/src/lib/investor/investor-idle/IdleOpportunity.ts @@ -5,13 +5,13 @@ import { toAddressNList } from '@shapeshiftoss/chain-adapters' import type { ETHSignTx, HDWallet } from '@shapeshiftoss/hdwallet-core' import type { BIP44Params, KnownChainIds } from '@shapeshiftoss/types' import type { BigNumber } from 'bignumber.js' +import { DAO_TREASURY_ETHEREUM_MAINNET } from 'constants/treasury' import toLower from 'lodash/toLower' import type Web3 from 'web3' import type { Contract } from 'web3-eth-contract' import { numberToHex } from 'web3-utils' +import { bn, bnOrZero } from 'lib/bignumber/bignumber' -import { DAO_TREASURY_ETHEREUM_MAINNET } from '../../../constants/treasury' -import { bn, bnOrZero } from '../../../lib/bignumber/bignumber' import type { ApprovalRequired, DepositWithdrawArgs, @@ -307,7 +307,7 @@ export class IdleOpportunity } async getRewardAssetIds(): Promise { - let govTokens = [] + let govTokens: any[] if (this.metadata.cdoAddress) { const cdoContract: Contract = new this.#internals.web3.eth.Contract( diff --git a/src/lib/swapper/api.ts b/src/lib/swapper/api.ts index 0e25f08a809..b3b6b653c5e 100644 --- a/src/lib/swapper/api.ts +++ b/src/lib/swapper/api.ts @@ -88,7 +88,7 @@ export type GetSwappersWithQuoteMetadataArgs = GetTradeQuoteInput & { export type SwapperWithQuoteMetadata = { swapper: Swapper - quote: TradeQuote + quote: TradeQuote inputOutputRatio: number | undefined } export type GetSwappersWithQuoteMetadataReturn = SwapperWithQuoteMetadata[] @@ -250,7 +250,7 @@ export interface Swapper { /** * Get a trade quote */ - getTradeQuote(input: GetTradeQuoteInput): Promise, SwapErrorRight>> + getTradeQuote(input: GetTradeQuoteInput): Promise> /** * Execute a trade built with buildTrade by signing and broadcasting diff --git a/src/lib/swapper/manager/SwapperManager.ts b/src/lib/swapper/manager/SwapperManager.ts index db724a9b2f0..2f2f6c0b5a8 100644 --- a/src/lib/swapper/manager/SwapperManager.ts +++ b/src/lib/swapper/manager/SwapperManager.ts @@ -96,7 +96,7 @@ export class SwapperManager { /** * * @param pair type {GetQuoteInput} - * @returns {SwapperType} + * @returns {Swapper[]} */ getSwappersByPair(pair: ByPairInput): Swapper[] { const { sellAssetId, buyAssetId } = pair diff --git a/src/lib/swapper/manager/utils.test.ts b/src/lib/swapper/manager/utils.test.ts index c0a34922515..404e551e63b 100644 --- a/src/lib/swapper/manager/utils.test.ts +++ b/src/lib/swapper/manager/utils.test.ts @@ -1,4 +1,3 @@ -import type { ChainId } from '@shapeshiftoss/caip' import type { Asset } from 'lib/asset-service' import type { TradeQuote } from '../api' @@ -9,7 +8,7 @@ import { getRatioFromQuote } from './utils' describe('getRatioFromQuote', () => { it('should get the ratio for a quote', () => { - const quote: TradeQuote = tradeQuote + const quote: TradeQuote = tradeQuote const feeAsset: Asset = ETH const result = getRatioFromQuote({ quote, diff --git a/src/lib/swapper/manager/utils.ts b/src/lib/swapper/manager/utils.ts index e4678751fa3..f163df42447 100644 --- a/src/lib/swapper/manager/utils.ts +++ b/src/lib/swapper/manager/utils.ts @@ -1,4 +1,4 @@ -import type { AssetId, ChainId } from '@shapeshiftoss/caip' +import type { AssetId } from '@shapeshiftoss/caip' import type { MarketData } from '@shapeshiftoss/types' import type { Asset } from 'lib/asset-service' import { bnOrZero } from 'lib/bignumber/bignumber' @@ -23,7 +23,7 @@ export const getRatioFromQuote = ({ feeAsset, cryptoMarketDataById, }: { - quote: TradeQuote + quote: TradeQuote feeAsset: Asset cryptoMarketDataById: Partial>> }): number | undefined => { diff --git a/src/lib/swapper/swappers/CowSwapper/utils/constants.ts b/src/lib/swapper/swappers/CowSwapper/utils/constants.ts index 1475976af8d..05ac97dbcc7 100644 --- a/src/lib/swapper/swappers/CowSwapper/utils/constants.ts +++ b/src/lib/swapper/swappers/CowSwapper/utils/constants.ts @@ -14,7 +14,6 @@ export const DEFAULT_ADDRESS = AddressZero export const DEFAULT_APP_DATA = '0x68a7b5781dfe48bd5d7aeb11261c17517f5c587da682e4fade9b6a00a59b8970' export const COW_SWAP_VAULT_RELAYER_ADDRESS = '0xc92e8bdf79f0507f65a392b0ab4667716bfe0110' export const COW_SWAP_SETTLEMENT_ADDRESS = '0x9008D19f58AAbD9eD0D60971565AA8510560ab41' -export const WETH_ASSET_ID = 'eip155:1/erc20:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' export const ORDER_KIND_SELL = 'sell' export const ORDER_KIND_BUY = 'buy' diff --git a/src/lib/swapper/swappers/LifiSwapper/getTradeQuote/getTradeQuote.ts b/src/lib/swapper/swappers/LifiSwapper/getTradeQuote/getTradeQuote.ts index 392e674fe50..93f26bbf6da 100644 --- a/src/lib/swapper/swappers/LifiSwapper/getTradeQuote/getTradeQuote.ts +++ b/src/lib/swapper/swappers/LifiSwapper/getTradeQuote/getTradeQuote.ts @@ -21,7 +21,6 @@ import { getMinimumCryptoHuman } from 'lib/swapper/swappers/LifiSwapper/utils/ge import { transformLifiStepFeeData } from 'lib/swapper/swappers/LifiSwapper/utils/transformLifiFeeData/transformLifiFeeData' import type { LifiTradeQuote } from 'lib/swapper/swappers/LifiSwapper/utils/types' -import { getLifiChainMap } from '../utils/getLifiChainMap' import { getNetworkFeeCryptoBaseUnit } from '../utils/getNetworkFeeCryptoBaseUnit/getNetworkFeeCryptoBaseUnit' export async function getTradeQuote( @@ -198,21 +197,3 @@ export async function getTradeQuote( ) } } - -let lifiChainMapPromise: Promise, SwapErrorRight>> | undefined - -// TODO(woodenfurniture): this function and its singletons should be moved elsewhere once we have -// more visibility on the pattern for multi-hop swappers -export const getLifiTradeQuote = async ( - input: GetEvmTradeQuoteInput, - assets: Partial>, - sellAssetPriceUsdPrecision: string, -): Promise> => { - if (lifiChainMapPromise === undefined) lifiChainMapPromise = getLifiChainMap() - - const maybeLifiChainMap = await lifiChainMapPromise - - if (maybeLifiChainMap.isErr()) return Err(maybeLifiChainMap.unwrapErr()) - - return getTradeQuote(input, maybeLifiChainMap.unwrap(), assets, sellAssetPriceUsdPrecision) -} diff --git a/src/lib/swapper/swappers/LifiSwapper/utils/getAssetBalance/getAssetBalance.ts b/src/lib/swapper/swappers/LifiSwapper/utils/getAssetBalance/getAssetBalance.ts deleted file mode 100644 index 4aaa91c4309..00000000000 --- a/src/lib/swapper/swappers/LifiSwapper/utils/getAssetBalance/getAssetBalance.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { ChainId } from '@shapeshiftoss/caip' -import type { Asset } from 'lib/asset-service' -import { SwapError, SwapErrorType } from 'lib/swapper/api' -import { selectPortfolioCryptoBalanceBaseUnitByFilter } from 'state/slices/common-selectors' -import { selectAccountIdByAccountNumberAndChainId } from 'state/slices/selectors' -import { store } from 'state/store' - -export const getAssetBalance = ({ - asset, - accountNumber, - chainId, -}: { - asset: Asset - accountNumber: number - chainId: ChainId -}) => { - const accountId = selectAccountIdByAccountNumberAndChainId(store.getState(), { - accountNumber, - chainId, - }) - - if (accountId === undefined) { - throw new SwapError('[getTradeQuote] no account id found', { - code: SwapErrorType.TRADE_QUOTE_FAILED, - }) - } - - return selectPortfolioCryptoBalanceBaseUnitByFilter(store.getState(), { - accountId, - assetId: asset.assetId, - }) -} diff --git a/src/lib/swapper/swappers/LifiSwapper/utils/getFeeAssets/getFeeAssets.ts b/src/lib/swapper/swappers/LifiSwapper/utils/getFeeAssets/getFeeAssets.ts deleted file mode 100644 index b2fbb123813..00000000000 --- a/src/lib/swapper/swappers/LifiSwapper/utils/getFeeAssets/getFeeAssets.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { ChainId } from '@shapeshiftoss/caip' -import type { Asset } from 'lib/asset-service' -import { SwapError, SwapErrorType } from 'lib/swapper/api' -import { selectFeeAssetByChainId } from 'state/slices/selectors' -import { store } from 'state/store' - -export const getFeeAssets = (chainId: ChainId): Asset => { - const feeAsset = selectFeeAssetByChainId(store.getState(), chainId) - - if (feeAsset === undefined) { - throw new SwapError('[processGasCosts] a fee asset was not found', { - code: SwapErrorType.TRADE_QUOTE_FAILED, - details: { chainId }, - }) - } - - return feeAsset -} diff --git a/src/lib/swapper/swappers/OneInchSwapper/utils/helpers.ts b/src/lib/swapper/swappers/OneInchSwapper/utils/helpers.ts index dc5b504fc53..99f283a1896 100644 --- a/src/lib/swapper/swappers/OneInchSwapper/utils/helpers.ts +++ b/src/lib/swapper/swappers/OneInchSwapper/utils/helpers.ts @@ -1,6 +1,6 @@ -import type { AssetId, ChainId } from '@shapeshiftoss/caip' +import type { ChainId } from '@shapeshiftoss/caip' import type { EvmChainAdapter } from '@shapeshiftoss/chain-adapters' -import { KnownChainIds } from '@shapeshiftoss/types' +import type { KnownChainIds } from '@shapeshiftoss/types' import type { Result } from '@sniptt/monads/build' import { Err, Ok } from '@sniptt/monads/build' import type BigNumber from 'bignumber.js' @@ -13,7 +13,6 @@ import { makeSwapErrorRight, SwapErrorType } from 'lib/swapper/api' import { isEvmChainAdapter } from 'lib/utils/evm' import { isNativeEvmAsset } from '../../utils/helpers/helpers' -import { WAVAX_ASSET_ID, WBNB_ASSET_ID, WETH_ASSET_ID, WOP_ASSET_ID } from './constants' import type { OneInchBaseResponse, OneInchSupportedChainId } from './types' import { oneInchSupportedChainIds } from './types' @@ -26,22 +25,6 @@ export const getRate = (response: OneInchBaseResponse): BigNumber => { return bn(toTokenAmountCryptoHuman).div(fromTokenAmountCryptoHuman) } -export const getNativeWrappedAssetId = (chainId: ChainId): AssetId => { - switch (chainId) { - case KnownChainIds.EthereumMainnet: - return WETH_ASSET_ID - case KnownChainIds.BnbSmartChainMainnet: - return WBNB_ASSET_ID - // TODO: We should double check that the fee calculations work correctly on optimism and using this wETH contract. - case KnownChainIds.OptimismMainnet: - return WOP_ASSET_ID - case KnownChainIds.AvalancheMainnet: - return WAVAX_ASSET_ID - default: - throw new Error(`${chainId} not supported`) - } -} - export const assertValidTrade = ({ buyAsset, sellAsset, diff --git a/src/lib/swapper/swappers/OsmosisSwapper/OsmosisSwapper.ts b/src/lib/swapper/swappers/OsmosisSwapper/OsmosisSwapper.ts index ae4862b56ce..c89b0ce829b 100644 --- a/src/lib/swapper/swappers/OsmosisSwapper/OsmosisSwapper.ts +++ b/src/lib/swapper/swappers/OsmosisSwapper/OsmosisSwapper.ts @@ -198,7 +198,7 @@ export class OsmosisSwapper implements Swapper { }) } - getTradeQuote(input: GetTradeQuoteInput): Promise, SwapErrorRight>> { + getTradeQuote(input: GetTradeQuoteInput): Promise> { const sellAssetUsdRate = selectSellAssetUsdRate(swapperStore.getState()) return getTradeQuote(input, { sellAssetUsdRate }) } diff --git a/src/lib/swapper/swappers/OsmosisSwapper/getTradeQuote/getTradeQuote.ts b/src/lib/swapper/swappers/OsmosisSwapper/getTradeQuote/getTradeQuote.ts index 758ec23bdb8..24a1b68b28a 100644 --- a/src/lib/swapper/swappers/OsmosisSwapper/getTradeQuote/getTradeQuote.ts +++ b/src/lib/swapper/swappers/OsmosisSwapper/getTradeQuote/getTradeQuote.ts @@ -1,4 +1,3 @@ -import type { ChainId } from '@shapeshiftoss/caip' import { cosmosChainId, osmosisChainId } from '@shapeshiftoss/caip' import type { cosmos, GetFeeDataInput } from '@shapeshiftoss/chain-adapters' import { osmosis } from '@shapeshiftoss/chain-adapters' @@ -19,7 +18,7 @@ import { DEFAULT_SOURCE } from '../utils/constants' export const getTradeQuote = async ( input: GetTradeQuoteInput, { sellAssetUsdRate }: { sellAssetUsdRate: string }, -): Promise, SwapErrorRight>> => { +): Promise> => { const { accountNumber, sellAsset, diff --git a/src/lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote.test.ts b/src/lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote.test.ts index 0900c4f408e..68d6d512e17 100644 --- a/src/lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote.test.ts +++ b/src/lib/swapper/swappers/ThorchainSwapper/getThorTradeQuote/getTradeQuote.test.ts @@ -80,13 +80,12 @@ describe('getTradeQuote', () => { switch (url) { case '/lcd/thorchain/pools': return Promise.resolve( - Ok({ data: thornodePools } as unknown as AxiosResponse), + Ok({ data: thornodePools } as unknown as AxiosResponse), ) case '/lcd/thorchain/inbound_addresses': return Promise.resolve( Ok({ data: mockInboundAddresses } as unknown as AxiosResponse< - InboundAddressResponse[], - any + InboundAddressResponse[] >), ) default: diff --git a/src/lib/swapper/swappers/ThorchainSwapper/utils/getSignTxFromQuote.ts b/src/lib/swapper/swappers/ThorchainSwapper/utils/getSignTxFromQuote.ts index ed03f04f190..a7cdb6b5f61 100644 --- a/src/lib/swapper/swappers/ThorchainSwapper/utils/getSignTxFromQuote.ts +++ b/src/lib/swapper/swappers/ThorchainSwapper/utils/getSignTxFromQuote.ts @@ -1,4 +1,3 @@ -import type { ChainId } from '@shapeshiftoss/caip' import { CHAIN_NAMESPACE, fromAssetId } from '@shapeshiftoss/caip' import type { CosmosSdkBaseAdapter, @@ -23,7 +22,7 @@ import { createBuildCustomApiTxInput } from 'lib/utils/evm' import { isNativeEvmAsset } from '../../utils/helpers/helpers' type GetSignTxFromQuoteArgs = { - tradeQuote: TradeQuote + tradeQuote: TradeQuote receiveAddress: string affiliateBps?: string chainSpecific?: utxo.BuildTxInput diff --git a/src/lib/swapper/swappers/test/TestSwapper.ts b/src/lib/swapper/swappers/test/TestSwapper.ts index ff4087f9ed3..21f466a2ba7 100644 --- a/src/lib/swapper/swappers/test/TestSwapper.ts +++ b/src/lib/swapper/swappers/test/TestSwapper.ts @@ -49,7 +49,7 @@ export class TestSwapper implements Swapper { throw new Error('TestSwapper: buildTrade unimplemented') } - getTradeQuote(): Promise, SwapErrorRight>> { + getTradeQuote(): Promise> { throw new Error('TestSwapper: getTradeQuote unimplemented') } diff --git a/src/lib/swapper/swappers/utils/helpers/helpers.test.ts b/src/lib/swapper/swappers/utils/helpers/helpers.test.ts index 57819ba26a6..a9c25d19882 100644 --- a/src/lib/swapper/swappers/utils/helpers/helpers.test.ts +++ b/src/lib/swapper/swappers/utils/helpers/helpers.test.ts @@ -1,7 +1,7 @@ import { thorchainChainId } from '@shapeshiftoss/caip' import type { EvmChainId } from '@shapeshiftoss/chain-adapters' +import { bn } from 'lib/bignumber/bignumber' -import { bn } from '../../../../bignumber/bignumber' import { getTreasuryAddressFromChainId, normalizeIntegerAmount } from './helpers' describe('normalizeIntegerAmount', () => { diff --git a/src/lib/swapper/utils.ts b/src/lib/swapper/utils.ts index 00d5735b98e..aee8424d48a 100644 --- a/src/lib/swapper/utils.ts +++ b/src/lib/swapper/utils.ts @@ -49,12 +49,12 @@ export const makeSwapperAxiosServiceMonadic = (service: AxiosInstance, _swapperN get: ( url: string, config?: AxiosRequestConfig, - ) => Promise, SwapErrorRight>> + ) => Promise, SwapErrorRight>> post: ( url: string, data: any, config?: AxiosRequestConfig, - ) => Promise, SwapErrorRight>> + ) => Promise, SwapErrorRight>> } >(service, { get: (trappedAxios, method: 'get' | 'post') => { diff --git a/src/lib/utils/index.test.ts b/src/lib/utils/index.test.ts index 98d2016b558..d5af3fe605c 100644 --- a/src/lib/utils/index.test.ts +++ b/src/lib/utils/index.test.ts @@ -9,15 +9,15 @@ import { osmosisAssetId, osmosisChainId, } from '@shapeshiftoss/caip' - -import { fauxmesAccountId } from '../../state/slices/opportunitiesSlice/mocks' +import { fauxmesAccountId } from 'state/slices/opportunitiesSlice/mocks' import type { LpId, OpportunityId, StakingId, ValidatorId, -} from '../../state/slices/opportunitiesSlice/types' -import { opportunityIdToChainId } from '../../state/slices/opportunitiesSlice/utils' +} from 'state/slices/opportunitiesSlice/types' +import { opportunityIdToChainId } from 'state/slices/opportunitiesSlice/utils' + import { assertIsDefined, deepUpsertArray, diff --git a/src/pages/Dashboard/PortfolioBreakdown.tsx b/src/pages/Dashboard/PortfolioBreakdown.tsx index 5324c77a7c3..a2b3a31fa21 100644 --- a/src/pages/Dashboard/PortfolioBreakdown.tsx +++ b/src/pages/Dashboard/PortfolioBreakdown.tsx @@ -5,6 +5,7 @@ import { Amount } from 'components/Amount/Amount' import { Card } from 'components/Card/Card' import { CircularProgress } from 'components/CircularProgress/CircularProgress' import { Text } from 'components/Text' +import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag' import { bnOrZero } from 'lib/bignumber/bignumber' import { selectClaimableRewards, @@ -13,8 +14,6 @@ import { } from 'state/slices/selectors' import { useAppSelector } from 'state/store' -import { useFeatureFlag } from '../../hooks/useFeatureFlag/useFeatureFlag' - type StatCardProps = { percentage: number value: string diff --git a/src/pages/TransactionHistory/TransactionHistoryFilter.tsx b/src/pages/TransactionHistory/TransactionHistoryFilter.tsx index b3dddd2a1a0..5749110514b 100644 --- a/src/pages/TransactionHistory/TransactionHistoryFilter.tsx +++ b/src/pages/TransactionHistory/TransactionHistoryFilter.tsx @@ -20,10 +20,10 @@ import type { FieldValues } from 'react-hook-form' import { useForm } from 'react-hook-form' import { IoOptionsOutline } from 'react-icons/io5' import { useTranslate } from 'react-polyglot' +import type { Option } from 'components/FilterGroup' +import { FilterGroup } from 'components/FilterGroup' import { Text } from 'components/Text' -import type { Option } from '../../components/FilterGroup' -import { FilterGroup } from '../../components/FilterGroup' import { DatePicker } from './components/DatePicker/DatePicker' const customRangeOption: string = 'customRange' diff --git a/src/plugins/cosmos/components/AprTag/AprTag.tsx b/src/plugins/cosmos/components/AprTag/AprTag.tsx deleted file mode 100644 index ad38a4146e7..00000000000 --- a/src/plugins/cosmos/components/AprTag/AprTag.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { Text as CText } from '@chakra-ui/react' -import type { TagProps } from '@chakra-ui/tag' -import { Tag } from '@chakra-ui/tag' -import { useTranslate } from 'react-polyglot' -import { Amount } from 'components/Amount/Amount' - -type AprTagProps = { - percentage: string | number - showAprSuffix?: boolean -} - -export const AprTag: React.FC = ({ - percentage, - showAprSuffix, - ...styleProps -}) => { - const translate = useTranslate() - - return ( - - - {showAprSuffix && ( - -   - {`${translate('defi.apr')}*`} - - )} - - ) -} diff --git a/src/plugins/cosmos/components/modals/Staking/StakingCommon.ts b/src/plugins/cosmos/components/modals/Staking/StakingCommon.ts index 784f3f608ef..1cd5629419a 100644 --- a/src/plugins/cosmos/components/modals/Staking/StakingCommon.ts +++ b/src/plugins/cosmos/components/modals/Staking/StakingCommon.ts @@ -1,5 +1,5 @@ -import type { AssetId, ChainId } from '@shapeshiftoss/caip' -import { cosmosAssetId, cosmosChainId, osmosisAssetId, osmosisChainId } from '@shapeshiftoss/caip' +import type { AssetId } from '@shapeshiftoss/caip' +import { cosmosAssetId, osmosisAssetId } from '@shapeshiftoss/caip' import type { cosmos, osmosis } from '@shapeshiftoss/chain-adapters' import { bnOrZero } from 'lib/bignumber/bignumber' @@ -16,12 +16,6 @@ export enum StakingAction { export const COSMOS_UNBONDING_DAYS = '21' export const OSMOSIS_UNBONDING_DAYS = '14' -export const supportsStaking = (chainId: ChainId) => { - if (chainId === cosmosChainId) return true - if (chainId === osmosisChainId) return true - return false -} - export const isStakingChainAdapter = ( adapter: unknown, ): adapter is cosmos.ChainAdapter | osmosis.ChainAdapter => { diff --git a/src/setupTests.ts b/src/setupTests.ts index c951aa0710f..d4cde702320 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -4,7 +4,7 @@ // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom' -import { server } from './test/msw-utils' +import { server } from 'test/msw-utils' global.console = { ...console, diff --git a/src/state/apis/swapper/getSwappersApi.ts b/src/state/apis/swapper/getSwappersApi.ts index 963e9493671..ea2673a1225 100644 --- a/src/state/apis/swapper/getSwappersApi.ts +++ b/src/state/apis/swapper/getSwappersApi.ts @@ -1,4 +1,3 @@ -import type { ChainId } from '@shapeshiftoss/caip' import { getSwapperManager } from 'components/Trade/hooks/useSwapper/swapperManager' import type { GetTradeQuoteInput, SwapperName, TradeQuote } from 'lib/swapper/api' import { swapperApi } from 'state/apis/swapper/swapperApi' @@ -18,7 +17,7 @@ type GetAvailableSwappersReturn = { to a swapper in the swapperManager, which is keyed by SwapperType */ swapperName: SwapperName - quote: TradeQuote + quote: TradeQuote inputOutputRatio: number | undefined }[] diff --git a/src/state/slices/tradeQuoteSlice/helpers.ts b/src/state/slices/tradeQuoteSlice/helpers.ts index e3099b95434..bc68eead807 100644 --- a/src/state/slices/tradeQuoteSlice/helpers.ts +++ b/src/state/slices/tradeQuoteSlice/helpers.ts @@ -134,8 +134,8 @@ export const getHopTotalNetworkFeeFiatPrecision = ( /** * Computes the total receive amount across all hops after protocol fees are deducted - * @param param0.quote The trade quote - * @param param0.swapperName The swapper name + * @param quote The trade quote + * @param swapperName The swapper name * @returns The total receive amount across all hops in crypto precision after protocol fees are deducted */ export const getNetReceiveAmountCryptoPrecision = ({ diff --git a/src/types/common.ts b/src/types/common.ts index 950d0662f55..42816b02eeb 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -1,6 +1,5 @@ export type AnyFunction = (...args: any[]) => any export type Nullable = T | null -export type Identity = (args: T) => T interface Flavoring { _type?: FlavorT