Show transaction history for deleted accounts

This commit is contained in:
Justin Starry 2020-05-20 23:51:25 +08:00 committed by Michael Vines
parent 7d00398662
commit 5946817978
3 changed files with 7 additions and 10 deletions

View File

@ -178,7 +178,7 @@ function HistoryCard({ pubkey }: { pubkey: PublicKey }) {
const info = useAccountInfo(address);
const refresh = useFetchAccountHistory();
if (!info || !info.details) {
if (!info || info.lamports === undefined) {
return null;
} else if (info.status === Status.FetchingHistory) {
return <LoadingCard />;

View File

@ -109,10 +109,6 @@ const renderAccountRow = (account: Account) => {
let statusText;
let statusClass;
switch (account.status) {
case Status.NotFound:
statusClass = "danger";
statusText = "Not Found";
break;
case Status.CheckFailed:
case Status.HistoryFailed:
statusClass = "dark";
@ -127,9 +123,12 @@ const renderAccountRow = (account: Account) => {
if (account.details?.executable) {
statusClass = "dark";
statusText = "Executable";
} else {
} else if (account.lamports) {
statusClass = "success";
statusText = "Found";
} else {
statusClass = "danger";
statusText = "Not Found";
}
break;
default:

View File

@ -16,7 +16,6 @@ export enum Status {
CheckFailed,
FetchingHistory,
HistoryFailed,
NotFound,
Success
}
@ -192,7 +191,6 @@ async function fetchAccountInfo(
const result = await new Connection(url, "recent").getAccountInfo(pubkey);
if (result === null) {
lamports = 0;
fetchStatus = Status.NotFound;
} else {
lamports = result.lamports;
let data = undefined;
@ -214,9 +212,9 @@ async function fetchAccountInfo(
owner: result.owner,
data
};
fetchStatus = Status.FetchingHistory;
fetchAccountHistory(dispatch, pubkey, url);
}
fetchStatus = Status.FetchingHistory;
fetchAccountHistory(dispatch, pubkey, url);
} catch (error) {
console.error("Failed to fetch account info", error);
fetchStatus = Status.CheckFailed;