diff --git a/apps/explorer/src/app/components/table/index.tsx b/apps/explorer/src/app/components/table/index.tsx index 186306c45..55e1b6197 100644 --- a/apps/explorer/src/app/components/table/index.tsx +++ b/apps/explorer/src/app/components/table/index.tsx @@ -57,7 +57,7 @@ export const TableRow = ({ ...props }: TableRowProps) => { const cellClasses = classnames(className, { - 'border-b border-white-40': modifier === 'bordered', + 'border-b border-white-40 py-2': modifier === 'bordered', 'bg-white-25 border-b-4 border-b-black': modifier === 'background', }); return ( diff --git a/apps/explorer/src/app/components/txs/id/tx-content.tsx b/apps/explorer/src/app/components/txs/id/tx-content.tsx index ed0f0112e..129fc6711 100644 --- a/apps/explorer/src/app/components/txs/id/tx-content.tsx +++ b/apps/explorer/src/app/components/txs/id/tx-content.tsx @@ -1,6 +1,8 @@ import { ChainExplorerTxResponse } from '../../../routes/types/chain-explorer-response'; -import { Table } from '../../table'; import { SyntaxHighlighter } from '../../syntax-highlighter'; +import { Table, TableRow, TableHeader, TableCell } from '../../table'; +import { TxOrderType } from '../tx-order-type'; +import { StatusMessage } from '../../status-message'; interface TxContentProps { data: ChainExplorerTxResponse | undefined; @@ -8,29 +10,30 @@ interface TxContentProps { export const TxContent = ({ data }: TxContentProps) => { if (!data?.Command) { - return <>Awaiting decoded transaction data; + return ( + Could not retrieve transaction content + ); } - const { marketId, type, side, size } = JSON.parse(data.Command); - - const displayCode = { - market: marketId, - type, - side, - size, - }; - return ( <> - - - - - +
Type{data.Type}
+ + + Type + + + + +
-

Decoded transaction content

- + {data.Command && ( + <> +

Decoded transaction content

+ + + )} ); }; diff --git a/apps/explorer/src/app/components/txs/id/tx-details.tsx b/apps/explorer/src/app/components/txs/id/tx-details.tsx index 2d674ba79..71a9f1915 100644 --- a/apps/explorer/src/app/components/txs/id/tx-details.tsx +++ b/apps/explorer/src/app/components/txs/id/tx-details.tsx @@ -1,50 +1,63 @@ import { Link } from 'react-router-dom'; import { Routes } from '../../../routes/router-config'; import { Result } from '../../../routes/txs/tendermint-transaction-response.d'; -import { Table, TableRow, TableCell } from '../../table'; +import { Table, TableRow, TableCell, TableHeader } from '../../table'; +import { TruncateInline } from '../../truncate/truncate'; interface TxDetailsProps { txData: Result | undefined; pubKey: string | undefined; + className?: string; } -export const TxDetails = ({ txData, pubKey }: TxDetailsProps) => { +const truncateLength = 30; + +export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => { if (!txData) { return <>Awaiting Tendermint transaction details; } return ( - - +
+ Hash - {txData.hash} + + {txData.hash} + - {pubKey ? ( - - - - - ) : ( - - - - - )} - {txData.height ? ( - - - - - ) : null} - - - + + + Submitted by + + + + {pubKey} + + + + + Block + + + {txData.height} + + + + + Encoded tnx + + +
Submitted by - {pubKey} - Submitted byAwaiting decoded transaction dataBlock - - {txData.height} - - Encoded tnx{txData.tx}
); diff --git a/apps/explorer/src/app/routes/txs/id/index.tsx b/apps/explorer/src/app/routes/txs/id/index.tsx index ee24647b2..5698bdbe4 100644 --- a/apps/explorer/src/app/routes/txs/id/index.tsx +++ b/apps/explorer/src/app/routes/txs/id/index.tsx @@ -1,20 +1,24 @@ import React from 'react'; import { useParams } from 'react-router-dom'; -import { TxContent, TxDetails } from '../../../components/txs'; -import { DATA_SOURCES } from '../../../config'; import useFetch from '../../../hooks/use-fetch'; -import { ChainExplorerTxResponse } from '../../types/chain-explorer-response'; import { TendermintTransactionResponse } from '../tendermint-transaction-response.d'; +import { ChainExplorerTxResponse } from '../../types/chain-explorer-response'; +import { DATA_SOURCES } from '../../../config'; +import { TxContent, TxDetails } from '../../../components/txs'; +import { RouteTitle } from '../../../components/route-title'; +import { RenderFetched } from '../../../components/render-fetched'; const Tx = () => { const { txHash } = useParams<{ txHash: string }>(); + const { - state: { data: transactionData }, + state: { data: tTxData, loading: tTxLoading, error: tTxError }, } = useFetch( `${DATA_SOURCES.tendermintUrl}/tx?hash=${txHash}` ); + const { - state: { data: decodedData }, + state: { data: ceTxData, loading: ceTxLoading, error: ceTxError }, } = useFetch(DATA_SOURCES.chainExplorerUrl, { method: 'POST', body: JSON.stringify({ @@ -25,13 +29,20 @@ const Tx = () => { return (
-

Transaction details

- -

Transaction content

- + Transaction details + + + + + +

Transaction content

+ + +
); };