diff --git a/scripts/generateAssetData/bnbsmartchain/index.ts b/scripts/generateAssetData/bnbsmartchain/index.ts index ef04ad8d5e5..2b2ff8d3429 100644 --- a/scripts/generateAssetData/bnbsmartchain/index.ts +++ b/scripts/generateAssetData/bnbsmartchain/index.ts @@ -4,13 +4,12 @@ import uniqBy from 'lodash/uniqBy' import { bnbsmartchain } from '../baseAssets' import * as coingecko from '../coingecko' -// import { getPortalTokens } from '../utils/portals' +import { getPortalTokens } from '../utils/portals' export const getAssets = async (): Promise => { const results = await Promise.allSettled([ coingecko.getAssets(bscChainId), - // TODO(gomes): revert me back, there are 10k+ assets for BSC = problems - [], // getPortalTokens(bnbsmartchain), + getPortalTokens(bnbsmartchain), ]) const [assets, portalsAssets] = results.map(result => { diff --git a/scripts/generateAssetData/ethereum/index.ts b/scripts/generateAssetData/ethereum/index.ts index ecbff28d78e..91db3104134 100644 --- a/scripts/generateAssetData/ethereum/index.ts +++ b/scripts/generateAssetData/ethereum/index.ts @@ -8,7 +8,7 @@ import uniqBy from 'lodash/uniqBy' import { ethereum } from '../baseAssets' import * as coingecko from '../coingecko' import { generateTrustWalletUrl } from '../generateTrustWalletUrl/generateTrustWalletUrl' -// import { getPortalTokens } from '../utils/portals' +import { getPortalTokens } from '../utils/portals' import { getIdleTokens } from './idleVaults' import { getUniswapV2Pools } from './uniswapV2Pools' // Yearn SDK is currently rugged upstream @@ -40,8 +40,7 @@ export const getAssets = async (): Promise => { // getUnderlyingVaultTokens(), getUniswapV2Pools(), getIdleTokens(), - // TODO(gomes): revert me back, there are 10k+ assets for Ethereum = problems - [], // getPortalTokens(ethereum), + getPortalTokens(ethereum), ]) const [ethTokens, uniV2PoolTokens, idleTokens, portalsAssets] = results.map(result => { diff --git a/scripts/generateAssetData/utils/portals.ts b/scripts/generateAssetData/utils/portals.ts index 926be056b02..a638b950b42 100644 --- a/scripts/generateAssetData/utils/portals.ts +++ b/scripts/generateAssetData/utils/portals.ts @@ -72,6 +72,10 @@ export const fetchPortalsTokens = async ( const params = { limit: '250', + // Minimum 1000 bucks liquidity if asset is a LP token + minLiquidity: '1000', + // Minimum 1% APY if asset is a LP token + minApy: '1', networks: [network], page: page.toString(), } @@ -132,7 +136,7 @@ export const getPortalTokens = async (nativeAsset: Asset): Promise => { ...explorerData, color: colorMap[assetId] ?? '#FFFFFF', icon: token.images?.[0], - icons: token.images, + ...(token.images?.length && { icons: token.images }), name: token.name, precision: Number(token.decimals), symbol: token.symbol, diff --git a/src/assets/translations/en/main.json b/src/assets/translations/en/main.json index d9a5b2a3a10..21a297e1413 100644 --- a/src/assets/translations/en/main.json +++ b/src/assets/translations/en/main.json @@ -945,7 +945,7 @@ }, "approvalTitle": "Token allowance approval", "resetTitle": "Token allowance reset", - "assetSummaryDescription": "%{amountFiatFormatted} on %{chainName}", + "fiatAmountOnChain": "%{amountFiatFormatted} on %{chainName}", "quote": { "cantSetSlippage": "We are unable to set a custom slippage (%{userSlippageFormatted}) for %{swapperName}", "slippage": "Slippage: %{slippageFormatted}" @@ -1776,6 +1776,7 @@ "SegwitNativeTooltip": "Recommended for most users. Only use the other addresses if you know what they are for", "btcFormat": "BTC format", "assetUnavailable": "Market data for this asset isn't available yet. We're working on it, hang tight!", + "customAsset": "This is a custom imported asset. Market data may not be accurate.", "loading": "Fetching price history, hang tight...", "maxTotalSupply": "Max Total Supply", "availableSupply": "Available Supply", diff --git a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/AssetSummaryStep.tsx b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/AssetSummaryStep.tsx index 2172f7db06b..c77721be519 100644 --- a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/AssetSummaryStep.tsx +++ b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/AssetSummaryStep.tsx @@ -6,7 +6,10 @@ import { getChainAdapterManager } from 'context/PluginProvider/chainAdapterSingl import { useLocaleFormatter } from 'hooks/useLocaleFormatter/useLocaleFormatter' import { bn } from 'lib/bignumber/bignumber' import { fromBaseUnit } from 'lib/math' -import { selectMarketDataUserCurrency } from 'state/slices/selectors' +import { + selectIsAssetWithoutMarketData, + selectMarketDataUserCurrency, +} from 'state/slices/selectors' import { useAppSelector } from 'state/store' import { StepperStep } from './StepperStep' @@ -27,6 +30,9 @@ export const AssetSummaryStep = ({ number: { toCrypto, toFiat }, } = useLocaleFormatter() const marketDataUserCurrency = useAppSelector(selectMarketDataUserCurrency) + const isAssetWithoutMarketData = useAppSelector(state => + selectIsAssetWithoutMarketData(state, asset.assetId), + ) const sellAmountCryptoPrecision = useMemo( () => fromBaseUnit(amountCryptoBaseUnit, asset.precision), @@ -41,7 +47,7 @@ export const AssetSummaryStep = ({ const amountFiatFormatted = useMemo(() => { const sellAssetRateUserCurrency = marketDataUserCurrency[asset.assetId]?.price ?? '0' return toFiat(bn(sellAmountCryptoPrecision).times(sellAssetRateUserCurrency).toString()) - }, [marketDataUserCurrency, sellAmountCryptoPrecision, toFiat, asset.assetId]) + }, [marketDataUserCurrency, asset.assetId, toFiat, sellAmountCryptoPrecision]) const chainName = useMemo(() => { const chainAdapterManager = getChainAdapterManager() @@ -55,7 +61,11 @@ export const AssetSummaryStep = ({ return ( diff --git a/src/components/MultiHopTrade/components/TradeAmountInput.tsx b/src/components/MultiHopTrade/components/TradeAmountInput.tsx index 686a9cf9731..ea3d1d54b3a 100644 --- a/src/components/MultiHopTrade/components/TradeAmountInput.tsx +++ b/src/components/MultiHopTrade/components/TradeAmountInput.tsx @@ -28,7 +28,11 @@ import { PercentOptionsButtonGroup } from 'components/DeFi/components/PercentOpt import { useLocaleFormatter } from 'hooks/useLocaleFormatter/useLocaleFormatter' import { bnOrZero } from 'lib/bignumber/bignumber' import { allowedDecimalSeparators } from 'state/slices/preferencesSlice/preferencesSlice' -import { selectAssetById, selectMarketDataByAssetIdUserCurrency } from 'state/slices/selectors' +import { + selectAssetById, + selectIsAssetWithoutMarketData, + selectMarketDataByAssetIdUserCurrency, +} from 'state/slices/selectors' import { useAppSelector } from 'state/store' import { colors } from 'theme/colors' @@ -170,6 +174,9 @@ export const TradeAmountInput: React.FC = memo( const assetMarketDataUserCurrency = useAppSelector(state => selectMarketDataByAssetIdUserCurrency(state, assetId), ) + const isAssetWithoutMarketData = useAppSelector(state => + selectIsAssetWithoutMarketData(state, assetId), + ) // Local controller in case consumers don't have a form context, which is the case for all current consumers currently except RFOX const _methods = useForm({ @@ -348,7 +355,7 @@ export const TradeAmountInput: React.FC = memo( /> {RightComponent && } - {layout === 'inline' && showFiatAmount && !hideAmounts && ( + {layout === 'inline' && showFiatAmount && !isAssetWithoutMarketData && !hideAmounts && (