From 4d94de92c546bc0d86f0a5e0d3baf072be88ff70 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Thu, 14 May 2020 22:27:51 +0800 Subject: [PATCH] Use authority in copy, hide default lockup info --- .../account/StakeAccountDetailsCard.tsx | 46 ++++++++--------- .../stake/AuthorizeDetailsCard.tsx | 6 +-- .../stake/DeactivateDetailsCard.tsx | 2 +- .../instruction/stake/DelegateDetailsCard.tsx | 2 +- .../stake/InitializeDetailsCard.tsx | 49 +++++++++++-------- .../instruction/stake/SplitDetailsCard.tsx | 2 +- .../instruction/stake/WithdrawDetailsCard.tsx | 2 +- .../system/NonceAdvanceDetailsCard.tsx | 2 +- .../system/NonceAuthorizeDetailsCard.tsx | 4 +- .../system/NonceInitializeDetailsCard.tsx | 2 +- .../system/NonceWithdrawDetailsCard.tsx | 2 +- 11 files changed, 63 insertions(+), 56 deletions(-) diff --git a/explorer/src/components/account/StakeAccountDetailsCard.tsx b/explorer/src/components/account/StakeAccountDetailsCard.tsx index 862cedad80..c7defe6ea8 100644 --- a/explorer/src/components/account/StakeAccountDetailsCard.tsx +++ b/explorer/src/components/account/StakeAccountDetailsCard.tsx @@ -11,6 +11,7 @@ export function StakeAccountDetailsCard({ account: StakeAccount; }) { const { meta, stake } = account; + const hasLockup = meta && meta.lockup.unixTimestamp > 0; return (
@@ -34,7 +35,7 @@ export function StakeAccountDetailsCard({ - Authorized Staker Address + Stake Authority Address {meta.authorized.staker.toBase58()} @@ -43,7 +44,7 @@ export function StakeAccountDetailsCard({ - Authorized Withdrawer Address + Withdraw Authority Address {meta.authorized.withdrawer.toBase58()} @@ -51,28 +52,27 @@ export function StakeAccountDetailsCard({ - - Lockup Expiry Epoch - {meta.lockup.epoch} - + {hasLockup && ( + + Lockup Expiry Timestamp + + {new Date(meta.lockup.unixTimestamp).toUTCString()} + + + )} - - Lockup Expiry Timestamp - - {new Date(meta.lockup.unixTimestamp).toUTCString()} - - - - - Lockup Custodian Address - - - - {displayAddress(meta.lockup.custodian.toBase58())} - - - - + {hasLockup && ( + + Lockup Custodian Address + + + + {displayAddress(meta.lockup.custodian.toBase58())} + + + + + )} )} diff --git a/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx b/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx index 00f760dc01..4e3bf6f737 100644 --- a/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx @@ -68,7 +68,7 @@ export function AuthorizeDetailsCard(props: { - Old Authorized Address + Old Authority Address {authorizedPubkey} @@ -77,7 +77,7 @@ export function AuthorizeDetailsCard(props: { - New Authorized Address + New Authority Address {newAuthorizedPubkey} @@ -86,7 +86,7 @@ export function AuthorizeDetailsCard(props: { - Authorization Type + Authority Type {authorizationType} diff --git a/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx b/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx index d348be4e93..45726e95bc 100644 --- a/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx @@ -54,7 +54,7 @@ export function DeactivateDetailsCard(props: { - Authorized Address + Authority Address {authorizedPubkey} diff --git a/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx b/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx index f6de80dfb0..7315498657 100644 --- a/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx @@ -64,7 +64,7 @@ export function DelegateDetailsCard(props: { - Authorized Address + Authority Address {authorizedPubkey} diff --git a/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx b/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx index 05fd5ca114..23a2ccb6fa 100644 --- a/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx @@ -3,7 +3,8 @@ import { TransactionInstruction, SignatureResult, StakeInstruction, - StakeProgram + StakeProgram, + SystemProgram } from "@solana/web3.js"; import { displayAddress } from "utils/tx"; import { InstructionCard } from "../InstructionCard"; @@ -55,7 +56,7 @@ export function InitializeDetailsCard(props: { - Authorized Staker Address + Stake Authority Address {stakerPubkey} @@ -64,7 +65,7 @@ export function InitializeDetailsCard(props: { - Authorized Withdrawer Address + Withdraw Authority Address {withdrawerPubkey} @@ -72,26 +73,32 @@ export function InitializeDetailsCard(props: { - - Lockup Expiry Epoch - {params.lockup.epoch} - + {params.lockup.epoch > 0 && ( + + Lockup Expiry Epoch + {params.lockup.epoch} + + )} - - Lockup Expiry Timestamp - - {new Date(params.lockup.unixTimestamp * 1000).toUTCString()} - - + {params.lockup.unixTimestamp > 0 && ( + + Lockup Expiry Timestamp + + {new Date(params.lockup.unixTimestamp * 1000).toUTCString()} + + + )} - - Lockup Custodian Address - - - {displayAddress(params.lockup.custodian.toBase58())} - - - + {!params.lockup.custodian.equals(SystemProgram.programId) && ( + + Lockup Custodian Address + + + {displayAddress(params.lockup.custodian.toBase58())} + + + + )} ); } diff --git a/explorer/src/components/instruction/stake/SplitDetailsCard.tsx b/explorer/src/components/instruction/stake/SplitDetailsCard.tsx index cf51d8f4e0..a211974733 100644 --- a/explorer/src/components/instruction/stake/SplitDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/SplitDetailsCard.tsx @@ -51,7 +51,7 @@ export function SplitDetailsCard(props: { - Authorized Address + Authority Address {authorizedPubkey} diff --git a/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx b/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx index 39ccd31e19..a1a5a3608a 100644 --- a/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx +++ b/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx @@ -56,7 +56,7 @@ export function WithdrawDetailsCard(props: { - Authorized Address + Authority Address {authorizedPubkey} diff --git a/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx b/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx index 6ba33213a7..d32b06964d 100644 --- a/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx +++ b/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx @@ -54,7 +54,7 @@ export function NonceAdvanceDetailsCard(props: { - Authorized Address + Authority Address {authorizedKey} diff --git a/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx b/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx index 0f33f7da7f..1566f20491 100644 --- a/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx +++ b/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx @@ -55,7 +55,7 @@ export function NonceAuthorizeDetailsCard(props: { - Authorized Address + Old Authority Address {authorizedKey} @@ -64,7 +64,7 @@ export function NonceAuthorizeDetailsCard(props: { - New Authorized Address + New Authority Address {newAuthorizedKey} diff --git a/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx b/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx index fbd922ae86..1f81353445 100644 --- a/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx +++ b/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx @@ -54,7 +54,7 @@ export function NonceInitializeDetailsCard(props: { - Authorized Address + Authority Address {authorizedKey} diff --git a/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx b/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx index 3fa90bc699..742293f401 100644 --- a/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx +++ b/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx @@ -57,7 +57,7 @@ export function NonceWithdrawDetailsCard(props: { - Authorized Address + Authority Address {authorizedKey}