diff --git a/src/App.js b/src/App.js
index a1fbe00d..78ffc0d4 100755
--- a/src/App.js
+++ b/src/App.js
@@ -13,6 +13,7 @@ import _ from 'lodash';
import {matchPath, Route} from 'react-router';
import './App.css';
import createBrowserHistory from 'history/createBrowserHistory';
+import {Connection} from '@solana/web3.js';
import EndpointConfig from './EndpointConfig';
import BxDataTable from './BxDataTable';
@@ -129,6 +130,7 @@ class App extends Component {
super(props);
this.ws = null;
+ this.connection = new Connection(EndpointConfig.BLOCK_EXPLORER_RPC_URL);
this.state = {
enabled: true,
@@ -136,7 +138,12 @@ class App extends Component {
selectedValue: null,
currentMatch: null,
stateLoading: false,
- globalStats: {},
+ globalStats: {
+ 'node-count': 0,
+ '!blk-last-slot': 0,
+ '!txn-count': 0,
+ '!txn-per-sec-max': 0,
+ },
txnStats: {},
users: [],
userState: {},
@@ -201,11 +208,19 @@ class App extends Component {
});
}
- updateGlobalStats() {
+ async updateGlobalStats() {
this.getRemoteState(
'globalStats',
`http:${BLOCK_EXPLORER_API_BASE}/global-stats`,
);
+
+ try {
+ const nodes = await this.connection.getClusterNodes();
+ this.updateSpecificGlobalStateAttribute('node-count', nodes.length);
+ } catch (err) {
+ this.updateSpecificGlobalStateAttribute('node-count', '?');
+ console.log(err);
+ }
}
updateTxnStats() {
diff --git a/src/BxStatsTable.jsx b/src/BxStatsTable.jsx
index b97c6515..52e9329c 100644
--- a/src/BxStatsTable.jsx
+++ b/src/BxStatsTable.jsx
@@ -35,7 +35,7 @@ class BxStatsTable extends React.Component {
this.copyLeaderPublickey()}>
- Current Leader
+ Leader
@@ -44,6 +44,19 @@ class BxStatsTable extends React.Component {
+
+
+
+
+ Node Count
+
+
+
+ {globalStats['node-count']}
+
+
+
+
@@ -87,7 +100,7 @@ class BxStatsTable extends React.Component {
- Total Transactions
+ Transactions
diff --git a/src/EndpointConfig.js b/src/EndpointConfig.js
index ca628b67..8563c8da 100644
--- a/src/EndpointConfig.js
+++ b/src/EndpointConfig.js
@@ -1,5 +1,6 @@
let EndpointConfig = {
BLOCK_EXPLORER_API_BASE: `//${window.location.hostname}:3001`,
+ BLOCK_EXPLORER_RPC_URL: `http://${window.location.hostname}:8899`,
};
export default EndpointConfig;