Skip to content

Commit

Permalink
Fix/issues OK-33896 (#6234)
Browse files Browse the repository at this point in the history
* fix: disable fetch nft details in unsupported nft evm networks

* fix: lint
  • Loading branch information
weatherstar authored Nov 19, 2024
1 parent 4847177 commit 38677c1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@onekeyhq/shared/src/background/backgroundDecorators';
import { getNetworkIdsMap } from '@onekeyhq/shared/src/config/networkIds';
import { getPresetNetworks } from '@onekeyhq/shared/src/config/presetNetworks';
import { ETranslations } from '@onekeyhq/shared/src/locale';
import { appLocale } from '@onekeyhq/shared/src/locale/appLocale';
import accountUtils from '@onekeyhq/shared/src/utils/accountUtils';
import { memoizee } from '@onekeyhq/shared/src/utils/cacheUtils';
Expand All @@ -32,7 +33,6 @@ import type {
IAccountDeriveInfoItems,
IAccountDeriveTypes,
} from '../../vaults/types';
import { ETranslations } from '@onekeyhq/shared/src/locale';

const defaultPinnedNetworkIds = [
getNetworkIdsMap().btc,
Expand Down
9 changes: 8 additions & 1 deletion packages/kit-bg/src/vaults/impls/evm/Vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { IEncodedTxEvm } from '@onekeyhq/core/src/chains/evm/types';
import coreChainApi from '@onekeyhq/core/src/instance/coreChainApi';
import type { ISignedTxPro, IUnsignedTxPro } from '@onekeyhq/core/src/types';
import { getNetworkIdsMap } from '@onekeyhq/shared/src/config/networkIds';
import { getEnabledNFTNetworkIds } from '@onekeyhq/shared/src/engine/engineConsts';
import { OneKeyError, OneKeyInternalError } from '@onekeyhq/shared/src/errors';
import chainValueUtils from '@onekeyhq/shared/src/utils/chainValueUtils';
import hexUtils from '@onekeyhq/shared/src/utils/hexUtils';
Expand Down Expand Up @@ -109,6 +110,8 @@ import type { IDBWalletType } from '../../../dbs/local/types';
import type { KeyringBase } from '../../base/KeyringBase';
import type { IJsonRpcRequest } from '@onekeyfe/cross-inpage-provider-types';

const enabledNFTNetworkIds = getEnabledNFTNetworkIds();

// evm vault
export default class Vault extends VaultBase {
override coreApi = coreChainApi.evm.hd;
Expand Down Expand Up @@ -240,7 +243,7 @@ export default class Vault extends VaultBase {
icon: network.logoURI ?? '',
},
};
let isToContract = false;
let isToContract: boolean | undefined;
let extraNativeTransferAction: IDecodedTxAction | undefined;

if (swapInfo) {
Expand Down Expand Up @@ -988,6 +991,10 @@ export default class Vault extends VaultBase {
const { encodedTx, txDesc, transferPayload } = params;
const accountAddress = await this.getAccountAddress();

if (!enabledNFTNetworkIds.includes(this.networkId)) {
return;
}

if (
txDesc.name !== EErc721TxDescriptionName.SafeTransferFrom &&
txDesc.name !== EErc1155TxDescriptionName.SafeTransferFrom
Expand Down
5 changes: 3 additions & 2 deletions packages/kit/src/components/AddressInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useIntl } from 'react-intl';

import { Badge, Dialog, Stack, XStack } from '@onekeyhq/components';
import { ETranslations } from '@onekeyhq/shared/src/locale/enum/translations';
import { ERootRoutes, ETabRoutes } from '@onekeyhq/shared/src/routes';
import { EAccountSelectorSceneName } from '@onekeyhq/shared/types';

import { ETranslations } from '@onekeyhq/shared/src/locale/enum/translations';
import { useIntl } from 'react-intl';
import backgroundApiProxy from '../../background/instance/backgroundApiProxy';
import useAppNavigation from '../../hooks/useAppNavigation';
import { usePromiseResult } from '../../hooks/usePromiseResult';
Expand Down

0 comments on commit 38677c1

Please sign in to comment.