Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for assets not refreshing #5295

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Changes from all commits
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
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
Loading