import { useRouter } from 'next/router'; import React from 'react'; import type { TabItemRegular } from 'toolkit/components/AdaptiveTabs/types'; import type { EntityTag as TEntityTag } from 'ui/shared/EntityTags/types'; import config from 'configs/app'; import { AddressHighlightProvider } from 'lib/contexts/addressHighlight'; import throwOnResourceLoadError from 'lib/errors/throwOnResourceLoadError'; import getQueryParamString from 'lib/router/getQueryParamString'; import useEtherscanRedirects from 'lib/router/useEtherscanRedirects'; import { publicClient } from 'lib/web3/client'; import RoutedTabs from 'toolkit/components/RoutedTabs/RoutedTabs'; import TextAd from 'ui/shared/ad/TextAd'; import isCustomAppError from 'ui/shared/AppError/isCustomAppError'; import EntityTags from 'ui/shared/EntityTags/EntityTags'; import PageTitle from 'ui/shared/Page/PageTitle'; import TxAssetFlows from 'ui/tx/TxAssetFlows'; import TxAuthorizations from 'ui/tx/TxAuthorizations'; import TxBlobs from 'ui/tx/TxBlobs'; import TxDetailsApi from 'ui/tx/TxDetailsApi'; import TxDetailsRpc from 'ui/tx/TxDetailsRpc'; import TxDetailsWrapped from 'ui/tx/TxDetailsWrapped'; import TxFHEOperations from 'ui/tx/TxFHEOperations'; import TxInternals from 'ui/tx/TxInternals'; import TxLogs from 'ui/tx/TxLogs'; import TxRawTrace from 'ui/tx/TxRawTrace'; import TxState from 'ui/tx/TxState'; import TxSubHeading from 'ui/tx/TxSubHeading'; import TxTokenTransfer from 'ui/tx/TxTokenTransfer'; import TxUserOps from 'ui/tx/TxUserOps'; import useTxQuery from 'ui/tx/useTxQuery'; const txInterpretation = config.features.txInterpretation; const rollupFeature = config.features.rollup; const TransactionPageContent = () => { const router = useRouter(); const hash = getQueryParamString(router.query.hash); useEtherscanRedirects(); const txQuery = useTxQuery(); const { data, isPlaceholderData, isError, error, errorUpdateCount } = txQuery; const showDegradedView = publicClient && ((isError && error.status !== 422) || isPlaceholderData) && errorUpdateCount > 0; const tabs: Array = (() => { const detailsComponent = showDegradedView ? : ; return [ { id: 'index', title: config.features.suave.isEnabled && data?.wrapped ? 'Confidential compute tx details' : 'Details', component: detailsComponent, }, txInterpretation.isEnabled && txInterpretation.provider === 'noves' ? { id: 'asset_flows', title: 'Asset Flows', component: } : undefined, config.features.suave.isEnabled && data?.wrapped ? { id: 'wrapped', title: 'Regular tx details', component: } : undefined, { id: 'token_transfers', title: 'Token transfers', component: , subTabs: [ 'token_transfers', 'token_transfers_cross_chain' ], }, config.features.userOps.isEnabled ? { id: 'user_ops', title: 'User operations', component: } : undefined, { id: 'internal', title: 'Internal txns', component: }, config.features.dataAvailability.isEnabled && txQuery.data?.blob_versioned_hashes?.length ? { id: 'blobs', title: 'Blobs', component: } : undefined, { id: 'logs', title: 'Logs', component: }, { id: 'state', title: 'State', component: }, { id: 'raw_trace', title: 'Raw trace', component: }, txQuery.data?.fhe_operations_count && txQuery.data.fhe_operations_count > 0 ? { id: 'fhe_operations', title: 'FHE operations', component: } : undefined, txQuery.data?.authorization_list?.length ? { id: 'authorizations', title: 'Authorizations', component: } : undefined, ].filter(Boolean); })(); const txTags: Array = data?.transaction_tag ? [ { slug: data.transaction_tag, name: data.transaction_tag, tagType: 'private_tag' as const, ordinal: 1 } ] : []; if (rollupFeature.isEnabled && rollupFeature.interopEnabled && data?.op_interop_messages && data.op_interop_messages.length > 0) { if (data.op_interop_messages.some(message => message.init_chain !== undefined)) { txTags.push({ slug: 'relay_tx', name: 'Relay tx', tagType: 'custom' as const, ordinal: 0 }); } if (data.op_interop_messages.some(message => message.relay_chain !== undefined)) { txTags.push({ slug: 'init_tx', name: 'Source tx', tagType: 'custom' as const, ordinal: 0 }); } } const protocolTags = data?.to?.metadata?.tags?.filter(tag => tag.tagType === 'protocol'); if (protocolTags && protocolTags.length > 0) { txTags.push(...protocolTags); } const tags = ( ); const titleSecondRow = ; if (isError && !showDegradedView) { if (isCustomAppError(error)) { throwOnResourceLoadError({ resource: 'general:tx', error, isError: true }); } } return ( ); }; export default TransactionPageContent;