Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add config for vite worker
  • Loading branch information
premiumjibles committed Aug 21, 2025
commit 96d0e5a67801e0a7748411188e03fb719ddca551
2 changes: 1 addition & 1 deletion src/components/StakingVaults/PositionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { RawText } from '@/components/Text'
import { useIsSnapInstalled } from '@/hooks/useIsSnapInstalled/useIsSnapInstalled'
import { useWallet } from '@/hooks/useWallet/useWallet'
import { walletSupportsChain } from '@/hooks/useWalletSupportsChain/useWalletSupportsChain'
import { isEthAddress } from '@/lib/address/utils'
import { bnOrZero } from '@/lib/bignumber/bignumber'
import { isEthAddress } from '@/lib/utils/ethAddress'
import type { AggregatedOpportunitiesByAssetIdReturn } from '@/state/slices/opportunitiesSlice/types'
import {
selectAccountIdsByChainId,
Expand Down
7 changes: 1 addition & 6 deletions src/components/TradeAssetSearch/TradeAssetSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { bnOrZero } from '@/lib/bignumber/bignumber'
import { sortChainIdsByDisplayName } from '@/lib/utils'
import {
selectAssetsSortedByMarketCap,
selectAssetsSortedByMarketCapUserCurrencyBalanceCryptoPrecisionAndName,
selectPortfolioFungibleAssetsSortedByBalance,
selectPortfolioTotalUserCurrencyBalance,
selectWalletConnectedChainIds,
Expand Down Expand Up @@ -74,9 +73,6 @@ export const TradeAssetSearch: FC<TradeAssetSearchProps> = ({
const [shouldShowWarningAcknowledgement, setShouldShowWarningAcknowledgement] = useState(false)

const portfolioTotalUserCurrencyBalance = useAppSelector(selectPortfolioTotalUserCurrencyBalance)
const assets = useAppSelector(
selectAssetsSortedByMarketCapUserCurrencyBalanceCryptoPrecisionAndName,
)

const portfolioAssetsSortedByBalance = useAppSelector(
// When no wallet is connected, there is no portfolio, hence we display all Assets
Expand Down Expand Up @@ -105,13 +101,12 @@ export const TradeAssetSearch: FC<TradeAssetSearchProps> = ({

const assetWorkerParams = useMemo(
() => ({
assets,
activeChainId,
allowWalletUnsupportedAssets,
walletConnectedChainIds,
hasWallet,
}),
[activeChainId, allowWalletUnsupportedAssets, assets, hasWallet, walletConnectedChainIds],
[activeChainId, allowWalletUnsupportedAssets, hasWallet, walletConnectedChainIds],
)

// Asset search worker hook
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AssetSearchWorker from '../workers/assetSearch.worker?worker'

import { useDebounce } from '@/hooks/useDebounce/useDebounce'
import type { AssetSearchWorkerOutboundMessage } from '@/lib/assetSearch'
import { selectAssetsSortedByMarketCapUserCurrencyBalanceCryptoPrecisionAndName } from '@/state/slices/common-selectors'
import { selectAssetsSortedByMarketCapUserCurrencyBalanceCryptoPrecisionAndName } from '@/state/slices/selectors'
import { useAppSelector } from '@/state/store'

type WorkerState = 'initializing' | 'ready' | 'failed'
Expand Down
2 changes: 0 additions & 2 deletions src/lib/address/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { isEvmChainId } from '@shapeshiftoss/chain-adapters'
import { viemClientByChainId } from '@shapeshiftoss/contracts'
import { getAddress, isAddress } from 'viem'

export const isEthAddress = (address: string): boolean => /^0x[0-9A-Fa-f]{40}$/.test(address)

export const isSmartContractAddress = async (
address: string,
chainId: ChainId,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/assetSearch/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { matchSorter } from 'match-sorter'
import { ASSET_SEARCH_MATCH_SORTER_CONFIG } from './config'
import type { SearchableAsset } from './types'

import { isEthAddress } from '@/lib/address/utils'
import { isEthAddress } from '@/lib/utils/ethAddress'

export const isSearchableAsset = (assetId: AssetId): boolean => !isNft(assetId)

Expand Down
1 change: 1 addition & 0 deletions src/lib/utils/ethAddress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isEthAddress = (address: string): boolean => /^0x[0-9A-Fa-f]{40}$/.test(address)
3 changes: 3 additions & 0 deletions vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ export default defineConfig(({ mode }) => {
port: 3000,
headers,
},
worker: {
format: 'es',
},
resolve: {
alias: {
'@': resolve(__dirname, './src'),
Expand Down