explorer: Add account bytes to tx inspector (#26200)

This commit is contained in:
Justin Starry 2022-06-24 11:40:30 +01:00 committed by GitHub
parent b26c79b77b
commit 8ef33a53a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -81,21 +81,21 @@ function AccountInfo({
const errorMessage = validator && validator(info.data);
if (errorMessage) return <span className="text-warning">{errorMessage}</span>;
if (info.data.details?.executable) {
return <span className="text-muted">Executable Program</span>;
if (!info.data.details) {
return <span className="text-muted">Account doesn't exist</span>;
}
const owner = info.data.details?.owner;
const ownerAddress = owner?.toBase58();
const ownerLabel = ownerAddress && addressLabel(ownerAddress, cluster);
const owner = info.data.details.owner;
const ownerAddress = owner.toBase58();
const ownerLabel = addressLabel(ownerAddress, cluster);
return (
<span className="text-muted">
{ownerAddress
? `Owned by ${
ownerLabel || ownerAddress
}. Balance is ${lamportsToSolString(info.data.lamports)} SOL`
: "Account doesn't exist"}
{`Owned by ${ownerLabel || ownerAddress}.`}
{` Balance is ${lamportsToSolString(info.data.lamports)} SOL.`}
{` Size is ${new Intl.NumberFormat("en-US").format(
info.data.details.space
)} byte(s).`}
</span>
);
}