Skip to content

Commit

Permalink
fixes for assets not refreshing (#5295)
Browse files Browse the repository at this point in the history
  • Loading branch information
walmat authored Dec 19, 2023
1 parent dc6a91c commit 5f94c45
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/hooks/useSwappableUserAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,16 @@ export const useSwappableUserAssets = (params: {
}, {} as SwappableAddresses)
);

const filteredAssetsInWallet = useMemo(
() =>
(assetsInWallet || []).filter(asset => {
// filter out hidden tokens
if (hiddenCoinsObj[asset.uniqueId]) return true;
const filteredAssetsInWallet = (assetsInWallet || []).filter(asset => {
// filter out hidden tokens
if (hiddenCoinsObj[asset.uniqueId]) return true;

// filter out networks where swaps are not enabled
const assetNetwork = ethereumUtils.getNetworkFromType(asset.type);
if (getNetworkObj(assetNetwork).features.swaps) return true;
// filter out networks where swaps are not enabled
const assetNetwork = ethereumUtils.getNetworkFromType(asset.type);
if (getNetworkObj(assetNetwork).features.swaps) return true;

return false;
}),
[assetsInWallet, hiddenCoinsObj]
);
return false;
});

const getSwappableAddressesForNetwork = useCallback(
async (addresses: EthereumAddress[], network: keyof SwappableAddresses) => {
Expand Down Expand Up @@ -111,8 +107,7 @@ export const useSwappableUserAssets = (params: {
asset?.address === ETH_ADDRESS
? ETH_ADDRESS_AGGREGATORS
: asset?.address;
// we place our testnets (goerli) in the Network type which creates this type issue
// @ts-ignore

const isSwappable = swappableAssetsRef.current[assetNetwork]?.includes(
assetAddress
);
Expand Down

0 comments on commit 5f94c45

Please sign in to comment.