diff --git a/explorer/src/components/account/StakeAccountSection.tsx b/explorer/src/components/account/StakeAccountSection.tsx
index f98ce050e5..196690a1dc 100644
--- a/explorer/src/components/account/StakeAccountSection.tsx
+++ b/explorer/src/components/account/StakeAccountSection.tsx
@@ -25,6 +25,9 @@ export function StakeAccountSection({
stakeAccountType: StakeAccountType;
activation?: StakeActivationData;
}) {
+ const hideDelegation =
+ stakeAccountType !== "delegated" ||
+ isFullyInactivated(stakeAccount, activation);
return (
<>
@@ -32,17 +35,17 @@ export function StakeAccountSection({
account={account}
stakeAccount={stakeAccount}
stakeAccountType={stakeAccountType}
+ activation={activation}
+ hideDelegation={hideDelegation}
/>
- {stakeAccount.meta && (
- <>
-
-
- >
+ {!hideDelegation && (
+
)}
+
>
);
}
@@ -68,14 +71,33 @@ const TYPE_NAMES = {
rewardsPool: "RewardsPool",
};
+function displayStatus(
+ stakeAccountType: StakeAccountType,
+ activation?: StakeActivationData
+) {
+ let status = TYPE_NAMES[stakeAccountType];
+ let activationState = "";
+ if (stakeAccountType !== "delegated") {
+ status = "Not delegated";
+ } else {
+ activationState = activation ? `(${activation.state})` : "";
+ }
+
+ return [status, activationState].join(" ");
+}
+
function OverviewCard({
account,
stakeAccount,
stakeAccountType,
+ activation,
+ hideDelegation,
}: {
account: Account;
stakeAccount: StakeAccountInfo;
stakeAccountType: StakeAccountType;
+ activation?: StakeActivationData;
+ hideDelegation: boolean;
}) {
const refresh = useFetchAccountInfo();
return (
@@ -106,20 +128,22 @@ function OverviewCard({
{lamportsToSolString(account.lamports || 0)}
- {stakeAccount.meta && (
+
+ Rent Reserve (SOL) |
+
+ {lamportsToSolString(stakeAccount.meta.rentExemptReserve)}
+ |
+
+ {hideDelegation && (
- Rent Reserve (SOL) |
+ Status |
- {lamportsToSolString(stakeAccount.meta.rentExemptReserve)}
+ {isFullyInactivated(stakeAccount, activation)
+ ? "Not delegated"
+ : displayStatus(stakeAccountType, activation)}
|
)}
- {!stakeAccount.meta && (
-
- State |
- {TYPE_NAMES[stakeAccountType]} |
-
- )}
);
@@ -134,18 +158,6 @@ function DelegationCard({
stakeAccountType: StakeAccountType;
activation?: StakeActivationData;
}) {
- const displayStatus = () => {
- let status = TYPE_NAMES[stakeAccountType];
- let activationState = "";
- if (stakeAccountType !== "delegated") {
- status = "Not delegated";
- } else {
- activationState = activation ? `(${activation.state})` : "";
- }
-
- return [status, activationState].join(" ");
- };
-
let voterPubkey, activationEpoch, deactivationEpoch;
const delegation = stakeAccount?.stake?.delegation;
if (delegation) {
@@ -157,7 +169,6 @@ function DelegationCard({
? "-"
: delegation.deactivationEpoch.toString();
}
-
const { stake } = stakeAccount;
return (
@@ -169,7 +180,9 @@ function DelegationCard({
Status |
- {displayStatus()} |
+
+ {displayStatus(stakeAccountType, activation)}
+ |
{stake && (
@@ -225,7 +238,7 @@ function DelegationCard({
}
function AuthoritiesCard({ meta }: { meta: StakeMeta }) {
- const hasLockup = meta && meta.lockup.unixTimestamp > 0;
+ const hasLockup = meta.lockup.unixTimestamp > 0;
return (
@@ -260,3 +273,16 @@ function AuthoritiesCard({ meta }: { meta: StakeMeta }) {
);
}
+
+function isFullyInactivated(
+ stakeAccount: StakeAccountInfo,
+ activation?: StakeActivationData
+): boolean {
+ const { stake } = stakeAccount;
+
+ if (!stake || !activation) {
+ return false;
+ }
+
+ return stake.delegation.stake.toString() === activation.inactive.toString();
+}