Files
tom goriunovandGitHub e6e83ee4e7 Add cross-chain transaction tracking and visualization (#3227)
* envs and feature setup

* home page layout

* cross-chain txs page

* cross-chain transfers page

* cross-chain transfers on tx page

* cross-chain messages on tx page

* cross-chain tx page

* cross-chain tx details token transfers

* stats and counters for lists

* migrate to new API version

* add swagger

* mobile lists

* placeholder views on address page

* tests

* fix adaptive tabs initial state when there is only one tab in the list

* tweaks

* bug fixes

* fix tests

* update screenshots

* migrate to new api version

* add chain label tooltip, copy button to txs in lists and same address highlight

* list views on address page

* fix tests

* fix links to current address in the list views

* update tooltips

* update tables layout

* review fixes

* fix spelling

* update screenshots

* update screenshot
2026-02-19 15:14:32 +01:00

74 lines
2.3 KiB
TypeScript

import { Box, Flex, Text } from '@chakra-ui/react';
import React from 'react';
import { route } from 'nextjs-routes';
import useApiQuery from 'lib/api/useApiQuery';
import useIsMobile from 'lib/hooks/useIsMobile';
import { INTERCHAIN_MESSAGE } from 'stubs/interchainIndexer';
import { generateListStub } from 'stubs/utils';
import { Link } from 'toolkit/chakra/link';
import { TableBody, TableRoot } from 'toolkit/chakra/table';
import TransactionsCrossChainListItem from 'ui/crossChain/txs/TransactionsCrossChainListItem';
import LatestCrossChainTxsItemDesktop from './LatestCrossChainTxsItemDesktop';
const LatestCrossChainTxs = () => {
const isMobile = useIsMobile();
const txsCount = isMobile ? 2 : 5;
const { data, isPlaceholderData, isError } = useApiQuery('interchainIndexer:messages', {
queryOptions: {
placeholderData: generateListStub<'interchainIndexer:messages'>(
INTERCHAIN_MESSAGE,
txsCount,
{
next_page_params: undefined,
},
),
},
});
if (isError || !data) {
return <Text mt={ 4 }>No data. Please reload the page.</Text>;
}
return (
<>
<Box mb={ 3 } hideFrom="lg" textStyle="sm">
{ data.items.slice(0, txsCount).map(((tx, index) => (
<TransactionsCrossChainListItem
key={ tx.message_id + (isPlaceholderData ? index : '') }
data={ tx }
isLoading={ isPlaceholderData }
py={ 4 }
textStyle="sm"
rowGap="14px"
_first={{
borderTopWidth: '0',
paddingTop: '4px',
}}
/>
))) }
</Box>
<Box mb={ 3 } hideBelow="lg" textStyle="sm">
<TableRoot minWidth="750px">
<TableBody>
{ data.items.slice(0, txsCount).map(((tx, index) => (
<LatestCrossChainTxsItemDesktop
key={ tx.message_id + (isPlaceholderData ? index : '') }
data={ tx }
isLoading={ isPlaceholderData }
/>
))) }
</TableBody>
</TableRoot>
</Box>
<Flex justifyContent="center">
<Link textStyle="sm" href={ route({ pathname: '/txs', query: { tab: 'txs_cross_chain' } }) }>View all transactions</Link>
</Flex>
</>
);
};
export default React.memo(LatestCrossChainTxs);