From 5946817978d56a974a9c7fd43129d1067518f492 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 20 May 2020 23:51:25 +0800 Subject: [PATCH] Show transaction history for deleted accounts --- explorer/src/components/AccountDetails.tsx | 2 +- explorer/src/components/AccountsCard.tsx | 9 ++++----- explorer/src/providers/accounts.tsx | 6 ++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/explorer/src/components/AccountDetails.tsx b/explorer/src/components/AccountDetails.tsx index d9d95dedf5..cecd7322d0 100644 --- a/explorer/src/components/AccountDetails.tsx +++ b/explorer/src/components/AccountDetails.tsx @@ -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 ; diff --git a/explorer/src/components/AccountsCard.tsx b/explorer/src/components/AccountsCard.tsx index 56c59b80c2..35c2c8b044 100644 --- a/explorer/src/components/AccountsCard.tsx +++ b/explorer/src/components/AccountsCard.tsx @@ -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: diff --git a/explorer/src/providers/accounts.tsx b/explorer/src/providers/accounts.tsx index 88a7b9966f..882d2978e4 100644 --- a/explorer/src/providers/accounts.tsx +++ b/explorer/src/providers/accounts.tsx @@ -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;