explorer: Display confirmed block's child slot (#20322)
This commit is contained in:
parent
5c35ab619d
commit
58f8713292
|
@ -98,6 +98,14 @@ export function BlockOverviewCard({
|
||||||
<span>{block.previousBlockhash}</span>
|
<span>{block.previousBlockhash}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{confirmedBlock.data.child && (
|
||||||
|
<tr>
|
||||||
|
<td className="w-100">Child Slot</td>
|
||||||
|
<td className="text-lg-right text-monospace">
|
||||||
|
<Slot slot={confirmedBlock.data.child} link />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
<tr>
|
<tr>
|
||||||
<td className="w-100">Processed Transactions</td>
|
<td className="w-100">Processed Transactions</td>
|
||||||
<td className="text-lg-right text-monospace">
|
<td className="text-lg-right text-monospace">
|
||||||
|
|
|
@ -17,6 +17,7 @@ export enum ActionType {
|
||||||
|
|
||||||
type Block = {
|
type Block = {
|
||||||
block?: BlockResponse;
|
block?: BlockResponse;
|
||||||
|
child?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = Cache.State<Block>;
|
type State = Cache.State<Block>;
|
||||||
|
@ -71,13 +72,14 @@ export async function fetchBlock(
|
||||||
let data: Block | undefined = undefined;
|
let data: Block | undefined = undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const connection = new Connection(url, "finalized");
|
const connection = new Connection(url, "confirmed");
|
||||||
const block = await connection.getBlock(Number(key));
|
const block = await connection.getBlock(key);
|
||||||
|
const child = (await connection.getBlocks(key + 1, key + 100)).shift();
|
||||||
if (block === null) {
|
if (block === null) {
|
||||||
data = {};
|
data = {};
|
||||||
status = FetchStatus.Fetched;
|
status = FetchStatus.Fetched;
|
||||||
} else {
|
} else {
|
||||||
data = { block };
|
data = { block, child };
|
||||||
status = FetchStatus.Fetched;
|
status = FetchStatus.Fetched;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue