diff --git a/packages/engine/src/vaults/impl/tron/Vault.ts b/packages/engine/src/vaults/impl/tron/Vault.ts index 19eb1ed8907..68c32734b89 100644 --- a/packages/engine/src/vaults/impl/tron/Vault.ts +++ b/packages/engine/src/vaults/impl/tron/Vault.ts @@ -1370,7 +1370,7 @@ export default class Vault extends VaultBase { } }); - const finanlTransferHistory = ( + const finalTransferHistory = ( await Promise.all(transferHistoryPromises) ).filter(Boolean); const finalTxHistory = (await Promise.all(txHistoryPromises)).filter( @@ -1380,11 +1380,7 @@ export default class Vault extends VaultBase { await Promise.all(internalTxHistoryPromises) ).filter(Boolean); - return [ - ...finanlTransferHistory, - ...finalTxHistory, - ...finalInterTxHistory, - ]; + return [...finalTransferHistory, ...finalTxHistory, ...finalInterTxHistory]; } override async proxyJsonRPCCall(request: IJsonRpcRequest): Promise { diff --git a/packages/engine/src/vaults/types.ts b/packages/engine/src/vaults/types.ts index 9ab33ac8238..6e0cc721fa0 100644 --- a/packages/engine/src/vaults/types.ts +++ b/packages/engine/src/vaults/types.ts @@ -595,6 +595,7 @@ export type IDecodedTxActionInscription = IDecodedTxActionBase & { send: string; receive: string; isInscribeTransfer?: boolean; + assetsInSameUtxo?: NFTBTCAssetModel[]; }; export type IDecodedTxActionBRC20 = IDecodedTxActionBase & { @@ -602,6 +603,7 @@ export type IDecodedTxActionBRC20 = IDecodedTxActionBase & { sender: string; receiver: string; asset: NFTBTCAssetModel; + assetsInSameUtxo?: NFTBTCAssetModel[]; amount?: string; max?: string; limit?: string; diff --git a/packages/engine/src/vaults/utils/btcForkChain/VaultBtcFork.ts b/packages/engine/src/vaults/utils/btcForkChain/VaultBtcFork.ts index 85a5e2a25ed..7aed78ee59c 100644 --- a/packages/engine/src/vaults/utils/btcForkChain/VaultBtcFork.ts +++ b/packages/engine/src/vaults/utils/btcForkChain/VaultBtcFork.ts @@ -57,6 +57,7 @@ import { import { getAccountNameInfoByTemplate } from '../../../managers/impl'; import { batchAsset, + getAllAssetsFromLocal, getBRC20TransactionHistory, getNFTTransactionHistory, } from '../../../managers/nft'; @@ -735,7 +736,7 @@ export default class VaultBtcFork extends VaultBase { return action; } - buildNFTAction({ + async buildNFTAction({ nftInfo, dbAccount, }: { @@ -743,6 +744,7 @@ export default class VaultBtcFork extends VaultBase { dbAccount: DBUTXOAccount; }) { const { from, to } = nftInfo; + const asset = nftInfo.asset as NFTBTCAssetModel; let direction = IDecodedTxDirection.OTHER; @@ -754,6 +756,18 @@ export default class VaultBtcFork extends VaultBase { direction = IDecodedTxDirection.IN; } + const localNFTs = (await getAllAssetsFromLocal({ + networkId: this.networkId, + accountId: this.accountId, + })) as NFTBTCAssetModel[]; + const inscriptionsInSameUtxo = localNFTs.filter( + (nft) => + nft.inscription_id !== asset.inscription_id && + nft.owner === asset.owner && + nft.output === asset.output && + nft.output_value_sat === asset.output_value_sat, + ); + const action: IDecodedTxAction = { type: IDecodedTxActionType.NFT_TRANSFER_BTC, direction, @@ -761,6 +775,7 @@ export default class VaultBtcFork extends VaultBase { send: nftInfo.from, receive: nftInfo?.to, asset: nftInfo?.asset as NFTBTCAssetModel, + assetsInSameUtxo: inscriptionsInSameUtxo, extraInfo: null, }, }; diff --git a/packages/kit/src/components/Format/index.tsx b/packages/kit/src/components/Format/index.tsx index e2507d62395..06190656d83 100644 --- a/packages/kit/src/components/Format/index.tsx +++ b/packages/kit/src/components/Format/index.tsx @@ -347,7 +347,7 @@ export function FormatBalanceTokenOfAccount({ accountId, token, fallback: '0', - useRecycleBalance: useRecycleBalance ?? token?.isNative, + useRecycleBalance: useRecycleBalance ?? token?.isNative ?? true, useCustomAddressesBalance, }); diff --git a/packages/kit/src/hooks/useOverview.ts b/packages/kit/src/hooks/useOverview.ts index a17a3efa93e..b31e716fb49 100644 --- a/packages/kit/src/hooks/useOverview.ts +++ b/packages/kit/src/hooks/useOverview.ts @@ -252,12 +252,14 @@ export const useTokenBalance = ({ accountId, token, fallback = '0', + useRecycleBalance, useCustomAddressesBalance, }: { networkId: string; accountId: string; token?: Partial | null; fallback?: string; + useRecycleBalance?: boolean; useCustomAddressesBalance?: boolean; }) => { const balances = useAppSelector((s) => s.tokens.accountTokensBalance); @@ -274,11 +276,18 @@ export const useTokenBalance = ({ networkId, accountId, useCustomAddressesBalance, + useRecycleBalance, }) .then((value) => { setManuallyAddedAddressBalance(value?.available ?? fallback); }); - }, [networkId, accountId, useCustomAddressesBalance, fallback]); + }, [ + networkId, + accountId, + useCustomAddressesBalance, + fallback, + useRecycleBalance, + ]); if (isAllNetworks(networkId)) { throw new Error(`useTokenBalance: networkId is not valid: ${networkId}`); @@ -323,8 +332,10 @@ export const useTokenBalanceWithoutFrozen = ({ accountId, token, fallback, + useRecycleBalance, useCustomAddressesBalance, }); + const frozenBalance = useFrozenBalance({ networkId, accountId, diff --git a/packages/kit/src/hooks/useTokens.ts b/packages/kit/src/hooks/useTokens.ts index a13f83e704a..d609a1cae11 100644 --- a/packages/kit/src/hooks/useTokens.ts +++ b/packages/kit/src/hooks/useTokens.ts @@ -1,16 +1,19 @@ -import { useEffect, useMemo, useState } from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; import { pick } from 'lodash'; import type { Token } from '@onekeyhq/engine/src/types/token'; import { useActiveWalletAccount } from '@onekeyhq/kit/src/hooks'; +import { AppUIEventBusNames } from '@onekeyhq/shared/src/eventBus/appUIEventBus'; import debugLogger from '@onekeyhq/shared/src/logger/debugLogger'; import backgroundApiProxy from '../background/instance/backgroundApiProxy'; import { appSelector } from '../store'; import { createDeepEqualSelector } from '../utils/reselectUtils'; +import { useShouldHideInscriptions } from './crossHooks/useShouldHideInscriptions'; import { useAppSelector } from './useAppSelector'; +import { useOnUIEventBus } from './useOnUIEventBus'; import type { IAppState } from '../store'; @@ -127,31 +130,43 @@ export const useFrozenBalance = ({ number | Record >(0); - useEffect(() => { - (async () => { - let password; + const shouldHideInscriptions = useShouldHideInscriptions({ + accountId, + networkId, + }); - const vaultSettings = await backgroundApiProxy.engine.getVaultSettings( + const fetchFrozenBalance = useCallback(async () => { + let password; + + const vaultSettings = await backgroundApiProxy.engine.getVaultSettings( + networkId, + ); + if (vaultSettings.validationRequired) { + password = await backgroundApiProxy.servicePassword.getPassword(); + } + + backgroundApiProxy.engine + .getFrozenBalance({ + accountId, networkId, - ); - if (vaultSettings.validationRequired) { - password = await backgroundApiProxy.servicePassword.getPassword(); - } + password, + useRecycleBalance, + useCustomAddressesBalance, + }) + .then(setFrozenBalance) + .catch((e) => { + debugLogger.common.error('getFrozenBalance error', e); + }); + }, [accountId, networkId, useCustomAddressesBalance, useRecycleBalance]); - backgroundApiProxy.engine - .getFrozenBalance({ - accountId, - networkId, - password, - useRecycleBalance, - useCustomAddressesBalance, - }) - .then(setFrozenBalance) - .catch((e) => { - debugLogger.common.error('getFrozenBalance error', e); - }); - })(); - }, [networkId, accountId, useRecycleBalance, useCustomAddressesBalance]); + useOnUIEventBus( + AppUIEventBusNames.InscriptionRecycleChanged, + fetchFrozenBalance, + ); + + useEffect(() => { + fetchFrozenBalance(); + }, [fetchFrozenBalance, shouldHideInscriptions]); return useMemo( () => diff --git a/packages/kit/src/views/BulkSender/OneToMany/index.tsx b/packages/kit/src/views/BulkSender/OneToMany/index.tsx index 8e22d6bcdea..1c3dfa68ed8 100644 --- a/packages/kit/src/views/BulkSender/OneToMany/index.tsx +++ b/packages/kit/src/views/BulkSender/OneToMany/index.tsx @@ -72,7 +72,7 @@ function OneToMany(props: Props) { const [isBuildingTx, setIsBuildingTx] = useState(false); const [isUnlimited, setIsUnlimited] = useState(false); const [isAlreadyUnlimited, setIsAlreadyUnlimited] = useState(false); - const [isfetchingAllowance, setIsFetchingAllowance] = useState(false); + const [isFetchingAllowance, setIsFetchingAllowance] = useState(false); const [amountType, setAmountType] = useState( amountDefaultTypeMap[bulkType] ?? AmountTypeEnum.Fixed, @@ -98,7 +98,7 @@ function OneToMany(props: Props) { const currentToken = selectedToken || initialToken; const isNative = currentToken?.isNative; - const tokenBalnace = useTokenBalanceWithoutFrozen({ + const tokenBalance = useTokenBalanceWithoutFrozen({ accountId, networkId, token: currentToken, @@ -176,7 +176,7 @@ function OneToMany(props: Props) { new BigNumber(0), ); - if (totalAmount.gt(tokenBalnace)) { + if (totalAmount.gt(tokenBalance)) { ToastManager.show( { title: intl.formatMessage( @@ -191,7 +191,7 @@ function OneToMany(props: Props) { return true; }, - [tokenBalnace, intl], + [tokenBalance, intl], ); const handlePreviewTransfer = useCallback(async () => { @@ -414,7 +414,7 @@ function OneToMany(props: Props) { title={currentToken?.symbol ?? ''} desc={intl.formatMessage( { id: 'content__balance_str' }, - { 0: tokenBalnace }, + { 0: tokenBalance }, )} icon={} onPress={handleOpenTokenSelector} @@ -431,7 +431,7 @@ function OneToMany(props: Props) { /> {!isNative && network?.settings.batchTransferApprovalRequired && ( = ({ networkId, token, fallback: '0', - useRecycleBalance: token?.isNative, + useRecycleBalance: token?.isNative ?? true, }); const intl = useIntl(); const closeModal = useModalClose(); diff --git a/packages/kit/src/views/BulkSender/index.tsx b/packages/kit/src/views/BulkSender/index.tsx index 47aea6f1efb..eaf5a7b171e 100644 --- a/packages/kit/src/views/BulkSender/index.tsx +++ b/packages/kit/src/views/BulkSender/index.tsx @@ -1,4 +1,10 @@ -import { useCallback, useLayoutEffect, useMemo } from 'react'; +import { + useCallback, + useEffect, + useLayoutEffect, + useMemo, + useState, +} from 'react'; import { useNavigation } from '@react-navigation/core'; import { useRoute } from '@react-navigation/native'; @@ -10,6 +16,7 @@ import { HStack, IconButton, ScrollView, + Spinner, Text, useIsVerticalLayout, } from '@onekeyhq/components'; @@ -56,6 +63,7 @@ function BulkSender() { const navigation = useNavigation(); const isVertical = useIsVerticalLayout(); const route = useRoute(); + const [initialized, setInitialized] = useState(false); const routeParams = route.params; const mode = routeParams?.mode; @@ -181,12 +189,27 @@ function BulkSender() { }); }, [headerLeft, headerRight, intl, isVertical, navigation, title]); + useEffect(() => { + if (accountId && networkId) { + setTimeout(() => setInitialized(true), 800); + } else { + setInitialized(false); + } + }, [accountId, networkId]); + if (!isSupported) return ; - if (selectedMode) { + if (!accountId || !networkId) return (
- + +
+ ); + + if (initialized) { + if (selectedMode) + return ( +
- -
- ); + + ); + + return ; } - return ; + return ( +
+ +
+ ); // const tabsHeader = useMemo(() => , []); // return ( // = ({ networkId, token, fallback: '0', + useRecycleBalance: token.isNative ?? true, }); const tokenId = token?.tokenIdOnNetwork || 'main'; const decimal = diff --git a/packages/kit/src/views/Send/components/BaseSendModal.tsx b/packages/kit/src/views/Send/components/BaseSendModal.tsx index df7ff8d6374..73264549415 100644 --- a/packages/kit/src/views/Send/components/BaseSendModal.tsx +++ b/packages/kit/src/views/Send/components/BaseSendModal.tsx @@ -1,6 +1,6 @@ import type { ComponentProps } from 'react'; -import { Box, Image, Modal, Text, Token } from '@onekeyhq/components'; +import { Box, Modal, Text, Token } from '@onekeyhq/components'; import { LazyLoadingDisplayView } from '../../../components/LazyDisplayView'; import { useNetwork } from '../../../hooks'; diff --git a/packages/kit/src/views/Send/components/BatchSendTokenInfo.tsx b/packages/kit/src/views/Send/components/BatchSendTokenInfo.tsx index 53656e70c91..262e155c01c 100644 --- a/packages/kit/src/views/Send/components/BatchSendTokenInfo.tsx +++ b/packages/kit/src/views/Send/components/BatchSendTokenInfo.tsx @@ -88,12 +88,14 @@ function BatchSendTokenInfo(props: Props) { sendAddress: transferInfo.tokenSendAddress, }, fallback: '0', + useRecycleBalance: token?.isNative ?? true, }); const nativeTokenBalance = useTokenBalance({ accountId, networkId, token: nativeToken, fallback: '0', + useRecycleBalance: true, }); if (!transferInfo || transferInfo.isNFT) return null; diff --git a/packages/kit/src/views/Send/components/SendConfirmErrorsAlert.tsx b/packages/kit/src/views/Send/components/SendConfirmErrorsAlert.tsx index 8879a697c22..b68dec80502 100644 --- a/packages/kit/src/views/Send/components/SendConfirmErrorsAlert.tsx +++ b/packages/kit/src/views/Send/components/SendConfirmErrorsAlert.tsx @@ -1,4 +1,3 @@ -import { useNavigation } from '@react-navigation/native'; import { find } from 'lodash'; import { useIntl } from 'react-intl'; @@ -10,7 +9,7 @@ import type { IInvoiceConfig } from '@onekeyhq/engine/src/vaults/impl/lightning- import backgroundApiProxy from '../../../background/instance/backgroundApiProxy'; import { useNetwork } from '../../../hooks'; import { useTools } from '../../../hooks/redux'; -import { MainRoutes, RootRoutes, TabRoutes } from '../../../routes/routesEnum'; +import { navigationShortcuts } from '../../../routes/navigationShortcuts'; import { setHomeTabName } from '../../../store/reducers/status'; import { openUrl } from '../../../utils/openUrl'; import { WalletHomeTabEnum } from '../../Wallet/type'; @@ -57,7 +56,6 @@ export function SendConfirmErrorsAlert({ }) { const errors = []; const intl = useIntl(); - const navigation = useNavigation(); const tools = useTools(networkId); @@ -205,12 +203,7 @@ export function SendConfirmErrorsAlert({ backgroundApiProxy.dispatch( setHomeTabName(WalletHomeTabEnum.History), ); - navigation?.navigate(RootRoutes.Main, { - screen: MainRoutes.Tab, - params: { - screen: TabRoutes.Home, - }, - }); + navigationShortcuts.navigateToHome(); }} />, ); diff --git a/packages/kit/src/views/Send/modals/PreSendAmount.tsx b/packages/kit/src/views/Send/modals/PreSendAmount.tsx index db702dd07b0..7ca06a7707f 100644 --- a/packages/kit/src/views/Send/modals/PreSendAmount.tsx +++ b/packages/kit/src/views/Send/modals/PreSendAmount.tsx @@ -197,7 +197,7 @@ function PreSendAmount() { ...tokenInfo, sendAddress: transferInfo.tokenSendAddress, }, - useRecycleBalance: tokenInfo?.isNative, + useRecycleBalance: tokenInfo?.isNative ?? true, fallback: '0', useCustomAddressesBalance, }); @@ -206,7 +206,7 @@ function PreSendAmount() { networkId, accountId, tokenId: tokenInfo?.tokenIdOnNetwork || 'main', - useRecycleBalance: tokenInfo?.isNative, + useRecycleBalance: tokenInfo?.isNative ?? true, useCustomAddressesBalance, }); @@ -217,6 +217,7 @@ function PreSendAmount() { ...tokenInfo, sendAddress: transferInfo.tokenSendAddress, }, + useRecycleBalance: tokenInfo?.isNative ?? true, fallback: '0', }); @@ -364,7 +365,7 @@ function PreSendAmount() { const balanceDetailsInfo = useAccountBalanceDetailsInfo({ networkId, accountId, - useRecycleBalance: tokenInfo?.isNative, + useRecycleBalance: tokenInfo?.isNative ?? true, useCustomAddressesBalance, }); @@ -517,6 +518,7 @@ function PreSendAmount() { ...(tokenInfo || {}), sendAddress: transferInfo.tokenSendAddress, }} + useRecycleBalance={tokenInfo?.isNative ?? true} useCustomAddressesBalance={useCustomAddressesBalance} render={(ele) => ( { diff --git a/packages/kit/src/views/Swap/components/TokenSelector/index.tsx b/packages/kit/src/views/Swap/components/TokenSelector/index.tsx index e63309b4d64..c119e58eb7f 100644 --- a/packages/kit/src/views/Swap/components/TokenSelector/index.tsx +++ b/packages/kit/src/views/Swap/components/TokenSelector/index.tsx @@ -160,6 +160,7 @@ const ExtraInfo: FC = ({ token, isSearchMode }) => { networkId: token?.networkId ?? '', accountId: accountId ?? '', token, + useRecycleBalance: token?.isNative ?? true, }); const price = useTokenPrice(token); diff --git a/packages/kit/src/views/Swap/components/TokenSelectorUtilComponent/index.tsx b/packages/kit/src/views/Swap/components/TokenSelectorUtilComponent/index.tsx index 6530bf8767b..8bc72d69a09 100644 --- a/packages/kit/src/views/Swap/components/TokenSelectorUtilComponent/index.tsx +++ b/packages/kit/src/views/Swap/components/TokenSelectorUtilComponent/index.tsx @@ -109,6 +109,7 @@ const TokenBalanceAndValue: FC = ({ networkId: token?.networkId ?? '', accountId: accountId ?? '', token, + useRecycleBalance: token?.isNative ?? true, }); const price = useTokenPrice(token); diff --git a/packages/kit/src/views/Swap/hooks/useSwapTokenUtils.ts b/packages/kit/src/views/Swap/hooks/useSwapTokenUtils.ts index b349ea52b89..902319cb744 100644 --- a/packages/kit/src/views/Swap/hooks/useSwapTokenUtils.ts +++ b/packages/kit/src/views/Swap/hooks/useSwapTokenUtils.ts @@ -128,6 +128,7 @@ export const useTokenBalance = (token?: Token, accountId?: string) => { networkId: token?.networkId ?? '', accountId: accountId ?? '', token, + useRecycleBalance: token?.isNative ?? true, }); useEffect(() => { if (token && accountId) { diff --git a/packages/kit/src/views/TxDetail/TxAction/TxActionNFTInscription.tsx b/packages/kit/src/views/TxDetail/TxAction/TxActionNFTInscription.tsx index de2219a2aea..62fd5a56756 100644 --- a/packages/kit/src/views/TxDetail/TxAction/TxActionNFTInscription.tsx +++ b/packages/kit/src/views/TxDetail/TxAction/TxActionNFTInscription.tsx @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { useNavigation } from '@react-navigation/native'; import BigNumber from 'bignumber.js'; @@ -14,7 +14,6 @@ import { IDecodedTxStatus, } from '@onekeyhq/engine/src/vaults/types'; -import backgroundApiProxy from '../../../background/instance/backgroundApiProxy'; import { useAccount, useNetwork } from '../../../hooks'; import { ModalRoutes, @@ -111,6 +110,7 @@ export function getTxActionInscriptionInfo(props: ITxActionCardProps) { action, isInscribeTransfer, asset: inscriptionInfo?.asset, + assetsInSameUtxo: inscriptionInfo?.assetsInSameUtxo, }; } @@ -125,33 +125,12 @@ export function TxActionNFTInscription(props: ITxActionCardProps) { const { accountId, networkId } = decodedTx; const intl = useIntl(); const { account } = useAccount({ accountId, networkId }); - const { send, receive, isOut, asset, isInscribeTransfer } = + const { send, receive, isOut, asset, assetsInSameUtxo, isInscribeTransfer } = getTxActionInscriptionInfo(props); const navigation = useNavigation(); - - const [assets, setAssets] = useState([]); const [showAllAssets, setShowAllAssets] = useState(false); - useEffect(() => { - const fetchInscriptionsInSameUtxo = async () => { - if (!asset) return; - const localNFTs = - (await backgroundApiProxy.serviceNFT.getAllAssetsFromLocal({ - networkId, - accountId, - })) as NFTBTCAssetModel[]; - const inscriptionsInSameUtxo = localNFTs.filter( - (nft) => - nft.inscription_id !== asset.inscription_id && - nft.owner === asset.owner && - nft.output === asset.output && - nft.output_value_sat === asset.output_value_sat, - ); - - setAssets([asset, ...inscriptionsInSameUtxo]); - }; - fetchInscriptionsInSameUtxo(); - }, [accountId, asset, networkId]); + const assets = [asset, assetsInSameUtxo].flat().filter(Boolean); const details: ITxActionElementDetail[] = [ { diff --git a/packages/kit/src/views/TxUtxos/TxUtxoDetailBlock.tsx b/packages/kit/src/views/TxUtxos/TxUtxoDetailBlock.tsx index 82065b64d5d..3d39a2aa4aa 100644 --- a/packages/kit/src/views/TxUtxos/TxUtxoDetailBlock.tsx +++ b/packages/kit/src/views/TxUtxos/TxUtxoDetailBlock.tsx @@ -1,5 +1,5 @@ import type { ComponentProps } from 'react'; -import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useNavigation } from '@react-navigation/native'; import BigNumber from 'bignumber.js'; @@ -20,7 +20,6 @@ import type { IBtcUTXO } from '@onekeyhq/engine/src/vaults/impl/btc/types'; import type { IDecodedTx } from '@onekeyhq/engine/src/vaults/types'; import type { IEncodedTxBtc } from '@onekeyhq/engine/src/vaults/utils/btcForkChain/types'; -import backgroundApiProxy from '../../background/instance/backgroundApiProxy'; import OrdinalsSVG from '../../components/SVG/OrdinalsSVG'; import { useNetwork } from '../../hooks'; import { @@ -44,7 +43,6 @@ const MAX_UTXOS_DEFAULT = 5; function TxUtxoDetailBlock(props: Props) { const { title, utxos, style, decodedTx, type } = props; const [showAll, setShowAll] = useState(false); - const [localNFTs, setLocalNFTs] = useState([]); const navigation = useNavigation(); const intl = useIntl(); const { networkId, accountId, actions, encodedTx } = decodedTx; @@ -103,16 +101,17 @@ function TxUtxoDetailBlock(props: Props) { ); const renderUtxos = useCallback(() => { - const inscriptionsInActions = getInscriptionsInActions(actions); + const { inscriptions: inscriptionsInActions, inscriptionsInSameUtxo } = + getInscriptionsInActions(actions); let restInscriptions = inscriptionsInActions; return utxosToShow.map((utxo, index) => { const result = getInscriptionsInUtxo({ utxo, inscriptionsInActions: restInscriptions, + inscriptionsInSameUtxo, isListOrderPsbt, type, - localNFTs, }); const { inscriptions } = result; restInscriptions = result.restInscriptions; @@ -137,7 +136,6 @@ function TxUtxoDetailBlock(props: Props) { }, [ actions, isListOrderPsbt, - localNFTs, network?.decimals, network?.symbol, renderInscriptions, @@ -145,17 +143,6 @@ function TxUtxoDetailBlock(props: Props) { utxosToShow, ]); - useEffect(() => { - const fetchLocalNFTs = async () => { - const resp = (await backgroundApiProxy.serviceNFT.getAllAssetsFromLocal({ - networkId, - accountId, - })) as NFTBTCAssetModel[]; - setLocalNFTs(resp); - }; - fetchLocalNFTs(); - }, [accountId, networkId]); - return ( ; inscriptionsInActions: NFTBTCAssetModel[]; - localNFTs: NFTBTCAssetModel[]; + inscriptionsInSameUtxo: NFTBTCAssetModel[]; type: 'inputs' | 'outputs'; isListOrderPsbt?: boolean; }) { @@ -68,7 +74,7 @@ export function getInscriptionsInUtxo({ } } - const inscriptionsInSameUtxo = localNFTs.filter((nft) => + const siblingInscriptions = inscriptionsInSameUtxo.filter((nft) => inscriptions.some( (inscription) => nft.inscription_id !== inscription.inscription_id && @@ -81,7 +87,7 @@ export function getInscriptionsInUtxo({ return { inscriptions: [ ...unionBy(inscriptions, 'inscription_id'), - ...inscriptionsInSameUtxo, + ...siblingInscriptions, ], restInscriptions: unionBy(restInscriptions, 'inscription_id'), };