Skip to content

Commit

Permalink
fix: import from wrong slice, prevent it from happening again
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture committed Nov 13, 2024
1 parent 2f7e1ab commit 4c915c8
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { limitOrderInput } from 'state/slices/limitOrderInputSlice/limitOrderInp
import {
selectBuyAccountId,
selectHasUserEnteredAmount,
selectInputBuyAsset,
selectInputSellAmountCryptoPrecision,
selectInputSellAmountUsd,
selectInputSellAmountUserCurrency,
Expand All @@ -31,7 +32,6 @@ import {
selectUserSlippagePercentageDecimal,
} from 'state/slices/limitOrderInputSlice/selectors'
import {
selectInputBuyAsset,
selectIsAnyAccountMetadataLoadedForChainId,
selectUserCurrencyToUsdRate,
} from 'state/slices/selectors'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MiddleEllipsis } from 'components/MiddleEllipsis/MiddleEllipsis'
import { Text } from 'components/Text'
import { useSafeTxQuery } from 'hooks/queries/useSafeTx'
import { getTxLink } from 'lib/getTxLink'
import { selectFirstHopSellAccountId } from 'state/slices/selectors'
import { selectFirstHopSellAccountId } from 'state/slices/tradeInputSlice/selectors'
import { useAppSelector } from 'state/store'

export type TxLineProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useLocaleFormatter } from 'hooks/useLocaleFormatter/useLocaleFormatter'
import { bnOrZero } from 'lib/bignumber/bignumber'
import { THORSWAP_MAXIMUM_YEAR_TRESHOLD, THORSWAP_UNIT_THRESHOLD } from 'lib/fees/model'
import { selectCalculatedFees, selectThorVotingPower } from 'state/apis/snapshot/selectors'
import { selectInputSellAmountUsd } from 'state/slices/selectors'
import { selectInputSellAmountUsd } from 'state/slices/tradeInputSlice/selectors'
import { selectActiveQuoteAffiliateBps } from 'state/slices/tradeQuoteSlice/selectors'
import { useAppSelector } from 'state/store'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { type TradeQuoteStep } from '@shapeshiftoss/swapper'
import { useEffect, useMemo, useState } from 'react'
import { useIsAllowanceApprovalRequired } from 'hooks/queries/useIsAllowanceApprovalRequired'
import { useIsAllowanceResetRequired } from 'hooks/queries/useIsAllowanceResetRequired'
import { selectFirstHopSellAccountId, selectSecondHopSellAccountId } from 'state/slices/selectors'
import {
selectFirstHopSellAccountId,
selectSecondHopSellAccountId,
} from 'state/slices/tradeInputSlice/selectors'
import {
selectActiveQuote,
selectFirstHop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ import { getMixPanel } from 'lib/mixpanel/mixPanelSingleton'
import { MixPanelEvent } from 'lib/mixpanel/types'
import { isKeplrHDWallet } from 'lib/utils'
import { selectIsVotingPowerLoading } from 'state/apis/snapshot/selectors'
import { selectIsAnyAccountMetadataLoadedForChainId } from 'state/slices/selectors'
import {
selectHasUserEnteredAmount,
selectInputBuyAsset,
selectInputSellAmountCryptoPrecision,
selectInputSellAmountUserCurrency,
selectInputSellAsset,
selectIsAnyAccountMetadataLoadedForChainId,
selectIsInputtingFiatSellAmount,
} from 'state/slices/selectors'
} from 'state/slices/tradeInputSlice/selectors'
import { tradeInput } from 'state/slices/tradeInputSlice/tradeInputSlice'
import {
selectActiveQuote,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ import { useIsSmartContractAddress } from 'hooks/useIsSmartContractAddress/useIs
import { useWallet } from 'hooks/useWallet/useWallet'
import { isToken } from 'lib/utils'
import { selectIsTradeQuoteApiQueryPending } from 'state/apis/swapper/selectors'
import { selectFeeAssetById } from 'state/slices/selectors'
import {
selectFeeAssetById,
selectHasUserEnteredAmount,
selectInputBuyAsset,
selectInputSellAmountUsd,
selectInputSellAsset,
selectIsManualReceiveAddressEditing,
selectIsManualReceiveAddressValid,
selectIsManualReceiveAddressValidating,
} from 'state/slices/selectors'
} from 'state/slices/tradeInputSlice/selectors'
import {
selectActiveQuote,
selectActiveQuoteAffiliateBps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback } from 'react'
import { selectInputBuyAsset } from 'state/slices/selectors'
import { selectInputBuyAsset } from 'state/slices/tradeInputSlice/selectors'
import { tradeInput } from 'state/slices/tradeInputSlice/tradeInputSlice'
import { useAppDispatch, useAppSelector } from 'state/store'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ import { type ApiQuote, TradeQuoteValidationError } from 'state/apis/swapper/typ
import {
selectFeeAssetByChainId,
selectFeeAssetById,
selectInputBuyAsset,
selectInputSellAmountCryptoPrecision,
selectInputSellAsset,
selectIsAssetWithoutMarketData,
selectMarketDataByAssetIdUserCurrency,
selectMarketDataByFilter,
selectUserSlippagePercentageDecimal,
} from 'state/slices/selectors'
import {
selectInputBuyAsset,
selectInputSellAmountCryptoPrecision,
selectInputSellAsset,
selectUserSlippagePercentageDecimal,
} from 'state/slices/tradeInputSlice/selectors'
import {
getBuyAmountAfterFeesCryptoPrecision,
getTotalNetworkFeeUserCurrencyPrecision,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Text } from 'components/Text'
import { selectIsTradeQuoteApiQueryPending } from 'state/apis/swapper/selectors'
import type { ApiQuote } from 'state/apis/swapper/types'
import { TradeQuoteValidationError } from 'state/apis/swapper/types'
import { selectInputBuyAsset, selectInputSellAsset } from 'state/slices/selectors'
import { selectInputBuyAsset, selectInputSellAsset } from 'state/slices/tradeInputSlice/selectors'
import {
selectActiveQuoteMetaOrDefault,
selectBuyAmountAfterFeesCryptoPrecision,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
selectInputBuyAsset,
selectLastHopBuyAccountId,
selectManualReceiveAddress,
} from 'state/slices/selectors'
} from 'state/slices/tradeInputSlice/selectors'
import { useAppSelector } from 'state/store'

