Use authority in copy, hide default lockup info

This commit is contained in:
Justin Starry 2020-05-14 22:27:51 +08:00 committed by Michael Vines
parent 26e4767fdd
commit 4d94de92c5
11 changed files with 63 additions and 56 deletions

View File

@ -11,6 +11,7 @@ export function StakeAccountDetailsCard({
account: StakeAccount;
}) {
const { meta, stake } = account;
const hasLockup = meta && meta.lockup.unixTimestamp > 0;
return (
<div className="card">
<div className="card-header">
@ -34,7 +35,7 @@ export function StakeAccountDetailsCard({
</tr>
<tr>
<td>Authorized Staker Address</td>
<td>Stake Authority Address</td>
<td className="text-right">
<Copyable text={meta.authorized.staker.toBase58()}>
<code>{meta.authorized.staker.toBase58()}</code>
@ -43,7 +44,7 @@ export function StakeAccountDetailsCard({
</tr>
<tr>
<td>Authorized Withdrawer Address</td>
<td>Withdraw Authority Address</td>
<td className="text-right">
<Copyable text={meta.authorized.withdrawer.toBase58()}>
<code>{meta.authorized.withdrawer.toBase58()}</code>
@ -51,28 +52,27 @@ export function StakeAccountDetailsCard({
</td>
</tr>
<tr>
<td>Lockup Expiry Epoch</td>
<td className="text-right">{meta.lockup.epoch}</td>
</tr>
{hasLockup && (
<tr>
<td>Lockup Expiry Timestamp</td>
<td className="text-right">
{new Date(meta.lockup.unixTimestamp).toUTCString()}
</td>
</tr>
)}
<tr>
<td>Lockup Expiry Timestamp</td>
<td className="text-right">
{new Date(meta.lockup.unixTimestamp).toUTCString()}
</td>
</tr>
<tr>
<td>Lockup Custodian Address</td>
<td className="text-right">
<Copyable text={meta.lockup.custodian.toBase58()}>
<code>
{displayAddress(meta.lockup.custodian.toBase58())}
</code>
</Copyable>
</td>
</tr>
{hasLockup && (
<tr>
<td>Lockup Custodian Address</td>
<td className="text-right">
<Copyable text={meta.lockup.custodian.toBase58()}>
<code>
{displayAddress(meta.lockup.custodian.toBase58())}
</code>
</Copyable>
</td>
</tr>
)}
</>
)}

View File

@ -68,7 +68,7 @@ export function AuthorizeDetailsCard(props: {
</tr>
<tr>
<td>Old Authorized Address</td>
<td>Old Authority Address</td>
<td className="text-right">
<Copyable text={authorizedPubkey}>
<code>{authorizedPubkey}</code>
@ -77,7 +77,7 @@ export function AuthorizeDetailsCard(props: {
</tr>
<tr>
<td>New Authorized Address</td>
<td>New Authority Address</td>
<td className="text-right">
<Copyable text={newAuthorizedPubkey}>
<code>{newAuthorizedPubkey}</code>
@ -86,7 +86,7 @@ export function AuthorizeDetailsCard(props: {
</tr>
<tr>
<td>Authorization Type</td>
<td>Authority Type</td>
<td className="text-right">{authorizationType}</td>
</tr>
</InstructionCard>

View File

@ -54,7 +54,7 @@ export function DeactivateDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedPubkey}>
<code>{authorizedPubkey}</code>

View File

@ -64,7 +64,7 @@ export function DelegateDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedPubkey}>
<code>{authorizedPubkey}</code>

View File

@ -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: {
</tr>
<tr>
<td>Authorized Staker Address</td>
<td>Stake Authority Address</td>
<td className="text-right">
<Copyable text={stakerPubkey}>
<code>{stakerPubkey}</code>
@ -64,7 +65,7 @@ export function InitializeDetailsCard(props: {
</tr>
<tr>
<td>Authorized Withdrawer Address</td>
<td>Withdraw Authority Address</td>
<td className="text-right">
<Copyable text={withdrawerPubkey}>
<code>{withdrawerPubkey}</code>
@ -72,26 +73,32 @@ export function InitializeDetailsCard(props: {
</td>
</tr>
<tr>
<td>Lockup Expiry Epoch</td>
<td className="text-right">{params.lockup.epoch}</td>
</tr>
{params.lockup.epoch > 0 && (
<tr>
<td>Lockup Expiry Epoch</td>
<td className="text-right">{params.lockup.epoch}</td>
</tr>
)}
<tr>
<td>Lockup Expiry Timestamp</td>
<td className="text-right">
{new Date(params.lockup.unixTimestamp * 1000).toUTCString()}
</td>
</tr>
{params.lockup.unixTimestamp > 0 && (
<tr>
<td>Lockup Expiry Timestamp</td>
<td className="text-right">
{new Date(params.lockup.unixTimestamp * 1000).toUTCString()}
</td>
</tr>
)}
<tr>
<td>Lockup Custodian Address</td>
<td className="text-right">
<Copyable text={params.lockup.custodian.toBase58()}>
<code>{displayAddress(params.lockup.custodian.toBase58())}</code>
</Copyable>
</td>
</tr>
{!params.lockup.custodian.equals(SystemProgram.programId) && (
<tr>
<td>Lockup Custodian Address</td>
<td className="text-right">
<Copyable text={params.lockup.custodian.toBase58()}>
<code>{displayAddress(params.lockup.custodian.toBase58())}</code>
</Copyable>
</td>
</tr>
)}
</InstructionCard>
);
}

View File

@ -51,7 +51,7 @@ export function SplitDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedPubkey}>
<code>{authorizedPubkey}</code>

View File

@ -56,7 +56,7 @@ export function WithdrawDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedPubkey}>
<code>{authorizedPubkey}</code>

View File

@ -54,7 +54,7 @@ export function NonceAdvanceDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedKey}>
<code>{authorizedKey}</code>

View File

@ -55,7 +55,7 @@ export function NonceAuthorizeDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Old Authority Address</td>
<td className="text-right">
<Copyable text={authorizedKey}>
<code>{authorizedKey}</code>
@ -64,7 +64,7 @@ export function NonceAuthorizeDetailsCard(props: {
</tr>
<tr>
<td>New Authorized Address</td>
<td>New Authority Address</td>
<td className="text-right">
<Copyable text={newAuthorizedKey}>
<code>{newAuthorizedKey}</code>

View File

@ -54,7 +54,7 @@ export function NonceInitializeDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedKey}>
<code>{authorizedKey}</code>

View File

@ -57,7 +57,7 @@ export function NonceWithdrawDetailsCard(props: {
</tr>
<tr>
<td>Authorized Address</td>
<td>Authority Address</td>
<td className="text-right">
<Copyable text={authorizedKey}>
<code>{authorizedKey}</code>