Skip to content

Commit

Permalink
swaps bug fix: missing asset balance for some tokens (#5998)
Browse files Browse the repository at this point in the history
* remove filter

* forgot this
  • Loading branch information
benisgold authored Aug 13, 2024
1 parent 796ec0b commit d0c2f16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/__swaps__/screens/Swap/resources/assets/userAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SupportedCurrencyKey, SUPPORTED_CHAIN_IDS } from '@/references';
import { ParsedAssetsDictByChain, ZerionAsset } from '@/__swaps__/types/assets';
import { ChainId } from '@/__swaps__/types/chains';
import { AddressAssetsReceivedMessage } from '@/__swaps__/types/refraction';
import { filterAsset, parseUserAsset } from '@/__swaps__/utils/assets';
import { parseUserAsset } from '@/__swaps__/utils/assets';
import { greaterThan } from '@/__swaps__/utils/numbers';

import { fetchUserAssetsByChain } from './userAssetsByChain';
Expand Down Expand Up @@ -190,7 +190,7 @@ export async function parseUserAssets({
}) {
const parsedAssetsDict = chainIds.reduce((dict, currentChainId) => ({ ...dict, [currentChainId]: {} }), {}) as ParsedAssetsDictByChain;
for (const { asset, quantity, small_balance } of assets) {
if (!filterAsset(asset) && greaterThan(quantity, 0)) {
if (greaterThan(quantity, 0)) {
const parsedAsset = parseUserAsset({
asset,
currency,
Expand Down
9 changes: 0 additions & 9 deletions src/__swaps__/utils/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,6 @@ export const parseSearchAsset = ({
type: userAsset?.type || assetWithPrice?.type || searchAsset?.type,
});

export function filterAsset(asset: ZerionAsset) {
const nameFragments = asset?.name?.split(' ');
const nameContainsURL = nameFragments.some(f => isValidDomain(f));
const symbolFragments = asset?.symbol?.split(' ');
const symbolContainsURL = symbolFragments.some(f => isValidDomain(f));
const shouldFilter = nameContainsURL || symbolContainsURL;
return shouldFilter;
}

const assetQueryFragment = (
address: AddressOrEth,
chainId: ChainId,
Expand Down

0 comments on commit d0c2f16

Please sign in to comment.