Added validator link to block id route
This commit is contained in:
parent
3f47eed917
commit
d3b81babb9
@ -30,20 +30,18 @@ export const BlocksTable = ({ data, showTransactions }: BlocksProps) => {
|
||||
? '1 transaction'
|
||||
: `${block.num_txs} transactions`}
|
||||
</td>
|
||||
{block.header?.proposer_address && (
|
||||
<td>
|
||||
<Link to={`/validators/${block.header.proposer_address}`}>
|
||||
{block.header.proposer_address}
|
||||
</Link>
|
||||
</td>
|
||||
)}
|
||||
<td>
|
||||
<Link to={`/validators/${block.header?.proposer_address}`}>
|
||||
{block.header.proposer_address}
|
||||
</Link>
|
||||
</td>
|
||||
<td>
|
||||
<SecondsAgo date={block.header?.time} />
|
||||
</td>
|
||||
</tr>
|
||||
{showTransactions && (
|
||||
<tr>
|
||||
<TxsPerBlock blockHeight={block.header.height} />
|
||||
<TxsPerBlock blockHeight={block.header?.height} />
|
||||
</tr>
|
||||
)}
|
||||
</>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
import { DATA_SOURCES } from '../../../config';
|
||||
import useFetch from '../../../hooks/use-fetch';
|
||||
import { TendermintBlocksResponse } from '../tendermint-blocks-response';
|
||||
@ -15,18 +15,28 @@ const Block = () => {
|
||||
`${DATA_SOURCES.tendermintUrl}/block?height=${block}`
|
||||
);
|
||||
|
||||
const header = blockData?.result.block.header;
|
||||
|
||||
if (!header) {
|
||||
return <>Could not get block data</>;
|
||||
}
|
||||
|
||||
return (
|
||||
<section>
|
||||
<h1>BLOCK {block}</h1>
|
||||
<Table>
|
||||
<tr>
|
||||
<td>Mined by</td>
|
||||
<td>{blockData?.result.block.header?.proposer_address}</td>
|
||||
<td>
|
||||
<Link to={`/validators/${header.proposer_address}`}>
|
||||
{header.proposer_address}
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Time</td>
|
||||
<td>
|
||||
<SecondsAgo date={blockData?.result.block.header?.time} />
|
||||
<SecondsAgo date={header.time} />
|
||||
</td>
|
||||
</tr>
|
||||
</Table>
|
||||
|
Loading…
Reference in New Issue
Block a user