diff --git a/src/pages/wallet/AssetList.module.scss b/src/pages/wallet/AssetList.module.scss index 7ef17312d..ff8868cc6 100644 --- a/src/pages/wallet/AssetList.module.scss +++ b/src/pages/wallet/AssetList.module.scss @@ -4,6 +4,7 @@ background-color: var(--card-bg-muted); padding-inline: 10px; grid-area: list; + display: grid; grid-template-areas: "title" "list"; grid-template-rows: min-content auto; diff --git a/src/pages/wallet/AssetList.tsx b/src/pages/wallet/AssetList.tsx index 57ca825d0..63b53833e 100644 --- a/src/pages/wallet/AssetList.tsx +++ b/src/pages/wallet/AssetList.tsx @@ -10,10 +10,7 @@ import Asset from "./Asset" import styles from "./AssetList.module.scss" import { useTokenFilters } from "utils/localStorage" import { toInput } from "txs/utils" -import { - useCustomTokensCW20, - useCustomTokensNative, -} from "data/settings/CustomTokens" +import { isNativeToken } from "utils/chain" const AssetList = () => { const { t } = useTranslation() @@ -23,16 +20,6 @@ const AssetList = () => { const coins = useBankBalance() const { data: prices } = useExchangeRates() const readNativeDenom = useNativeDenoms() - const native = useCustomTokensNative() - const cw20 = useCustomTokensCW20() - const alwaysVisibleDenoms = useMemo( - () => - new Set([ - ...cw20.list.map((a) => a.token), - ...native.list.map((a) => a.denom), - ]), - [cw20.list, native.list] - ) const list = useMemo( () => @@ -68,7 +55,7 @@ const AssetList = () => { (a) => (hideNoWhitelist ? !a.symbol.endsWith("...") : true) // TODO: update and implement whitelist check ) .filter((a) => { - if (!hideLowBal || a.price === 0 || alwaysVisibleDenoms.has(a.denom)) + if (!(hideLowBal && a.price === 0) || isNativeToken(a.denom)) return true return a.price * toInput(a.balance) >= 1 }) @@ -76,14 +63,7 @@ const AssetList = () => { (a, b) => b.price * parseInt(b.balance) - a.price * parseInt(a.balance) ), - [ - coins, - readNativeDenom, - prices, - hideNoWhitelist, - hideLowBal, - alwaysVisibleDenoms, - ] + [coins, readNativeDenom, prices, hideNoWhitelist, hideLowBal] ) const render = () => { diff --git a/src/utils/chain.ts b/src/utils/chain.ts index 764495fe3..8cab487c1 100644 --- a/src/utils/chain.ts +++ b/src/utils/chain.ts @@ -3,6 +3,7 @@ import { useNativeDenoms } from "data/token" import { useExchangeRates } from "data/queries/coingecko" import { useDisplayChains } from "./localStorage/hooks" import { useNetworkName } from "data/wallet" +import { AccAddress } from "@terra-money/feather.js" type ChainId = string type ChainPrefix = string @@ -55,3 +56,8 @@ export const useSortedDisplayChains = () => { export const useTerraChainName = () => useNetworkName() === "mainnet" ? "phoenix-1" : "pisco-1" + +export const isNativeToken = (denom: string) => + !denom.startsWith("ibc/") && + !denom.startsWith("factory/") && + !AccAddress.validate(denom)