diff --git a/explorer/src/App.tsx b/explorer/src/App.tsx index efaf166185..4135728beb 100644 --- a/explorer/src/App.tsx +++ b/explorer/src/App.tsx @@ -23,77 +23,79 @@ function App() { const currentTab = useCurrentTab(); return ( - - - setShowClusterModal(false)} - /> - -
- - -
-
-
-
-
- setShowClusterModal(true)} - /> -
-
-
+ + + + setShowClusterModal(false)} + /> + +
+ + +
+
+
+
+
+ setShowClusterModal(true)} + /> +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
+
+
+ setShowClusterModal(true)} + /> +
-
-
-
-
- {currentTab === "Transactions" ? : null} +
+
+
+ {currentTab === "Transactions" ? ( + + ) : null} +
-
-
-
- +
+
{currentTab === "Accounts" ? : null} - +
-
- setShowClusterModal(false)} - /> - - + setShowClusterModal(false)} + /> + + + ); } diff --git a/explorer/src/providers/accounts.tsx b/explorer/src/providers/accounts.tsx index 8295341c90..b02c486e0c 100644 --- a/explorer/src/providers/accounts.tsx +++ b/explorer/src/providers/accounts.tsx @@ -55,7 +55,7 @@ interface Input { } type Action = Update | Input; -type Dispatch = (action: Action) => void; +export type Dispatch = (action: Action) => void; function reducer(state: State, action: Action): State { switch (action.type) { @@ -175,7 +175,7 @@ export async function fetchAccountInfo( let details; let lamports; try { - const result = await new Connection(url).getAccountInfo( + const result = await new Connection(url, "recent").getAccountInfo( new PublicKey(address) ); if (result === null) { diff --git a/explorer/src/providers/transactions.tsx b/explorer/src/providers/transactions.tsx index 63dc57942f..2474705526 100644 --- a/explorer/src/providers/transactions.tsx +++ b/explorer/src/providers/transactions.tsx @@ -8,6 +8,12 @@ import { import { findGetParameter, findPathSegment } from "../utils"; import { useCluster, ClusterStatus } from "../providers/cluster"; import base58 from "bs58"; +import { + useAccountsDispatch, + fetchAccountInfo, + Dispatch as AccountsDispatch, + ActionType as AccountsActionType +} from "./accounts"; export enum Status { Checking, @@ -181,6 +187,7 @@ export function TransactionsProvider({ children }: TransactionsProviderProps) { const [state, dispatch] = React.useReducer(reducer, undefined, initState); const { status, url } = useCluster(); + const accountsDispatch = useAccountsDispatch(); // Check transaction statuses on startup and whenever cluster updates React.useEffect(() => { @@ -188,7 +195,7 @@ export function TransactionsProvider({ children }: TransactionsProviderProps) { // Create a test transaction if (findGetParameter("test") !== null) { - createTestTransaction(dispatch, url); + createTestTransaction(dispatch, accountsDispatch, url); } Object.keys(state.transactions).forEach(signature => { @@ -205,7 +212,11 @@ export function TransactionsProvider({ children }: TransactionsProviderProps) { ); } -async function createTestTransaction(dispatch: Dispatch, url: string) { +async function createTestTransaction( + dispatch: Dispatch, + accountsDispatch: AccountsDispatch, + url: string +) { const testKey = process.env.REACT_APP_TEST_KEY; let testAccount = new Account(); if (testKey) { @@ -221,6 +232,11 @@ async function createTestTransaction(dispatch: Dispatch, url: string) { ); dispatch({ type: ActionType.InputSignature, signature }); checkTransactionStatus(dispatch, signature, url); + accountsDispatch({ + type: AccountsActionType.Input, + pubkey: testAccount.publicKey + }); + fetchAccountInfo(accountsDispatch, testAccount.publicKey.toBase58(), url); } catch (error) { console.error("Failed to create test success transaction", error); }