diff --git a/explorer/src/components/block/BlockHistoryCard.tsx b/explorer/src/components/block/BlockHistoryCard.tsx
new file mode 100644
index 0000000000..5352c2b426
--- /dev/null
+++ b/explorer/src/components/block/BlockHistoryCard.tsx
@@ -0,0 +1,65 @@
+import React from "react";
+import { ConfirmedBlock } from "@solana/web3.js";
+import { ErrorCard } from "components/common/ErrorCard";
+import { Signature } from "components/common/Signature";
+import bs58 from "bs58";
+
+export function BlockHistoryCard({ block }: { block: ConfirmedBlock }) {
+ if (block.transactions.length === 0) {
+ return ;
+ }
+
+ return (
+
+
+
Block Transactions
+
+
+
+
+
+
+ Result |
+ Transaction Signature |
+
+
+
+ {block.transactions.map((tx, i) => {
+ let statusText;
+ let statusClass;
+ let signature: React.ReactNode;
+ if (tx.meta?.err || !tx.transaction.signature) {
+ statusClass = "warning";
+ statusText = "Failed";
+ } else {
+ statusClass = "success";
+ statusText = "Success";
+ }
+
+ if (tx.transaction.signature) {
+ signature = (
+
+ );
+ }
+
+ return (
+
+
+
+ {statusText}
+
+ |
+
+ {signature} |
+
+ );
+ })}
+
+
+
+
+ );
+}
diff --git a/explorer/src/components/account/BlockHistoryCard.tsx b/explorer/src/components/block/BlockOverviewCard.tsx
similarity index 53%
rename from explorer/src/components/account/BlockHistoryCard.tsx
rename to explorer/src/components/block/BlockOverviewCard.tsx
index d6371580db..fc4fe0ab7c 100644
--- a/explorer/src/components/account/BlockHistoryCard.tsx
+++ b/explorer/src/components/block/BlockOverviewCard.tsx
@@ -1,14 +1,14 @@
-import bs58 from "bs58";
import React from "react";
import { TableCardBody } from "components/common/TableCardBody";
import { useBlock, useFetchBlock, FetchStatus } from "providers/block";
-import { Signature } from "components/common/Signature";
import { ErrorCard } from "components/common/ErrorCard";
import { LoadingCard } from "components/common/LoadingCard";
import { Slot } from "components/common/Slot";
import { ClusterStatus, useCluster } from "providers/cluster";
+import { BlockHistoryCard } from "./BlockHistoryCard";
+import { BlockRewardsCard } from "./BlockRewardsCard";
-export function BlockHistoryCard({ slot }: { slot: number }) {
+export function BlockOverviewCard({ slot }: { slot: number }) {
const confirmedBlock = useBlock(slot);
const fetchBlock = useFetchBlock();
const { status } = useCluster();
@@ -67,61 +67,8 @@ export function BlockHistoryCard({ slot }: { slot: number }) {
- {block.transactions.length === 0 ? (
-
- ) : (
-
-
-
Block Transactions
-
-
-
-
-
-
- Result |
- Transaction Signature |
-
-
-
- {block.transactions.map((tx, i) => {
- let statusText;
- let statusClass;
- let signature: React.ReactNode;
- if (tx.meta?.err || !tx.transaction.signature) {
- statusClass = "warning";
- statusText = "Failed";
- } else {
- statusClass = "success";
- statusText = "Success";
- }
-
- if (tx.transaction.signature) {
- signature = (
-
- );
- }
-
- return (
-
-
-
- {statusText}
-
- |
-
- {signature} |
-
- );
- })}
-
-
-
-
- )}
+
+
>
);
}
diff --git a/explorer/src/components/block/BlockRewardsCard.tsx b/explorer/src/components/block/BlockRewardsCard.tsx
new file mode 100644
index 0000000000..a6a6e504f5
--- /dev/null
+++ b/explorer/src/components/block/BlockRewardsCard.tsx
@@ -0,0 +1,59 @@
+import React from "react";
+import { lamportsToSolString } from "utils";
+import { ConfirmedBlock, PublicKey } from "@solana/web3.js";
+import { Address } from "components/common/Address";
+
+export function BlockRewardsCard({ block }: { block: ConfirmedBlock }) {
+ if (block.rewards.length < 1) {
+ return null;
+ }
+
+ return (
+
+
+
Block Rewards
+
+
+
+
+
+
+ Address |
+ Type |
+ Amount |
+ New Balance |
+ Percent Change |
+
+
+
+ {block.rewards.map((reward) => {
+ let percentChange;
+ if (reward.postBalance !== null && reward.postBalance !== 0) {
+ percentChange = (
+ (Math.abs(reward.lamports) /
+ (reward.postBalance - reward.lamports)) *
+ 100
+ ).toFixed(9);
+ }
+ return (
+
+
+
+ |
+ {reward.rewardType} |
+ {lamportsToSolString(reward.lamports)} |
+
+ {reward.postBalance
+ ? lamportsToSolString(reward.postBalance)
+ : "-"}
+ |
+ {percentChange ? percentChange + "%" : "-"} |
+
+ );
+ })}
+
+
+
+
+ );
+}
diff --git a/explorer/src/pages/BlockDetailsPage.tsx b/explorer/src/pages/BlockDetailsPage.tsx
index f207bf30c0..b106109ede 100644
--- a/explorer/src/pages/BlockDetailsPage.tsx
+++ b/explorer/src/pages/BlockDetailsPage.tsx
@@ -1,7 +1,7 @@
import React from "react";
-import { BlockHistoryCard } from "components/account/BlockHistoryCard";
import { ErrorCard } from "components/common/ErrorCard";
+import { BlockOverviewCard } from "components/block/BlockOverviewCard";
type Props = { slot: string };
@@ -9,7 +9,7 @@ export function BlockDetailsPage({ slot }: Props) {
let output = ;
if (!isNaN(Number(slot))) {
- output = ;
+ output = ;
}
return (