export const useTradeReceiveAddress = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ import { useWallet } from 'hooks/useWallet/useWallet'
import { walletSupportsChain } from 'hooks/useWalletSupportsChain/useWalletSupportsChain'
import {
selectAccountIdsByChainIdFilter,
selectPortfolioAccountMetadataByAccountId,
} from 'state/slices/selectors'
import {
selectInputBuyAsset,
selectInputSellAsset,
selectManualReceiveAddress,
selectPortfolioAccountMetadataByAccountId,
} from 'state/slices/selectors'
} from 'state/slices/tradeInputSlice/selectors'
import { useAppSelector } from 'state/store'

import { WithBackButton } from '../WithBackButton'
Expand Down
5 changes: 4 additions & 1 deletion src/components/MultiHopTrade/hooks/useAccountIds.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { AccountId } from '@shapeshiftoss/caip'
import { useCallback, useMemo } from 'react'
import { selectFirstHopSellAccountId, selectLastHopBuyAccountId } from 'state/slices/selectors'
import {
selectFirstHopSellAccountId,
selectLastHopBuyAccountId,
} from 'state/slices/tradeInputSlice/selectors'
import { tradeInput } from 'state/slices/tradeInputSlice/tradeInputSlice'
import { useAppDispatch, useAppSelector } from 'state/store'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ import {
} from 'state/apis/snapshot/selectors'
import { swapperApi } from 'state/apis/swapper/swapperApi'
import type { ApiQuote, TradeQuoteError } from 'state/apis/swapper/types'
import {
selectPortfolioAccountMetadataByAccountId,
selectUsdRateByAssetId,
} from 'state/slices/selectors'
import {
selectFirstHopSellAccountId,
selectInputBuyAsset,
selectInputSellAmountCryptoPrecision,
selectInputSellAmountUsd,
selectInputSellAsset,
selectLastHopBuyAccountId,
selectPortfolioAccountMetadataByAccountId,
selectUsdRateByAssetId,
selectUserSlippagePercentageDecimal,
} from 'state/slices/selectors'
} from 'state/slices/tradeInputSlice/selectors'
import {
selectActiveQuoteMetaOrDefault,
selectIsAnyTradeQuoteLoading,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tradeExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { getConfig } from 'config'
import EventEmitter from 'events'
import { fetchIsSmartContractAddressQuery } from 'hooks/useIsSmartContractAddress/useIsSmartContractAddress'
import { poll } from 'lib/poll/poll'
import { selectFirstHopSellAccountId } from 'state/slices/selectors'
import { selectFirstHopSellAccountId } from 'state/slices/tradeInputSlice/selectors'
import { store } from 'state/store'

import { assertGetCosmosSdkChainAdapter } from './utils/cosmosSdk'
Expand Down
6 changes: 4 additions & 2 deletions src/state/apis/swapper/helpers/validateTradeQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import {
import {
selectAssets,
selectFeeAssetById,
selectPortfolioAccountIdByNumberByChainId,
} from 'state/slices/selectors'
import {
selectFirstHopSellAccountId,
selectInputSellAmountCryptoPrecision,
selectPortfolioAccountIdByNumberByChainId,
selectSecondHopSellAccountId,
} from 'state/slices/selectors'
} from 'state/slices/tradeInputSlice/selectors'
import { getTotalProtocolFeeByAssetForStep } from 'state/slices/tradeQuoteSlice/helpers'

import type { ErrorWithMeta } from '../types'
Expand Down
1 change: 0 additions & 1 deletion src/state/slices/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export * from './portfolioSlice/selectors'
export * from './preferencesSlice/selectors'
export * from './txHistorySlice/selectors'
export * from './opportunitiesSlice/selectors'
export * from './tradeInputSlice/selectors'

/**
* some selectors span multiple business logic domains, e.g. portfolio and opportunities
Expand Down

0 comments on commit 4c915c8

Please sign in to comment.