Skip to content

Commit 113c239

Browse files
committed
fix: add bee version
1 parent 8cbd812 commit 113c239

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/pages/info/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import NodeInfoCard from './NodeInfoCard'
1212
import { WalletInfoCard } from './WalletInfoCard'
1313

1414
export default function Status(): ReactElement {
15-
const { status, topology, nodeInfo, chainId } = useContext(BeeContext)
15+
const { beeVersion, status, topology, nodeInfo, chainId } = useContext(BeeContext)
1616
const { isDesktop, desktopUrl } = useContext(SettingsContext)
1717
const { beeDesktopVersion } = useBeeDesktop(isDesktop, desktopUrl)
1818
const { newBeeDesktopVersion } = useNewBeeDesktopVersion(isDesktop, desktopUrl, false)
@@ -52,6 +52,7 @@ export default function Status(): ReactElement {
5252
}
5353
/>
5454
)}
55+
<ExpandableListItem label="Bee version" value={beeVersion} />
5556
<ExpandableListItem label="Mode" value={nodeInfo?.beeMode} />
5657
{chainId !== null && <ExpandableListItem label="Blockchain network" value={chainIdToName(chainId)} />}
5758
</div>

src/providers/Bee.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ interface Status {
4141
}
4242

4343
interface ContextInterface {
44+
beeVersion: string | null
4445
status: Status
4546
error: Error | null
4647
apiHealth: boolean
@@ -65,6 +66,7 @@ interface ContextInterface {
6566
}
6667

6768
const initialValues: ContextInterface = {
69+
beeVersion: null,
6870
status: {
6971
all: CheckState.ERROR,
7072
apiConnection: { isEnabled: false, checkState: CheckState.ERROR },
@@ -164,6 +166,7 @@ interface Props {
164166

165167
export function Provider({ children }: Props): ReactElement {
166168
const { beeApi } = useContext(SettingsContext)
169+
const [beeVersion, setBeeVersion] = useState<string | null>(null)
167170
const [apiHealth, setApiHealth] = useState<boolean>(false)
168171
const [nodeAddresses, setNodeAddresses] = useState<NodeAddresses | null>(null)
169172
const [nodeInfo, setNodeInfo] = useState<NodeInfo | null>(null)
@@ -262,11 +265,13 @@ export function Provider({ children }: Props): ReactElement {
262265
}
263266

264267
const promises = [
265-
// API health
266268
beeApi
267-
.isConnected({ timeout: TIMEOUT })
268-
.then(setApiHealth)
269-
.catch(() => setApiHealth(false)),
269+
.getHealth({ timeout: TIMEOUT })
270+
.then(response => setBeeVersion(response.version))
271+
.catch(() => setBeeVersion(null)),
272+
273+
// API health
274+
beeApi.isConnected({ timeout: TIMEOUT }).catch(() => setApiHealth(false)),
270275

271276
// Node Addresses
272277
beeApi
@@ -376,6 +381,7 @@ export function Provider({ children }: Props): ReactElement {
376381
return (
377382
<Context.Provider
378383
value={{
384+
beeVersion,
379385
status,
380386
error,
381387
apiHealth,

0 commit comments

Comments
 (0)