diff --git a/src/_api/server.ts b/src/_api/server.ts index 00f6ae58..90cb1dea 100644 --- a/src/_api/server.ts +++ b/src/_api/server.ts @@ -36,7 +36,7 @@ async function service(url: string, options: RequestWithParams) { } } - console.log(url, 'url-----------'); + console.log(url, options, 'url-----------'); try { const response = await fetch(url, options); diff --git a/src/_api/type.ts b/src/_api/type.ts index d9f6acf4..4cbe2a82 100644 --- a/src/_api/type.ts +++ b/src/_api/type.ts @@ -37,7 +37,7 @@ export interface IFromInfo { isProducer: boolean; } -export interface ITransactionsRequestParams { +export interface ITransactionsRequestParams extends RequestInit { chainId: TChainID; transactionId: string; blockHeight: number; @@ -62,13 +62,13 @@ export interface ITransactionsResponse { transactions: ITransactionsResponseItem[]; } -export interface ITransactionDetailRequestParams { +export interface ITransactionDetailRequestParams extends RequestInit { chainId: TChainID; transactionId: string; blockHeight: number; } -export interface IBlocksRequestParams { +export interface IBlocksRequestParams extends RequestInit { chainId: TChainID; blockHeight?: number; maxResultCount: number; @@ -90,7 +90,7 @@ export interface IBlocksResponse { blocks: IBlocksResponseItem[]; } -export interface IBlocksDetailRequestParams { +export interface IBlocksDetailRequestParams extends RequestInit { chainId: TChainID; blockHeight: number; } @@ -190,7 +190,7 @@ export interface ITransactionDetailDataList { list: ITransactionDetailData[]; } -export interface ITokenHoldersRequestParams { +export interface ITokenHoldersRequestParams extends RequestInit { chainId: TChainID; symbol: string; skipCount: number; @@ -198,7 +198,7 @@ export interface ITokenHoldersRequestParams { // search: string; } -export interface ITokenTransfersRequestParams { +export interface ITokenTransfersRequestParams extends RequestInit { chainId: TChainID; skipCount: number; maxResultCount: number; @@ -206,15 +206,15 @@ export interface ITokenTransfersRequestParams { search: string; } -export interface ITokenDetailRequestParams { +export interface ITokenDetailRequestParams extends RequestInit { chainId: TChainID; symbol: string; } -export interface TTokenListRequestParams { +export interface TTokenListRequestParams extends RequestInit { chainId: TChainID; skipCount: number; maxResultCount: number; sort: SortEnum; - sortBy: number; + sortBy: string; } diff --git a/src/_style/globals.css b/src/_style/globals.css index 972b9fd2..8733d9aa 100644 --- a/src/_style/globals.css +++ b/src/_style/globals.css @@ -28,7 +28,7 @@ html{ @apply h-full w-full; } body { - @apply lg:min-w-[768px] bg-F7 select-none relative h-full w-full overflow-x-hidden overflow-y-auto; + @apply lg:min-w-[768px] bg-F7 relative h-full w-full overflow-x-hidden overflow-y-auto; .explorer-dropdown-menu{ .explorer-dropdown-menu-item{ @apply !text-xs !leading-20 !text-base-100 !px-2 !py-[6px]; diff --git a/src/_types/common.ts b/src/_types/common.ts index 6e54239e..ac03f4ac 100644 --- a/src/_types/common.ts +++ b/src/_types/common.ts @@ -28,6 +28,6 @@ export enum AddressType { } export enum SortEnum { - asc, - desc, + asc = 'Asc', + desc = 'Desc', } diff --git a/src/_utils/formatter.ts b/src/_utils/formatter.ts index 15ad4c3b..1d8d39a7 100644 --- a/src/_utils/formatter.ts +++ b/src/_utils/formatter.ts @@ -62,9 +62,9 @@ export const addSymbol = (str: string | number) => { return `${str} ${process.env.NEXT_PUBLIC_SYMBOL}`; }; -export const divDecimals = (num: number | string, decimals = 8e10) => { +export const divDecimals = (num: number | string, decimals = 1e10) => { const bigNumber = new BigNumber(num); - return bigNumber.dividedBy(decimals || 8e10).toNumber(); + return bigNumber.dividedBy(decimals || 1e10).toNumber(); }; export const getPageNumber = (page: number, pageSize: number): number => { diff --git a/src/_utils/urlUtils.ts b/src/_utils/urlUtils.ts index 9188b71e..b0a34b0d 100644 --- a/src/_utils/urlUtils.ts +++ b/src/_utils/urlUtils.ts @@ -9,7 +9,6 @@ export function getPathnameFirstSlash(pathname: string) { } export default function addressFormat(address: string, chainId?: string, prefix?: string) { const defaultChainId = store.getState().getChainId.defaultChain; - console.log(defaultChainId, 'defaultChainId'); if (!address) return ''; return `${prefix || SYMBOL}_${address}_${chainId || defaultChainId}`; } diff --git a/src/app/[chain]/block/[hash]/_components/baseinfo.tsx b/src/app/[chain]/block/[hash]/_components/baseinfo.tsx index e64bf6bd..ded06ef0 100644 --- a/src/app/[chain]/block/[hash]/_components/baseinfo.tsx +++ b/src/app/[chain]/block/[hash]/_components/baseinfo.tsx @@ -23,8 +23,8 @@ import { useParams } from 'next/navigation'; export default function BaseInfo({ data }) { const router = useRouter(); const { chain } = useParams(); - const isFirst = data.preBlockHeight === 0; - const isLast = data.nextBlockHeight === 0; + const isFirst = data?.preBlockHeight === 0; + const isLast = data?.nextBlockHeight === 0; const jump = useCallback( (type: JumpTypes) => { switch (type) { diff --git a/src/app/[chain]/block/[hash]/_components/detail.tsx b/src/app/[chain]/block/[hash]/_components/detail.tsx index 71a9f65b..d4128c75 100644 --- a/src/app/[chain]/block/[hash]/_components/detail.tsx +++ b/src/app/[chain]/block/[hash]/_components/detail.tsx @@ -29,7 +29,7 @@ export default function Detail({ SSRData }) { const [showMore, setShowMore] = useState(false); const [currentPage, setCurrentPage] = useState(1); const [pageSize, setPageSize] = useState(25); - const [total] = useState(SSRData.transactions.length); + const [total] = useState(SSRData?.transactions?.length); const [timeFormat, setTimeFormat] = useState('Age'); const { chain } = useParams(); @@ -41,7 +41,7 @@ export default function Detail({ SSRData }) { }, chainId: chain as string, }); - }, [timeFormat]); + }, [chain, timeFormat]); const multiTitle = `More than > ${total} transactions found`; @@ -57,9 +57,9 @@ export default function Detail({ SSRData }) { }; const tableData = useMemo(() => { - const transactions = detailData.transactions || []; + const transactions = detailData?.transactions || []; return transactions.slice((currentPage - 1) * pageSize, currentPage * pageSize); - }, [currentPage, detailData.transactions, pageSize]); + }, [currentPage, detailData?.transactions, pageSize]); const moreChange = useCallback(() => { setShowMore(!showMore); @@ -104,7 +104,7 @@ export default function Detail({ SSRData }) { return (
- #{detailData.blockHeight} + #{detailData?.blockHeight}
diff --git a/src/app/[chain]/block/[hash]/page.tsx b/src/app/[chain]/block/[hash]/page.tsx index 4b45b736..e7d26702 100644 --- a/src/app/[chain]/block/[hash]/page.tsx +++ b/src/app/[chain]/block/[hash]/page.tsx @@ -9,7 +9,11 @@ import { fetchServerBlocksDetail } from '@_api/fetchBlocks'; import Detail from './_components/detail'; import { TChainID } from '@_api/type'; export default async function Block({ params }: { params: { hash: string; chain: TChainID } }) { - const data = await fetchServerBlocksDetail({ blockHeight: Number(params.hash), chainId: params.chain }); + const data = await fetchServerBlocksDetail({ + blockHeight: Number(params.hash), + chainId: params.chain, + cache: 'no-store', + }); console.log(data, 'data'); return ; } diff --git a/src/app/[chain]/blocks/blockList.tsx b/src/app/[chain]/blocks/blockList.tsx index f96412bd..3bef1c9e 100644 --- a/src/app/[chain]/blocks/blockList.tsx +++ b/src/app/[chain]/blocks/blockList.tsx @@ -31,6 +31,7 @@ export interface IBlocksData { } export default function BlockList({ SSRData }) { + console.log(SSRData, ' SSRData'); const { isMobile } = useMobileAll(); const [currentPage, setCurrentPage] = useState(1); const [pageSize, setPageSize] = useState(25); @@ -79,7 +80,7 @@ export default function BlockList({ SSRData }) { }, chianId: chain, }); - }, [timeFormat]); + }, [chain, timeFormat]); const pageMaxBlock = data[0]?.blockHeight; const pageMinBlock = data[data.length - 1]?.blockHeight; diff --git a/src/app/[chain]/blocks/page.tsx b/src/app/[chain]/blocks/page.tsx index 7525ad03..f52db530 100644 --- a/src/app/[chain]/blocks/page.tsx +++ b/src/app/[chain]/blocks/page.tsx @@ -4,6 +4,7 @@ export default async function BlocksPage({ params }) { const data = await fetchServerBlocks({ chainId: params.chain || 'AELF', maxResultCount: 25, + cache: 'no-store', }); return ; } diff --git a/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx b/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx index 495c6d6b..f8215eec 100644 --- a/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/_components/Overview/index.tsx @@ -26,7 +26,7 @@ const TokenDetailItems: IOverviewItem[] = [ render: (text, record) => , }, { - key: 'totalTransfers', + key: 'transferCount', label: 'TOTAL TRANSFERS', format: thousandsNumber, }, diff --git a/src/app/[chain]/token/[tokenSymbol]/page.tsx b/src/app/[chain]/token/[tokenSymbol]/page.tsx index e02f8336..fdd5e76d 100644 --- a/src/app/[chain]/token/[tokenSymbol]/page.tsx +++ b/src/app/[chain]/token/[tokenSymbol]/page.tsx @@ -17,7 +17,7 @@ export default async function TokenSymbol({ tokenSymbol: string; }; }) { - const tokenDetail = await fetchTokenDetail({ chainId: chain as TChainID, symbol: tokenSymbol }); + const tokenDetail = await fetchTokenDetail({ chainId: chain as TChainID, symbol: tokenSymbol, cache: 'no-store' }); console.log(tokenDetail, 'tokenDetail'); return (
diff --git a/src/app/[chain]/token/[tokenSymbol]/type.ts b/src/app/[chain]/token/[tokenSymbol]/type.ts index 6615b336..b4c15364 100644 --- a/src/app/[chain]/token/[tokenSymbol]/type.ts +++ b/src/app/[chain]/token/[tokenSymbol]/type.ts @@ -46,7 +46,7 @@ export interface ITokenDetail { circulatingSupply: string; holders: number; holderPercentChange24h: number; - totalTransfers: string; + transferCount: number; priceInUsd: number; pricePercentChange24h: number; contractAddress: string; diff --git a/src/app/[chain]/tokens/page.tsx b/src/app/[chain]/tokens/page.tsx index 9c800617..24b283fa 100644 --- a/src/app/[chain]/tokens/page.tsx +++ b/src/app/[chain]/tokens/page.tsx @@ -9,14 +9,16 @@ import { ChainId } from 'global'; import TokensList from './tokensList'; import { fetchServerTokenList } from '@_api/fetchTokens'; import { TChainID } from '@_api/type'; +import { SortEnum } from '@_types/common'; export default async function TokensPage({ params }: { params: ChainId }) { const data = await fetchServerTokenList({ skipCount: 0, maxResultCount: 50, chainId: params.chain as TChainID, - sortBy: 2, - sort: 1, + sortBy: 'HolderCount', + sort: SortEnum.desc, + cache: 'no-store', }); return ; } diff --git a/src/app/[chain]/tokens/tokensList.tsx b/src/app/[chain]/tokens/tokensList.tsx index 68a8bf1f..ac3bace0 100644 --- a/src/app/[chain]/tokens/tokensList.tsx +++ b/src/app/[chain]/tokens/tokensList.tsx @@ -36,7 +36,7 @@ export default function TokensList({ SSRData }: TokensListProps) { maxResultCount: 50, chainId: chain as TChainID, sort, - sortBy: 2, + sortBy: 'HolderCount', }; setLoading(true); const data = await fetchTokenList(params);