From 70f58afb1f2323628afe889a5f1339b4b588df64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Wed, 31 Jul 2024 15:26:20 +0200 Subject: [PATCH] feat(#1644): add missing network metrics model to frontend service --- CHANGELOG.md | 1 + govtool/frontend/src/models/api.ts | 14 ++++++++++++++ .../src/services/requests/getNetworkMetrics.ts | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 986e19412..34856725b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ changes. ### Added - Add network name to GET /network/metrics [Issue 1644](https://github.com/IntersectMBO/govtool/issues/1644) +- Add network metrics model to frontend service ### Fixed diff --git a/govtool/frontend/src/models/api.ts b/govtool/frontend/src/models/api.ts index ed33d9199..d073459ac 100644 --- a/govtool/frontend/src/models/api.ts +++ b/govtool/frontend/src/models/api.ts @@ -1,5 +1,19 @@ import { MetadataValidationStatus } from "@models"; +export type NetworkMetrics = { + currentTime: string; + currentEpoch: number; + currentBlock: number; + uniqueDelegators: number; + totalDelegations: number; + totalGovernanceActions: number; + totalDRepVotes: number; + totalRegisteredDReps: number; + alwaysAbstainVotingPower: number; + alwaysNoConfidenceVotingPower: number; + networkName: string; +}; + export interface VoterInfo { isRegisteredAsDRep: boolean; wasRegisteredAsDRep: boolean; diff --git a/govtool/frontend/src/services/requests/getNetworkMetrics.ts b/govtool/frontend/src/services/requests/getNetworkMetrics.ts index 59fd0c674..33c30a108 100644 --- a/govtool/frontend/src/services/requests/getNetworkMetrics.ts +++ b/govtool/frontend/src/services/requests/getNetworkMetrics.ts @@ -1,7 +1,8 @@ +import { NetworkMetrics } from "@models"; import { API } from "../API"; export const getNetworkMetrics = async () => { - const response = await API.get("/network/metrics"); + const response = await API.get("/network/metrics"); return response.data; };