Skip to content

Commit

Permalink
(fix) Change default currency details
Browse files Browse the repository at this point in the history
(fix) Remove Zilliqa 1 only stats unless we're connected to a Zilliqa 1 chain.

Other stats are currently inaccurate because zq2 doesn't report them correctly
  • Loading branch information
rrw-zilliqa committed Nov 22, 2024
1 parent c5d5d3b commit f5cd64b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
57 changes: 36 additions & 21 deletions src/execution/ChainInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,29 @@ import ContentFrame from "../components/ContentFrame";
import { PendingChainInfoResults } from "../search/PendingResults";
import { useBCInfoStateInfo, useLatestBlockChainInfo } from "../useLatestBlock";
import { RuntimeContext } from "../useRuntime";
import { useQuirks } from "../useQuirks";

const ChainInfo: FC = () => {
const { zilliqa } = useContext(RuntimeContext);
const { zilliqa, provider } = useContext(RuntimeContext);
const quirks = useQuirks(provider);

const latestBlockChainInfo = useLatestBlockChainInfo(zilliqa);

const BCInfo = useBCInfoStateInfo(latestBlockChainInfo);

let gridValues = "grid-rows-2 grid-cols-4"
if (quirks?.isZilliqa1) {
gridValues = "grid-rows-3 grid-cols-4"
}
gridValues = "grid items-baseline gap-x-1 border-t border-b border-gray-200 bg-gray-100 text-sm " + gridValues;
// Return a table with rows containing the basic information of the most recent RECENT_SIZE blocks
return (
<ContentFrame isLoading={latestBlockChainInfo === undefined}>
<div className="pb-3">
<ChainInfoHeader isLoading={latestBlockChainInfo === undefined} />
{latestBlockChainInfo ? (
<div
className="grid grid-rows-3 grid-cols-4 items-baseline gap-x-1 border-t
border-b border-gray-200 bg-gray-100 text-sm"
className={ gridValues }
>
<span>
<ChainInfoItem
Expand All @@ -37,30 +43,35 @@ const ChainInfo: FC = () => {
data={latestBlockChainInfo.NumTransactions}
/>
</span>
<span>
{ quirks?.isZilliqa1 && (<span>
<ChainInfoItem
title="Peers:"
data={latestBlockChainInfo.NumPeers}
/>
</span>
<span>
</span>) }
{ quirks?.isZilliqa1 && (<span>
<ChainInfoItem
title="Sharding Structure:"
data={`[${latestBlockChainInfo.ShardingStructure.NumPeers.toString()}]`}
/>
</span>
<span>
<ChainInfoItem
</span>)
}
{ quirks?.isZilliqa1 && (
<span>
<ChainInfoItem
title="Current DS Epoch:"
data={latestBlockChainInfo.CurrentDSEpoch}
/>
</span>
/>
</span>
)}
{ quirks?.isZilliqa1 && (
<span>
<ChainInfoItem
title="DS Block Rate:"
data={latestBlockChainInfo.DSBlockRate.toFixed(5)}
/>
</span>
/>
</span>)
}
<span>
<ChainInfoItem
title="Tx Block Rate:"
Expand All @@ -73,18 +84,22 @@ const ChainInfo: FC = () => {
data={latestBlockChainInfo.TransactionRate.toFixed(5)}
/>
</span>
{ quirks?.isZilliqa1 && (
<span>
<ChainInfoItem
title="Number of Txns in DS Epoch:"
data={latestBlockChainInfo.NumTxnsDSEpoch}
/>
</span>
)}
{quirks?.isZilliqa1 && (
<span>
<ChainInfoItem
title="Number of Txns in DS Epoch:"
data={latestBlockChainInfo.NumTxnsDSEpoch}
/>
</span>
<span>
<ChainInfoItem
title="Number of Txns in Txn Epoch:"
title="Number of Txns in Txn Epoch:"
data={latestBlockChainInfo.NumTxnsTxEpoch}
/>
</span>
</span>
)}
<span>
<ChainInfoItem
title={
Expand Down
4 changes: 2 additions & 2 deletions src/useConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ export const defaultChainInfo: ChainInfo = {
name: "",
faucets: [],
nativeCurrency: {
name: "Ether",
symbol: "ETH",
name: "Zilliqa",
symbol: "ZIL",
decimals: 18,
},
};
Expand Down

0 comments on commit f5cd64b

Please sign in to comment.