Skip to content

Commit

Permalink
Merge pull request #210 from shutter-network/fix/206-executed-transac…
Browse files Browse the repository at this point in the history
…tions

total tx reverted to be addition of shielded and unshielded
  • Loading branch information
blockchainluffy authored Oct 30, 2024
2 parents 0f1c2bf + c33f7eb commit 10c1f2a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/src/modules/TransactionGauge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const TransactionGauge = () => {
const { data: transactionStatsData, loading: loadingTransactionStats, error: errorTransactionStats } = useFetch('/api/inclusion_time/executed_transactions');
const [successfulTransactions, setSuccessfulTransactions] = useState<number>(transactionStatsData?.message?.Shielded || 0);
const [failedTransactions, setFailedTransactions] = useState<number>(transactionStatsData?.message?.Unshielded || 0);
const [totalTransactions, setTotalTransactions] = useState<number>(transactionStatsData?.message?.Total || 0);
const [, setWebSocketError] = useState<string | null>(null);

const { socket } = useWebSocket()!;
Expand All @@ -23,10 +22,9 @@ const TransactionGauge = () => {
} else if (websocketEvent.data) {
setWebSocketError(null);
if (websocketEvent.type === 'executed_transactions_updated') {
if ('Shielded' in websocketEvent.data.message && 'Unshielded' in websocketEvent.data.message && 'Total' in websocketEvent.data.message) {
if ('Shielded' in websocketEvent.data.message && 'Unshielded' in websocketEvent.data.message) {
setSuccessfulTransactions(websocketEvent.data.message.Shielded);
setFailedTransactions(websocketEvent.data.message.Unshielded);
setTotalTransactions(websocketEvent.data.message.Total);
}
}
}
Expand All @@ -48,9 +46,9 @@ const TransactionGauge = () => {
useEffect(() => {
if (transactionStatsData?.message?.Shielded) setSuccessfulTransactions(transactionStatsData.message.Shielded);
if (transactionStatsData?.message?.Unshielded) setFailedTransactions(transactionStatsData.message.Unshielded);
if (transactionStatsData?.message?.Total) setTotalTransactions(transactionStatsData.message.Total);
}, [transactionStatsData]);

const totalTransactions = successfulTransactions + failedTransactions
return (
<Box sx={{ flexGrow: 1, marginTop: 4 }}>
<OverviewCard title="Shielded Transactions" centerTitle>
Expand Down

0 comments on commit 10c1f2a

Please sign in to comment.