diff --git a/src/_api/type.ts b/src/_api/type.ts index 5476860ee..adf06a52d 100644 --- a/src/_api/type.ts +++ b/src/_api/type.ts @@ -1,5 +1,5 @@ import { ILogsProps } from '@_components/LogsContainer/type'; -import { AddressType, SortEnum } from '@_types/common'; +import { AddressType, IAddress, SortEnum } from '@_types/common'; export type TChainID = 'AELF' | 'tDVV' | 'tDVW' | '' | 'multiChain'; @@ -413,6 +413,7 @@ export interface CollectionDetailData { floorPriceOfUsd: number; floorPrice: number; tokenContractAddress: string; + contractAddress: IAddress; mainChainFloorPrice: number; sideChainFloorPrice: number; mainChainFloorPriceOfUsd: number; diff --git a/src/_components/AddressDetail/components/Events/index.tsx b/src/_components/AddressDetail/components/Events/index.tsx index f90e0b70f..a7f46be80 100644 --- a/src/_components/AddressDetail/components/Events/index.tsx +++ b/src/_components/AddressDetail/components/Events/index.tsx @@ -48,7 +48,7 @@ export default function Events() { chainId: chain as TChainID, skipCount: getPageNumber(page, pageSize), maxResultCount: pageSize, - blockHeight: search || null, + blockHeight: !isNaN(Number(search)) ? Number(search) : search || null, contractAddress: address && getAddress(address as string), }; setLoading(true); @@ -163,7 +163,11 @@ export default function Events() { value: searchText, placeholder: 'Search blockNo', onChange: ({ currentTarget }) => { - setSearchText(currentTarget.value); + const { value: inputValue } = currentTarget; + const reg = /^-?\d*(\.\d*)?$/; + if (reg.test(inputValue) || inputValue === '' || inputValue === '-') { + setSearchText(inputValue); + } }, onSearchChange: () => { // searchChange(); diff --git a/src/_components/AddressDetail/components/Tokens/NFTAssets/columnConfig.tsx b/src/_components/AddressDetail/components/Tokens/NFTAssets/columnConfig.tsx index e73b035fe..bfd69fa17 100644 --- a/src/_components/AddressDetail/components/Tokens/NFTAssets/columnConfig.tsx +++ b/src/_components/AddressDetail/components/Tokens/NFTAssets/columnConfig.tsx @@ -6,6 +6,7 @@ import Link from 'next/link'; import EPTooltip from '@_components/EPToolTip'; import EPSortIcon from '@_components/EPSortIcon'; import ChainTags from '@_components/ChainTags'; +import dayjs from 'dayjs'; const renderToken = (token, record, chain) => { if (!token) return null; @@ -25,7 +26,7 @@ const renderToken = (token, record, chain) => { const renderCollection = (collection, record, chain) => collection && ( - +
{collection.name} @@ -39,6 +40,11 @@ const renderCollection = (collection, record, chain) => ); +const trimmedDateString = (originalDateString) => { + const result = originalDateString.replace(/\.\d+Z$/, 'Z'); + return dayjs(result).unix(); +}; + const getSortOrder = (sortedInfo, columnKey) => (sortedInfo?.columnKey === columnKey ? sortedInfo.order : null); const renderQuantity = (text) => ( @@ -46,7 +52,7 @@ const renderQuantity = (text) => ( ); const renderDate = (text) => ( - {formatDate(text, 'Date Time (UTC)')} + {formatDate(trimmedDateString(text), 'Date Time (UTC)')} ); export default function getColumns(chain, sortedInfo, multi): ColumnsType { diff --git a/src/_components/AddressDetail/components/Tokens/NFTAssets/index.tsx b/src/_components/AddressDetail/components/Tokens/NFTAssets/index.tsx index e6643bd3f..ab278d65b 100644 --- a/src/_components/AddressDetail/components/Tokens/NFTAssets/index.tsx +++ b/src/_components/AddressDetail/components/Tokens/NFTAssets/index.tsx @@ -34,9 +34,12 @@ export default function NFTAssets() { maxResultCount: pageSize, chainId: getChainId(selectChain), address: getAddress(address as string), - orderBy: sortedInfo.order ? (sortedInfo.columnKey as string) : undefined, - sort: sortedInfo.order ? SortEnum[TableSortEnum[sortedInfo.order]] : undefined, + // orderBy: sortedInfo.order ? (sortedInfo.columnKey as string) : undefined, + // sort: sortedInfo.order ? SortEnum[TableSortEnum[sortedInfo.order]] : undefined, search: SearchFetchText, + orderInfos: sortedInfo.order + ? [{ orderBy: sortedInfo.columnKey as string, sort: SortEnum[TableSortEnum[sortedInfo.order]] }] + : [], }; setLoading(true); const data = await fetchAccountsDetailNFTAssets(params); diff --git a/src/_components/AddressWithCopy/index.tsx b/src/_components/AddressWithCopy/index.tsx index f7b0cdda2..250150a7f 100644 --- a/src/_components/AddressWithCopy/index.tsx +++ b/src/_components/AddressWithCopy/index.tsx @@ -1,24 +1,32 @@ import Copy from '@_components/Copy'; +import { MULTI_CHAIN } from '@_utils/contant'; +import { getAddress } from '@_utils/formatter'; import addressFormat, { hiddenAddress } from '@_utils/urlUtils'; import Link from 'next/link'; import { useMemo } from 'react'; export interface IAddressWithCopyProps { address: string; + chain: string; hidden?: boolean; } -const AddressWithCopy = ({ address, hidden }: IAddressWithCopyProps) => { +const AddressWithCopy = ({ address, hidden, chain }: IAddressWithCopyProps) => { const addressStr = useMemo(() => { const str = hidden ? hiddenAddress(address, 4, 4) : address; - return addressFormat(str); + return getAddress(str); }, [address, hidden]); + + const previewAddress = useMemo(() => { + return chain === MULTI_CHAIN ? addressStr : addressFormat(addressStr, chain); + }, [addressStr, chain]); + return ( <> - - {addressStr} + + {previewAddress} - + ); }; diff --git a/src/_components/ChainSelect/index.tsx b/src/_components/ChainSelect/index.tsx index 419f4b436..ffdf74b6f 100644 --- a/src/_components/ChainSelect/index.tsx +++ b/src/_components/ChainSelect/index.tsx @@ -1,17 +1,21 @@ 'use client'; import { Select } from 'antd'; -import { useAppDispatch, useAppSelector } from '@_store'; -import { setDefaultChain } from '@_store/features/chainIdSlice'; -import { useParams, useRouter, useSearchParams } from 'next/navigation'; +import { useAppSelector } from '@_store'; +import { useParams, useSearchParams } from 'next/navigation'; const { Option } = Select; import './index.css'; import { useMemo } from 'react'; -import { DEFAULT_CHAIN } from '@_utils/contant'; +import { MenuItem } from '@_types'; +import useChainSelect from '@_hooks/useChainSelect'; -export default function ChainSelect({ setCurrent }) { +export default function ChainSelect({ + setCurrent, + headerList, +}: { + headerList: MenuItem[]; + setCurrent: (key: string) => void; +}) { const { chainArr, defaultChain } = useAppSelector((state) => state.getChainId); - const dispatch = useAppDispatch(); - const router = useRouter(); const { chain } = useParams(); const chainId = useSearchParams().get('chainId'); @@ -19,16 +23,7 @@ export default function ChainSelect({ setCurrent }) { return chainId || (chain as string) || defaultChain; }, [chain, chainId, defaultChain]); - const onChangeHandler = (value: string) => { - dispatch(setDefaultChain(value)); - if (value === DEFAULT_CHAIN) { - router.push('/'); - } else { - router.push(`/${value}`); - } - setCurrent('/'); - }; - + const onChangeHandler = useChainSelect(headerList, setCurrent); return (
{chainArr && chainArr.length > 0 && ( diff --git a/src/_components/ContractToken/index.tsx b/src/_components/ContractToken/index.tsx index b11b25277..d6f3913f4 100644 --- a/src/_components/ContractToken/index.tsx +++ b/src/_components/ContractToken/index.tsx @@ -63,8 +63,8 @@ export default function ContractToken({ -
Contract Name:{name}
+
+
Contract Name: {name}
({addressFormat(address, chainId)})
} diff --git a/src/_components/HeaderTop/index.tsx b/src/_components/HeaderTop/index.tsx index 2d6e90374..0a5927489 100644 --- a/src/_components/HeaderTop/index.tsx +++ b/src/_components/HeaderTop/index.tsx @@ -120,7 +120,7 @@ export default function HeaderTop({ setCurrent, selectedKey, networkList, header )}
- {!isMobile && } + {!isMobile && }
diff --git a/src/_components/LogsContainer/index.tsx b/src/_components/LogsContainer/index.tsx index 38ec7b38a..616e90f76 100644 --- a/src/_components/LogsContainer/index.tsx +++ b/src/_components/LogsContainer/index.tsx @@ -1,9 +1,6 @@ import React from 'react'; import { ILogsProps } from './type'; import DetailContainer from '@_components/DetailContainer'; -import Link from 'next/link'; -import addressFormat from '@_utils/urlUtils'; -import Copy from '@_components/Copy'; import LogItems from './logItems'; import { useParams } from 'next/navigation'; import ContractToken from '@_components/ContractToken'; diff --git a/src/_components/MobileHeaderMenu/index.tsx b/src/_components/MobileHeaderMenu/index.tsx index 1584fdf5c..c0ab1736a 100644 --- a/src/_components/MobileHeaderMenu/index.tsx +++ b/src/_components/MobileHeaderMenu/index.tsx @@ -3,11 +3,10 @@ import IconFont from '@_components/IconFont'; import { MenuItem, NetworkItem } from '@_types'; import { Drawer, Menu, MenuProps } from 'antd'; import Link from 'next/link'; -import { useParams, usePathname, useRouter, useSearchParams } from 'next/navigation'; -import { useCallback, useMemo, useState } from 'react'; +import { useParams, usePathname, useSearchParams } from 'next/navigation'; +import { useMemo, useState } from 'react'; import './index.css'; -import { useAppDispatch, useAppSelector } from '@_store'; -import { setDefaultChain } from '@_store/features/chainIdSlice'; +import { useAppSelector } from '@_store'; import { getPathnameFirstSlash, isURL } from '@_utils/urlUtils'; import { useEnvContext } from 'next-runtime-env'; import { checkMainNet } from '@_utils/isMainNet'; @@ -19,6 +18,7 @@ import { homePath } from '@_components/Main'; import { DEFAULT_CHAIN, TG_BOT_LINK } from '@_utils/contant'; const ChangeIcoTest = '/image/aelf-header-top-test-change.svg'; import { TelegramPlatform } from '@portkey/did-ui-react'; +import useChainSelect from '@_hooks/useChainSelect'; interface IProps { headerMenuList: MenuItem[]; @@ -38,7 +38,6 @@ export default function MobileHeaderMenu({ headerMenuList, setCurrent, selectedK setShowMobileMenu(!showMobileMenu); }; - console.log(chainArr, 'chainArr'); const onClick: MenuProps['onClick'] = (e) => { if (!e.key.startsWith('http')) { setCurrent(e.key); @@ -47,7 +46,6 @@ export default function MobileHeaderMenu({ headerMenuList, setCurrent, selectedK }; const { NEXT_PUBLIC_NETWORK_TYPE } = useEnvContext(); const isMainNet = checkMainNet(NEXT_PUBLIC_NETWORK_TYPE); - const router = useRouter(); function getItem(label: React.ReactNode, key: React.Key, children?: AntdMenuItem[], type?: 'group'): AntdMenuItem { return { key, @@ -84,21 +82,11 @@ export default function MobileHeaderMenu({ headerMenuList, setCurrent, selectedK return getItem(label, path, convertMenuItems(children)); }); }; - const dispatch = useAppDispatch(); - const onSelectHandler = useCallback( - (value: string) => { - dispatch(setDefaultChain(value)); - if (value === DEFAULT_CHAIN) { - router.push('/'); - } else { - router.push(`/${value}`); - } - setCurrent('/'); - }, - [dispatch, router, setCurrent], - ); const pathname = usePathname(); + + const onSelectHandler = useChainSelect(headerMenuList, setCurrent); + const origin = typeof window !== 'undefined' && window.location.origin; const { chain } = useParams(); @@ -165,7 +153,7 @@ export default function MobileHeaderMenu({ headerMenuList, setCurrent, selectedK }, ...chainList, ]; - }, [chainArr, networkList, onSelectHandler, origin, selectChain]); + }, [chainArr, isTg, networkList, onSelectHandler, origin, selectChain]); const items: MenuProps['items'] = [...convertMenuItems(headerMenuList)]; diff --git a/src/_hooks/useChainSelect.ts b/src/_hooks/useChainSelect.ts new file mode 100644 index 000000000..0cd8e738b --- /dev/null +++ b/src/_hooks/useChainSelect.ts @@ -0,0 +1,48 @@ +import { useAppDispatch } from '@_store'; +import { setDefaultChain } from '@_store/features/chainIdSlice'; +import { MenuItem } from '@_types'; +import { DEFAULT_CHAIN } from '@_utils/contant'; +import { usePathname, useRouter } from 'next/navigation'; +import { useCallback, useMemo } from 'react'; + +export default function useChainSelect(headerMenuList: MenuItem[], setCurrent) { + const menus = useMemo(() => { + return headerMenuList.reduce((pre, cur) => { + if (cur.children.length) { + pre.push(...cur.children); + } else { + pre.push(cur); + } + return pre; + }, [] as MenuItem[]); + }, [headerMenuList]); + + const dispatch = useAppDispatch(); + + const pathname = usePathname(); + + const router = useRouter(); + + const onSelectHandler = useCallback( + (value: string) => { + dispatch(setDefaultChain(value)); + const segments = pathname.split('/'); + const current = segments.length > 2 ? `/${segments[2]}` : ''; + + if (menus.find((item) => item.path === current)) { + router.push(`/${value}${current}`); + setCurrent(current); + } else { + if (value === DEFAULT_CHAIN) { + router.push('/'); + } else { + router.push(`/${value}`); + } + setCurrent('/'); + } + }, + [dispatch, menus, pathname, router, setCurrent], + ); + + return onSelectHandler; +} diff --git a/src/_pluginsComponents/nft/_overview/OverView.tsx b/src/_pluginsComponents/nft/_overview/OverView.tsx index d8eb8881b..a7309bfdc 100644 --- a/src/_pluginsComponents/nft/_overview/OverView.tsx +++ b/src/_pluginsComponents/nft/_overview/OverView.tsx @@ -4,7 +4,6 @@ import { CollectionDetailData } from '../type'; import '../detail.css'; import ContractToken from '@_components/ContractToken'; -import { AddressType } from '@_types/common'; import { useSearchParams } from 'next/navigation'; import { TChainID } from '@_api/type'; import { addSymbol, thousandsNumber } from '@_utils/formatter'; @@ -208,10 +207,10 @@ export default function OverView(props: OverViewProps) {
-
diff --git a/src/_pluginsComponents/nft/type.ts b/src/_pluginsComponents/nft/type.ts index 9cf1cb8e2..795e6aa65 100644 --- a/src/_pluginsComponents/nft/type.ts +++ b/src/_pluginsComponents/nft/type.ts @@ -1,5 +1,5 @@ import { IFromInfo, TChainID, TransactionStatus } from '@_api/type'; -import { IToken } from '@_types/common'; +import { IAddress, IToken } from '@_types/common'; import { ISearchProps } from 'aelf-design'; // Collection detail api return type @@ -13,6 +13,7 @@ export interface CollectionDetailData { mergeHolders: number; floorPrice: number; tokenContractAddress: string; + contractAddress: IAddress; mainChainFloorPrice: number; sideChainFloorPrice: number; mainChainFloorPriceOfUsd: number; diff --git a/src/_types/common.ts b/src/_types/common.ts index 167a39e52..d799c6d47 100644 --- a/src/_types/common.ts +++ b/src/_types/common.ts @@ -18,7 +18,7 @@ export interface IToken { export interface IAddress { name: string; address: string; - addressType: TAddressType; + addressType: AddressType; isManager: false; isProducer: true; } diff --git a/src/app/[chain]/block/[hash]/_components/baseinfo.tsx b/src/app/[chain]/block/[hash]/_components/baseinfo.tsx index 00bc894b4..5fc28c2a9 100644 --- a/src/app/[chain]/block/[hash]/_components/baseinfo.tsx +++ b/src/app/[chain]/block/[hash]/_components/baseinfo.tsx @@ -53,7 +53,7 @@ export default function BaseInfo({ data, tabChange, jump }) {
- {formatDate(data.timestamp, 'age')}({dayjs.unix(data.timestamp).format('MMM-DD-YYYY hh:mm:ss Z')}) + {formatDate(data.timestamp, 'age')}({formatDate(data.timestamp, 'Date Time (UTC)')})
), diff --git a/src/app/[chain]/blocks/blockList.tsx b/src/app/[chain]/blocks/blockList.tsx index abb2b4a0f..af5ad0dcd 100644 --- a/src/app/[chain]/blocks/blockList.tsx +++ b/src/app/[chain]/blocks/blockList.tsx @@ -84,8 +84,8 @@ export default function BlockList({ SSRData, defaultPage, defaultPageSize, defau }); }, [chain, timeFormat]); - const pageMaxBlock = data[0]?.blockHeight; - const pageMinBlock = data[data.length - 1]?.blockHeight; + const pageMaxBlock = data && data[0]?.blockHeight; + const pageMinBlock = data && data[data.length - 1]?.blockHeight; const { pageChange, pageSizeChange, chainChange } = usePagination({ setCurrentPage, diff --git a/src/app/[chain]/blocks/columnConfig.tsx b/src/app/[chain]/blocks/columnConfig.tsx index 1d74bb074..fcec8c2e1 100644 --- a/src/app/[chain]/blocks/columnConfig.tsx +++ b/src/app/[chain]/blocks/columnConfig.tsx @@ -4,15 +4,32 @@ import Link from 'next/link'; import Copy from '@_components/Copy'; import { MULTI_CHAIN } from '@_utils/contant'; import ChainTags from '@_components/ChainTags'; +import EPTooltip from '@_components/EPToolTip'; -const getAddressLink = (address, chainId, record) => ( - - {record.producerName || addressFormat(hiddenAddress(address, 4, 4), record.chainIds ? record.chainIds[0] : chainId)} - -); +const getAddressLink = (address, chainId, record) => { + const chain = record.chainIds ? record.chainIds[0] : chainId; + return ( + +
Producer Name: {record.producerName}
+
({addressFormat(address, chain)})
+
+ ) : ( + addressFormat(address || '', chain) + ) + } + mode="dark" + pointAtCenter={false}> + + {record.producerName || addressFormat(hiddenAddress(address, 4, 4), chain)} + + + ); +}; const getBlockLink = (text, chainId, record) => ( (
{getAddressLink(address, chainId, record)} - +
), }, diff --git a/src/app/[chain]/chart/address/page.tsx b/src/app/[chain]/chart/address/page.tsx index 471609e30..01752f1dc 100644 --- a/src/app/[chain]/chart/address/page.tsx +++ b/src/app/[chain]/chart/address/page.tsx @@ -1,13 +1,11 @@ 'use client'; import Highcharts from 'highcharts/highstock'; import { getChartOptions, thousandsNumber } from '@_utils/formatter'; -import { useEffect, useMemo } from 'react'; +import { useMemo } from 'react'; import { IDailyAddAddressData, IHIGHLIGHTDataItem } from '../type'; import BaseHightCharts from '../_components/charts'; -import { exportToCSV } from '@_utils/urlUtils'; import { fetchUniqueAddresses } from '@_api/fetchChart'; import PageLoadingSkeleton from '@_components/PageLoadingSkeleton'; -import { useMultiChain } from '@_hooks/useSelectChain'; import { useChartDownloadData, useFetchChartData } from '@_hooks/useFetchChartData'; const title = 'aelf Cumulative Addresses Chart'; @@ -18,9 +16,9 @@ const getOption = (list: any[], multi, chain): Highcharts.Options => { const customMap = {}; list.forEach((item) => { - const totalUniqueAddresses = multi ? item.mergeTotalUniqueAddressees : item.ownerUniqueAddressees; - const mainUniqueAddresses = multi ? item.mainChainTotalUniqueAddressees : item.ownerUniqueAddressees; - const sideUniqueAddresses = multi ? item.sideChainTotalUniqueAddressees : item.ownerUniqueAddressees; + const totalUniqueAddresses = item.mergeTotalUniqueAddressees; + const mainUniqueAddresses = item.mainChainTotalUniqueAddressees; + const sideUniqueAddresses = item.sideChainTotalUniqueAddressees; allData.push([item.date, totalUniqueAddresses]); mainData.push([item.date, mainUniqueAddresses]); @@ -95,10 +93,28 @@ export default function Page() { return getOption(data?.list || [], multi, chain); }, [data, multi, chain]); + const Highest = useMemo(() => { + if (multi) { + return data?.highestIncrease; + } else if (chain === 'AELF') { + const result = data?.list || []; + const maxMainChainAddressCountItem = result.reduce((maxItem, currentItem) => { + return currentItem.mainChainAddressCount > maxItem.mainChainAddressCount ? currentItem : maxItem; + }, result[0]); + return maxMainChainAddressCountItem; + } else { + const result = data?.list || []; + const maxMainChainAddressCountItem = result.reduce((maxItem, currentItem) => { + return currentItem.sideChainAddressCount > maxItem.sideChainAddressCount ? currentItem : maxItem; + }, result[0]); + return maxMainChainAddressCountItem; + } + }, [multi, chain, data]); + const { download } = useChartDownloadData(data, chartRef, title); const highlightData = useMemo(() => { - const key = multi ? 'mergeAddressCount' : 'addressCount'; + const key = multi ? 'mergeAddressCount' : chain === 'AELF' ? 'mainChainAddressCount' : 'sideChainAddressCount'; return data ? [ { @@ -107,15 +123,15 @@ export default function Page() { text: ( Highest increase of - {thousandsNumber(data.highestIncrease[key])} + {thousandsNumber((Highest && Highest[key]) || 0)} addresses was recorded on - {Highcharts.dateFormat('%A, %B %e, %Y', data.highestIncrease.date)} + {Highcharts.dateFormat('%A, %B %e, %Y', Highest?.date || 0)} ), }, ] : []; - }, [data, multi]); + }, [Highest, chain, data, multi]); return loading ? ( ) : ( diff --git a/src/app/[chain]/chart/produce/page.tsx b/src/app/[chain]/chart/produce/page.tsx index 8f594343a..c8cd2448d 100644 --- a/src/app/[chain]/chart/produce/page.tsx +++ b/src/app/[chain]/chart/produce/page.tsx @@ -12,6 +12,7 @@ import useBpProduce from '@_hooks/useBpProduce'; let highlightElement; let centerElement; import List from './list'; +import addressFormat from '@_utils/urlUtils'; const gbColors = [ 'rgba(144, 171, 240, 0.3)', @@ -112,7 +113,7 @@ const drawHighlight = (chart: any, highlightIndex: number, totalCategories: numb .add(); }; -const getOption = (list: any[]): Highcharts.Options => { +const getOption = (list: any[], chain): Highcharts.Options => { const length = list.length; const allData: any[] = Array.from({ length }, () => { return 83; @@ -120,15 +121,15 @@ const getOption = (list: any[]): Highcharts.Options => { const categories: any[] = []; const customMap = {}; list.forEach((item) => { - categories.push(item.producerName || item.producerAddress); - const key = item.producerName || item.producerAddress; - customMap[key] = {}; - customMap[key].missedCount = item.missedCount; - customMap[key].blockCount = item.blockCount; + const name = item.producerName || addressFormat(item.producerAddress, chain); + categories.push(name); + customMap[name] = {}; + customMap[name].missedCount = item.missedCount; + customMap[name].blockCount = item.blockCount; }); const highlightIndex = list.findIndex((item) => item.isMinning); - console.log(highlightIndex, 'highlightIndex'); + const totalCategories = categories.length; return { chart: { @@ -248,8 +249,8 @@ export default function Page() { const { chain } = useParams<{ chain: TChainID }>(); const { loading, produces } = useBpProduce(chain); const options = useMemo(() => { - return getOption(produces || []); - }, [produces]); + return getOption(produces || [], chain); + }, [chain, produces]); const chartRef = useRef(null); diff --git a/src/app/[chain]/token/[tokenSymbol]/_components/Holders/columns.tsx b/src/app/[chain]/token/[tokenSymbol]/_components/Holders/columns.tsx index f68df53b4..a13d884cc 100644 --- a/src/app/[chain]/token/[tokenSymbol]/_components/Holders/columns.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/_components/Holders/columns.tsx @@ -7,8 +7,8 @@ import ChainTags from '@_components/ChainTags'; const renderIndex = (currentPage, pageSize) => (text, record, index) => (currentPage - 1) * pageSize + index + 1; const renderAddress = (chain, data) => { - const { address, addressType } = data; - return ; + const { address, addressType, name } = data; + return ; }; const renderQuantity = (text) => thousandsNumber(text); diff --git a/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx b/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx index 719f1e3a7..946df4f4a 100644 --- a/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx @@ -4,7 +4,6 @@ import { IOverviewItem } from '@_components/OverviewCard/type'; import { thousandsNumber } from '@_utils/formatter'; import { ITokenDetail } from '../../type'; import NumberPercentGroup from '../NumberPercentGroup'; -import { AddressType } from '@_types/common'; import { useParams } from 'next/navigation'; import { usePad } from '@_hooks/useResponsive'; import clsx from 'clsx'; @@ -47,11 +46,16 @@ const TokenDetail = (chain): IOverviewItem[] => { ), }, { - key: 'tokenContractAddress', + key: 'contractAddress', label: 'CONTRACT', tooltip: 'This is the MultiToken contract that defines a common implementation for fungible and non-fungible tokens.', - render: (text) => (text ? : '--'), + render: (text) => + text?.address ? ( + + ) : ( + '--' + ), }, { key: 'token', diff --git a/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/columns.tsx b/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/columns.tsx index 37d7daadf..4d53ce173 100644 --- a/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/columns.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/columns.tsx @@ -31,6 +31,7 @@ const renderContractToken = (data, record, chain) => ( diff --git a/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/index.tsx b/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/index.tsx index af8dc0eaa..357fc215a 100644 --- a/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/index.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/index.tsx @@ -154,12 +154,12 @@ const Transfers = ({ search, searchText, searchType, onSearchChange, onSearchInp const title = useMemo(() => `A total of ${total} records found`, [total]); const searchByHolder: DescriptionsProps['items'] = useMemo( - () => getSearchByHolderItems(address, isMobile, searchData), - [address, isMobile, searchData], + () => getSearchByHolderItems(address, isMobile, chain as string, searchData), + [address, chain, isMobile, searchData], ); const searchByHash: DescriptionsProps['items'] = useMemo( - () => getSearchByHashItems(address, isMobile, chain, data[0]?.blockHeight), - [address, chain, data, isMobile], + () => getSearchByHashItems(address, isMobile, data[0]?.chainIds[0]), + [address, data, isMobile], ); return ( diff --git a/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/utils.tsx b/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/utils.tsx index fb40a4750..88e6163e0 100644 --- a/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/utils.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/_components/Transfers/utils.tsx @@ -1,5 +1,5 @@ import AddressWithCopy from '@_components/AddressWithCopy'; -import { thousandsNumber } from '@_utils/formatter'; +import { addSymbol, thousandsNumber } from '@_utils/formatter'; import { DescriptionsProps } from 'antd'; import Link from 'next/link'; import { TTransferSearchData } from '../../type'; @@ -7,6 +7,7 @@ import { TTransferSearchData } from '../../type'; export function getSearchByHolderItems( address: string, isMobile: boolean, + chain: string, sourceData?: TTransferSearchData, ): DescriptionsProps['items'] { const spanWith2col = isMobile ? 4 : 2; @@ -16,7 +17,7 @@ export function getSearchByHolderItems( { key: 'desc', label: 'Filtered by Token Holder', - children: , + children: , labelStyle: { color: '#252525', fontWeight: 500, @@ -26,7 +27,7 @@ export function getSearchByHolderItems( { key: 'balance', label: 'BALANCE', - children: thousandsNumber(sourceData?.balance as number), + children: addSymbol(thousandsNumber(sourceData?.balance as number)), labelStyle: { marginTop, }, @@ -35,7 +36,7 @@ export function getSearchByHolderItems( { key: 'value', label: 'VALUE', - children: thousandsNumber(sourceData?.value as number), + children: '$' + thousandsNumber(sourceData?.value as number), labelStyle: { marginTop, }, @@ -44,12 +45,7 @@ export function getSearchByHolderItems( ]; } -export function getSearchByHashItems( - address: string, - isMobile: boolean, - chain, - blockHeight, -): DescriptionsProps['items'] { +export function getSearchByHashItems(address: string, isMobile: boolean, chain): DescriptionsProps['items'] { const spanWith2col = isMobile ? 4 : 2; return [ { diff --git a/src/app/[chain]/token/[tokenSymbol]/type.ts b/src/app/[chain]/token/[tokenSymbol]/type.ts index a2121d78a..837434941 100644 --- a/src/app/[chain]/token/[tokenSymbol]/type.ts +++ b/src/app/[chain]/token/[tokenSymbol]/type.ts @@ -1,5 +1,5 @@ import { IFromInfo, TChainID } from '@_api/type'; -import { IToken } from '@_types/common'; +import { IAddress, IToken } from '@_types/common'; export interface ITransferItem { transactionId: string; @@ -55,6 +55,7 @@ export interface ITokenDetail { transferCount: number; pricePercentChange24h: number; tokenContractAddress: string; + contractAddress: IAddress; decimals: number; // multi mainChainCirculatingSupply: number;