From 7e2eefad3e5f5e5c9ec7c9eacf8c59560a5a0004 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Sat, 23 May 2020 18:19:39 +0800 Subject: [PATCH] Add disclaimer stating oldest available slot (#136) --- explorer/package-lock.json | 6 +++--- explorer/package.json | 2 +- explorer/src/components/TransactionDetails.tsx | 10 ++++++++++ explorer/src/components/common/ErrorCard.tsx | 13 ++++++++++--- explorer/src/providers/cluster.tsx | 11 +++++++++-- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/explorer/package-lock.json b/explorer/package-lock.json index c5ee1946d9840a..251a8dc950c70d 100644 --- a/explorer/package-lock.json +++ b/explorer/package-lock.json @@ -1269,9 +1269,9 @@ "integrity": "sha512-DetpxZw1fzPD5xUBrIAoplLChO2VB8DlL5Gg+I1IR9b2wPqYIca2WSUxL5g1vLeR4MsQq1NeWriXAVffV+U1Fw==" }, "@solana/web3.js": { - "version": "0.55.0", - "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.55.0.tgz", - "integrity": "sha512-1VfcfeI8nNJSlFA8ZZpyoaZHeftyvmBfE9dRyPtqsZszPfbtyA6NeOvydRBaSSU7XDC7hQZnKP4QFIf6uef8Mw==", + "version": "0.56.0", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-0.56.0.tgz", + "integrity": "sha512-Vys4PY7wksHXLyMbjpTLJGMSs58zRGdDPaBmlxeTXfwjv27W5xcjanuC+sNQ8CaeKjUy9Rd0ptU2qSjBHp/rNw==", "requires": { "@babel/runtime": "^7.3.1", "bn.js": "^5.0.0", diff --git a/explorer/package.json b/explorer/package.json index c42e4e82fcb040..452ff7974a6ce4 100644 --- a/explorer/package.json +++ b/explorer/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "@solana/web3.js": "^0.55.0", + "@solana/web3.js": "^0.56.0", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", diff --git a/explorer/src/components/TransactionDetails.tsx b/explorer/src/components/TransactionDetails.tsx index 0844bce8d64aa7..3daf01679a7a5a 100644 --- a/explorer/src/components/TransactionDetails.tsx +++ b/explorer/src/components/TransactionDetails.tsx @@ -101,12 +101,22 @@ function StatusCard({ signature }: Props) { const status = useTransactionStatus(signature); const refresh = useFetchTransactionStatus(); const details = useTransactionDetails(signature); + const { firstAvailableBlock } = useCluster(); if (!status || status.fetchStatus === FetchStatus.Fetching) { return ; } else if (status?.fetchStatus === FetchStatus.FetchFailed) { return refresh(signature)} text="Fetch Failed" />; } else if (!status.info) { + if (firstAvailableBlock !== undefined) { + return ( + refresh(signature)} + text="Not Found" + subtext={`Note: Transactions processed before block ${firstAvailableBlock} are not available at this time`} + /> + ); + } return refresh(signature)} text="Not Found" />; } diff --git a/explorer/src/components/common/ErrorCard.tsx b/explorer/src/components/common/ErrorCard.tsx index faa91fb9aa27c1..bb788ff56cb2c9 100644 --- a/explorer/src/components/common/ErrorCard.tsx +++ b/explorer/src/components/common/ErrorCard.tsx @@ -3,11 +3,13 @@ import React from "react"; export default function ErrorCard({ retry, retryText, - text + text, + subtext }: { retry?: () => void; retryText?: string; text: string; + subtext?: string; }) { const buttonText = retryText || "Try Again"; return ( @@ -23,11 +25,16 @@ export default function ErrorCard({ {buttonText}
-
- + {buttonText}
+ {subtext && ( +
+
+ {subtext} +
+ )} )} diff --git a/explorer/src/providers/cluster.tsx b/explorer/src/providers/cluster.tsx index 6225ea292686f1..3ea32f0e2b39c5 100644 --- a/explorer/src/providers/cluster.tsx +++ b/explorer/src/providers/cluster.tsx @@ -58,6 +58,7 @@ export const DEFAULT_CUSTOM_URL = "http://localhost:8899"; interface State { cluster: Cluster; customUrl: string; + firstAvailableBlock?: number; status: ClusterStatus; } @@ -65,6 +66,7 @@ interface Action { status: ClusterStatus; cluster: Cluster; customUrl: string; + firstAvailableBlock?: number; } type Dispatch = (action: Action) => void; @@ -192,8 +194,13 @@ async function updateCluster( try { const connection = new Connection(clusterUrl(cluster, customUrl)); - await connection.getRecentBlockhash(); - dispatch({ status: ClusterStatus.Connected, cluster, customUrl }); + const firstAvailableBlock = await connection.getFirstAvailableBlock(); + dispatch({ + status: ClusterStatus.Connected, + cluster, + customUrl, + firstAvailableBlock + }); } catch (error) { console.error("Failed to update cluster", error); dispatch({ status: ClusterStatus.Failure, cluster, customUrl });