From a5681bc65e2501897798ba6a5d5c6471205b5af0 Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Mon, 29 Apr 2024 19:04:37 +0200 Subject: [PATCH] fix: remove duplicated ownership check (#2393) * filter for network on ownership check * disable feature flag --- packages/desktop/features/network.features.ts | 2 +- .../src/lib/core/layer-2/actions/fetchL2BalanceForAccount.ts | 2 +- .../src/lib/core/nfts/actions/updateErc721NftOwnership.ts | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/desktop/features/network.features.ts b/packages/desktop/features/network.features.ts index 7cf79283c1..2d49c92cb9 100644 --- a/packages/desktop/features/network.features.ts +++ b/packages/desktop/features/network.features.ts @@ -12,7 +12,7 @@ const networkFeatures: INetworkFeatures = { }, }, evmNetworks: { - enabled: true, + enabled: false, }, } diff --git a/packages/shared/src/lib/core/layer-2/actions/fetchL2BalanceForAccount.ts b/packages/shared/src/lib/core/layer-2/actions/fetchL2BalanceForAccount.ts index a0102ef16b..758584959b 100644 --- a/packages/shared/src/lib/core/layer-2/actions/fetchL2BalanceForAccount.ts +++ b/packages/shared/src/lib/core/layer-2/actions/fetchL2BalanceForAccount.ts @@ -23,7 +23,7 @@ export function fetchL2BalanceForAccount(profileId: string, account: IAccountSta } if (features.collectibles.erc721.enabled) { - void updateErc721NftsOwnership(account) + void updateErc721NftsOwnership(account, evmNetwork.id) } const l2TokenBalance = isIscChain(evmNetwork) diff --git a/packages/shared/src/lib/core/nfts/actions/updateErc721NftOwnership.ts b/packages/shared/src/lib/core/nfts/actions/updateErc721NftOwnership.ts index cee6632566..b3c65cd83c 100644 --- a/packages/shared/src/lib/core/nfts/actions/updateErc721NftOwnership.ts +++ b/packages/shared/src/lib/core/nfts/actions/updateErc721NftOwnership.ts @@ -5,12 +5,13 @@ import { IErc721Nft } from '../interfaces' import { getAllAccountNfts, persistedNftForActiveProfile, updatePersistedNft } from '../stores' import { getOwnerOfErc721Nft } from '../utils' import { get } from 'svelte/store' +import { NetworkId } from '@core/network' -export async function updateErc721NftsOwnership(account: IAccountState): Promise { +export async function updateErc721NftsOwnership(account: IAccountState, networkId: NetworkId): Promise { try { const trackedErc721Nfts = (getAllAccountNfts()[account.index]?.filter((nft) => { - return nft.standard === NftStandard.Erc721 + return nft.standard === NftStandard.Erc721 && nft.networkId === networkId }) as IErc721Nft[]) ?? [] const promises = trackedErc721Nfts.map(async (nft) => { const updatedOwner = await getOwnerOfErc721Nft(nft)