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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,8 @@ import {
TransactionInstruction, TransactionInstruction,
SignatureResult, SignatureResult,
StakeInstruction, StakeInstruction,
StakeProgram StakeProgram,
SystemProgram
} from "@solana/web3.js"; } from "@solana/web3.js";
import { displayAddress } from "utils/tx"; import { displayAddress } from "utils/tx";
import { InstructionCard } from "../InstructionCard"; import { InstructionCard } from "../InstructionCard";
@ -55,7 +56,7 @@ export function InitializeDetailsCard(props: {
</tr> </tr>
<tr> <tr>
<td>Authorized Staker Address</td> <td>Stake Authority Address</td>
<td className="text-right"> <td className="text-right">
<Copyable text={stakerPubkey}> <Copyable text={stakerPubkey}>
<code>{stakerPubkey}</code> <code>{stakerPubkey}</code>
@ -64,7 +65,7 @@ export function InitializeDetailsCard(props: {
</tr> </tr>
<tr> <tr>
<td>Authorized Withdrawer Address</td> <td>Withdraw Authority Address</td>
<td className="text-right"> <td className="text-right">
<Copyable text={withdrawerPubkey}> <Copyable text={withdrawerPubkey}>
<code>{withdrawerPubkey}</code> <code>{withdrawerPubkey}</code>
@ -72,18 +73,23 @@ export function InitializeDetailsCard(props: {
</td> </td>
</tr> </tr>
{params.lockup.epoch > 0 && (
<tr> <tr>
<td>Lockup Expiry Epoch</td> <td>Lockup Expiry Epoch</td>
<td className="text-right">{params.lockup.epoch}</td> <td className="text-right">{params.lockup.epoch}</td>
</tr> </tr>
)}
{params.lockup.unixTimestamp > 0 && (
<tr> <tr>
<td>Lockup Expiry Timestamp</td> <td>Lockup Expiry Timestamp</td>
<td className="text-right"> <td className="text-right">
{new Date(params.lockup.unixTimestamp * 1000).toUTCString()} {new Date(params.lockup.unixTimestamp * 1000).toUTCString()}
</td> </td>
</tr> </tr>
)}
{!params.lockup.custodian.equals(SystemProgram.programId) && (
<tr> <tr>
<td>Lockup Custodian Address</td> <td>Lockup Custodian Address</td>
<td className="text-right"> <td className="text-right">
@ -92,6 +98,7 @@ export function InitializeDetailsCard(props: {
</Copyable> </Copyable>
</td> </td>
</tr> </tr>
)}
</InstructionCard> </InstructionCard>
); );
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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