);
}
diff --git a/src/app/(header-footer-layout)/address/[address]/transcations.component.tsx b/src/app/(header-footer-layout)/address/[address]/transcations.component.tsx
new file mode 100644
index 0000000..62abca7
--- /dev/null
+++ b/src/app/(header-footer-layout)/address/[address]/transcations.component.tsx
@@ -0,0 +1,358 @@
+'use client';
+
+import Link from 'next/link';
+import Image from 'next/image';
+import { useState } from 'react';
+import { useFormik } from 'formik';
+import * as yup from 'yup';
+import { useQuery } from 'react-query';
+import { useRouter } from 'next/navigation';
+
+import TableSkeleton from 'src/components/internal/table-skeleton/table-skeleton.component';
+import Tooltip from 'src/components/internal/tooltip/tooltip.component';
+import Pagination from 'src/components/internal/pagination/pagination.component';
+import QuickPagination from 'src/components/internal/quick-pagination/quick-pagination.component';
+import ErrorComponent from 'src/components/error/error.component';
+
+import { BnToDec, shortenAddress, timeAgo } from 'src/shared/utils/formatters';
+import { copyToClipboard, isAddress, isHash } from 'src/shared/utils/functions';
+import QueryApi from 'src/shared/api/query-api';
+
+import QUERY_KEYS from 'src/static/query.keys';
+import ROUTES from 'src/static/router.data';
+import TransactionTooltipDetails from 'src/components/internal/transaction-tooltip-details/transaction-tooltip-details';
+import './address.scss';
+
+const headers = [
+ {
+ id: 0,
+ name: 'Txn Hash',
+ thClass: 'xl:px-8 px-2',
+ },
+ {
+ id: 1,
+ name: 'Type',
+ thClass: 'xl:px-8 px-2',
+ },
+ {
+ id: 2,
+ name: 'Block',
+ thClass: 'xl:px-8 px-2',
+ },
+ {
+ id: 3,
+ name: 'Timestamp',
+ thClass: 'xl:px-8 px-2',
+ },
+ {
+ id: 4,
+ name: 'From',
+ thClass: 'xl:pl-8 pl-2 pr-2',
+ },
+ {
+ id: 5,
+ name: '', // Direction
+ thClass: ' px-2',
+ },
+ {
+ id: 6,
+ name: 'To',
+ thClass: 'xl:pr-8 pr-2 pl-2',
+ },
+ {
+ id: 7,
+ name: 'Value',
+ thClass: 'xl:px-8 px-2',
+ },
+];
+
+type TransactionComponentProps = {
+ address: string;
+ page: number;
+ setPage: (page: number) => void;
+ count: number;
+ setCount: (count: number) => void;
+};
+
+let met: any = null;
+
+export default function TransactionComponent({
+ address,
+ page,
+ setPage,
+ count,
+ setCount,
+}: TransactionComponentProps) {
+ // *~~*~~*~~ account balance ~~*~~*~~* //
+ const {
+ data: balanceData,
+ isLoading: balanceLoading,
+ isError: balanceError,
+ } = useQuery([QUERY_KEYS.balance, address], () => QueryApi.user.balance(address), {
+ staleTime: 1000 * 60 * 5,
+ cacheTime: 0,
+ });
+
+ // *~~*~~*~~ Txn history ~~*~~*~~* //
+
+ const [paginationMetadata, setPaginationMetadata] = useState(
+ met || {
+ currentPage: 1,
+ totalPages: 1,
+ startIndex: 0,
+ endIndex: 0,
+ totalItems: 0,
+ itemsPerPage: 0,
+ nextPage: 0,
+ previousPage: 0,
+ }
+ );
+
+ // txnHistory
+
+ const {
+ data: txnHistoryData,
+ isLoading: txnHistoryLoading,
+ isError: txnHistoryError,
+ } = useQuery(
+ [QUERY_KEYS.txn_history, address, page, count],
+ () => QueryApi.user.txnHistory(address, page, count),
+ {
+ cacheTime: 0,
+ onSuccess: (data) => {
+ setPaginationMetadata(data.metadata);
+ met = data.metadata;
+ },
+ }
+ );
+ console.log('TransactionComponentProps', txnHistoryData?.metadata);
+
+ function handlePageChange(newPage: number) {
+ setPage(newPage);
+ }
+
+ if (
+ balanceError ||
+ (!balanceLoading && !balanceData) ||
+ txnHistoryError ||
+ (!txnHistoryLoading && !txnHistoryData)
+ )
+ return
+ );
+}
diff --git a/src/app/(header-footer-layout)/blocks/[blocknumber]/page.tsx b/src/app/(header-footer-layout)/blocks/[blocknumber]/page.tsx
index 5ea57ce..bb4782b 100644
--- a/src/app/(header-footer-layout)/blocks/[blocknumber]/page.tsx
+++ b/src/app/(header-footer-layout)/blocks/[blocknumber]/page.tsx
@@ -152,7 +152,7 @@ export default function SingleBlock({ params }: BlockTransactionsProps) {
{block_data.txnsCount} transactions
{' '}
@@ -179,7 +179,7 @@ export default function SingleBlock({ params }: BlockTransactionsProps) {
{block_data.blockSubmitter}
@@ -193,7 +193,7 @@ export default function SingleBlock({ params }: BlockTransactionsProps) {
copyToClipboard(block_data.blockSubmitter)
}
>
-
+
diff --git a/src/app/(header-footer-layout)/blocks/[blocknumber]/transactions/page.tsx b/src/app/(header-footer-layout)/blocks/[blocknumber]/transactions/page.tsx
index d2b2f57..722ac2f 100644
--- a/src/app/(header-footer-layout)/blocks/[blocknumber]/transactions/page.tsx
+++ b/src/app/(header-footer-layout)/blocks/[blocknumber]/transactions/page.tsx
@@ -195,7 +195,7 @@ export default function BlockTransactions({ params }: BlockTransactionsProps) {
{shortenAddress(txn.txnHash)}
@@ -206,7 +206,7 @@ export default function BlockTransactions({ params }: BlockTransactionsProps) {
{txn.blockNumber}
@@ -224,7 +224,7 @@ export default function BlockTransactions({ params }: BlockTransactionsProps) {
{shortenAddress(txn.from, 4)}
@@ -235,7 +235,7 @@ export default function BlockTransactions({ params }: BlockTransactionsProps) {
trigger="click"
>
|